Unnecessary parentheses.

This commit is contained in:
Yuriy Pikhtarev 2017-05-05 01:10:13 +03:00
commit 7f57f0c084
No known key found for this signature in database
GPG key ID: 3A9B5A757B48ECC6
99 changed files with 568 additions and 568 deletions

View file

@ -275,7 +275,7 @@ if ($view === 'search') {
$s_forums = ''; $s_forums = '';
$list_cat = []; $list_cat = [];
while ($row = DB()->sql_fetchrow($result)) { //sf while ($row = DB()->sql_fetchrow($result)) { //sf
$s_forums .= '<option value="' . $row['forum_id'] . '">' . (($row['forum_parent']) ? HTML_SF_SPACER : '') . htmlCHR($row['forum_name']) . '</option>'; $s_forums .= '<option value="' . $row['forum_id'] . '">' . ($row['forum_parent'] ? HTML_SF_SPACER : '') . htmlCHR($row['forum_name']) . '</option>';
if (empty($list_cat[$row['cat_id']])) { if (empty($list_cat[$row['cat_id']])) {
$list_cat[$row['cat_id']] = $row['cat_title']; $list_cat[$row['cat_id']] = $row['cat_title'];
@ -318,7 +318,7 @@ if ($view === 'username') {
// Attachments // Attachments
if ($view === 'attachments') { if ($view === 'attachments') {
$user_based = ($uid) ? true : false; $user_based = $uid ? true : false;
$search_based = (isset($_POST['search']) && $_POST['search']); $search_based = (isset($_POST['search']) && $_POST['search']);
$hidden_fields = ''; $hidden_fields = '';
@ -461,7 +461,7 @@ if ($view === 'attachments') {
'FILENAME' => htmlspecialchars($attachments[$i]['real_filename']), 'FILENAME' => htmlspecialchars($attachments[$i]['real_filename']),
'COMMENT' => htmlspecialchars($attachments[$i]['comment']), 'COMMENT' => htmlspecialchars($attachments[$i]['comment']),
'EXTENSION' => $attachments[$i]['extension'], 'EXTENSION' => $attachments[$i]['extension'],
'SIZE' => round(($attachments[$i]['filesize'] / 1024), 2), 'SIZE' => round($attachments[$i]['filesize'] / 1024, 2),
'DOWNLOAD_COUNT' => $attachments[$i]['download_count'], 'DOWNLOAD_COUNT' => $attachments[$i]['download_count'],
'POST_TIME' => bb_date($attachments[$i]['filetime']), 'POST_TIME' => bb_date($attachments[$i]['filetime']),
'POST_TITLE' => $post_titles, 'POST_TITLE' => $post_titles,

View file

@ -30,7 +30,7 @@ if (!empty($setmodules)) {
$module['ATTACHMENTS']['QUOTA_LIMITS'] = $filename . '?mode=quota'; $module['ATTACHMENTS']['QUOTA_LIMITS'] = $filename . '?mode=quota';
return; return;
} }
require('./pagestart.php'); require './pagestart.php';
$error = false; $error = false;
@ -49,10 +49,10 @@ $size = request_var('size', '');
$quota_size = request_var('quota_size', ''); $quota_size = request_var('quota_size', '');
$pm_size = request_var('pm_size', ''); $pm_size = request_var('pm_size', '');
$submit = (isset($_POST['submit'])) ? true : false; $submit = isset($_POST['submit']) ? true : false;
$check_upload = (isset($_POST['settings'])) ? true : false; $check_upload = isset($_POST['settings']) ? true : false;
$check_image_cat = (isset($_POST['cat_settings'])) ? true : false; $check_image_cat = isset($_POST['cat_settings']) ? true : false;
$search_imagick = (isset($_POST['search_imagick'])) ? true : false; $search_imagick = isset($_POST['search_imagick']) ? true : false;
// Re-evaluate the Attachment Configuration // Re-evaluate the Attachment Configuration
$sql = 'SELECT * FROM ' . BB_ATTACH_CONFIG; $sql = 'SELECT * FROM ' . BB_ATTACH_CONFIG;
@ -408,7 +408,7 @@ if ($submit && $mode == 'quota') {
SET quota_desc = '" . attach_mod_sql_escape($quota_desc_list[$i]) . "', quota_limit = " . (int)$filesize_list[$i] . " SET quota_desc = '" . attach_mod_sql_escape($quota_desc_list[$i]) . "', quota_limit = " . (int)$filesize_list[$i] . "
WHERE quota_limit_id = " . (int)$quota_change_list[$i]; WHERE quota_limit_id = " . (int)$quota_change_list[$i];
if (!(DB()->sql_query($sql))) { if (!DB()->sql_query($sql)) {
bb_die('Could not update quota limits'); bb_die('Could not update quota limits');
} }
} }
@ -437,7 +437,7 @@ if ($submit && $mode == 'quota') {
$quota_desc = get_var('quota_description', ''); $quota_desc = get_var('quota_description', '');
$filesize = get_var('add_max_filesize', 0); $filesize = get_var('add_max_filesize', 0);
$size_select = get_var('add_size_select', ''); $size_select = get_var('add_size_select', '');
$add = (isset($_POST['add_quota_check'])) ? true : false; $add = isset($_POST['add_quota_check']) ? true : false;
if ($quota_desc != '' && $add) { if ($quota_desc != '' && $add) {
// check Quota Description // check Quota Description
@ -469,7 +469,7 @@ if ($submit && $mode == 'quota') {
$sql = "INSERT INTO " . BB_QUOTA_LIMITS . " (quota_desc, quota_limit) $sql = "INSERT INTO " . BB_QUOTA_LIMITS . " (quota_desc, quota_limit)
VALUES ('" . attach_mod_sql_escape($quota_desc) . "', " . (int)$filesize . ")"; VALUES ('" . attach_mod_sql_escape($quota_desc) . "', " . (int)$filesize . ")";
if (!(DB()->sql_query($sql))) { if (!DB()->sql_query($sql)) {
bb_die('Could not add quota limit'); bb_die('Could not add quota limit');
} }
} }

View file

@ -138,8 +138,8 @@ switch ($mode) {
'SITENAME' => htmlCHR($new['sitename']), 'SITENAME' => htmlCHR($new['sitename']),
'CONFIG_SITE_DESCRIPTION' => htmlCHR($new['site_desc']), 'CONFIG_SITE_DESCRIPTION' => htmlCHR($new['site_desc']),
'DISABLE_BOARD' => ($new['board_disable']) ? true : false, 'DISABLE_BOARD' => $new['board_disable'] ? true : false,
'ALLOW_AUTOLOGIN' => ($new['allow_autologin']) ? true : false, 'ALLOW_AUTOLOGIN' => $new['allow_autologin'] ? true : false,
'AUTOLOGIN_TIME' => (int)$new['max_autologin_time'], 'AUTOLOGIN_TIME' => (int)$new['max_autologin_time'],
'MAX_POLL_OPTIONS' => $new['max_poll_options'], 'MAX_POLL_OPTIONS' => $new['max_poll_options'],
'FLOOD_INTERVAL' => $new['flood_interval'], 'FLOOD_INTERVAL' => $new['flood_interval'],
@ -151,12 +151,12 @@ switch ($mode) {
'TIMEZONE_SELECT' => tz_select($new['board_timezone'], 'board_timezone'), 'TIMEZONE_SELECT' => tz_select($new['board_timezone'], 'board_timezone'),
'MAX_LOGIN_ATTEMPTS' => $new['max_login_attempts'], 'MAX_LOGIN_ATTEMPTS' => $new['max_login_attempts'],
'LOGIN_RESET_TIME' => $new['login_reset_time'], 'LOGIN_RESET_TIME' => $new['login_reset_time'],
'PRUNE_ENABLE' => ($new['prune_enable']) ? true : false, 'PRUNE_ENABLE' => $new['prune_enable'] ? true : false,
'ALLOW_BBCODE' => ($new['allow_bbcode']) ? true : false, 'ALLOW_BBCODE' => $new['allow_bbcode'] ? true : false,
'ALLOW_SMILIES' => ($new['allow_smilies']) ? true : false, 'ALLOW_SMILIES' => $new['allow_smilies'] ? true : false,
'ALLOW_SIG' => ($new['allow_sig']) ? true : false, 'ALLOW_SIG' => $new['allow_sig'] ? true : false,
'SIG_SIZE' => $new['max_sig_chars'], 'SIG_SIZE' => $new['max_sig_chars'],
'ALLOW_NAMECHANGE' => ($new['allow_namechange']) ? true : false, 'ALLOW_NAMECHANGE' => $new['allow_namechange'] ? true : false,
'SMILIES_PATH' => $new['smilies_path'], 'SMILIES_PATH' => $new['smilies_path'],
)); ));
break; break;

View file

@ -132,11 +132,11 @@ foreach ($db_fields_bool as $field_name => $field_def_val) {
foreach ($rowset as $rid => $forum) { foreach ($rowset as $rid => $forum) {
foreach ($db_fields_bool as $field_name => $field_def_val) { foreach ($db_fields_bool as $field_name => $field_def_val) {
$forum_name = $forum['forum_name']; $forum_name = $forum['forum_name'];
$selected = ($forum[$field_name]) ? ' selected="selected"' : ''; $selected = $forum[$field_name] ? ' selected="selected"' : '';
$forum_name = str_short($forum_name, $max_forum_name_len); $forum_name = str_short($forum_name, $max_forum_name_len);
$$field_name .= '<option value="' . $forum['forum_id'] . '" ' . $selected . '>&nbsp;' . (($forum['forum_parent']) ? HTML_SF_SPACER : '') . htmlCHR($forum_name) . "</option>\n"; $$field_name .= '<option value="' . $forum['forum_id'] . '" ' . $selected . '>&nbsp;' . ($forum['forum_parent'] ? HTML_SF_SPACER : '') . htmlCHR($forum_name) . "</option>\n";
} }
} }

View file

@ -38,7 +38,7 @@ $cron_action = $_POST['cron_action'] ?? '';
if ($mode == 'run' && !$job_id) { if ($mode == 'run' && !$job_id) {
define('BB_ROOT', './../'); define('BB_ROOT', './../');
require(BB_ROOT . 'common.php'); require BB_ROOT . 'common.php';
$user->session_start(); $user->session_start();
redirect('admin/' . basename(__FILE__) . '?mode=list'); redirect('admin/' . basename(__FILE__) . '?mode=list');
} else { } else {
@ -67,7 +67,7 @@ foreach ($sql as $row) {
} }
$template->assign_vars(array( $template->assign_vars(array(
'CRON_ENABLED' => ($new['cron_enabled']) ? true : false, 'CRON_ENABLED' => $new['cron_enabled'] ? true : false,
'CRON_CHECK_INTERVAL' => $new['cron_check_interval'], 'CRON_CHECK_INTERVAL' => $new['cron_check_interval'],
)); ));

View file

@ -34,7 +34,7 @@ $message = '';
if (isset($_POST['add_name'])) { if (isset($_POST['add_name'])) {
include INC_DIR . '/functions_validate.php'; include INC_DIR . '/functions_validate.php';
$disallowed_user = (isset($_POST['disallowed_user'])) ? trim($_POST['disallowed_user']) : trim($_GET['disallowed_user']); $disallowed_user = isset($_POST['disallowed_user']) ? trim($_POST['disallowed_user']) : trim($_GET['disallowed_user']);
if ($disallowed_user == '') { if ($disallowed_user == '') {
bb_die($lang['FIELDS_EMPTY']); bb_die($lang['FIELDS_EMPTY']);
@ -54,7 +54,7 @@ if (isset($_POST['add_name'])) {
bb_die($message); bb_die($message);
} elseif (isset($_POST['delete_name'])) { } elseif (isset($_POST['delete_name'])) {
$disallowed_id = (isset($_POST['disallowed_id'])) ? (int)$_POST['disallowed_id'] : (int)$_GET['disallowed_id']; $disallowed_id = isset($_POST['disallowed_id']) ? (int)$_POST['disallowed_id'] : (int)$_GET['disallowed_id'];
$sql = "DELETE FROM " . BB_DISALLOW . " WHERE disallow_id = $disallowed_id"; $sql = "DELETE FROM " . BB_DISALLOW . " WHERE disallow_id = $disallowed_id";
$result = DB()->sql_query($sql); $result = DB()->sql_query($sql);

View file

@ -29,7 +29,7 @@ if (!empty($setmodules)) {
$module['ATTACHMENTS']['EXTENSION_GROUP_MANAGE'] = $filename . '?mode=groups'; $module['ATTACHMENTS']['EXTENSION_GROUP_MANAGE'] = $filename . '?mode=groups';
return; return;
} }
require('./pagestart.php'); require './pagestart.php';
function update_attach_extensions() function update_attach_extensions()
{ {
@ -57,7 +57,7 @@ $size = get_var('size', '');
$mode = get_var('mode', ''); $mode = get_var('mode', '');
$e_mode = get_var('e_mode', ''); $e_mode = get_var('e_mode', '');
$submit = (isset($_POST['submit'])) ? true : false; $submit = isset($_POST['submit']) ? true : false;
// Get Attachment Config // Get Attachment Config
$attach_config = array(); $attach_config = array();
@ -132,7 +132,7 @@ if ($submit && $mode == 'extensions') {
$extension = get_var('add_extension', ''); $extension = get_var('add_extension', '');
$extension_explain = get_var('add_extension_explain', ''); $extension_explain = get_var('add_extension_explain', '');
$extension_group = get_var('add_group_select', 0); $extension_group = get_var('add_group_select', 0);
$add = (isset($_POST['add_extension_check'])) ? true : false; $add = isset($_POST['add_extension_check']) ? true : false;
if ($extension != '' && $add) { if ($extension != '' && $add) {
$template->assign_vars(array( $template->assign_vars(array(
@ -259,7 +259,7 @@ if ($submit && $mode == 'groups') {
} }
for ($i = 0; $i < count($group_change_list); $i++) { for ($i = 0; $i < count($group_change_list); $i++) {
$allowed = (isset($allowed_list[$i])) ? 1 : 0; $allowed = isset($allowed_list[$i]) ? 1 : 0;
$filesize_list[$i] = ($size_select_list[$i] == 'kb') ? round($filesize_list[$i] * 1024) : (($size_select_list[$i] == 'mb') ? round($filesize_list[$i] * 1048576) : $filesize_list[$i]); $filesize_list[$i] = ($size_select_list[$i] == 'kb') ? round($filesize_list[$i] * 1024) : (($size_select_list[$i] == 'mb') ? round($filesize_list[$i] * 1048576) : $filesize_list[$i]);
@ -275,7 +275,7 @@ if ($submit && $mode == 'groups') {
$sql = 'UPDATE ' . BB_EXTENSION_GROUPS . ' SET ' . attach_mod_sql_build_array('UPDATE', $sql_ary) . ' $sql = 'UPDATE ' . BB_EXTENSION_GROUPS . ' SET ' . attach_mod_sql_build_array('UPDATE', $sql_ary) . '
WHERE group_id = ' . (int)$group_change_list[$i]; WHERE group_id = ' . (int)$group_change_list[$i];
if (!(DB()->sql_query($sql))) { if (!DB()->sql_query($sql)) {
bb_die('Could not update extension groups informations'); bb_die('Could not update extension groups informations');
} }
} }
@ -312,8 +312,8 @@ if ($submit && $mode == 'groups') {
$filesize = get_var('add_max_filesize', 0); $filesize = get_var('add_max_filesize', 0);
$size_select = get_var('add_size_select', ''); $size_select = get_var('add_size_select', '');
$is_allowed = (isset($_POST['add_allowed'])) ? 1 : 0; $is_allowed = isset($_POST['add_allowed']) ? 1 : 0;
$add = (isset($_POST['add_extension_group_check'])) ? true : false; $add = isset($_POST['add_extension_group_check']) ? true : false;
if ($extension_group != '' && $add) { if ($extension_group != '' && $add) {
// check Extension Group // check Extension Group
@ -354,7 +354,7 @@ if ($submit && $mode == 'groups') {
$sql = 'INSERT INTO ' . BB_EXTENSION_GROUPS . ' ' . attach_mod_sql_build_array('INSERT', $sql_ary); $sql = 'INSERT INTO ' . BB_EXTENSION_GROUPS . ' ' . attach_mod_sql_build_array('INSERT', $sql_ary);
if (!(DB()->sql_query($sql))) { if (!DB()->sql_query($sql)) {
bb_die('Could not add extension group'); bb_die('Could not add extension group');
} }
} }
@ -383,7 +383,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($submit)) ? @$extension_group : '', 'ADD_GROUP_NAME' => isset($submit) ? @$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'),
@ -458,8 +458,8 @@ if ($mode == 'groups') {
if ($e_mode == 'perm') { if ($e_mode == 'perm') {
$group = get_var('e_group', 0); $group = get_var('e_group', 0);
$add_forum = (isset($_POST['add_forum'])) ? true : false; $add_forum = isset($_POST['add_forum']) ? true : false;
$delete_forum = (isset($_POST['del_forum'])) ? true : false; $delete_forum = isset($_POST['del_forum']) ? true : false;
if (isset($_POST['close_perm'])) { if (isset($_POST['close_perm'])) {
$e_mode = ''; $e_mode = '';

View file

@ -27,7 +27,7 @@ if (!empty($setmodules)) {
$module['FORUMS']['PRUNE'] = basename(__FILE__); $module['FORUMS']['PRUNE'] = basename(__FILE__);
return; return;
} }
require('./pagestart.php'); require './pagestart.php';
$all_forums = -1; $all_forums = -1;
$pruned_total = 0; $pruned_total = 0;

View file

@ -27,7 +27,7 @@ if (!empty($setmodules)) {
$module['FORUMS']['PERMISSIONS'] = basename(__FILE__); $module['FORUMS']['PERMISSIONS'] = basename(__FILE__);
return; return;
} }
require('./pagestart.php'); require './pagestart.php';
$forum_auth_fields = array( $forum_auth_fields = array(
'auth_view', 'auth_view',
@ -226,9 +226,9 @@ if (empty($forum_id)) {
} }
} }
$adv_mode = (empty($adv)) ? '1' : '0'; $adv_mode = empty($adv) ? '1' : '0';
$switch_mode = "admin_forumauth.php?f=$forum_id&amp;adv=$adv_mode"; $switch_mode = "admin_forumauth.php?f=$forum_id&amp;adv=$adv_mode";
$switch_mode_text = (empty($adv)) ? $lang['ADVANCED_MODE'] : $lang['SIMPLE_MODE']; $switch_mode_text = empty($adv) ? $lang['ADVANCED_MODE'] : $lang['SIMPLE_MODE'];
$u_switch_mode = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>'; $u_switch_mode = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>';
$s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '">'; $s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '">';

View file

@ -27,7 +27,7 @@ if (!empty($setmodules)) {
$module['FORUMS']['PERMISSIONS_LIST'] = basename(__FILE__); $module['FORUMS']['PERMISSIONS_LIST'] = basename(__FILE__);
return; return;
} }
require('./pagestart.php'); require './pagestart.php';
// View Read Post Reply Edit Delete Sticky Announce Vote Poll PostAttach Download // View Read Post Reply Edit Delete Sticky Announce Vote Poll PostAttach Download
$simple_auth_ary = array( $simple_auth_ary = array(
@ -81,7 +81,7 @@ $forum_auth_levels = array('ALL', 'REG', 'PRIVATE', 'MOD', 'ADMIN');
$forum_auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN); $forum_auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN);
if (isset($_GET[POST_FORUM_URL]) || isset($_POST[POST_FORUM_URL])) { if (isset($_GET[POST_FORUM_URL]) || isset($_POST[POST_FORUM_URL])) {
$forum_id = (isset($_POST[POST_FORUM_URL])) ? (int)$_POST[POST_FORUM_URL] : (int)$_GET[POST_FORUM_URL]; $forum_id = isset($_POST[POST_FORUM_URL]) ? (int)$_POST[POST_FORUM_URL] : (int)$_GET[POST_FORUM_URL];
$forum_sql = "AND forum_id = $forum_id"; $forum_sql = "AND forum_id = $forum_id";
} else { } else {
unset($forum_id); unset($forum_id);
@ -89,7 +89,7 @@ if (isset($_GET[POST_FORUM_URL]) || isset($_POST[POST_FORUM_URL])) {
} }
if (isset($_GET[POST_CAT_URL]) || isset($_POST[POST_CAT_URL])) { if (isset($_GET[POST_CAT_URL]) || isset($_POST[POST_CAT_URL])) {
$cat_id = (isset($_POST[POST_CAT_URL])) ? (int)$_POST[POST_CAT_URL] : (int)$_GET[POST_CAT_URL]; $cat_id = isset($_POST[POST_CAT_URL]) ? (int)$_POST[POST_CAT_URL] : (int)$_GET[POST_CAT_URL];
$cat_sql = "AND c.cat_id = $cat_id"; $cat_sql = "AND c.cat_id = $cat_id";
} else { } else {
unset($cat_id); unset($cat_id);
@ -227,7 +227,7 @@ if (empty($forum_id) && empty($cat_id)) {
if ($cat_id == $forum_rows[$j]['cat_id']) { if ($cat_id == $forum_rows[$j]['cat_id']) {
$template->assign_block_vars('cat_row.forum_row', array( $template->assign_block_vars('cat_row.forum_row', array(
'ROW_CLASS' => !($j % 2) ? 'row4' : 'row5', 'ROW_CLASS' => !($j % 2) ? 'row4' : 'row5',
'FORUM_NAME' => '<a class="' . (($forum_rows[$j]['forum_parent']) ? 'genmed' : 'gen') . '" href="admin_forumauth.php?' . POST_FORUM_URL . '=' . $forum_rows[$j]['forum_id'] . '">' . htmlCHR($forum_rows[$j]['forum_name']) . '</a>', 'FORUM_NAME' => '<a class="' . ($forum_rows[$j]['forum_parent'] ? 'genmed' : 'gen') . '" href="admin_forumauth.php?' . POST_FORUM_URL . '=' . $forum_rows[$j]['forum_id'] . '">' . htmlCHR($forum_rows[$j]['forum_name']) . '</a>',
'IS_SUBFORUM' => $forum_rows[$j]['forum_parent'], 'IS_SUBFORUM' => $forum_rows[$j]['forum_parent'],
)); ));
@ -286,7 +286,7 @@ if (empty($forum_id) && empty($cat_id)) {
if ($cat_id == $forum_rows[$j]['cat_id']) { if ($cat_id == $forum_rows[$j]['cat_id']) {
$template->assign_block_vars('cat_row.forum_row', array( $template->assign_block_vars('cat_row.forum_row', array(
'ROW_CLASS' => !($j % 2) ? 'row4' : 'row5', 'ROW_CLASS' => !($j % 2) ? 'row4' : 'row5',
'FORUM_NAME' => '<a class="' . (($forum_rows[$j]['forum_parent']) ? 'genmed' : 'gen') . '" href="admin_forumauth.php?' . POST_FORUM_URL . '=' . $forum_rows[$j]['forum_id'] . '">' . htmlCHR($forum_rows[$j]['forum_name']) . '</a>', 'FORUM_NAME' => '<a class="' . ($forum_rows[$j]['forum_parent'] ? 'genmed' : 'gen') . '" href="admin_forumauth.php?' . POST_FORUM_URL . '=' . $forum_rows[$j]['forum_id'] . '">' . htmlCHR($forum_rows[$j]['forum_name']) . '</a>',
'IS_SUBFORUM' => $forum_rows[$j]['forum_parent'], 'IS_SUBFORUM' => $forum_rows[$j]['forum_parent'],
)); ));

View file

@ -60,7 +60,7 @@ $forum_parent = $cat_id = 0;
$forumname = ''; $forumname = '';
if (isset($_REQUEST['addforum']) || isset($_REQUEST['addcategory'])) { if (isset($_REQUEST['addforum']) || isset($_REQUEST['addcategory'])) {
$mode = (isset($_REQUEST['addforum'])) ? "addforum" : "addcat"; $mode = isset($_REQUEST['addforum']) ? "addforum" : "addcat";
if ($mode == 'addforum' && isset($_POST['addforum']) && isset($_POST['forumname']) && is_array($_POST['addforum'])) { if ($mode == 'addforum' && isset($_POST['addforum']) && isset($_POST['forumname']) && is_array($_POST['addforum'])) {
$req_cat_id = array_keys($_POST['addforum']); $req_cat_id = array_keys($_POST['addforum']);
@ -133,7 +133,7 @@ if ($mode) {
$catlist = get_list('category', $cat_id, true); $catlist = get_list('category', $cat_id, true);
$forumlocked = $forumunlocked = ''; $forumlocked = $forumunlocked = '';
$forumstatus == (FORUM_LOCKED) ? $forumlocked = 'selected="selected"' : $forumunlocked = 'selected="selected"'; $forumstatus == FORUM_LOCKED ? $forumlocked = 'selected="selected"' : $forumunlocked = 'selected="selected"';
$statuslist = '<option value="' . FORUM_UNLOCKED . '" ' . $forumunlocked . '>' . $lang['STATUS_UNLOCKED'] . '</option>\n'; $statuslist = '<option value="' . FORUM_UNLOCKED . '" ' . $forumunlocked . '>' . $lang['STATUS_UNLOCKED'] . '</option>\n';
$statuslist .= '<option value="' . FORUM_LOCKED . '" ' . $forumlocked . '>' . $lang['STATUS_LOCKED'] . '</option>\n'; $statuslist .= '<option value="' . FORUM_LOCKED . '" ' . $forumlocked . '>' . $lang['STATUS_LOCKED'] . '</option>\n';
@ -160,7 +160,7 @@ if ($mode) {
'SHOW_ON_INDEX' => $show_on_index, 'SHOW_ON_INDEX' => $show_on_index,
'S_PARENT_FORUM' => $s_parent, 'S_PARENT_FORUM' => $s_parent,
'CAT_LIST_CLASS' => ($forum_parent) ? 'hidden' : '', 'CAT_LIST_CLASS' => $forum_parent ? 'hidden' : '',
'SHOW_ON_INDEX_CLASS' => (!$forum_parent) ? 'hidden' : '', 'SHOW_ON_INDEX_CLASS' => (!$forum_parent) ? 'hidden' : '',
'TPL_SELECT' => get_select('forum_tpl', $forum_tpl_id, 'html', $lang['TEMPLATE_DISABLE']), 'TPL_SELECT' => get_select('forum_tpl', $forum_tpl_id, 'html', $lang['TEMPLATE_DISABLE']),
'ALLOW_REG_TRACKER' => build_select('allow_reg_tracker', array($lang['DISALLOWED'] => 0, $lang['ALLOWED'] => 1), $allow_reg_tracker), 'ALLOW_REG_TRACKER' => build_select('allow_reg_tracker', array($lang['DISALLOWED'] => 0, $lang['ALLOWED'] => 1), $allow_reg_tracker),
@ -187,7 +187,7 @@ if ($mode) {
$prune_days = (int)$_POST['prune_days']; $prune_days = (int)$_POST['prune_days'];
$forum_parent = ($_POST['forum_parent'] != -1) ? (int)$_POST['forum_parent'] : 0; $forum_parent = ($_POST['forum_parent'] != -1) ? (int)$_POST['forum_parent'] : 0;
$show_on_index = ($forum_parent) ? (int)$_POST['show_on_index'] : 1; $show_on_index = $forum_parent ? (int)$_POST['show_on_index'] : 1;
$forum_display_sort = (int)$_POST['forum_display_sort']; $forum_display_sort = (int)$_POST['forum_display_sort'];
$forum_display_order = (int)$_POST['forum_display_order']; $forum_display_order = (int)$_POST['forum_display_order'];
@ -207,7 +207,7 @@ if ($mode) {
} }
$cat_id = $parent['cat_id']; $cat_id = $parent['cat_id'];
$forum_parent = ($parent['forum_parent']) ?: $parent['forum_id']; $forum_parent = $parent['forum_parent'] ?: $parent['forum_id'];
$forum_order = $parent['forum_order'] + 5; $forum_order = $parent['forum_order'] + 5;
} else { } else {
$max_order = get_max_forum_order($cat_id); $max_order = get_max_forum_order($cat_id);
@ -250,7 +250,7 @@ if ($mode) {
$prune_days = (int)$_POST['prune_days']; $prune_days = (int)$_POST['prune_days'];
$forum_parent = ($_POST['forum_parent'] != -1) ? (int)$_POST['forum_parent'] : 0; $forum_parent = ($_POST['forum_parent'] != -1) ? (int)$_POST['forum_parent'] : 0;
$show_on_index = ($forum_parent) ? (int)$_POST['show_on_index'] : 1; $show_on_index = $forum_parent ? (int)$_POST['show_on_index'] : 1;
$forum_display_order = (int)$_POST['forum_display_order']; $forum_display_order = (int)$_POST['forum_display_order'];
$forum_display_sort = (int)$_POST['forum_display_sort']; $forum_display_sort = (int)$_POST['forum_display_sort'];
@ -273,7 +273,7 @@ if ($mode) {
} }
$cat_id = $parent['cat_id']; $cat_id = $parent['cat_id'];
$forum_parent = ($parent['forum_parent']) ?: $parent['forum_id']; $forum_parent = $parent['forum_parent'] ?: $parent['forum_id'];
$forum_order = $parent['forum_order'] + 5; $forum_order = $parent['forum_order'] + 5;
if ($forum_id == $forum_parent) { if ($forum_id == $forum_parent) {
@ -322,7 +322,7 @@ if ($mode) {
CACHE('bb_cache')->rm(); CACHE('bb_cache')->rm();
$message = $lang['FORUMS_UPDATED'] . '<br /><br />'; $message = $lang['FORUMS_UPDATED'] . '<br /><br />';
$message .= ($fix) ? "$fix<br /><br />" : ''; $message .= $fix ? "$fix<br /><br />" : '';
$message .= sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php?c=' . $cat_id . '">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'); $message .= sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php?c=' . $cat_id . '">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message); bb_die($message);
@ -557,7 +557,7 @@ if ($mode) {
CACHE('bb_cache')->rm(); CACHE('bb_cache')->rm();
$message = $lang['FORUMS_UPDATED'] . '<br /><br />'; $message = $lang['FORUMS_UPDATED'] . '<br /><br />';
$message .= ($fix) ? "$fix<br /><br />" : ''; $message .= $fix ? "$fix<br /><br />" : '';
$message .= sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'); $message .= sprintf($lang['CLICK_RETURN_FORUMADMIN'], '<a href="admin_forums.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message); bb_die($message);
@ -750,7 +750,7 @@ if (!$mode || $show_main_page) {
'FORUM_DESC' => htmlCHR($forum_rows[$j]['forum_desc']), 'FORUM_DESC' => htmlCHR($forum_rows[$j]['forum_desc']),
'NUM_TOPICS' => $forum_rows[$j]['forum_topics'], 'NUM_TOPICS' => $forum_rows[$j]['forum_topics'],
'NUM_POSTS' => $forum_rows[$j]['forum_posts'], 'NUM_POSTS' => $forum_rows[$j]['forum_posts'],
'PRUNE_DAYS' => ($forum_rows[$j]['prune_days']) ?: '-', 'PRUNE_DAYS' => $forum_rows[$j]['prune_days'] ?: '-',
'ORDER' => $forum_rows[$j]['forum_order'], 'ORDER' => $forum_rows[$j]['forum_order'],
'FORUM_ID' => $forum_rows[$j]['forum_id'], 'FORUM_ID' => $forum_rows[$j]['forum_id'],
@ -758,8 +758,8 @@ if (!$mode || $show_main_page) {
'SHOW_ON_INDEX' => (bool)$forum_rows[$j]['show_on_index'], 'SHOW_ON_INDEX' => (bool)$forum_rows[$j]['show_on_index'],
'FORUM_PARENT' => $forum_rows[$j]['forum_parent'], 'FORUM_PARENT' => $forum_rows[$j]['forum_parent'],
'SF_PAD' => ($forum_rows[$j]['forum_parent']) ? ' style="padding-left: 20px;" ' : '', 'SF_PAD' => $forum_rows[$j]['forum_parent'] ? ' style="padding-left: 20px;" ' : '',
'FORUM_NAME_CLASS' => ($forum_rows[$j]['forum_parent']) ? 'genmed' : 'gen', 'FORUM_NAME_CLASS' => $forum_rows[$j]['forum_parent'] ? 'genmed' : 'gen',
'ADD_SUB_HREF' => "admin_forums.php?mode=addforum&amp;forum_parent={$forum_rows[$j]['forum_id']}", 'ADD_SUB_HREF' => "admin_forums.php?mode=addforum&amp;forum_parent={$forum_rows[$j]['forum_id']}",
'U_VIEWFORUM' => BB_ROOT . "viewforum.php?f=$forum_id", 'U_VIEWFORUM' => BB_ROOT . "viewforum.php?f=$forum_id",
'U_FORUM_EDIT' => "admin_forums.php?mode=editforum&amp;f=$forum_id", 'U_FORUM_EDIT' => "admin_forums.php?mode=editforum&amp;f=$forum_id",
@ -859,7 +859,7 @@ function get_list($mode, $id, $select)
$catlist .= '<option value="' . $row[$idfield] . '"' . $s . '>&nbsp;' . htmlCHR(str_short($row[$namefield], 60)) . '</option>\n'; $catlist .= '<option value="' . $row[$idfield] . '"' . $s . '>&nbsp;' . htmlCHR(str_short($row[$namefield], 60)) . '</option>\n';
} }
return ($catlist); return $catlist;
} }
function renumber_order($mode, $cat = 0) function renumber_order($mode, $cat = 0)
@ -1052,8 +1052,8 @@ function sf_get_list($mode, $exclude = 0, $select = 0)
foreach ($c['f'] as $fid => $f) { foreach ($c['f'] as $fid => $f) {
$selected = ($fid == $select) ? HTML_SELECTED : ''; $selected = ($fid == $select) ? HTML_SELECTED : '';
$disabled = ($fid == $exclude && !$forum_parent) ? HTML_DISABLED : ''; $disabled = ($fid == $exclude && !$forum_parent) ? HTML_DISABLED : '';
$style = ($disabled) ? ' style="color: gray" ' : (($fid == $exclude) ? ' style="color: darkred" ' : ''); $style = $disabled ? ' style="color: gray" ' : (($fid == $exclude) ? ' style="color: darkred" ' : '');
$opt .= '<option value="' . $fid . '" ' . $selected . $disabled . $style . '>' . (($f['forum_parent']) ? HTML_SF_SPACER : '') . htmlCHR(str_short($f['forum_name'], 60)) . "&nbsp;</option>\n"; $opt .= '<option value="' . $fid . '" ' . $selected . $disabled . $style . '>' . ($f['forum_parent'] ? HTML_SF_SPACER : '') . htmlCHR(str_short($f['forum_name'], 60)) . "&nbsp;</option>\n";
} }
$opt .= '</optgroup>'; $opt .= '</optgroup>';

View file

@ -82,7 +82,7 @@ if (!empty($_POST['edit']) || !empty($_POST['new'])) {
'S_GROUP_OPEN_CHECKED' => ($group_info['group_type'] == GROUP_OPEN) ? HTML_CHECKED : '', 'S_GROUP_OPEN_CHECKED' => ($group_info['group_type'] == GROUP_OPEN) ? HTML_CHECKED : '',
'S_GROUP_CLOSED_CHECKED' => ($group_info['group_type'] == GROUP_CLOSED) ? HTML_CHECKED : '', 'S_GROUP_CLOSED_CHECKED' => ($group_info['group_type'] == GROUP_CLOSED) ? HTML_CHECKED : '',
'S_GROUP_HIDDEN_CHECKED' => ($group_info['group_type'] == GROUP_HIDDEN) ? HTML_CHECKED : '', 'S_GROUP_HIDDEN_CHECKED' => ($group_info['group_type'] == GROUP_HIDDEN) ? HTML_CHECKED : '',
'RELEASE_GROUP' => ($group_info['release_group']) ? true : false, 'RELEASE_GROUP' => $group_info['release_group'] ? true : false,
'S_GROUP_ACTION' => "admin_groups.php", 'S_GROUP_ACTION' => "admin_groups.php",
'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_HIDDEN_FIELDS' => $s_hidden_fields,
)); ));

View file

@ -27,7 +27,7 @@ if (!empty($setmodules)) {
$module['USERS']['ACTIONS_LOG'] = basename(__FILE__); $module['USERS']['ACTIONS_LOG'] = basename(__FILE__);
return; return;
} }
require('./pagestart.php'); require './pagestart.php';
$datastore->enqueue(array( $datastore->enqueue(array(
'moderators', 'moderators',
@ -145,7 +145,7 @@ $topic_csv = '';
if ($var =& $_REQUEST[$topic_key]) { if ($var =& $_REQUEST[$topic_key]) {
$topic_selected = get_id_ary($var); $topic_selected = get_id_ary($var);
$topic_csv = implode(',', $topic_selected); $topic_csv = implode(',', $topic_selected);
$url = ($topic_csv) ? url_arg($url, $topic_key, $topic_csv) : $url; $url = $topic_csv ? url_arg($url, $topic_key, $topic_csv) : $url;
} }
// Order // Order
@ -202,19 +202,19 @@ $from = "FROM " . BB_LOG;
$where = " $where = "
WHERE log_time BETWEEN $time_start_val AND $time_end_val WHERE log_time BETWEEN $time_start_val AND $time_end_val
"; ";
$where .= ($type_csv) ? " $where .= $type_csv ? "
AND log_type_id IN($type_csv) AND log_type_id IN($type_csv)
" : ''; " : '';
$where .= ($user_csv) ? " $where .= $user_csv ? "
AND log_user_id IN($user_csv) AND log_user_id IN($user_csv)
" : ''; " : '';
$where .= ($forum_csv) ? " $where .= $forum_csv ? "
AND log_forum_id IN($forum_csv) AND log_forum_id IN($forum_csv)
" : ''; " : '';
$where .= ($topic_csv) ? " $where .= $topic_csv ? "
AND log_topic_id IN($topic_csv) AND log_topic_id IN($topic_csv)
" : ''; " : '';
$where .= ($title_match_sql) ? " $where .= $title_match_sql ? "
AND MATCH (log_topic_title) AGAINST ('$title_match_sql' IN BOOLEAN MODE) AND MATCH (log_topic_title) AGAINST ('$title_match_sql' IN BOOLEAN MODE)
" : ''; " : '';
@ -355,7 +355,7 @@ if ($log_rowset) {
} }
$template->assign_vars(array( $template->assign_vars(array(
'FILTERS' => ($topic_csv || $forum_csv || $user_csv), 'FILTERS' => $topic_csv || $forum_csv || $user_csv,
'FILTER_TOPICS' => !empty($filter['topics']), 'FILTER_TOPICS' => !empty($filter['topics']),
'FILTER_FORUMS' => !empty($filter['forums']), 'FILTER_FORUMS' => !empty($filter['forums']),
'FILTER_USERS' => !empty($filter['users']), 'FILTER_USERS' => !empty($filter['users']),
@ -379,7 +379,7 @@ $template->assign_vars(array(
'DATETIME_VAL' => date('Y-m-d', $datetime_val), 'DATETIME_VAL' => date('Y-m-d', $datetime_val),
'DAYSBACK_NAME' => $daysback_key, 'DAYSBACK_NAME' => $daysback_key,
'DAYSBACK_VAL' => $daysback_val, 'DAYSBACK_VAL' => $daysback_val,
'FIRST_LOG_TIME' => ($first_log_time) ? date('Y-m-d', $first_log_time) : $lang['ACC_NONE'], 'FIRST_LOG_TIME' => $first_log_time ? date('Y-m-d', $first_log_time) : $lang['ACC_NONE'],
'TITLE_MATCH_MAX' => $title_match_max_len, 'TITLE_MATCH_MAX' => $title_match_max_len,
'TITLE_MATCH_NAME' => $title_match_key, 'TITLE_MATCH_NAME' => $title_match_key,

View file

@ -27,7 +27,7 @@ if (!empty($setmodules)) {
$module['MODS']['MASS_EMAIL'] = basename(__FILE__); $module['MODS']['MASS_EMAIL'] = basename(__FILE__);
return; return;
} }
require('./pagestart.php'); require './pagestart.php';
@set_time_limit(1200); @set_time_limit(1200);
@ -113,7 +113,7 @@ $template->assign_vars(array(
'MESSAGE' => $message, 'MESSAGE' => $message,
'SUBJECT' => $subject, 'SUBJECT' => $subject,
'ERROR_MESSAGE' => ($errors) ? implode('<br />', array_unique($errors)) : '', 'ERROR_MESSAGE' => $errors ? implode('<br />', array_unique($errors)) : '',
'S_USER_ACTION' => 'admin_mass_email.php', 'S_USER_ACTION' => 'admin_mass_email.php',
'S_GROUP_SELECT' => build_select(POST_GROUPS_URL, $groups), 'S_GROUP_SELECT' => build_select(POST_GROUPS_URL, $groups),

View file

@ -27,6 +27,6 @@ if (!empty($setmodules)) {
$module['GENERAL']['PHP_INFO'] = basename(__FILE__); $module['GENERAL']['PHP_INFO'] = basename(__FILE__);
return; return;
} }
require('./pagestart.php'); require './pagestart.php';
phpinfo(); phpinfo();

View file

@ -27,7 +27,7 @@ if (!empty($setmodules)) {
$module['USERS']['RANKS'] = basename(__FILE__); $module['USERS']['RANKS'] = basename(__FILE__);
return; return;
} }
require('./pagestart.php'); require './pagestart.php';
$_POST['special_rank'] = 1; $_POST['special_rank'] = 1;
$_POST['min_posts'] = -1; $_POST['min_posts'] = -1;
@ -52,7 +52,7 @@ if ($mode != '') {
// //
// They want to add a new rank, show the form. // They want to add a new rank, show the form.
// //
$rank_id = (isset($_GET['id'])) ? (int)$_GET['id'] : 0; $rank_id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
$s_hidden_fields = ''; $s_hidden_fields = '';
@ -83,7 +83,7 @@ if ($mode != '') {
'RANK' => !empty($rank_info['rank_title']) ? $rank_info['rank_title'] : '', 'RANK' => !empty($rank_info['rank_title']) ? $rank_info['rank_title'] : '',
'SPECIAL_RANK' => $rank_is_special, 'SPECIAL_RANK' => $rank_is_special,
'NOT_SPECIAL_RANK' => $rank_is_not_special, 'NOT_SPECIAL_RANK' => $rank_is_not_special,
'MINIMUM' => ($rank_is_special) ? '' : @$rank_info['rank_min'], 'MINIMUM' => $rank_is_special ? '' : @$rank_info['rank_min'],
'IMAGE' => !empty($rank_info['rank_image']) ? $rank_info['rank_image'] : 'styles/images/ranks/rank_image.png', 'IMAGE' => !empty($rank_info['rank_image']) ? $rank_info['rank_image'] : 'styles/images/ranks/rank_image.png',
'STYLE' => !empty($rank_info['rank_style']) ? $rank_info['rank_style'] : '', 'STYLE' => !empty($rank_info['rank_style']) ? $rank_info['rank_style'] : '',
'IMAGE_DISPLAY' => !empty($rank_info['rank_image']) ? '<img src="../' . $rank_info['rank_image'] . '" />' : '', 'IMAGE_DISPLAY' => !empty($rank_info['rank_image']) ? '<img src="../' . $rank_info['rank_image'] . '" />' : '',
@ -96,12 +96,12 @@ if ($mode != '') {
// Ok, they sent us our info, let's update it. // Ok, they sent us our info, let's update it.
// //
$rank_id = (isset($_POST['id'])) ? (int)$_POST['id'] : 0; $rank_id = isset($_POST['id']) ? (int)$_POST['id'] : 0;
$rank_title = (isset($_POST['title'])) ? trim($_POST['title']) : ''; $rank_title = isset($_POST['title']) ? trim($_POST['title']) : '';
$rank_style = (isset($_POST['style'])) ? trim($_POST['style']) : ''; $rank_style = isset($_POST['style']) ? trim($_POST['style']) : '';
$special_rank = ($_POST['special_rank'] == 1) ? true : 0; $special_rank = ($_POST['special_rank'] == 1) ? true : 0;
$min_posts = (isset($_POST['min_posts'])) ? (int)$_POST['min_posts'] : -1; $min_posts = isset($_POST['min_posts']) ? (int)$_POST['min_posts'] : -1;
$rank_image = ((isset($_POST['rank_image']))) ? trim($_POST['rank_image']) : ''; $rank_image = isset($_POST['rank_image']) ? trim($_POST['rank_image']) : '';
if ($rank_title == '') { if ($rank_title == '') {
bb_die($lang['MUST_SELECT_RANK']); bb_die($lang['MUST_SELECT_RANK']);
@ -159,7 +159,7 @@ if ($mode != '') {
// //
if (isset($_POST['id']) || isset($_GET['id'])) { if (isset($_POST['id']) || isset($_GET['id'])) {
$rank_id = (isset($_POST['id'])) ? (int)$_POST['id'] : (int)$_GET['id']; $rank_id = isset($_POST['id']) ? (int)$_POST['id'] : (int)$_GET['id'];
} else { } else {
$rank_id = 0; $rank_id = 0;
} }
@ -213,13 +213,13 @@ if ($mode != '') {
$row_class = !($i % 2) ? 'row1' : 'row2'; $row_class = !($i % 2) ? 'row1' : 'row2';
$rank_is_special = ($special_rank) ? $lang['YES'] : $lang['NO']; $rank_is_special = $special_rank ? $lang['YES'] : $lang['NO'];
$template->assign_block_vars('ranks', array( $template->assign_block_vars('ranks', array(
'ROW_CLASS' => $row_class, 'ROW_CLASS' => $row_class,
'RANK' => $rank, 'RANK' => $rank,
'STYLE' => $rank_rows[$i]['rank_style'], 'STYLE' => $rank_rows[$i]['rank_style'],
'IMAGE_DISPLAY' => ($rank_rows[$i]['rank_image']) ? '<img src="../' . $rank_rows[$i]['rank_image'] . '" />' : '', 'IMAGE_DISPLAY' => $rank_rows[$i]['rank_image'] ? '<img src="../' . $rank_rows[$i]['rank_image'] . '" />' : '',
'SPECIAL_RANK' => $rank_is_special, 'SPECIAL_RANK' => $rank_is_special,
'RANK_MIN' => $rank_min, 'RANK_MIN' => $rank_min,

View file

@ -237,7 +237,7 @@ if ($mode == 'submit' || $mode == 'refresh') {
$template->assign_vars(array('TPL_REBUILD_SEARCH_PROGRESS' => true)); $template->assign_vars(array('TPL_REBUILD_SEARCH_PROGRESS' => true));
$processing_messages = ''; $processing_messages = '';
$processing_messages .= ($timer_expired) ? sprintf($lang['TIMER_EXPIRED'], TIMENOW - $start_time) : ''; $processing_messages .= $timer_expired ? sprintf($lang['TIMER_EXPIRED'], TIMENOW - $start_time) : '';
$processing_messages .= ($start == 0 && $clear_search) ? $lang['CLEARED_SEARCH_TABLES'] : ''; $processing_messages .= ($start == 0 && $clear_search) ? $lang['CLEARED_SEARCH_TABLES'] : '';
// check if we have reached the end of our post processing // check if we have reached the end of our post processing
@ -383,7 +383,7 @@ if ($mode == 'submit' || $mode == 'refresh') {
// when finished // when finished
if ($last_session_data['end_post_id'] < $max_post_id) { if ($last_session_data['end_post_id'] < $max_post_id) {
$last_saved_processing = sprintf($lang['INFO_PROCESSING_FINISHED_NEW'], $last_saved_post_id, $total_posts_processed, $last_saved_date, ($total_posts - $total_posts_processed)); $last_saved_processing = sprintf($lang['INFO_PROCESSING_FINISHED_NEW'], $last_saved_post_id, $total_posts_processed, $last_saved_date, $total_posts - $total_posts_processed);
$clear_search_disabled = 'disabled="disabled"'; $clear_search_disabled = 'disabled="disabled"';
$template->assign_block_vars("start_select_input", array()); $template->assign_block_vars("start_select_input", array());

View file

@ -27,7 +27,7 @@ if (!empty($setmodules)) {
$module['GENERAL']['SMILIES'] = basename(__FILE__); $module['GENERAL']['SMILIES'] = basename(__FILE__);
return; return;
} }
require('./pagestart.php'); require './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'])) {

View file

@ -38,8 +38,8 @@ if (isset($_POST['post']) && $bb_cfg['terms'] != $_POST['message']) {
$template->assign_vars(array( $template->assign_vars(array(
'S_ACTION' => 'admin_terms.php', 'S_ACTION' => 'admin_terms.php',
'EXT_LINK_NW' => $bb_cfg['ext_link_new_win'], 'EXT_LINK_NW' => $bb_cfg['ext_link_new_win'],
'MESSAGE' => ($bb_cfg['terms']) ?: '', 'MESSAGE' => $bb_cfg['terms'] ?: '',
'PREVIEW_HTML' => (isset($_REQUEST['preview'])) ? bbcode2html($_POST['message']) : '', 'PREVIEW_HTML' => isset($_REQUEST['preview']) ? bbcode2html($_POST['message']) : '',
)); ));
print_page('admin_terms.tpl', 'admin'); print_page('admin_terms.tpl', 'admin');

View file

@ -225,11 +225,11 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
'DISABLED' => $disabled, 'DISABLED' => $disabled,
'FORUM_ID' => $f_id, 'FORUM_ID' => $f_id,
'FORUM_NAME' => str_short($forums['forum_name_html'][$f_id], $max_forum_name_length), 'FORUM_NAME' => str_short($forums['forum_name_html'][$f_id], $max_forum_name_length),
'SF_SPACER' => ($f_data['forum_parent']) ? HTML_SF_SPACER : '', 'SF_SPACER' => $f_data['forum_parent'] ? HTML_SF_SPACER : '',
'IS_MODERATOR' => (bool)$auth_mod, 'IS_MODERATOR' => (bool)$auth_mod,
'MOD_STATUS' => ($auth_mod) ? $lang['MODERATOR'] : $lang['NONE'], 'MOD_STATUS' => $auth_mod ? $lang['MODERATOR'] : $lang['NONE'],
'MOD_CLASS' => ($auth_mod) ? (($disabled) ? 'yesDisabled' : 'yesMOD') : 'noMOD', 'MOD_CLASS' => $auth_mod ? ($disabled ? 'yesDisabled' : 'yesMOD') : 'noMOD',
'AUTH_MOD_VAL' => ($auth_mod) ? 1 : 0, 'AUTH_MOD_VAL' => $auth_mod ? 1 : 0,
)); ));
foreach ($forum_auth_fields as $auth_type) { foreach ($forum_auth_fields as $auth_type) {
@ -243,8 +243,8 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
$acl_class = ($auth_via_acl || $auth_mod) ? 'yes' : 'no'; $acl_class = ($auth_via_acl || $auth_mod) ? 'yes' : 'no';
} else { } else {
$disabled = true; $disabled = true;
$perm_sign = ($auth_via_acl) ? $yes_sign : $no_sign; $perm_sign = $auth_via_acl ? $yes_sign : $no_sign;
$acl_class = ($auth_via_acl) ? 'yes' : 'no'; $acl_class = $auth_via_acl ? 'yes' : 'no';
} }
$template->assign_block_vars('c.f.acl', array( $template->assign_block_vars('c.f.acl', array(
@ -253,7 +253,7 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
'ACL_CLASS' => $acl_class, 'ACL_CLASS' => $acl_class,
'FORUM_ID' => $f_id, 'FORUM_ID' => $f_id,
'ACL_TYPE_BF' => $bf_num, 'ACL_TYPE_BF' => $bf_num,
'ACL_VAL' => ($auth_via_acl) ? 1 : 0, 'ACL_VAL' => $auth_via_acl ? 1 : 0,
)); ));
} }
} }
@ -346,11 +346,11 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
'DISABLED' => false, 'DISABLED' => false,
'FORUM_ID' => $f_id, 'FORUM_ID' => $f_id,
'FORUM_NAME' => str_short($forums['forum_name_html'][$f_id], $max_forum_name_length), 'FORUM_NAME' => str_short($forums['forum_name_html'][$f_id], $max_forum_name_length),
'SF_SPACER' => ($f_data['forum_parent']) ? HTML_SF_SPACER : '', 'SF_SPACER' => $f_data['forum_parent'] ? HTML_SF_SPACER : '',
'IS_MODERATOR' => (bool)$auth_mod, 'IS_MODERATOR' => (bool)$auth_mod,
'MOD_STATUS' => ($auth_mod) ? $lang['MODERATOR'] : $lang['NO'], 'MOD_STATUS' => $auth_mod ? $lang['MODERATOR'] : $lang['NO'],
'MOD_CLASS' => ($auth_mod) ? 'yesMOD' : 'noMOD', 'MOD_CLASS' => $auth_mod ? 'yesMOD' : 'noMOD',
'AUTH_MOD_VAL' => ($auth_mod) ? 1 : 0, 'AUTH_MOD_VAL' => $auth_mod ? 1 : 0,
)); ));
foreach ($forum_auth_fields as $auth_type) { foreach ($forum_auth_fields as $auth_type) {
@ -364,8 +364,8 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
$acl_class = ($auth_via_acl || $auth_mod) ? 'yes' : 'no'; $acl_class = ($auth_via_acl || $auth_mod) ? 'yes' : 'no';
} else { } else {
$disabled = true; $disabled = true;
$perm_sign = ($auth_via_acl) ? $yes_sign : $no_sign; $perm_sign = $auth_via_acl ? $yes_sign : $no_sign;
$acl_class = ($auth_via_acl) ? 'yes' : 'no'; $acl_class = $auth_via_acl ? 'yes' : 'no';
} }
$template->assign_block_vars('c.f.acl', array( $template->assign_block_vars('c.f.acl', array(
@ -374,7 +374,7 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
'ACL_CLASS' => $acl_class, 'ACL_CLASS' => $acl_class,
'FORUM_ID' => $f_id, 'FORUM_ID' => $f_id,
'ACL_TYPE_BF' => $bf_num, 'ACL_TYPE_BF' => $bf_num,
'ACL_VAL' => ($auth_via_acl) ? 1 : 0, 'ACL_VAL' => $auth_via_acl ? 1 : 0,
)); ));
} }
} }

View file

@ -27,7 +27,7 @@ if (!empty($setmodules)) {
$module['USERS']['BAN_MANAGEMENT'] = basename(__FILE__); $module['USERS']['BAN_MANAGEMENT'] = basename(__FILE__);
return; return;
} }
require('./pagestart.php'); require './pagestart.php';
if (isset($_POST['submit'])) { if (isset($_POST['submit'])) {
$user_bansql = ''; $user_bansql = '';

View file

@ -94,7 +94,7 @@ if (!isset($_REQUEST['dosearch'])) {
$last_cat_id = $row['cat_id']; $last_cat_id = $row['cat_id'];
} }
$forums_list .= '<option value="' . $row['forum_id'] . '">' . (($row['forum_parent']) ? HTML_SF_SPACER : '') . htmlCHR($row['forum_name']) . '</option>'; $forums_list .= '<option value="' . $row['forum_id'] . '">' . ($row['forum_parent'] ? HTML_SF_SPACER : '') . htmlCHR($row['forum_name']) . '</option>';
} }
} }
@ -888,7 +888,7 @@ if (!isset($_REQUEST['dosearch'])) {
$select_sql .= " $order"; $select_sql .= " $order";
$page = (isset($_GET['page'])) ? (int)$_GET['page'] : (int)trim(@$_POST['page']); $page = isset($_GET['page']) ? (int)$_GET['page'] : (int)trim(@$_POST['page']);
if ($page < 1) { if ($page < 1) {
$page = 1; $page = 1;
@ -915,7 +915,7 @@ if (!isset($_REQUEST['dosearch'])) {
bb_die($lang['SEARCH_NO_RESULTS']); bb_die($lang['SEARCH_NO_RESULTS']);
} }
} }
$num_pages = ceil(($total_pages['total'] / $bb_cfg['topics_per_page'])); $num_pages = ceil($total_pages['total'] / $bb_cfg['topics_per_page']);
$pagination = ''; $pagination = '';
@ -980,8 +980,8 @@ if (!isset($_REQUEST['dosearch'])) {
'JOINDATE' => bb_date($rowset[$i]['user_regdate']), 'JOINDATE' => bb_date($rowset[$i]['user_regdate']),
'LASTVISIT' => bb_date($rowset[$i]['user_lastvisit']), 'LASTVISIT' => bb_date($rowset[$i]['user_lastvisit']),
'POSTS' => $rowset[$i]['user_posts'], 'POSTS' => $rowset[$i]['user_posts'],
'BAN' => ((!isset($banned[$rowset[$i]['user_id']])) ? $lang['NOT_BANNED'] : $lang['BANNED']), 'BAN' => (!isset($banned[$rowset[$i]['user_id']])) ? $lang['NOT_BANNED'] : $lang['BANNED'],
'ABLED' => (($rowset[$i]['user_active']) ? $lang['ENABLED'] : $lang['DISABLED']), 'ABLED' => $rowset[$i]['user_active'] ? $lang['ENABLED'] : $lang['DISABLED'],
'U_VIEWPOSTS' => "../search.php?search_author=1&amp;uid={$rowset[$i]['user_id']}", 'U_VIEWPOSTS' => "../search.php?search_author=1&amp;uid={$rowset[$i]['user_id']}",
'U_MANAGE' => '../profile.php?mode=editprofile&' . POST_USERS_URL . '=' . $rowset[$i]['user_id'] . '&admin=1', 'U_MANAGE' => '../profile.php?mode=editprofile&' . POST_USERS_URL . '=' . $rowset[$i]['user_id'] . '&admin=1',

View file

@ -27,7 +27,7 @@ if (!empty($setmodules)) {
$module['GENERAL']['WORD_CENSOR'] = basename(__FILE__); $module['GENERAL']['WORD_CENSOR'] = basename(__FILE__);
return; return;
} }
require('./pagestart.php'); require './pagestart.php';
if (!$bb_cfg['use_word_censor']) { if (!$bb_cfg['use_word_censor']) {
bb_die('Word censor disabled <br /><br /> ($bb_cfg[\'use_word_censor\'] in config.php)'); bb_die('Word censor disabled <br /><br /> ($bb_cfg[\'use_word_censor\'] in config.php)');

View file

@ -23,7 +23,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
require('./pagestart.php'); require './pagestart.php';
// Generate relevant output // Generate relevant output
if (isset($_GET['pane']) && $_GET['pane'] == 'left') { if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
@ -32,7 +32,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
$setmodules = 1; $setmodules = 1;
while ($file = @readdir($dir)) { while ($file = @readdir($dir)) {
if (preg_match('/^admin_.*?\.php$/', $file)) { if (preg_match('/^admin_.*?\.php$/', $file)) {
include('./' . $file); include './' . $file;
} }
} }
unset($setmodules); unset($setmodules);
@ -74,8 +74,8 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
} elseif (isset($_GET['pane']) && $_GET['pane'] == 'right') { } elseif (isset($_GET['pane']) && $_GET['pane'] == 'right') {
$template->assign_vars(array( $template->assign_vars(array(
'TPL_ADMIN_MAIN' => true, 'TPL_ADMIN_MAIN' => true,
'ADMIN_LOCK' => ($bb_cfg['board_disable']) ? true : false, 'ADMIN_LOCK' => $bb_cfg['board_disable'] ? true : false,
'ADMIN_LOCK_CRON' => (file_exists(BB_DISABLED)) ? true : false, 'ADMIN_LOCK_CRON' => file_exists(BB_DISABLED) ? true : false,
)); ));
// Get forum statistics // Get forum statistics
@ -156,7 +156,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
'USERS_PER_DAY' => $users_per_day, 'USERS_PER_DAY' => $users_per_day,
'AVATAR_DIR_SIZE' => $avatar_dir_size, 'AVATAR_DIR_SIZE' => $avatar_dir_size,
'DB_SIZE' => $dbsize, 'DB_SIZE' => $dbsize,
'GZIP_COMPRESSION' => ($bb_cfg['gzip_compress']) ? $lang['ON'] : $lang['OFF'], 'GZIP_COMPRESSION' => $bb_cfg['gzip_compress'] ? $lang['ON'] : $lang['OFF'],
)); ));
if (@$_GET['users_online']) { if (@$_GET['users_online']) {

View file

@ -25,7 +25,7 @@
define('IN_ADMIN', true); define('IN_ADMIN', true);
define('BB_ROOT', './../../'); define('BB_ROOT', './../../');
require(BB_ROOT . 'common.php'); require BB_ROOT . 'common.php';
$user->session_start(); $user->session_start();
@ -64,7 +64,7 @@ if ($l = sys('la')) {
echo "\n\n<b>loadavg: </b>$l[0] $l[1] $l[2]\n\n"; echo "\n\n<b>loadavg: </b>$l[0] $l[1] $l[2]\n\n";
} }
echo 'gen time: <b>' . sprintf('%.3f', (array_sum(explode(' ', microtime())) - TIMESTART)) . "</b> sec\n"; echo 'gen time: <b>' . sprintf('%.3f', array_sum(explode(' ', microtime())) - TIMESTART) . "</b> sec\n";
echo '</pre></div>'; echo '</pre></div>';
echo '</body></html>'; echo '</body></html>';

View file

@ -25,7 +25,7 @@
define('IN_ADMIN', true); define('IN_ADMIN', true);
define('BB_ROOT', './../../'); define('BB_ROOT', './../../');
require(BB_ROOT . 'common.php'); require BB_ROOT . 'common.php';
$user->session_start(); $user->session_start();
@ -149,7 +149,7 @@ if ($l = sys('la')) {
echo "\n\n<b>loadavg: </b>$l[0] $l[1] $l[2]\n\n"; echo "\n\n<b>loadavg: </b>$l[0] $l[1] $l[2]\n\n";
} }
echo 'gen time: <b>' . sprintf('%.3f', (array_sum(explode(' ', microtime())) - TIMESTART)) . "</b> sec\n"; echo 'gen time: <b>' . sprintf('%.3f', array_sum(explode(' ', microtime())) - TIMESTART) . "</b> sec\n";
echo '</pre></div>'; echo '</pre></div>';
echo '</body></html>'; echo '</body></html>';

View file

@ -189,7 +189,7 @@ function msg_die($msg)
// Start announcer // Start announcer
define('TR_ROOT', './'); define('TR_ROOT', './');
require(TR_ROOT . 'includes/init_tr.php'); require TR_ROOT . 'includes/init_tr.php';
$seeder = ($left == 0) ? 1 : 0; $seeder = ($left == 0) ? 1 : 0;
$stopped = ($event === 'stopped'); $stopped = ($event === 'stopped');
@ -340,7 +340,7 @@ if ($tr_cfg['gold_silver_enabled'] && $down_add) {
// Insert/update peer info // Insert/update peer info
$peer_info_updated = false; $peer_info_updated = false;
$update_time = ($stopped) ? 0 : TIMENOW; $update_time = $stopped ? 0 : TIMENOW;
if ($lp_info) { if ($lp_info) {
$sql = "UPDATE " . BB_BT_TRACKER . " SET update_time = $update_time"; $sql = "UPDATE " . BB_BT_TRACKER . " SET update_time = $update_time";
@ -354,8 +354,8 @@ if ($lp_info) {
$sql .= ($downloaded != $lp_info['downloaded']) ? ", downloaded = $downloaded" : ''; $sql .= ($downloaded != $lp_info['downloaded']) ? ", downloaded = $downloaded" : '';
$sql .= ", remain = $left"; $sql .= ", remain = $left";
$sql .= ($up_add) ? ", up_add = up_add + $up_add" : ''; $sql .= $up_add ? ", up_add = up_add + $up_add" : '';
$sql .= ($down_add) ? ", down_add = down_add + $down_add" : ''; $sql .= $down_add ? ", down_add = down_add + $down_add" : '';
$sql .= ", speed_up = $speed_up"; $sql .= ", speed_up = $speed_up";
$sql .= ", speed_down = $speed_down"; $sql .= ", speed_down = $speed_down";

View file

@ -60,7 +60,7 @@ function msg_die($msg)
} }
define('TR_ROOT', './'); define('TR_ROOT', './');
require(TR_ROOT . 'includes/init_tr.php'); require TR_ROOT . 'includes/init_tr.php';
$info_hash_sql = rtrim(DB()->escape($info_hash), ' '); $info_hash_sql = rtrim(DB()->escape($info_hash), ' ');

View file

@ -63,14 +63,14 @@ require_once __DIR__ . '/vendor/autoload.php';
// Get initial config // Get initial config
require __DIR__ . '/library/config.php'; require __DIR__ . '/library/config.php';
$server_protocol = ($bb_cfg['cookie_secure']) ? 'https://' : 'http://'; $server_protocol = $bb_cfg['cookie_secure'] ? 'https://' : 'http://';
$server_port = (in_array($bb_cfg['server_port'], array(80, 443), true)) ? '' : ':' . $bb_cfg['server_port']; $server_port = in_array($bb_cfg['server_port'], array(80, 443), true) ? '' : ':' . $bb_cfg['server_port'];
define('FORUM_PATH', $bb_cfg['script_path']); define('FORUM_PATH', $bb_cfg['script_path']);
define('FULL_URL', $server_protocol . $bb_cfg['server_name'] . $server_port . $bb_cfg['script_path']); define('FULL_URL', $server_protocol . $bb_cfg['server_name'] . $server_port . $bb_cfg['script_path']);
unset($server_protocol, $server_port); unset($server_protocol, $server_port);
// Debug options // Debug options
define('DBG_USER', (isset($_COOKIE[COOKIE_DBG]))); define('DBG_USER', isset($_COOKIE[COOKIE_DBG]));
// Board/Tracker shared constants and functions // Board/Tracker shared constants and functions
define('BB_BT_TORRENTS', 'bb_bt_torrents'); define('BB_BT_TORRENTS', 'bb_bt_torrents');
@ -201,7 +201,7 @@ function short_query($sql, $esc_html = false)
} }
} }
return ($esc_html) ? htmlCHR($sql, true) : $sql; return $esc_html ? htmlCHR($sql, true) : $sql;
} }
// Functions // Functions
@ -215,7 +215,7 @@ function bb_log($msg, $file_name)
if (is_array($msg)) { if (is_array($msg)) {
$msg = implode(LOG_LF, $msg); $msg = implode(LOG_LF, $msg);
} }
$file_name .= (LOG_EXT) ? '.' . LOG_EXT : ''; $file_name .= LOG_EXT ? '.' . LOG_EXT : '';
return file_write($msg, LOG_DIR . '/' . $file_name); return file_write($msg, LOG_DIR . '/' . $file_name);
} }
@ -451,7 +451,7 @@ function log_request($file = '', $prepend_str = false, $add_post = true)
{ {
global $user; global $user;
$file = ($file) ?: 'req/' . date('m-d'); $file = $file ?: 'req/' . date('m-d');
$str = array(); $str = array();
$str[] = date('m-d H:i:s'); $str[] = date('m-d H:i:s');
if ($prepend_str !== false) { if ($prepend_str !== false) {

View file

@ -57,10 +57,10 @@ $full_url = isset($_POST['full_url']) ? str_replace('&amp;', '&', htmlspecialcha
if (isset($_POST['redirect_type']) && $_POST['redirect_type'] == 'search') { if (isset($_POST['redirect_type']) && $_POST['redirect_type'] == 'search') {
$redirect_type = "search.php"; $redirect_type = "search.php";
$redirect = ($full_url) ?: "$dl_key=1"; $redirect = $full_url ?: "$dl_key=1";
} else { } else {
$redirect_type = (!$topic_id) ? "viewforum.php" : "viewtopic.php"; $redirect_type = (!$topic_id) ? "viewforum.php" : "viewtopic.php";
$redirect = ($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 // Start session management

View file

@ -42,19 +42,19 @@ function generate_user_info(&$row, $group_mod, &$from, &$posts, &$joined, &$pm,
$from = (!empty($row['user_from'])) ? $row['user_from'] : ''; $from = (!empty($row['user_from'])) ? $row['user_from'] : '';
$joined = bb_date($row['user_regdate']); $joined = bb_date($row['user_regdate']);
$user_time = (!empty($row['user_time'])) ? bb_date($row['user_time']) : $lang['NONE']; $user_time = (!empty($row['user_time'])) ? bb_date($row['user_time']) : $lang['NONE'];
$posts = ($row['user_posts']) ?: 0; $posts = $row['user_posts'] ?: 0;
$pm = ($bb_cfg['text_buttons']) ? '<a class="txtb" href="' . (PM_URL . "?mode=post&amp;" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $lang['SEND_PM_TXTB'] . '</a>' : '<a href="' . (PM_URL . "?mode=post&amp;" . POST_USERS_URL . "=" . $row['user_id']) . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['SEND_PRIVATE_MESSAGE'] . '" title="' . $lang['SEND_PRIVATE_MESSAGE'] . '" border="0" /></a>'; $pm = $bb_cfg['text_buttons'] ? '<a class="txtb" href="' . (PM_URL . "?mode=post&amp;" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $lang['SEND_PM_TXTB'] . '</a>' : '<a href="' . (PM_URL . "?mode=post&amp;" . POST_USERS_URL . "=" . $row['user_id']) . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['SEND_PRIVATE_MESSAGE'] . '" title="' . $lang['SEND_PRIVATE_MESSAGE'] . '" border="0" /></a>';
$avatar = get_avatar($row['user_id'], $row['avatar_ext_id'], !bf($row['user_opt'], 'user_opt', 'dis_avatar'), '', 50, 50); $avatar = get_avatar($row['user_id'], $row['avatar_ext_id'], !bf($row['user_opt'], 'user_opt', 'dis_avatar'), '', 50, 50);
if (bf($row['user_opt'], 'user_opt', 'user_viewemail') || $group_mod) { if (bf($row['user_opt'], 'user_opt', 'user_viewemail') || $group_mod) {
$email_uri = ($bb_cfg['board_email_form']) ? ("profile.php?mode=email&amp;" . POST_USERS_URL . "=" . $row['user_id']) : 'mailto:' . $row['user_email']; $email_uri = $bb_cfg['board_email_form'] ? ("profile.php?mode=email&amp;" . POST_USERS_URL . "=" . $row['user_id']) : 'mailto:' . $row['user_email'];
$email = '<a class="editable" href="' . $email_uri . '">' . $row['user_email'] . '</a>'; $email = '<a class="editable" href="' . $email_uri . '">' . $row['user_email'] . '</a>';
} else { } else {
$email = ''; $email = '';
} }
if ($row['user_website']) { if ($row['user_website']) {
$www = ($bb_cfg['text_buttons']) ? '<a class="txtb" href="' . $row['user_website'] . '" target="_userwww">' . $lang['VISIT_WEBSITE_TXTB'] . '</a>' : '<a class="txtb" href="' . $row['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['VISIT_WEBSITE'] . '" title="' . $lang['VISIT_WEBSITE'] . '" border="0" /></a>'; $www = $bb_cfg['text_buttons'] ? '<a class="txtb" href="' . $row['user_website'] . '" target="_userwww">' . $lang['VISIT_WEBSITE_TXTB'] . '</a>' : '<a class="txtb" href="' . $row['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['VISIT_WEBSITE'] . '" title="' . $lang['VISIT_WEBSITE'] . '" border="0" /></a>';
} else { } else {
$www = ''; $www = '';
} }
@ -136,7 +136,7 @@ if (!$group_id) {
continue; continue;
} }
$data = array('id' => $row['group_id'], 'm' => ($row['members'] - $row['candidates']), 'c' => $row['candidates'], 'rg' => $row['release_group']); $data = array('id' => $row['group_id'], 'm' => $row['members'] - $row['candidates'], 'c' => $row['candidates'], 'rg' => $row['release_group']);
$groups[$type][$row['group_name']] = $data; $groups[$type][$row['group_name']] = $data;
} }
@ -149,11 +149,11 @@ if (!$group_id) {
foreach ($params as $name => $data) { foreach ($params as $name => $data) {
$text = htmlCHR(str_short(rtrim($name), HTML_SELECT_MAX_LENGTH)); $text = htmlCHR(str_short(rtrim($name), HTML_SELECT_MAX_LENGTH));
$members = ($data['m']) ? $lang['MEMBERS_IN_GROUP'] . ': ' . $data['m'] : $lang['NO_GROUP_MEMBERS']; $members = $data['m'] ? $lang['MEMBERS_IN_GROUP'] . ': ' . $data['m'] : $lang['NO_GROUP_MEMBERS'];
$candidates = ($data['c']) ? $lang['PENDING_MEMBERS'] . ': ' . $data['c'] : $lang['NO_PENDING_GROUP_MEMBERS']; $candidates = $data['c'] ? $lang['PENDING_MEMBERS'] . ': ' . $data['c'] : $lang['NO_PENDING_GROUP_MEMBERS'];
$options .= '<li class="pad_2"><a href="' . GROUP_URL . $data['id'] . '" class="med bold">' . $text . '</a></li>'; $options .= '<li class="pad_2"><a href="' . GROUP_URL . $data['id'] . '" class="med bold">' . $text . '</a></li>';
$options .= ($data['rg']) ? '<ul><li class="med">' . $lang['RELEASE_GROUP'] . '</li>' : '<ul>'; $options .= $data['rg'] ? '<ul><li class="med">' . $lang['RELEASE_GROUP'] . '</li>' : '<ul>';
$options .= '<li class="seedmed">' . $members . '</li>'; $options .= '<li class="seedmed">' . $members . '</li>';
if (IS_AM) { if (IS_AM) {
$options .= '<li class="leechmed">' . $candidates . '</li>'; $options .= '<li class="leechmed">' . $candidates . '</li>';
@ -369,9 +369,9 @@ if (!$group_id) {
} elseif ($is_group_member || $is_group_pending_member) { } elseif ($is_group_member || $is_group_pending_member) {
$template->assign_vars(array( $template->assign_vars(array(
'SHOW_UNSUBSCRIBE_CONTROLS' => true, 'SHOW_UNSUBSCRIBE_CONTROLS' => true,
'CONTROL_NAME' => ($is_group_member) ? 'unsub' : 'unsubpending', 'CONTROL_NAME' => $is_group_member ? 'unsub' : 'unsubpending',
)); ));
$group_details = ($is_group_pending_member) ? $lang['PENDING_THIS_GROUP'] : $lang['MEMBER_THIS_GROUP']; $group_details = $is_group_pending_member ? $lang['PENDING_THIS_GROUP'] : $lang['MEMBER_THIS_GROUP'];
$s_hidden_fields = '<input type="hidden" name="' . POST_GROUPS_URL . '" value="' . $group_id . '" />'; $s_hidden_fields = '<input type="hidden" name="' . POST_GROUPS_URL . '" value="' . $group_id . '" />';
} elseif (IS_GUEST) { } elseif (IS_GUEST) {
$group_details = $lang['LOGIN_TO_JOIN']; $group_details = $lang['LOGIN_TO_JOIN'];
@ -431,7 +431,7 @@ if (!$group_id) {
'U_GROUP_RELEASES' => "group.php?view=releases&amp;" . POST_GROUPS_URL . "=$group_id", 'U_GROUP_RELEASES' => "group.php?view=releases&amp;" . POST_GROUPS_URL . "=$group_id",
'U_GROUP_MEMBERS' => "group.php?view=members&amp;" . POST_GROUPS_URL . "=$group_id", 'U_GROUP_MEMBERS' => "group.php?view=members&amp;" . POST_GROUPS_URL . "=$group_id",
'U_GROUP_CONFIG' => "group_edit.php?g=$group_id", 'U_GROUP_CONFIG' => "group_edit.php?g=$group_id",
'RELEASE_GROUP' => ($group_info['release_group']) ? true : false, 'RELEASE_GROUP' => $group_info['release_group'] ? true : false,
'GROUP_TYPE' => $group_type, 'GROUP_TYPE' => $group_type,
'S_GROUP_OPEN_TYPE' => GROUP_OPEN, 'S_GROUP_OPEN_TYPE' => GROUP_OPEN,

View file

@ -87,7 +87,7 @@ if ($is_moderator) {
'GROUP_DESCRIPTION' => htmlCHR($group_info['group_description']), 'GROUP_DESCRIPTION' => htmlCHR($group_info['group_description']),
'GROUP_SIGNATURE' => htmlCHR($group_info['group_signature']), 'GROUP_SIGNATURE' => htmlCHR($group_info['group_signature']),
'U_GROUP_URL' => GROUP_URL . $group_id, 'U_GROUP_URL' => GROUP_URL . $group_id,
'RELEASE_GROUP' => ($group_info['release_group']) ? true : false, 'RELEASE_GROUP' => $group_info['release_group'] ? true : false,
'GROUP_TYPE' => $group_type, 'GROUP_TYPE' => $group_type,
'S_GROUP_OPEN_TYPE' => GROUP_OPEN, 'S_GROUP_OPEN_TYPE' => GROUP_OPEN,
'S_GROUP_CLOSED_TYPE' => GROUP_CLOSED, 'S_GROUP_CLOSED_TYPE' => GROUP_CLOSED,
@ -98,18 +98,18 @@ if ($is_moderator) {
'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_GROUP_CONFIG_ACTION' => "group_edit.php?" . POST_GROUPS_URL . "=$group_id", 'S_GROUP_CONFIG_ACTION' => "group_edit.php?" . POST_GROUPS_URL . "=$group_id",
'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], $bb_cfg['group_avatars']['max_width'], $bb_cfg['group_avatars']['max_height'], (round($bb_cfg['group_avatars']['max_size'] / 1024))), 'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], $bb_cfg['group_avatars']['max_width'], $bb_cfg['group_avatars']['max_height'], round($bb_cfg['group_avatars']['max_size'] / 1024)),
'AVATAR_IMG' => get_avatar(GROUP_AVATAR_MASK . $group_id, $group_info['avatar_ext_id']), 'AVATAR_IMG' => get_avatar(GROUP_AVATAR_MASK . $group_id, $group_info['avatar_ext_id']),
)); ));
$template->set_filenames(array('body' => 'group_edit.tpl')); $template->set_filenames(array('body' => 'group_edit.tpl'));
$template->assign_vars(array('PAGE_TITLE' => $lang['GROUP_CONFIGURATION'])); $template->assign_vars(array('PAGE_TITLE' => $lang['GROUP_CONFIGURATION']));
require(PAGE_HEADER); require PAGE_HEADER;
$template->pparse('body'); $template->pparse('body');
require(PAGE_FOOTER); require PAGE_FOOTER;
} else { } else {
$redirect = 'index.php'; $redirect = 'index.php';

View file

@ -53,11 +53,11 @@ $user->session_start();
// Init main vars // Init main vars
$viewcat = isset($_GET['c']) ? (int)$_GET['c'] : 0; $viewcat = isset($_GET['c']) ? (int)$_GET['c'] : 0;
$lastvisit = (IS_GUEST) ? TIMENOW : $userdata['user_lastvisit']; $lastvisit = IS_GUEST ? TIMENOW : $userdata['user_lastvisit'];
// Caching output // Caching output
$req_page = 'index_page'; $req_page = 'index_page';
$req_page .= ($viewcat) ? "_c{$viewcat}" : ''; $req_page .= $viewcat ? "_c{$viewcat}" : '';
define('REQUESTED_PAGE', $req_page); define('REQUESTED_PAGE', $req_page);
caching_output(IS_GUEST, 'send', REQUESTED_PAGE . '_guest_' . $bb_cfg['default_lang']); caching_output(IS_GUEST, 'send', REQUESTED_PAGE . '_guest_' . $bb_cfg['default_lang']);
@ -95,10 +95,10 @@ if ($viewcat and !$viewcat =& $forums['c'][$viewcat]['cat_id']) {
// Forums // Forums
$forums_join_sql = 'f.cat_id = c.cat_id'; $forums_join_sql = 'f.cat_id = c.cat_id';
$forums_join_sql .= ($viewcat) ? " $forums_join_sql .= $viewcat ? "
AND f.cat_id = $viewcat AND f.cat_id = $viewcat
" : ''; " : '';
$forums_join_sql .= ($excluded_forums_csv) ? " $forums_join_sql .= $excluded_forums_csv ? "
AND f.forum_id NOT IN($excluded_forums_csv) AND f.forum_id NOT IN($excluded_forums_csv)
AND f.forum_parent NOT IN($excluded_forums_csv) AND f.forum_parent NOT IN($excluded_forums_csv)
" : ''; " : '';
@ -232,10 +232,10 @@ foreach ($cat_forums as $cid => $c) {
$forums_count++; $forums_count++;
$new = is_unread($f['last_post_time'], $f['last_topic_id'], $f['forum_id']) ? '_new' : ''; $new = is_unread($f['last_post_time'], $f['last_topic_id'], $f['forum_id']) ? '_new' : '';
$folder_image = ($is_sf) ? $images["icon_minipost{$new}"] : $images["forum{$new}"]; $folder_image = $is_sf ? $images["icon_minipost{$new}"] : $images["forum{$new}"];
if ($f['forum_status'] == FORUM_LOCKED) { if ($f['forum_status'] == FORUM_LOCKED) {
$folder_image = ($is_sf) ? $images['icon_minipost'] : $images['forum_locked']; $folder_image = $is_sf ? $images['icon_minipost'] : $images['forum_locked'];
} }
if ($is_sf) { if ($is_sf) {
@ -256,7 +256,7 @@ foreach ($cat_forums as $cid => $c) {
'TOPICS' => commify($f['forum_topics']), 'TOPICS' => commify($f['forum_topics']),
'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'],
)); ));
if ($f['last_post_id']) { if ($f['last_post_id']) {
@ -273,28 +273,28 @@ foreach ($cat_forums as $cid => $c) {
$template->assign_vars(array( $template->assign_vars(array(
'SHOW_FORUMS' => $forums_count, 'SHOW_FORUMS' => $forums_count,
'SHOW_MAP' => (isset($_GET['map']) && !IS_GUEST), 'SHOW_MAP' => isset($_GET['map']) && !IS_GUEST,
'PAGE_TITLE' => ($viewcat) ? $cat_title_html[$viewcat] : $lang['HOME'], 'PAGE_TITLE' => $viewcat ? $cat_title_html[$viewcat] : $lang['HOME'],
'NO_FORUMS_MSG' => ($only_new) ? $lang['NO_NEW_POSTS'] : $lang['NO_FORUMS'], 'NO_FORUMS_MSG' => $only_new ? $lang['NO_NEW_POSTS'] : $lang['NO_FORUMS'],
'TOTAL_TOPICS' => sprintf($lang['POSTED_TOPICS_TOTAL'], $stats['topiccount']), 'TOTAL_TOPICS' => sprintf($lang['POSTED_TOPICS_TOTAL'], $stats['topiccount']),
'TOTAL_POSTS' => sprintf($lang['POSTED_ARTICLES_TOTAL'], $stats['postcount']), 'TOTAL_POSTS' => sprintf($lang['POSTED_ARTICLES_TOTAL'], $stats['postcount']),
'TOTAL_USERS' => sprintf($lang['REGISTERED_USERS_TOTAL'], $stats['usercount']), 'TOTAL_USERS' => sprintf($lang['REGISTERED_USERS_TOTAL'], $stats['usercount']),
'TOTAL_GENDER' => ($bb_cfg['gender']) ? sprintf($lang['USERS_TOTAL_GENDER'], $stats['male'], $stats['female'], $stats['unselect']) : '', 'TOTAL_GENDER' => $bb_cfg['gender'] ? sprintf($lang['USERS_TOTAL_GENDER'], $stats['male'], $stats['female'], $stats['unselect']) : '',
'NEWEST_USER' => sprintf($lang['NEWEST_USER'], profile_url($stats['newestuser'])), 'NEWEST_USER' => sprintf($lang['NEWEST_USER'], profile_url($stats['newestuser'])),
// Tracker stats // Tracker stats
'TORRENTS_STAT' => ($bb_cfg['tor_stats']) ? sprintf($lang['TORRENTS_STAT'], $stats['torrentcount'], humn_size($stats['size'])) : '', 'TORRENTS_STAT' => $bb_cfg['tor_stats'] ? sprintf($lang['TORRENTS_STAT'], $stats['torrentcount'], humn_size($stats['size'])) : '',
'PEERS_STAT' => ($bb_cfg['tor_stats']) ? sprintf($lang['PEERS_STAT'], $stats['peers'], $stats['seeders'], $stats['leechers']) : '', 'PEERS_STAT' => $bb_cfg['tor_stats'] ? sprintf($lang['PEERS_STAT'], $stats['peers'], $stats['seeders'], $stats['leechers']) : '',
'SPEED_STAT' => ($bb_cfg['tor_stats']) ? sprintf($lang['SPEED_STAT'], humn_size($stats['speed']) . '/s') : '', 'SPEED_STAT' => $bb_cfg['tor_stats'] ? sprintf($lang['SPEED_STAT'], humn_size($stats['speed']) . '/s') : '',
'SHOW_MOD_INDEX' => $bb_cfg['show_mod_index'], 'SHOW_MOD_INDEX' => $bb_cfg['show_mod_index'],
'FORUM_IMG' => $images['forum'], 'FORUM_IMG' => $images['forum'],
'FORUM_NEW_IMG' => $images['forum_new'], 'FORUM_NEW_IMG' => $images['forum_new'],
'FORUM_LOCKED_IMG' => $images['forum_locked'], 'FORUM_LOCKED_IMG' => $images['forum_locked'],
'SHOW_ONLY_NEW_MENU' => true, 'SHOW_ONLY_NEW_MENU' => true,
'ONLY_NEW_POSTS_ON' => ($only_new == ONLY_NEW_POSTS), 'ONLY_NEW_POSTS_ON' => $only_new == ONLY_NEW_POSTS,
'ONLY_NEW_TOPICS_ON' => ($only_new == ONLY_NEW_TOPICS), 'ONLY_NEW_TOPICS_ON' => $only_new == ONLY_NEW_TOPICS,
'U_SEARCH_NEW' => "search.php?new=1", 'U_SEARCH_NEW' => "search.php?new=1",
'U_SEARCH_SELF_BY_MY' => "search.php?uid={$userdata['user_id']}&amp;o=1", 'U_SEARCH_SELF_BY_MY' => "search.php?uid={$userdata['user_id']}&amp;o=1",
@ -364,7 +364,7 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
} }
$week_list[] = profile_url($week) . ' <span class="small">(' . birthday_age($week['user_birthday'] - 1) . ')</span>'; $week_list[] = profile_url($week) . ' <span class="small">(' . birthday_age($week['user_birthday'] - 1) . ')</span>';
} }
$week_all = ($week_all) ? '&nbsp;<a class="txtb" href="#" onclick="ajax.exec({action: \'index_data\', mode: \'birthday_week\'}); return false;" title="' . $lang['ALL'] . '">...</a>' : ''; $week_all = $week_all ? '&nbsp;<a class="txtb" href="#" onclick="ajax.exec({action: \'index_data\', mode: \'birthday_week\'}); return false;" title="' . $lang['ALL'] . '">...</a>' : '';
$week_list = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], implode(', ', $week_list)) . $week_all; $week_list = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], implode(', ', $week_list)) . $week_all;
} else { } else {
$week_list = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']); $week_list = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
@ -379,7 +379,7 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
} }
$today_list[] = profile_url($today) . ' <span class="small">(' . birthday_age($today['user_birthday']) . ')</span>'; $today_list[] = profile_url($today) . ' <span class="small">(' . birthday_age($today['user_birthday']) . ')</span>';
} }
$today_all = ($today_all) ? '&nbsp;<a class="txtb" href="#" onclick="ajax.exec({action: \'index_data\', mode: \'birthday_today\'}); return false;" title="' . $lang['ALL'] . '">...</a>' : ''; $today_all = $today_all ? '&nbsp;<a class="txtb" href="#" onclick="ajax.exec({action: \'index_data\', mode: \'birthday_today\'}); return false;" title="' . $lang['ALL'] . '">...</a>' : '';
$today_list = $lang['BIRTHDAY_TODAY'] . implode(', ', $today_list) . $today_all; $today_list = $lang['BIRTHDAY_TODAY'] . implode(', ', $today_list) . $today_all;
} else { } else {
$today_list = $lang['NOBIRTHDAY_TODAY']; $today_list = $lang['NOBIRTHDAY_TODAY'];

View file

@ -95,7 +95,7 @@ $require = file_exists($html_dir . $info['src']) ? $html_dir . $info['src'] : $h
<fieldset class="pad_6"> <fieldset class="pad_6">
<legend class="med bold mrg_2 warnColor1"><?php echo mb_strtoupper($info['title'], 'UTF-8'); ?></legend> <legend class="med bold mrg_2 warnColor1"><?php echo mb_strtoupper($info['title'], 'UTF-8'); ?></legend>
<div class="bCenter"> <div class="bCenter">
<?php require($require); ?> <?php require $require; ?>
</div> </div>
</fieldset> </fieldset>
<p class="gen tRight pad_6"><a href="javascript:window.close();" class="gen">[ <?php echo $lang['LOCK']; ?> ]</a> <p class="gen tRight pad_6"><a href="javascript:window.close();" class="gen">[ <?php echo $lang['LOCK']; ?> ]</a>

View file

@ -25,7 +25,7 @@
define('IN_FORUM', true); define('IN_FORUM', true);
define('BB_ROOT', './'); define('BB_ROOT', './');
require(BB_ROOT . 'common.php'); require BB_ROOT . 'common.php';
$user->session_start(); $user->session_start();

View file

@ -25,7 +25,7 @@
define('IN_FORUM', true); define('IN_FORUM', true);
define('BB_ROOT', './'); define('BB_ROOT', './');
require(BB_ROOT . 'common.php'); require BB_ROOT . 'common.php';
$user->session_start(); $user->session_start();

View file

@ -25,7 +25,7 @@
define('IN_FORUM', true); define('IN_FORUM', true);
define('BB_ROOT', './'); define('BB_ROOT', './');
require(BB_ROOT . 'common.php'); require BB_ROOT . 'common.php';
$user->session_start(); $user->session_start();

View file

@ -25,8 +25,8 @@
define('IN_FORUM', true); define('IN_FORUM', true);
define('BB_ROOT', './'); define('BB_ROOT', './');
require(BB_ROOT . 'common.php'); require BB_ROOT . 'common.php';
require(INC_DIR . 'functions_upload.php'); require INC_DIR . 'functions_upload.php';
while (@ob_end_flush()) ; while (@ob_end_flush()) ;
ob_implicit_flush(); ob_implicit_flush();

View file

@ -25,7 +25,7 @@
define('IN_FORUM', true); define('IN_FORUM', true);
define('BB_ROOT', './'); define('BB_ROOT', './');
require(BB_ROOT . 'common.php'); require BB_ROOT . 'common.php';
while (@ob_end_flush()) ; while (@ob_end_flush()) ;
ob_implicit_flush(); ob_implicit_flush();

View file

@ -25,7 +25,7 @@
define('IN_FORUM', true); define('IN_FORUM', true);
define('BB_ROOT', './'); define('BB_ROOT', './');
require(BB_ROOT . 'common.php'); require BB_ROOT . 'common.php';
while (@ob_end_flush()) ; while (@ob_end_flush()) ;
ob_implicit_flush(); ob_implicit_flush();

View file

@ -44,7 +44,7 @@ DB()->query("UPDATE " . BB_USERS . " SET user_rank = $rank_id WHERE user_id = $u
cache_rm_user_sessions($user_id); cache_rm_user_sessions($user_id);
$user_rank = ($rank_id) ? '<span class="' . $ranks[$rank_id]['rank_style'] . '">' . $ranks[$rank_id]['rank_title'] . '</span>' : ''; $user_rank = $rank_id ? '<span class="' . $ranks[$rank_id]['rank_style'] . '">' . $ranks[$rank_id]['rank_title'] . '</span>' : '';
$this->response['html'] = ($rank_id) ? $lang['AWARDED_RANK'] . "<b> $user_rank </b>" : $lang['SHOT_RANK']; $this->response['html'] = $rank_id ? $lang['AWARDED_RANK'] . "<b> $user_rank </b>" : $lang['SHOT_RANK'];
$this->response['rank_name'] = ($rank_id) ? $user_rank : $lang['USER']; $this->response['rank_name'] = $rank_id ? $user_rank : $lang['USER'];

View file

@ -36,7 +36,7 @@ if (!$mode = (string)$this->request['mode']) {
$this->ajax_die('No mode specified'); $this->ajax_die('No mode specified');
} }
$value = $this->request['value'] = (string)(isset($this->request['value'])) ? $this->request['value'] : 0; $value = $this->request['value'] = (string)isset($this->request['value']) ? $this->request['value'] : 0;
if (!IS_ADMIN && $userdata['user_id'] != $group_info['group_moderator']) { if (!IS_ADMIN && $userdata['user_id'] != $group_info['group_moderator']) {
$this->ajax_die($lang['ONLY_FOR_MOD']); $this->ajax_die($lang['ONLY_FOR_MOD']);

View file

@ -37,7 +37,7 @@ if (!$field = (string)$this->request['field']) {
} }
$table = BB_USERS; $table = BB_USERS;
$value = $this->request['value'] = (string)(isset($this->request['value'])) ? $this->request['value'] : 0; $value = $this->request['value'] = (string)isset($this->request['value']) ? $this->request['value'] : 0;
switch ($field) { switch ($field) {
case 'username': case 'username':

View file

@ -49,7 +49,7 @@ switch ($mode) {
"; ";
$html = array(); $html = array();
foreach (DB()->fetch_rowset($sql) as $row) { foreach (DB()->fetch_rowset($sql) as $row) {
$class = ($row['user_pending']) ? 'med' : 'med bold'; $class = $row['user_pending'] ? 'med' : 'med bold';
$class .= ($row['group_moderator'] == $user_id) ? ' colorMod' : ''; $class .= ($row['group_moderator'] == $user_id) ? ' colorMod' : '';
$href = "group.php?g={$row['group_id']}"; $href = "group.php?g={$row['group_id']}";

View file

@ -88,7 +88,7 @@ switch ($mode) {
} }
$html = ':&nbsp;'; $html = ':&nbsp;';
$html .= ($moderators) ? implode(', ', $moderators) : $lang['NONE']; $html .= $moderators ? implode(', ', $moderators) : $lang['NONE'];
unset($moderators, $mod); unset($moderators, $mod);
$datastore->rm('moderators'); $datastore->rm('moderators');
break; break;
@ -114,8 +114,8 @@ switch ($mode) {
$btu = get_bt_userdata($user_id); $btu = get_bt_userdata($user_id);
$profiledata = get_userdata($user_id); $profiledata = get_userdata($user_id);
$speed_up = ($btu['speed_up']) ? humn_size($btu['speed_up']) . '/s' : '0 KB/s'; $speed_up = $btu['speed_up'] ? humn_size($btu['speed_up']) . '/s' : '0 KB/s';
$speed_down = ($btu['speed_down']) ? humn_size($btu['speed_down']) . '/s' : '0 KB/s'; $speed_down = $btu['speed_down'] ? humn_size($btu['speed_down']) . '/s' : '0 KB/s';
$user_ratio = ($btu['u_down_total'] > MIN_DL_FOR_RATIO) ? '<b class="gen">' . get_bt_ratio($btu) . '</b>' : $lang['IT_WILL_BE_DOWN'] . ' <b>' . humn_size(MIN_DL_FOR_RATIO) . '</b>'; $user_ratio = ($btu['u_down_total'] > MIN_DL_FOR_RATIO) ? '<b class="gen">' . get_bt_ratio($btu) . '</b>' : $lang['IT_WILL_BE_DOWN'] . ' <b>' . humn_size(MIN_DL_FOR_RATIO) . '</b>';
$html = ' $html = '
@ -125,7 +125,7 @@ switch ($mode) {
<th>' . $lang['UPLOADED'] . '</th> <th>' . $lang['UPLOADED'] . '</th>
<th>' . $lang['RELEASED'] . '</th> <th>' . $lang['RELEASED'] . '</th>
<th>' . $lang['BONUS'] . '</th>'; <th>' . $lang['BONUS'] . '</th>';
$html .= ($bb_cfg['seed_bonus_enabled']) ? '<th>' . $lang['SEED_BONUS'] . '</th>' : ''; $html .= $bb_cfg['seed_bonus_enabled'] ? '<th>' . $lang['SEED_BONUS'] . '</th>' : '';
$html .= '</tr> $html .= '</tr>
<tr class="row1"> <tr class="row1">
<td>' . $lang['TOTAL_TRAF'] . '</td> <td>' . $lang['TOTAL_TRAF'] . '</td>
@ -133,13 +133,13 @@ switch ($mode) {
<td id="u_up_total"><span class="editable bold seedmed">' . humn_size($btu['u_up_total']) . '</span></td> <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_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>'; <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 .= $bb_cfg['seed_bonus_enabled'] ? '<td id="user_points"><span class="editable bold points">' . $profiledata['user_points'] . '</b></td>' : '';
$html .= '</tr> $html .= '</tr>
<tr class="row5"> <tr class="row5">
<td colspan="1">' . $lang['MAX_SPEED'] . '</td> <td colspan="1">' . $lang['MAX_SPEED'] . '</td>
<td colspan="2">' . $lang['DL_DL_SPEED'] . ': ' . $speed_down . '</span></td> <td colspan="2">' . $lang['DL_DL_SPEED'] . ': ' . $speed_down . '</span></td>
<td colspan="2">' . $lang['DL_UL_SPEED'] . ': ' . $speed_up . '</span></td>'; <td colspan="2">' . $lang['DL_UL_SPEED'] . ': ' . $speed_up . '</span></td>';
$html .= ($bb_cfg['seed_bonus_enabled']) ? '<td colspan="1"></td>' : ''; $html .= $bb_cfg['seed_bonus_enabled'] ? '<td colspan="1"></td>' : '';
$html .= '</tr>'; $html .= '</tr>';
$this->response['user_ratio'] = ' $this->response['user_ratio'] = '

View file

@ -47,9 +47,9 @@ if (!$post) {
} }
$data = array( $data = array(
'mc_comment' => ($mc_type) ? $mc_text : '', 'mc_comment' => $mc_type ? $mc_text : '',
'mc_type' => $mc_type, 'mc_type' => $mc_type,
'mc_user_id' => ($mc_type) ? $userdata['user_id'] : 0, 'mc_user_id' => $mc_type ? $userdata['user_id'] : 0,
); );
$sql_args = DB()->build_array('UPDATE', $data); $sql_args = DB()->build_array('UPDATE', $data);
DB()->query("UPDATE " . BB_POSTS . " SET $sql_args WHERE post_id = $post_id"); DB()->query("UPDATE " . BB_POSTS . " SET $sql_args WHERE post_id = $post_id");

View file

@ -245,7 +245,7 @@ switch ($this->request['type']) {
$message = prepare_message($message); $message = prepare_message($message);
// Flood control // Flood control
$where_sql = (IS_GUEST) ? "p.poster_ip = '" . USER_IP . "'" : "p.poster_id = {$userdata['user_id']}"; $where_sql = IS_GUEST ? "p.poster_ip = '" . USER_IP . "'" : "p.poster_id = {$userdata['user_id']}";
$sql = "SELECT MAX(p.post_time) AS last_post_time FROM " . BB_POSTS . " p WHERE $where_sql"; $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 ($row = DB()->fetch_row($sql) and $row['last_post_time']) {

View file

@ -67,7 +67,7 @@ switch ($mode) {
} elseif (mb_strlen($pass, 'UTF-8') < 5) { } elseif (mb_strlen($pass, 'UTF-8') < 5) {
$html = '<img src="./styles/images/bad.gif"> <span class="leechmed bold">' . sprintf($lang['CHOOSE_PASS_ERR_MIN'], 5) . '</span>'; $html = '<img src="./styles/images/bad.gif"> <span class="leechmed bold">' . sprintf($lang['CHOOSE_PASS_ERR_MIN'], 5) . '</span>';
} else { } else {
$text = (IS_GUEST) ? $lang['CHOOSE_PASS_REG_OK'] : $lang['CHOOSE_PASS_OK']; $text = IS_GUEST ? $lang['CHOOSE_PASS_REG_OK'] : $lang['CHOOSE_PASS_OK'];
$html = '<img src="./styles/images/good.gif"> <span class="seedmed bold">' . $text . '</span>'; $html = '<img src="./styles/images/good.gif"> <span class="seedmed bold">' . $text . '</span>';
} }
} }

View file

@ -132,7 +132,7 @@ class TorrentFileList
if ($j == $subdir_count) { if ($j == $subdir_count) {
if (is_string($cur_files_ary)) { if (is_string($cur_files_ary)) {
$GLOBALS['bnc_error'] = 1; $GLOBALS['bnc_error'] = 1;
break(1); break1;
} }
$cur_files_ary[] = $this->build_file_item($name, $length); $cur_files_ary[] = $this->build_file_item($name, $length);
} }

View file

@ -283,7 +283,7 @@ function display_attachments($post_id)
SET download_count = download_count + 1 SET download_count = download_count + 1
WHERE attach_id = ' . (int)$attachments['_' . $post_id][$i]['attach_id']; WHERE attach_id = ' . (int)$attachments['_' . $post_id][$i]['attach_id'];
if (!(DB()->sql_query($sql))) { if (!DB()->sql_query($sql)) {
bb_die('Could not update attachment download count'); bb_die('Could not update attachment download count');
} }
} }
@ -311,7 +311,7 @@ function display_attachments($post_id)
if ($link && ($attachments['_' . $post_id][$i]['extension'] === TORRENT_EXT)) { if ($link && ($attachments['_' . $post_id][$i]['extension'] === TORRENT_EXT)) {
include ATTACH_DIR . '/displaying_torrent.php'; include ATTACH_DIR . '/displaying_torrent.php';
} elseif ($link) { } elseif ($link) {
$target_blank = ((@(int)$display_categories[$attachments['_' . $post_id][$i]['extension']] == IMAGE_CAT)) ? 'target="_blank"' : ''; $target_blank = @(int)$display_categories[$attachments['_' . $post_id][$i]['extension']] == IMAGE_CAT ? 'target="_blank"' : '';
// display attachment // display attachment
$template->assign_block_vars('postrow.attach.attachrow', array( $template->assign_block_vars('postrow.attach.attachrow', array(

View file

@ -91,16 +91,16 @@ $tor_auth = ($bt_user_id != GUEST_UID && (($bt_user_id == $poster_id && !$locked
$tor_auth_reg = ($tor_auth && $t_data['allow_reg_tracker'] && $post_id == $t_data['topic_first_post_id']); $tor_auth_reg = ($tor_auth && $t_data['allow_reg_tracker'] && $post_id == $t_data['topic_first_post_id']);
$tor_auth_del = ($tor_auth && $tor_reged); $tor_auth_del = ($tor_auth && $tor_reged);
$tracker_link = ($tor_reged) ? $lang['BT_REG_YES'] : $lang['BT_REG_NO']; $tracker_link = $tor_reged ? $lang['BT_REG_YES'] : $lang['BT_REG_NO'];
$download_link = DOWNLOAD_URL . $attach_id; $download_link = DOWNLOAD_URL . $attach_id;
$description = ($comment) ?: preg_replace("#.torrent$#i", '', $display_name); $description = $comment ?: preg_replace("#.torrent$#i", '', $display_name);
if ($tor_auth_reg || $tor_auth_del) { if ($tor_auth_reg || $tor_auth_del) {
$reg_tor_url = '<a class="txtb" href="#" onclick="ajax.exec({ action: \'change_torrent\', attach_id : ' . $attach_id . ', type: \'reg\'}); return false;">' . $lang['BT_REG_ON_TRACKER'] . '</a>'; $reg_tor_url = '<a class="txtb" href="#" onclick="ajax.exec({ action: \'change_torrent\', attach_id : ' . $attach_id . ', type: \'reg\'}); return false;">' . $lang['BT_REG_ON_TRACKER'] . '</a>';
$unreg_tor_url = '<a class="txtb" href="#" onclick="ajax.exec({ action: \'change_torrent\', attach_id : ' . $attach_id . ', type: \'unreg\'}); return false;">' . $lang['BT_UNREG_FROM_TRACKER'] . '</a>'; $unreg_tor_url = '<a class="txtb" href="#" onclick="ajax.exec({ action: \'change_torrent\', attach_id : ' . $attach_id . ', type: \'unreg\'}); return false;">' . $lang['BT_UNREG_FROM_TRACKER'] . '</a>';
$tracker_link = ($tor_reged) ? $unreg_tor_url : $reg_tor_url; $tracker_link = $tor_reged ? $unreg_tor_url : $reg_tor_url;
} }
if ($bb_cfg['torrent_name_style']) { if ($bb_cfg['torrent_name_style']) {
@ -155,7 +155,7 @@ if ($tor_auth) {
} }
if ($tor_reged && $tor_info) { if ($tor_reged && $tor_info) {
$tor_size = ($tor_info['size']) ?: 0; $tor_size = $tor_info['size'] ?: 0;
$tor_id = $tor_info['topic_id']; $tor_id = $tor_info['topic_id'];
$tor_type = $tor_info['tor_type']; $tor_type = $tor_info['tor_type'];
@ -224,8 +224,8 @@ if ($tor_reged && $tor_info) {
'S_UPLOAD_IMAGE' => $upload_image, 'S_UPLOAD_IMAGE' => $upload_image,
'U_DOWNLOAD_LINK' => $download_link, 'U_DOWNLOAD_LINK' => $download_link,
'DL_LINK_CLASS' => (isset($bt_userdata['user_status'])) ? $dl_link_css[$bt_userdata['user_status']] : 'genmed', 'DL_LINK_CLASS' => isset($bt_userdata['user_status']) ? $dl_link_css[$bt_userdata['user_status']] : 'genmed',
'DL_TITLE_CLASS' => (isset($bt_userdata['user_status'])) ? $dl_status_css[$bt_userdata['user_status']] : 'gen', 'DL_TITLE_CLASS' => isset($bt_userdata['user_status']) ? $dl_status_css[$bt_userdata['user_status']] : 'gen',
'FILESIZE' => $tor_file_size, 'FILESIZE' => $tor_file_size,
'MAGNET' => $tor_magnet, 'MAGNET' => $tor_magnet,
'HASH' => strtoupper(bin2hex($tor_info['info_hash'])), 'HASH' => strtoupper(bin2hex($tor_info['info_hash'])),
@ -329,7 +329,7 @@ if ($tor_reged && $tor_info) {
if ($s_mode == 'full') { if ($s_mode == 'full') {
foreach ($peers as $pid => $peer) { foreach ($peers as $pid => $peer) {
$x = ($peer['seeder']) ? 's' : 'l'; $x = $peer['seeder'] ? 's' : 'l';
$cnt[$x]++; $cnt[$x]++;
$sp_up_tot[$x] += $peer['speed_up']; $sp_up_tot[$x] += $peer['speed_up'];
$sp_down_tot[$x] += $peer['speed_down']; $sp_down_tot[$x] += $peer['speed_down'];
@ -376,8 +376,8 @@ if ($tor_reged && $tor_info) {
$peers = $tmp; $peers = $tmp;
$template->assign_vars(array( $template->assign_vars(array(
'TOR_SPEED_UP' => ($tor_speed_up) ? humn_size($tor_speed_up, 0, 'KB') . '/s' : '0 KB/s', 'TOR_SPEED_UP' => $tor_speed_up ? humn_size($tor_speed_up, 0, 'KB') . '/s' : '0 KB/s',
'TOR_SPEED_DOWN' => ($tor_speed_down) ? humn_size($tor_speed_down, 0, 'KB') . '/s' : '0 KB/s', 'TOR_SPEED_DOWN' => $tor_speed_down ? humn_size($tor_speed_down, 0, 'KB') . '/s' : '0 KB/s',
)); ));
} }
@ -416,7 +416,7 @@ if ($tor_reged && $tor_info) {
$template->assign_block_vars("$x_full.porthead", array()); $template->assign_block_vars("$x_full.porthead", array());
} }
} }
$compl_perc = ($tor_size) ? round(($p_max_up / $tor_size), 1) : 0; $compl_perc = $tor_size ? round($p_max_up / $tor_size, 1) : 0;
} else { } else {
$x = 'l'; $x = 'l';
$x_row = 'lrow'; $x_row = 'lrow';
@ -440,24 +440,24 @@ if ($tor_reged && $tor_info) {
} }
} }
$compl_size = ($peer['remain'] && $tor_size && $tor_size > $peer['remain']) ? ($tor_size - $peer['remain']) : 0; $compl_size = ($peer['remain'] && $tor_size && $tor_size > $peer['remain']) ? ($tor_size - $peer['remain']) : 0;
$compl_perc = ($compl_size) ? floor($compl_size * 100 / $tor_size) : 0; $compl_perc = $compl_size ? floor($compl_size * 100 / $tor_size) : 0;
} }
$rel_sign = (!$guest && $peer['releaser']) ? '&nbsp;<b><sup>&reg;</sup></b>' : ''; $rel_sign = (!$guest && $peer['releaser']) ? '&nbsp;<b><sup>&reg;</sup></b>' : '';
$name = profile_url($peer) . $rel_sign; $name = profile_url($peer) . $rel_sign;
$up_tot = ($p_max_up) ? humn_size($p_max_up) : '-'; $up_tot = $p_max_up ? humn_size($p_max_up) : '-';
$down_tot = ($p_max_down) ? humn_size($p_max_down) : '-'; $down_tot = $p_max_down ? humn_size($p_max_down) : '-';
$up_ratio = ($p_max_down) ? round(($p_max_up / $p_max_down), 2) : ''; $up_ratio = $p_max_down ? round($p_max_up / $p_max_down, 2) : '';
$sp_up = ($peer['speed_up']) ? humn_size($peer['speed_up'], 0, 'KB') . '/s' : '-'; $sp_up = $peer['speed_up'] ? humn_size($peer['speed_up'], 0, 'KB') . '/s' : '-';
$sp_down = ($peer['speed_down']) ? humn_size($peer['speed_down'], 0, 'KB') . '/s' : '-'; $sp_down = $peer['speed_down'] ? humn_size($peer['speed_down'], 0, 'KB') . '/s' : '-';
$bgr_class = (!($tr[$x] % 2)) ? $bgr_class_1 : $bgr_class_2; $bgr_class = (!($tr[$x] % 2)) ? $bgr_class_1 : $bgr_class_2;
$row_bgr = ($change_peers_bgr_over) ? " class=\"$bgr_class\" onmouseover=\"this.className='$bgr_class_over';\" onmouseout=\"this.className='$bgr_class';\"" : ''; $row_bgr = $change_peers_bgr_over ? " class=\"$bgr_class\" onmouseover=\"this.className='$bgr_class_over';\" onmouseout=\"this.className='$bgr_class';\"" : '';
$tr[$x]++; $tr[$x]++;
$template->assign_block_vars("$x_full.$x_row", array( $template->assign_block_vars("$x_full.$x_row", array(
'ROW_BGR' => $row_bgr, 'ROW_BGR' => $row_bgr,
'NAME' => ($peer['update_time']) ? $name : "<s>$name</s>", 'NAME' => $peer['update_time'] ? $name : "<s>$name</s>",
'COMPL_PRC' => $compl_perc, 'COMPL_PRC' => $compl_perc,
'UP_TOTAL' => ($max_up_id[$x] == $pid) ? "<b>$up_tot</b>" : $up_tot, 'UP_TOTAL' => ($max_up_id[$x] == $pid) ? "<b>$up_tot</b>" : $up_tot,
'DOWN_TOTAL' => ($max_down_id[$x] == $pid) ? "<b>$down_tot</b>" : $down_tot, 'DOWN_TOTAL' => ($max_down_id[$x] == $pid) ? "<b>$down_tot</b>" : $down_tot,
@ -467,8 +467,8 @@ if ($tor_reged && $tor_info) {
'DOWN_TOTAL_RAW' => $peer['downloaded'], 'DOWN_TOTAL_RAW' => $peer['downloaded'],
'SPEED_UP_RAW' => $peer['speed_up'], 'SPEED_UP_RAW' => $peer['speed_up'],
'SPEED_DOWN_RAW' => $peer['speed_down'], 'SPEED_DOWN_RAW' => $peer['speed_down'],
'UPD_EXP_TIME' => ($peer['update_time']) ? $lang['DL_UPD'] . bb_date($peer['update_time'], 'd-M-y H:i') . ' &middot; ' . delta_time($peer['update_time']) . $lang['TOR_BACK'] : $lang['DL_STOPPED'], 'UPD_EXP_TIME' => $peer['update_time'] ? $lang['DL_UPD'] . bb_date($peer['update_time'], 'd-M-y H:i') . ' &middot; ' . delta_time($peer['update_time']) . $lang['TOR_BACK'] : $lang['DL_STOPPED'],
'TOR_RATIO' => ($up_ratio) ? $lang['USER_RATIO'] . "UL/DL: $up_ratio" : '', 'TOR_RATIO' => $up_ratio ? $lang['USER_RATIO'] . "UL/DL: $up_ratio" : '',
)); ));
if ($ip) { if ($ip) {
@ -484,7 +484,7 @@ if ($tor_reged && $tor_info) {
$seed_count = $peer['username']; $seed_count = $peer['username'];
} else { } else {
$compl_size = (@$peer['remain'] && $tor_size && $tor_size > $peer['remain']) ? ($tor_size - $peer['remain']) : 0; $compl_size = (@$peer['remain'] && $tor_size && $tor_size > $peer['remain']) ? ($tor_size - $peer['remain']) : 0;
$compl_perc = ($compl_size) ? floor($compl_size * 100 / $tor_size) : 0; $compl_perc = $compl_size ? floor($compl_size * 100 / $tor_size) : 0;
$leechers .= '<nobr><a href="' . $u_prof_href . '" class="leechmed">' . $peer['username'] . '</a>'; $leechers .= '<nobr><a href="' . $u_prof_href . '" class="leechmed">' . $peer['username'] . '</a>';
$leechers .= ($s_mode == 'names') ? ' [' . $compl_perc . '%]' : ''; $leechers .= ($s_mode == 'names') ? ' [' . $compl_perc . '%]' : '';
@ -498,14 +498,14 @@ if ($tor_reged && $tor_info) {
$seeders[strlen($seeders) - 9] = ' '; $seeders[strlen($seeders) - 9] = ' ';
$template->assign_vars(array( $template->assign_vars(array(
'SEED_LIST' => $seeders, 'SEED_LIST' => $seeders,
'SEED_COUNT' => ($seed_count) ?: 0, 'SEED_COUNT' => $seed_count ?: 0,
)); ));
} }
if ($s_mode != 'full' && $leechers) { if ($s_mode != 'full' && $leechers) {
$leechers[strlen($leechers) - 9] = ' '; $leechers[strlen($leechers) - 9] = ' ';
$template->assign_vars(array( $template->assign_vars(array(
'LEECH_LIST' => $leechers, 'LEECH_LIST' => $leechers,
'LEECH_COUNT' => ($leech_count) ?: 0, 'LEECH_COUNT' => $leech_count ?: 0,
)); ));
} }
} }
@ -513,7 +513,7 @@ if ($tor_reged && $tor_info) {
// Show "seeder last seen info" // Show "seeder last seen info"
if (($s_mode == 'count' && !$seed_count) || (!$seeders && !defined('SEEDER_EXIST'))) { if (($s_mode == 'count' && !$seed_count) || (!$seeders && !defined('SEEDER_EXIST'))) {
$last_seen_time = ($tor_info['seeder_last_seen']) ? delta_time($tor_info['seeder_last_seen']) : $lang['NEVER']; $last_seen_time = $tor_info['seeder_last_seen'] ? delta_time($tor_info['seeder_last_seen']) : $lang['NEVER'];
$template->assign_vars(array( $template->assign_vars(array(
'SEEDER_LAST_SEEN' => sprintf($lang['SEEDER_LAST_SEEN'], $last_seen_time), 'SEEDER_LAST_SEEN' => sprintf($lang['SEEDER_LAST_SEEN'], $last_seen_time),
@ -539,14 +539,14 @@ if ($bb_cfg['bt_allow_spmode_change'] && $s_mode != 'full') {
} }
$template->assign_vars(array( $template->assign_vars(array(
'SHOW_DL_LIST_LINK' => (($bb_cfg['bt_show_dl_list'] || $bb_cfg['allow_dl_list_names_mode']) && $t_data['topic_dl_type'] == TOPIC_DL_TYPE_DL), 'SHOW_DL_LIST_LINK' => ($bb_cfg['bt_show_dl_list'] || $bb_cfg['allow_dl_list_names_mode']) && $t_data['topic_dl_type'] == TOPIC_DL_TYPE_DL,
'SHOW_TOR_ACT' => ($tor_reged && $show_peers && (!isset($bb_cfg['tor_no_tor_act'][$tor_info['tor_status']]) || IS_AM)), 'SHOW_TOR_ACT' => $tor_reged && $show_peers && (!isset($bb_cfg['tor_no_tor_act'][$tor_info['tor_status']]) || IS_AM),
'S_MODE_COUNT' => ($s_mode == 'count'), 'S_MODE_COUNT' => $s_mode == 'count',
'S_MODE_NAMES' => ($s_mode == 'names'), 'S_MODE_NAMES' => $s_mode == 'names',
'S_MODE_FULL' => ($s_mode == 'full'), 'S_MODE_FULL' => $s_mode == 'full',
'PEER_EXIST' => ($seeders || $leechers || defined('SEEDER_EXIST') || defined('LEECHER_EXIST')), 'PEER_EXIST' => $seeders || $leechers || defined('SEEDER_EXIST') || defined('LEECHER_EXIST'),
'SEED_EXIST' => ($seeders || defined('SEEDER_EXIST')), 'SEED_EXIST' => $seeders || defined('SEEDER_EXIST'),
'LEECH_EXIST' => ($leechers || defined('LEECHER_EXIST')), 'LEECH_EXIST' => $leechers || defined('LEECHER_EXIST'),
'TOR_HELP_LINKS' => $bb_cfg['tor_help_links'], 'TOR_HELP_LINKS' => $bb_cfg['tor_help_links'],
'CALL_SEED' => ($bb_cfg['callseed'] && $tor_reged && !isset($bb_cfg['tor_no_tor_act'][$tor_info['tor_status']]) && $seed_count < 3 && $tor_info['call_seed_time'] < (TIMENOW - 86400)), 'CALL_SEED' => $bb_cfg['callseed'] && $tor_reged && !isset($bb_cfg['tor_no_tor_act'][$tor_info['tor_status']]) && $seed_count < 3 && $tor_info['call_seed_time'] < (TIMENOW - 86400),
)); ));

View file

@ -35,7 +35,7 @@ if (!function_exists('html_entity_decode')) {
{ {
$trans_table = array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style)); $trans_table = array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style));
$trans_table['&#39;'] = "'"; $trans_table['&#39;'] = "'";
return (strtr($given_html, $trans_table)); return strtr($given_html, $trans_table);
} }
} }
@ -499,7 +499,7 @@ function user_in_group($user_id, $group_id)
*/ */
function amod_realpath($path) function amod_realpath($path)
{ {
return (function_exists('realpath')) ? realpath($path) : $path; return function_exists('realpath') ? realpath($path) : $path;
} }
/** /**
@ -543,7 +543,7 @@ function get_var($var_name, $default, $multibyte = false)
(is_array($_REQUEST[$var_name]) && !is_array($default)) || (is_array($_REQUEST[$var_name]) && !is_array($default)) ||
(is_array($default) && !is_array($_REQUEST[$var_name])) (is_array($default) && !is_array($_REQUEST[$var_name]))
) { ) {
return (is_array($default)) ? [] : $default; return is_array($default) ? [] : $default;
} }
$var = $_REQUEST[$var_name]; $var = $_REQUEST[$var_name];
@ -622,7 +622,7 @@ function attach_mod_sql_build_array($query, $assoc_ary = false)
} elseif (is_array($var) && is_string($var[0])) { } elseif (is_array($var) && is_string($var[0])) {
$values[] = $var[0]; $values[] = $var[0];
} else { } else {
$values[] = (is_bool($var)) ? (int)$var : $var; $values[] = is_bool($var) ? (int)$var : $var;
} }
} }
@ -637,7 +637,7 @@ function attach_mod_sql_build_array($query, $assoc_ary = false)
} elseif (is_string($var)) { } elseif (is_string($var)) {
$values[] = "'" . attach_mod_sql_escape($var) . "'"; $values[] = "'" . attach_mod_sql_escape($var) . "'";
} else { } else {
$values[] = (is_bool($var)) ? (int)$var : $var; $values[] = is_bool($var) ? (int)$var : $var;
} }
} }
$ary[] = '(' . implode(', ', $values) . ')'; $ary[] = '(' . implode(', ', $values) . ')';
@ -652,7 +652,7 @@ function attach_mod_sql_build_array($query, $assoc_ary = false)
} elseif (is_string($var)) { } elseif (is_string($var)) {
$values[] = "$key = '" . attach_mod_sql_escape($var) . "'"; $values[] = "$key = '" . attach_mod_sql_escape($var) . "'";
} else { } else {
$values[] = (is_bool($var)) ? "$key = " . (int)$var : "$key = $var"; $values[] = is_bool($var) ? "$key = " . (int)$var : "$key = $var";
} }
} }
$query = implode(($query == 'UPDATE') ? ', ' : ' AND ', $values); $query = implode(($query == 'UPDATE') ? ', ' : ' AND ', $values);

View file

@ -154,7 +154,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0)
WHERE attach_id IN (' . implode(', ', $attach_id_array) . ") WHERE attach_id IN (' . implode(', ', $attach_id_array) . ")
AND $sql_id IN (" . implode(', ', $post_id_array) . ')'; AND $sql_id IN (" . implode(', ', $post_id_array) . ')';
if (!(DB()->sql_query($sql))) { if (!DB()->sql_query($sql)) {
bb_die($lang['ERROR_DELETED_ATTACHMENTS']); bb_die($lang['ERROR_DELETED_ATTACHMENTS']);
} }
@ -228,7 +228,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0)
$sql = 'DELETE FROM ' . BB_ATTACHMENTS_DESC . ' WHERE attach_id = ' . (int)$attachments[$j]['attach_id']; $sql = 'DELETE FROM ' . BB_ATTACHMENTS_DESC . ' WHERE attach_id = ' . (int)$attachments[$j]['attach_id'];
if (!(DB()->sql_query($sql))) { if (!DB()->sql_query($sql)) {
bb_die($lang['ERROR_DELETED_ATTACHMENTS']); bb_die($lang['ERROR_DELETED_ATTACHMENTS']);
} }
} }

View file

@ -37,8 +37,8 @@ function attach_build_auth_levels($is_auth, &$s_auth_can)
} }
// If you want to have the rules window link within the forum view too, comment out the two lines, and comment the third line // If you want to have the rules window link within the forum view too, comment out the two lines, and comment the third line
$s_auth_can .= (($is_auth['auth_attachments']) ? $lang['RULES_ATTACH_CAN'] : $lang['RULES_ATTACH_CANNOT']) . '<br />'; $s_auth_can .= ($is_auth['auth_attachments'] ? $lang['RULES_ATTACH_CAN'] : $lang['RULES_ATTACH_CANNOT']) . '<br />';
$s_auth_can .= (($is_auth['auth_download']) ? $lang['RULES_DOWNLOAD_CAN'] : $lang['RULES_DOWNLOAD_CANNOT']) . '<br />'; $s_auth_can .= ($is_auth['auth_download'] ? $lang['RULES_DOWNLOAD_CAN'] : $lang['RULES_DOWNLOAD_CANNOT']) . '<br />';
} }
/** /**
@ -66,7 +66,7 @@ function attachment_quota_settings($admin_mode, $submit = false, $mode)
if ($admin_mode == 'user') { if ($admin_mode == 'user') {
// We overwrite submit here... to be sure // We overwrite submit here... to be sure
$submit = (isset($_POST['submit'])) ? true : false; $submit = isset($_POST['submit']) ? true : false;
if (!$submit && $mode != 'save') { if (!$submit && $mode != 'save') {
$user_id = get_var(POST_USERS_URL, 0); $user_id = get_var(POST_USERS_URL, 0);

View file

@ -100,9 +100,9 @@ function get_supported_image_types($type)
} }
return array( return array(
'gd' => ($new_type) ? true : false, 'gd' => $new_type ? true : false,
'format' => $new_type, 'format' => $new_type,
'version' => (function_exists('imagecreatetruecolor')) ? 2 : 1 'version' => function_exists('imagecreatetruecolor') ? 2 : 1
); );
} }

View file

@ -392,7 +392,7 @@ class attach_parent
} else { } else {
$sql = 'UPDATE ' . BB_ATTACHMENTS_DESC . ' SET thumbnail = 0 WHERE attach_id = ' . (int) $actual_id_list[$i]; $sql = 'UPDATE ' . BB_ATTACHMENTS_DESC . ' SET thumbnail = 0 WHERE attach_id = ' . (int) $actual_id_list[$i];
if (!(DB()->sql_query($sql))) { if (!DB()->sql_query($sql)) {
bb_die('Unable to update ' . BB_ATTACHMENTS_DESC); bb_die('Unable to update ' . BB_ATTACHMENTS_DESC);
} }
} }
@ -471,7 +471,7 @@ class attach_parent
$sql = 'UPDATE ' . BB_ATTACHMENTS_DESC . ' SET ' . attach_mod_sql_build_array('UPDATE', $sql_ary) . ' $sql = 'UPDATE ' . BB_ATTACHMENTS_DESC . ' SET ' . attach_mod_sql_build_array('UPDATE', $sql_ary) . '
WHERE attach_id = ' . (int) $attachment_id; WHERE attach_id = ' . (int) $attachment_id;
if (!(DB()->sql_query($sql))) { if (!DB()->sql_query($sql)) {
bb_die('Unable to update the attachment'); bb_die('Unable to update the attachment');
} }
@ -552,7 +552,7 @@ class attach_parent
global $post_info, $userdata; global $post_info, $userdata;
$post_id = (int) $message_id; $post_id = (int) $message_id;
$user_id_1 = (isset($post_info['poster_id'])) ? (int) $post_info['poster_id'] : 0; $user_id_1 = isset($post_info['poster_id']) ? (int) $post_info['poster_id'] : 0;
if (!$user_id_1) { if (!$user_id_1) {
$user_id_1 = (int) $userdata['user_id']; $user_id_1 = (int) $userdata['user_id'];
@ -572,7 +572,7 @@ class attach_parent
SET comment = '" . @attach_mod_sql_escape($this->attachment_comment_list[$i]) . "' SET comment = '" . @attach_mod_sql_escape($this->attachment_comment_list[$i]) . "'
WHERE attach_id = " . $this->attachment_id_list[$i]; WHERE attach_id = " . $this->attachment_id_list[$i];
if (!(DB()->sql_query($sql))) { if (!DB()->sql_query($sql)) {
bb_die('Unable to update the file comment'); bb_die('Unable to update the file comment');
} }
} else { } else {
@ -594,7 +594,7 @@ class attach_parent
$sql = 'INSERT INTO ' . BB_ATTACHMENTS_DESC . ' ' . attach_mod_sql_build_array('INSERT', $sql_ary); $sql = 'INSERT INTO ' . BB_ATTACHMENTS_DESC . ' ' . attach_mod_sql_build_array('INSERT', $sql_ary);
if (!(DB()->sql_query($sql))) { if (!DB()->sql_query($sql)) {
bb_die('Could not store Attachment.<br />Your ' . $message_type . ' has been stored'); bb_die('Could not store Attachment.<br />Your ' . $message_type . ' has been stored');
} }
@ -614,7 +614,7 @@ class attach_parent
$sql = 'INSERT INTO ' . BB_ATTACHMENTS . ' ' . attach_mod_sql_build_array('INSERT', $sql_ary); $sql = 'INSERT INTO ' . BB_ATTACHMENTS . ' ' . attach_mod_sql_build_array('INSERT', $sql_ary);
if (!(DB()->sql_query($sql))) { if (!DB()->sql_query($sql)) {
bb_die('Could not store Attachment.<br />Your ' . $message_type . ' has been stored'); bb_die('Could not store Attachment.<br />Your ' . $message_type . ' has been stored');
} }
} }
@ -640,7 +640,7 @@ class attach_parent
$sql = 'INSERT INTO ' . BB_ATTACHMENTS_DESC . ' ' . attach_mod_sql_build_array('INSERT', $sql_ary); $sql = 'INSERT INTO ' . BB_ATTACHMENTS_DESC . ' ' . attach_mod_sql_build_array('INSERT', $sql_ary);
// Inform the user that his post has been created, but nothing is attached // Inform the user that his post has been created, but nothing is attached
if (!(DB()->sql_query($sql))) { if (!DB()->sql_query($sql)) {
bb_die('Could not store Attachment.<br />Your ' . $message_type . ' has been stored'); bb_die('Could not store Attachment.<br />Your ' . $message_type . ' has been stored');
} }
@ -654,7 +654,7 @@ class attach_parent
$sql = 'INSERT INTO ' . BB_ATTACHMENTS . ' ' . attach_mod_sql_build_array('INSERT', $sql_ary); $sql = 'INSERT INTO ' . BB_ATTACHMENTS . ' ' . attach_mod_sql_build_array('INSERT', $sql_ary);
if (!(DB()->sql_query($sql))) { if (!DB()->sql_query($sql)) {
bb_die('Could not store Attachment.<br />Your ' . $message_type . ' has been stored'); bb_die('Could not store Attachment.<br />Your ' . $message_type . ' has been stored');
} }
} }
@ -1134,7 +1134,7 @@ class attach_posting extends attach_parent
if ((count($this->attachment_list) > 0 || $this->post_attach) && !isset($_POST['update_attachment'])) { if ((count($this->attachment_list) > 0 || $this->post_attach) && !isset($_POST['update_attachment'])) {
$sql = 'UPDATE ' . BB_POSTS . ' SET post_attachment = 1 WHERE post_id = ' . (int) $post_id; $sql = 'UPDATE ' . BB_POSTS . ' SET post_attachment = 1 WHERE post_id = ' . (int) $post_id;
if (!(DB()->sql_query($sql))) { if (!DB()->sql_query($sql)) {
bb_die('Unable to update posts table'); bb_die('Unable to update posts table');
} }
@ -1149,7 +1149,7 @@ class attach_posting extends attach_parent
$sql = 'UPDATE ' . BB_TOPICS . ' SET topic_attachment = 1 WHERE topic_id = ' . (int) $row['topic_id']; $sql = 'UPDATE ' . BB_TOPICS . ' SET topic_attachment = 1 WHERE topic_id = ' . (int) $row['topic_id'];
if (!(DB()->sql_query($sql))) { if (!DB()->sql_query($sql)) {
bb_die('Unable to update topics table'); bb_die('Unable to update topics table');
} }
} }

View file

@ -393,7 +393,7 @@ function add_search_words($post_id, $post_message, $topic_title = '', $only_retu
global $bb_cfg; global $bb_cfg;
$text = $topic_title . ' ' . $post_message; $text = $topic_title . ' ' . $post_message;
$words = ($text) ? extract_search_words($text) : array(); $words = $text ? extract_search_words($text) : array();
if ($only_return_words || $bb_cfg['search_engine_type'] == 'sphinx') { if ($only_return_words || $bb_cfg['search_engine_type'] == 'sphinx') {
return implode("\n", $words); return implode("\n", $words);
@ -667,7 +667,7 @@ class bbcode
global $bb_cfg; global $bb_cfg;
$url = trim($m[1]); $url = trim($m[1]);
$url_name = (isset($m[2])) ? trim($m[2]) : $url; $url_name = isset($m[2]) ? trim($m[2]) : $url;
if (!preg_match("#^https?://#isu", $url) && !preg_match("/^#/", $url)) { if (!preg_match("#^https?://#isu", $url) && !preg_match("/^#/", $url)) {
$url = 'http://' . $url; $url = 'http://' . $url;
@ -725,7 +725,7 @@ class bbcode
// Remove our padding.. // Remove our padding..
$ret = substr(substr($ret, 0, -1), 1); $ret = substr(substr($ret, 0, -1), 1);
return ($ret); return $ret;
} }
/** /**

View file

@ -49,7 +49,7 @@ class cache_file extends cache_common
$this->debug('start'); $this->debug('start');
if (file_exists($filename)) { if (file_exists($filename)) {
require($filename); require $filename;
} }
$this->debug('stop'); $this->debug('stop');
@ -129,7 +129,7 @@ class cache_file extends cache_common
if ($file != "." && $file != "..") { if ($file != "." && $file != "..") {
$filename = $this->dir . $file; $filename = $this->dir . $file;
require($filename); require $filename;
if (!empty($filecache['expire']) && ($filecache['expire'] < $expire_time)) { if (!empty($filecache['expire']) && ($filecache['expire'] < $expire_time)) {
unlink($filename); unlink($filename);

View file

@ -50,7 +50,7 @@ class cache_memcache extends cache_common
public function connect() public function connect()
{ {
$connect_type = ($this->cfg['pconnect']) ? 'pconnect' : 'connect'; $connect_type = $this->cfg['pconnect'] ? 'pconnect' : 'connect';
$this->cur_query = $connect_type . ' ' . $this->cfg['host'] . ':' . $this->cfg['port']; $this->cur_query = $connect_type . ' ' . $this->cfg['host'] . ':' . $this->cfg['port'];
$this->debug('start'); $this->debug('start');
@ -83,7 +83,7 @@ class cache_memcache extends cache_common
$this->cur_query = null; $this->cur_query = null;
$this->num_queries++; $this->num_queries++;
return ($this->connected) ? $this->memcache->get($this->prefix . $name) : false; return $this->connected ? $this->memcache->get($this->prefix . $name) : false;
} }
public function set($name, $value, $ttl = 0): bool public function set($name, $value, $ttl = 0): bool
@ -98,7 +98,7 @@ class cache_memcache extends cache_common
$this->cur_query = null; $this->cur_query = null;
$this->num_queries++; $this->num_queries++;
return ($this->connected) ? $this->memcache->set($this->prefix . $name, $value, false, $ttl) : false; return $this->connected ? $this->memcache->set($this->prefix . $name, $value, false, $ttl) : false;
} }
public function rm($name = '') public function rm($name = '')
@ -114,7 +114,7 @@ class cache_memcache extends cache_common
$this->cur_query = null; $this->cur_query = null;
$this->num_queries++; $this->num_queries++;
return ($this->connected) ? $this->memcache->delete($this->prefix . $name, 0) : false; return $this->connected ? $this->memcache->delete($this->prefix . $name, 0) : false;
} }
return ($this->connected) ? $this->memcache->flush() : false; return ($this->connected) ? $this->memcache->flush() : false;

View file

@ -77,7 +77,7 @@ class cache_redis extends cache_common
$this->cur_query = null; $this->cur_query = null;
$this->num_queries++; $this->num_queries++;
return ($this->connected) ? unserialize($this->redis->get($this->prefix . $name)) : false; return $this->connected ? unserialize($this->redis->get($this->prefix . $name)) : false;
} }
public function set($name, $value, $ttl = 0) public function set($name, $value, $ttl = 0)
@ -117,7 +117,7 @@ class cache_redis extends cache_common
$this->cur_query = null; $this->cur_query = null;
$this->num_queries++; $this->num_queries++;
return ($this->connected) ? $this->redis->del($this->prefix . $name) : false; return $this->connected ? $this->redis->del($this->prefix . $name) : false;
} }
return ($this->connected) ? $this->redis->flushdb() : false; return ($this->connected) ? $this->redis->flushdb() : false;

View file

@ -120,7 +120,7 @@ class cache_sqlite extends cache_common
public function gc($expire_time = TIMENOW): int public function gc($expire_time = TIMENOW): int
{ {
$result = $this->db->query("DELETE FROM " . $this->cfg['table_name'] . " WHERE cache_expire_time < $expire_time"); $result = $this->db->query("DELETE FROM " . $this->cfg['table_name'] . " WHERE cache_expire_time < $expire_time");
return ($result) ? $this->db->changes() : 0; return $result ? $this->db->changes() : 0;
} }
} }
@ -151,7 +151,7 @@ class sqlite_common extends cache_common
public function connect() public function connect()
{ {
$this->cur_query = ($this->dbg_enabled) ? 'connect to: ' . $this->cfg['db_file_path'] : 'connect'; $this->cur_query = $this->dbg_enabled ? 'connect to: ' . $this->cfg['db_file_path'] : 'connect';
$this->debug('start'); $this->debug('start');
if (@$this->dbh = new SQLite3($this->cfg['db_file_path'])) { if (@$this->dbh = new SQLite3($this->cfg['db_file_path'])) {
@ -283,7 +283,7 @@ class sqlite_common extends cache_common
public function gc($expire_time = TIMENOW): int public function gc($expire_time = TIMENOW): int
{ {
$result = $this->db->query("DELETE FROM " . $this->cfg['table_name'] . " WHERE cache_expire_time < $expire_time"); $result = $this->db->query("DELETE FROM " . $this->cfg['table_name'] . " WHERE cache_expire_time < $expire_time");
return ($result) ? sqlite_changes($this->db->dbh) : 0; return $result ? sqlite_changes($this->db->dbh) : 0;
} }
public function trigger_error($msg = 'DB Error') public function trigger_error($msg = 'DB Error')

View file

@ -215,7 +215,7 @@ class emailer
// Did it work? // Did it work?
if (!$result) { if (!$result) {
bb_die('Failed sending email :: ' . (($this->use_smtp) ? 'SMTP' : 'PHP') . ' :: ' . $result); bb_die('Failed sending email :: ' . ($this->use_smtp ? 'SMTP' : 'PHP') . ' :: ' . $result);
} }
return true; return true;

View file

@ -99,7 +99,7 @@ class sitemap
} }
$not_forums_id = $forums['not_auth_forums']['guest_view']; $not_forums_id = $forums['not_auth_forums']['guest_view'];
$ignore_forum_sql = ($not_forums_id) ? "WHERE forum_id NOT IN($not_forums_id)" : ''; $ignore_forum_sql = $not_forums_id ? "WHERE forum_id NOT IN($not_forums_id)" : '';
$sql = DB()->sql_query("SELECT forum_id, forum_topics, forum_parent, forum_name FROM " . BB_FORUMS . " " . $ignore_forum_sql . " ORDER BY forum_id ASC"); $sql = DB()->sql_query("SELECT forum_id, forum_topics, forum_parent, forum_name FROM " . BB_FORUMS . " " . $ignore_forum_sql . " ORDER BY forum_id ASC");
@ -143,7 +143,7 @@ class sitemap
} }
$not_forums_id = $forums['not_auth_forums']['guest_view']; $not_forums_id = $forums['not_auth_forums']['guest_view'];
$ignore_forum_sql = ($not_forums_id) ? "WHERE forum_id NOT IN($not_forums_id)" : ''; $ignore_forum_sql = $not_forums_id ? "WHERE forum_id NOT IN($not_forums_id)" : '';
$sql = DB()->sql_query("SELECT topic_id, topic_title, topic_time FROM " . BB_TOPICS . " " . $ignore_forum_sql . " ORDER BY topic_time ASC" . $this->limit); $sql = DB()->sql_query("SELECT topic_id, topic_title, topic_time FROM " . BB_TOPICS . " " . $ignore_forum_sql . " ORDER BY topic_time ASC" . $this->limit);

View file

@ -110,7 +110,7 @@ class sql_db
*/ */
public function connect() public function connect()
{ {
$this->cur_query = ($this->dbg_enabled) ? "connect to: {$this->cfg['dbhost']}" : 'connect'; $this->cur_query = $this->dbg_enabled ? "connect to: {$this->cfg['dbhost']}" : 'connect';
$this->debug('start'); $this->debug('start');
$p = ((bool)$this->cfg['persist']) ? 'p:' : ''; $p = ((bool)$this->cfg['persist']) ? 'p:' : '';
@ -118,7 +118,7 @@ class sql_db
$this->selected_db = $this->cfg['dbname']; $this->selected_db = $this->cfg['dbname'];
if (mysqli_connect_error()) { if (mysqli_connect_error()) {
$server = (DBG_USER) ? $this->cfg['dbhost'] : ''; $server = DBG_USER ? $this->cfg['dbhost'] : '';
header("HTTP/1.0 503 Service Unavailable"); header("HTTP/1.0 503 Service Unavailable");
bb_log(' ', "db_err/connect_failed_{$this->cfg['dbhost']}"); bb_log(' ', "db_err/connect_failed_{$this->cfg['dbhost']}");
die("Could not connect to mysql server $server"); die("Could not connect to mysql server $server");
@ -319,7 +319,7 @@ class sql_db
$rowset = []; $rowset = [];
while ($row = mysqli_fetch_assoc($result)) { while ($row = mysqli_fetch_assoc($result)) {
$rowset[] = ($field_name) ? $row[$field_name] : $row; $rowset[] = $field_name ? $row[$field_name] : $row;
} }
return $rowset; return $rowset;
@ -409,7 +409,7 @@ class sql_db
case is_int($v): case is_int($v):
return "$v"; return "$v";
case is_bool($v): case is_bool($v):
return ($v) ? '1' : '0'; return $v ? '1' : '0';
case is_float($v): case is_float($v):
return "'$v'"; return "'$v'";
case null === $v: case null === $v:
@ -529,31 +529,31 @@ class sql_db
foreach ($sql_ary as $clause => $ary) { foreach ($sql_ary as $clause => $ary) {
switch ($clause) { switch ($clause) {
case 'SELECT': case 'SELECT':
$sql .= ($ary) ? ' SELECT ' . implode(' ', $sql_ary['select_options']) . ' ' . implode(', ', $ary) : ''; $sql .= $ary ? ' SELECT ' . implode(' ', $sql_ary['select_options']) . ' ' . implode(', ', $ary) : '';
break; break;
case 'FROM': case 'FROM':
$sql .= ($ary) ? ' FROM ' . implode(', ', $ary) : ''; $sql .= $ary ? ' FROM ' . implode(', ', $ary) : '';
break; break;
case 'INNER JOIN': case 'INNER JOIN':
$sql .= ($ary) ? ' INNER JOIN ' . implode(' INNER JOIN ', $ary) : ''; $sql .= $ary ? ' INNER JOIN ' . implode(' INNER JOIN ', $ary) : '';
break; break;
case 'LEFT JOIN': case 'LEFT JOIN':
$sql .= ($ary) ? ' LEFT JOIN ' . implode(' LEFT JOIN ', $ary) : ''; $sql .= $ary ? ' LEFT JOIN ' . implode(' LEFT JOIN ', $ary) : '';
break; break;
case 'WHERE': case 'WHERE':
$sql .= ($ary) ? ' WHERE ' . implode(' AND ', $ary) : ''; $sql .= $ary ? ' WHERE ' . implode(' AND ', $ary) : '';
break; break;
case 'GROUP BY': case 'GROUP BY':
$sql .= ($ary) ? ' GROUP BY ' . implode(', ', $ary) : ''; $sql .= $ary ? ' GROUP BY ' . implode(', ', $ary) : '';
break; break;
case 'HAVING': case 'HAVING':
$sql .= ($ary) ? ' HAVING ' . implode(' AND ', $ary) : ''; $sql .= $ary ? ' HAVING ' . implode(' AND ', $ary) : '';
break; break;
case 'ORDER BY': case 'ORDER BY':
$sql .= ($ary) ? ' ORDER BY ' . implode(', ', $ary) : ''; $sql .= $ary ? ' ORDER BY ' . implode(', ', $ary) : '';
break; break;
case 'LIMIT': case 'LIMIT':
$sql .= ($ary) ? ' LIMIT ' . implode(', ', $ary) : ''; $sql .= $ary ? ' LIMIT ' . implode(', ', $ary) : '';
break; break;
} }
} }

View file

@ -49,10 +49,10 @@ if ($cron_jobs) {
} }
} }
require(CRON_DIR . 'cron_run.php'); require CRON_DIR . 'cron_run.php';
// Update cron_last_check // Update cron_last_check
bb_update_config(array('cron_last_check' => (TIMENOW + 10))); bb_update_config(array('cron_last_check' => TIMENOW + 10));
} else { } else {
bb_log(date('H:i:s - ') . getmypid() . ' --x- no active jobs found ----------------------------------------------' . LOG_LF, CRON_LOG_DIR . '/cron_check'); bb_log(date('H:i:s - ') . getmypid() . ' --x- no active jobs found ----------------------------------------------' . LOG_LF, CRON_LOG_DIR . '/cron_check');
} }

View file

@ -72,7 +72,7 @@ if (cron_get_file_lock()) {
cron_track_running('start'); cron_track_running('start');
require(CRON_DIR . 'cron_check.php'); require CRON_DIR . 'cron_check.php';
cron_track_running('end'); cron_track_running('end');
} }

View file

@ -82,7 +82,7 @@ foreach ($cron_jobs as $job) {
} }
set_time_limit(600); set_time_limit(600);
require($job_script); require $job_script;
if ($job['log_sql_queries']) { if ($job['log_sql_queries']) {
DB()->log_next_query(0); DB()->log_next_query(0);
@ -102,7 +102,7 @@ foreach ($cron_jobs as $job) {
bb_log($msg . LOG_LF, CRON_LOG_DIR . '/' . CRON_LOG_FILE); bb_log($msg . LOG_LF, CRON_LOG_DIR . '/' . CRON_LOG_FILE);
if ($cron_runtime_log) { if ($cron_runtime_log) {
$runtime_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)); bb_log($cron_runtime_log . LOG_LF, CRON_LOG_DIR . '/' . basename($runtime_log_file));
} }
} }

View file

@ -33,6 +33,6 @@ if ($bb_cfg['prune_enable']) {
$sql = "SELECT forum_id, prune_days FROM " . BB_FORUMS . " WHERE prune_days != 0"; $sql = "SELECT forum_id, prune_days FROM " . BB_FORUMS . " WHERE prune_days != 0";
foreach (DB()->fetch_rowset($sql) as $row) { foreach (DB()->fetch_rowset($sql) as $row) {
topic_delete('prune', $row['forum_id'], (TIMENOW - 86400 * $row['prune_days'])); topic_delete('prune', $row['forum_id'], TIMENOW - 86400 * $row['prune_days']);
} }
} }

View file

@ -96,7 +96,7 @@ class datastore_file extends datastore_common
$this->num_queries++; $this->num_queries++;
if (file_exists($filename)) { if (file_exists($filename)) {
require($filename); require $filename;
$this->data[$item] = $filecache; $this->data[$item] = $filecache;
} }

View file

@ -49,7 +49,7 @@ class datastore_memcache extends datastore_common
public function connect() public function connect()
{ {
$connect_type = ($this->cfg['pconnect']) ? 'pconnect' : 'connect'; $connect_type = $this->cfg['pconnect'] ? 'pconnect' : 'connect';
$this->cur_query = $connect_type . ' ' . $this->cfg['host'] . ':' . $this->cfg['port']; $this->cur_query = $connect_type . ' ' . $this->cfg['host'] . ':' . $this->cfg['port'];
$this->debug('start'); $this->debug('start');

View file

@ -50,7 +50,7 @@ function get_attach_path($id, $ext_id = '', $base_path = null, $first_div = 1000
function delete_avatar($user_id, $avatar_ext_id) function delete_avatar($user_id, $avatar_ext_id)
{ {
$avatar_file = ($avatar_ext_id) ? get_avatar_path($user_id, $avatar_ext_id) : ''; $avatar_file = $avatar_ext_id ? get_avatar_path($user_id, $avatar_ext_id) : '';
return ($avatar_file && file_exists($avatar_file)) ? @unlink($avatar_file) : false; return ($avatar_file && file_exists($avatar_file)) ? @unlink($avatar_file) : false;
} }
@ -72,7 +72,7 @@ function get_tracks($type)
trigger_error(__FUNCTION__ . ": invalid type '$type'", E_USER_ERROR); trigger_error(__FUNCTION__ . ": invalid type '$type'", E_USER_ERROR);
} }
$tracks = !empty($_COOKIE[$c_name]) ? @unserialize($_COOKIE[$c_name]) : false; $tracks = !empty($_COOKIE[$c_name]) ? @unserialize($_COOKIE[$c_name]) : false;
return ($tracks) ?: array(); return $tracks ?: array();
} }
function set_tracks($cookie_name, &$tracking_ary, $tracks = null, $val = TIMENOW) function set_tracks($cookie_name, &$tracking_ary, $tracks = null, $val = TIMENOW)
@ -323,7 +323,7 @@ function bf($int, $bf_array_name, $key)
function setbit(&$int, $bit_num, $on) function setbit(&$int, $bit_num, $on)
{ {
return ($on) ? $int |= (1 << $bit_num) : $int &= ~(1 << $bit_num); return $on ? $int |= (1 << $bit_num) : $int &= ~(1 << $bit_num);
} }
/* /*
@ -706,8 +706,8 @@ class html_common
$this->_build_select_rec($params); $this->_build_select_rec($params);
$select_params = ($js) ? " $js" : ''; $select_params = $js ? " $js" : '';
$select_params .= ($multiple_size) ? ' multiple="multiple" size="' . $multiple_size . '"' : ''; $select_params .= $multiple_size ? ' multiple="multiple" size="' . $multiple_size . '"' : '';
$select_params .= ' name="' . htmlCHR($name) . '"'; $select_params .= ' name="' . htmlCHR($name) . '"';
$select_params .= ' id="' . htmlCHR($name) . '"'; $select_params .= ' id="' . htmlCHR($name) . '"';
@ -769,10 +769,10 @@ class html_common
{ {
$name = ' name="' . $name . '" '; $name = ' name="' . $name . '" ';
$value = ' value="' . $value . '" '; $value = ' value="' . $value . '" ';
$title = ($class) ? '<span class="' . $class . '">' . $title . '</span>' : $title; $title = $class ? '<span class="' . $class . '">' . $title . '</span>' : $title;
$id = ($id) ? " id=\"$id\" " : ''; $id = $id ? " id=\"$id\" " : '';
$checked = ($checked) ? HTML_CHECKED : ''; $checked = $checked ? HTML_CHECKED : '';
$disabled = ($disabled) ? HTML_DISABLED : ''; $disabled = $disabled ? HTML_DISABLED : '';
return '<label><input type="checkbox" ' . $id . $name . $value . $checked . $disabled . ' />&nbsp;' . $title . '&nbsp;</label>'; return '<label><input type="checkbox" ' . $id . $name . $value . $checked . $disabled . ' />&nbsp;' . $title . '&nbsp;</label>';
} }
@ -865,7 +865,7 @@ function declension($int, $expressions, $format = '%1$s %2$s')
} }
} }
return ($format) ? sprintf($format, $int, $result) : $result; return $format ? sprintf($format, $int, $result) : $result;
} }
// http://forum.dklab.ru/php/advises/UrlreplaceargChangesValueOfParameterInUrl.html // http://forum.dklab.ru/php/advises/UrlreplaceargChangesValueOfParameterInUrl.html
@ -924,7 +924,7 @@ function humn_size($size, $rounder = null, $min = null, $space = '&nbsp;')
$ext = 'KB'; $ext = 'KB';
$rounder = 1; $rounder = 1;
} else { } else {
for ($i = 1, $cnt = count($sizes); ($i < $cnt && $size >= 1024); $i++) { for ($i = 1, $cnt = count($sizes); $i < $cnt && $size >= 1024; $i++) {
$size /= 1024; $size /= 1024;
$ext = $sizes[$i]; $ext = $sizes[$i];
$rnd = $rounders[$i]; $rnd = $rounders[$i];
@ -943,7 +943,7 @@ function bt_show_ip($ip, $port = '')
if (IS_AM) { if (IS_AM) {
$ip = decode_ip($ip); $ip = decode_ip($ip);
$ip .= ($port) ? ":$port" : ''; $ip .= $port ? ":$port" : '';
return $ip; return $ip;
} }
@ -976,7 +976,7 @@ function checkbox_get_val(&$key, &$val, $default = 1, $on = 1, $off = 0)
} elseif (!isset($_REQUEST[$key]) && isset($_REQUEST['prev_' . $key])) { } elseif (!isset($_REQUEST[$key]) && isset($_REQUEST['prev_' . $key])) {
$val = $off; $val = $off;
} elseif (isset($previous_settings[$key]) && (!IS_GUEST || !empty($search_id))) { } elseif (isset($previous_settings[$key]) && (!IS_GUEST || !empty($search_id))) {
$val = ($previous_settings[$key]) ? $on : $off; $val = $previous_settings[$key] ? $on : $off;
} else { } else {
$val = $default; $val = $default;
} }
@ -988,7 +988,7 @@ function select_get_val($key, &$val, $options_ary, $default, $num = true)
if (isset($_REQUEST[$key]) && is_string($_REQUEST[$key])) { if (isset($_REQUEST[$key]) && is_string($_REQUEST[$key])) {
if (isset($options_ary[$_REQUEST[$key]])) { if (isset($options_ary[$_REQUEST[$key]])) {
$val = ($num) ? (int)$_REQUEST[$key] : $_REQUEST[$key]; $val = $num ? (int)$_REQUEST[$key] : $_REQUEST[$key];
} }
} elseif (isset($previous_settings[$key])) { } elseif (isset($previous_settings[$key])) {
$val = $previous_settings[$key]; $val = $previous_settings[$key];
@ -1026,7 +1026,7 @@ function set_var(&$result, $var, $type, $multibyte = false, $strip = true)
} }
} }
$result = ($strip) ? stripslashes($result) : $result; $result = $strip ? stripslashes($result) : $result;
} }
} }
@ -1044,13 +1044,13 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false)
{ {
if (!$cookie && isset($_COOKIE[$var_name])) { if (!$cookie && isset($_COOKIE[$var_name])) {
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] = $_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]))) {
return (is_array($default)) ? array() : $default; return is_array($default) ? array() : $default;
} }
$var = $_REQUEST[$var_name]; $var = $_REQUEST[$var_name];
@ -1167,7 +1167,7 @@ function get_bt_ratio($btu)
{ {
return return
(!empty($btu['u_down_total']) && $btu['u_down_total'] > MIN_DL_FOR_RATIO) (!empty($btu['u_down_total']) && $btu['u_down_total'] > MIN_DL_FOR_RATIO)
? round((($btu['u_up_total'] + $btu['u_up_release'] + $btu['u_up_bonus']) / $btu['u_down_total']), 2) ? round(($btu['u_up_total'] + $btu['u_up_release'] + $btu['u_up_bonus']) / $btu['u_down_total'], 2)
: null; : null;
} }
@ -1187,19 +1187,19 @@ function show_bt_userdata($user_id)
'USER_RATIO' => get_bt_ratio($btu), 'USER_RATIO' => get_bt_ratio($btu),
'MIN_DL_FOR_RATIO' => humn_size(MIN_DL_FOR_RATIO), 'MIN_DL_FOR_RATIO' => humn_size(MIN_DL_FOR_RATIO),
'MIN_DL_BYTES' => MIN_DL_FOR_RATIO, 'MIN_DL_BYTES' => MIN_DL_FOR_RATIO,
'AUTH_KEY' => ($btu['auth_key']) ?: $lang['NONE'], 'AUTH_KEY' => $btu['auth_key'] ?: $lang['NONE'],
'TD_DL' => humn_size($btu['down_today']), 'TD_DL' => humn_size($btu['down_today']),
'TD_UL' => humn_size($btu['up_today']), 'TD_UL' => humn_size($btu['up_today']),
'TD_REL' => humn_size($btu['up_release_today']), 'TD_REL' => humn_size($btu['up_release_today']),
'TD_BONUS' => humn_size($btu['up_bonus_today']), 'TD_BONUS' => humn_size($btu['up_bonus_today']),
'TD_POINTS' => ($btu['auth_key']) ? $btu['points_today'] : '0.00', 'TD_POINTS' => $btu['auth_key'] ? $btu['points_today'] : '0.00',
'YS_DL' => humn_size($btu['down_yesterday']), 'YS_DL' => humn_size($btu['down_yesterday']),
'YS_UL' => humn_size($btu['up_yesterday']), 'YS_UL' => humn_size($btu['up_yesterday']),
'YS_REL' => humn_size($btu['up_release_yesterday']), 'YS_REL' => humn_size($btu['up_release_yesterday']),
'YS_BONUS' => humn_size($btu['up_bonus_yesterday']), 'YS_BONUS' => humn_size($btu['up_bonus_yesterday']),
'YS_POINTS' => ($btu['auth_key']) ? $btu['points_yesterday'] : '0.00', 'YS_POINTS' => $btu['auth_key'] ? $btu['points_yesterday'] : '0.00',
'SPEED_UP' => humn_size($btu['speed_up'], 0, 'KB') . '/s', 'SPEED_UP' => humn_size($btu['speed_up'], 0, 'KB') . '/s',
'SPEED_DOWN' => humn_size($btu['speed_down'], 0, 'KB') . '/s', 'SPEED_DOWN' => humn_size($btu['speed_down'], 0, 'KB') . '/s',
@ -1373,7 +1373,7 @@ function make_jumpbox()
} }
$template->assign_vars(array( $template->assign_vars(array(
'JUMPBOX' => (IS_GUEST) ? $jumpbox['guest'] : $jumpbox['user'], 'JUMPBOX' => IS_GUEST ? $jumpbox['guest'] : $jumpbox['user'],
)); ));
} }
@ -1422,7 +1422,7 @@ function get_forum_select($mode = 'guest', $name = POST_FORUM_URL, $selected = n
trigger_error(__FUNCTION__ . ": invalid mode '$mode'", E_USER_ERROR); trigger_error(__FUNCTION__ . ": invalid mode '$mode'", E_USER_ERROR);
} }
$cat_title = $forums['c'][$f['cat_id']]['cat_title']; $cat_title = $forums['c'][$f['cat_id']]['cat_title'];
$f_name = ($f['forum_parent']) ? ' |- ' : ''; $f_name = $f['forum_parent'] ? ' |- ' : '';
$f_name .= $f['forum_name']; $f_name .= $f['forum_name'];
while (isset($select[$cat_title][$f_name])) { while (isset($select[$cat_title][$f_name])) {
@ -1483,7 +1483,7 @@ function bb_date($gmepoch, $format = false, $friendly_date = true)
$format = $bb_cfg['default_dateformat']; $format = $bb_cfg['default_dateformat'];
} }
if (empty($lang)) { if (empty($lang)) {
require_once($bb_cfg['default_lang_dir'] . 'main.php'); require_once $bb_cfg['default_lang_dir'] . 'main.php';
} }
if (empty($userdata['session_logged_in'])) { if (empty($userdata['session_logged_in'])) {
@ -1510,19 +1510,19 @@ function bb_date($gmepoch, $format = false, $friendly_date = true)
} elseif ($today != 1 && $date_today == ($today - 1) && $date_month == $month && $date_year == $year) { } elseif ($today != 1 && $date_today == ($today - 1) && $date_month == $month && $date_year == $year) {
$date = 'yesterday' . gmdate($time_format, $gmepoch + (3600 * $tz)); $date = 'yesterday' . gmdate($time_format, $gmepoch + (3600 * $tz));
} elseif ($today == 1 && $month != 1) { } elseif ($today == 1 && $month != 1) {
$yesterday = date('t', mktime(0, 0, 0, ($month - 1), 1, $year)); $yesterday = date('t', mktime(0, 0, 0, $month - 1, 1, $year));
if ($date_today == $yesterday && $date_month == ($month - 1) && $date_year == $year) { if ($date_today == $yesterday && $date_month == ($month - 1) && $date_year == $year) {
$date = 'yesterday' . gmdate($time_format, $gmepoch + (3600 * $tz)); $date = 'yesterday' . gmdate($time_format, $gmepoch + (3600 * $tz));
} }
} elseif ($today == 1 && $month == 1) { } elseif ($today == 1 && $month == 1) {
$yesterday = date('t', mktime(0, 0, 0, 12, 1, ($year - 1))); $yesterday = date('t', mktime(0, 0, 0, 12, 1, $year - 1));
if ($date_today == $yesterday && $date_month == 12 && $date_year == ($year - 1)) { if ($date_today == $yesterday && $date_month == 12 && $date_year == ($year - 1)) {
$date = 'yesterday' . gmdate($time_format, $gmepoch + (3600 * $tz)); $date = 'yesterday' . gmdate($time_format, $gmepoch + (3600 * $tz));
} }
} }
} }
return ($bb_cfg['translate_dates']) ? strtr(strtoupper($date), $lang['DATETIME']) : $date; return $bb_cfg['translate_dates'] ? strtr(strtoupper($date), $lang['DATETIME']) : $date;
} }
function birthday_age($date) function birthday_age($date)
@ -1624,12 +1624,12 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
} }
} }
$pagination = ($page_string) ? '<a class="menu-root" href="#pg-jump">' . $lang['GOTO_PAGE'] . '</a> :&nbsp;&nbsp;' . $page_string : ''; $pagination = $page_string ? '<a class="menu-root" href="#pg-jump">' . $lang['GOTO_PAGE'] . '</a> :&nbsp;&nbsp;' . $page_string : '';
$pagination = str_replace('&amp;start=0', '', $pagination); $pagination = str_replace('&amp;start=0', '', $pagination);
$template->assign_vars(array( $template->assign_vars(array(
'PAGINATION' => $pagination, 'PAGINATION' => $pagination,
'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], (floor($start_item / $per_page) + 1), ceil($num_items / $per_page)), 'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], floor($start_item / $per_page) + 1, ceil($num_items / $per_page)),
'PG_BASE_URL' => $base_url, 'PG_BASE_URL' => $base_url,
'PG_PER_PAGE' => $per_page, 'PG_PER_PAGE' => $per_page,
)); ));
@ -1696,7 +1696,7 @@ function bb_die($msg_text)
// If empty lang // If empty lang
if (empty($lang)) { if (empty($lang)) {
require($bb_cfg['default_lang_dir'] . 'main.php'); require $bb_cfg['default_lang_dir'] . 'main.php';
} }
// If empty session // If empty session
@ -1712,7 +1712,7 @@ function bb_die($msg_text)
if (empty($theme)) { if (empty($theme)) {
$theme = setup_style(); $theme = setup_style();
} }
require(PAGE_HEADER); require PAGE_HEADER;
} }
// Check for lang variable // Check for lang variable
@ -1728,7 +1728,7 @@ function bb_die($msg_text)
$template->set_filenames(array('bb_die' => 'common.tpl')); $template->set_filenames(array('bb_die' => 'common.tpl'));
$template->pparse('bb_die'); $template->pparse('bb_die');
require(PAGE_FOOTER); require PAGE_FOOTER;
exit; exit;
} }
@ -1752,7 +1752,7 @@ function bb_realpath($path)
function login_redirect($url = '') function login_redirect($url = '')
{ {
redirect(LOGIN_URL . '?redirect=' . (($url) ?: ($_SERVER['REQUEST_URI'] ?? '/'))); redirect(LOGIN_URL . '?redirect=' . ($url ?: ($_SERVER['REQUEST_URI'] ?? '/')));
} }
function meta_refresh($url, $time = 5) function meta_refresh($url, $time = 5)
@ -1775,7 +1775,7 @@ function redirect($url)
} }
$url = trim($url); $url = trim($url);
$server_protocol = ($bb_cfg['cookie_secure']) ? 'https://' : 'http://'; $server_protocol = $bb_cfg['cookie_secure'] ? 'https://' : 'http://';
$server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($bb_cfg['server_name'])); $server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($bb_cfg['server_name']));
$server_port = ($bb_cfg['server_port'] <> 80) ? ':' . trim($bb_cfg['server_port']) : ''; $server_port = ($bb_cfg['server_port'] <> 80) ? ':' . trim($bb_cfg['server_port']) : '';
@ -2066,8 +2066,8 @@ function get_topic_icon($topic, $is_unread = null)
if ($topic['topic_status'] == TOPIC_MOVED) { if ($topic['topic_status'] == TOPIC_MOVED) {
$folder_image = $images['folder']; $folder_image = $images['folder'];
} else { } else {
$folder = ($t_hot) ? $images['folder_hot'] : $images['folder']; $folder = $t_hot ? $images['folder_hot'] : $images['folder'];
$folder_new = ($t_hot) ? $images['folder_hot_new'] : $images['folder_new']; $folder_new = $t_hot ? $images['folder_hot_new'] : $images['folder_new'];
if ($topic['topic_type'] == POST_ANNOUNCE) { if ($topic['topic_type'] == POST_ANNOUNCE) {
$folder = $images['folder_announce']; $folder = $images['folder_announce'];
@ -2079,11 +2079,11 @@ function get_topic_icon($topic, $is_unread = null)
$folder = $images['folder_locked']; $folder = $images['folder_locked'];
$folder_new = $images['folder_locked_new']; $folder_new = $images['folder_locked_new'];
} elseif ($topic['topic_dl_type'] == TOPIC_DL_TYPE_DL) { } elseif ($topic['topic_dl_type'] == TOPIC_DL_TYPE_DL) {
$folder = ($t_hot) ? $images['folder_dl_hot'] : $images['folder_dl']; $folder = $t_hot ? $images['folder_dl_hot'] : $images['folder_dl'];
$folder_new = ($t_hot) ? $images['folder_dl_hot_new'] : $images['folder_dl_new']; $folder_new = $t_hot ? $images['folder_dl_hot_new'] : $images['folder_dl_new'];
} }
$folder_image = ($is_unread) ? $folder_new : $folder; $folder_image = $is_unread ? $folder_new : $folder;
} }
return $folder_image; return $folder_image;
@ -2097,7 +2097,7 @@ function build_topic_pagination($url, $replies, $per_page)
$total_pages = ceil($replies / $per_page); $total_pages = ceil($replies / $per_page);
for ($j = 0, $page = 1; $j < $replies; $j += $per_page, $page++) { for ($j = 0, $page = 1; $j < $replies; $j += $per_page, $page++) {
$href = ($j) ? "$url&amp;start=$j" : $url; $href = $j ? "$url&amp;start=$j" : $url;
$pg .= '<a href="' . $href . '" class="topicPG">' . $page . '</a>'; $pg .= '<a href="' . $href . '" class="topicPG">' . $page . '</a>';
if ($page == 1 && $total_pages > 3) { if ($page == 1 && $total_pages > 3) {
@ -2193,14 +2193,14 @@ function print_page($args, $type = '', $mode = '')
$gen_simple_header = (is_array($args) && !empty($args['simple']) or $type === 'simple') ? true : $gen_simple_header; $gen_simple_header = (is_array($args) && !empty($args['simple']) or $type === 'simple') ? true : $gen_simple_header;
if ($mode !== 'no_header') { if ($mode !== 'no_header') {
require(PAGE_HEADER); require PAGE_HEADER;
} }
$template->set_filenames(array('body' => $tpl)); $template->set_filenames(array('body' => $tpl));
$template->pparse('body'); $template->pparse('body');
if ($mode !== 'no_footer') { if ($mode !== 'no_footer') {
require(PAGE_FOOTER); require PAGE_FOOTER;
} }
} }
@ -2223,7 +2223,7 @@ function caching_output($enabled, $mode, $cache_var_name, $ttl = 300)
function clean_title($str, $replace_underscore = false) function clean_title($str, $replace_underscore = false)
{ {
$str = ($replace_underscore) ? str_replace('_', ' ', $str) : $str; $str = $replace_underscore ? str_replace('_', ' ', $str) : $str;
$str = htmlCHR(str_compact($str)); $str = htmlCHR(str_compact($str));
return $str; return $str;
} }
@ -2233,7 +2233,7 @@ function clean_text_match($text, $ltrim_star = true, $die_if_empty = false)
global $bb_cfg, $lang; global $bb_cfg, $lang;
$text = str_compact($text); $text = str_compact($text);
$ltrim_chars = ($ltrim_star) ? ' *-!' : ' '; $ltrim_chars = $ltrim_star ? ' *-!' : ' ';
$wrap_with_quotes = preg_match('#^"[^"]+"$#', $text); $wrap_with_quotes = preg_match('#^"[^"]+"$#', $text);
$text = ' ' . str_compact(ltrim($text, $ltrim_chars)) . ' '; $text = ' ' . str_compact(ltrim($text, $ltrim_chars)) . ' ';
@ -2300,7 +2300,7 @@ function get_title_match_topics($title_match_sql, array $forum_ids = array())
if ($bb_cfg['search_engine_type'] == 'sphinx') { if ($bb_cfg['search_engine_type'] == 'sphinx') {
$sphinx = init_sphinx(); $sphinx = init_sphinx();
$where = ($title_match) ? 'topics' : 'posts'; $where = $title_match ? 'topics' : 'posts';
$sphinx->setServer($bb_cfg['sphinx_topic_titles_host'], $bb_cfg['sphinx_topic_titles_port']); $sphinx->setServer($bb_cfg['sphinx_topic_titles_host'], $bb_cfg['sphinx_topic_titles_port']);
if ($forum_ids) { if ($forum_ids) {
@ -2324,7 +2324,7 @@ function get_title_match_topics($title_match_sql, array $forum_ids = array())
} }
} elseif ($bb_cfg['search_engine_type'] == 'mysql') { } elseif ($bb_cfg['search_engine_type'] == 'mysql') {
$where_forum = ($forum_ids) ? "AND forum_id IN(" . implode(',', $forum_ids) . ")" : ''; $where_forum = ($forum_ids) ? "AND forum_id IN(" . implode(',', $forum_ids) . ")" : '';
$search_bool_mode = ($bb_cfg['allow_search_in_bool_mode']) ? ' IN BOOLEAN MODE' : ''; $search_bool_mode = $bb_cfg['allow_search_in_bool_mode'] ? ' IN BOOLEAN MODE' : '';
if ($title_match) { if ($title_match) {
$where_id = 'topic_id'; $where_id = 'topic_id';
@ -2362,7 +2362,7 @@ function decode_text_match($txt)
function pad_with_space($str) function pad_with_space($str)
{ {
return ($str) ? " $str " : $str; return $str ? " $str " : $str;
} }
function create_magnet($infohash, $auth_key, $logged_in) function create_magnet($infohash, $auth_key, $logged_in)
@ -2378,9 +2378,9 @@ function set_die_append_msg($forum_id = null, $topic_id = null, $group_id = null
global $lang, $template; global $lang, $template;
$msg = ''; $msg = '';
$msg .= ($topic_id) ? '<p class="mrg_10"><a href="' . TOPIC_URL . $topic_id . '">' . $lang['TOPIC_RETURN'] . '</a></p>' : ''; $msg .= $topic_id ? '<p class="mrg_10"><a href="' . TOPIC_URL . $topic_id . '">' . $lang['TOPIC_RETURN'] . '</a></p>' : '';
$msg .= ($forum_id) ? '<p class="mrg_10"><a href="' . FORUM_URL . $forum_id . '">' . $lang['FORUM_RETURN'] . '</a></p>' : ''; $msg .= $forum_id ? '<p class="mrg_10"><a href="' . FORUM_URL . $forum_id . '">' . $lang['FORUM_RETURN'] . '</a></p>' : '';
$msg .= ($group_id) ? '<p class="mrg_10"><a href="' . GROUP_URL . $group_id . '">' . $lang['GROUP_RETURN'] . '</a></p>' : ''; $msg .= $group_id ? '<p class="mrg_10"><a href="' . GROUP_URL . $group_id . '">' . $lang['GROUP_RETURN'] . '</a></p>' : '';
$msg .= '<p class="mrg_10"><a href="index.php">' . $lang['INDEX_RETURN'] . '</a></p>'; $msg .= '<p class="mrg_10"><a href="index.php">' . $lang['INDEX_RETURN'] . '</a></p>';
$template->assign_var('BB_DIE_APPEND_MSG', $msg); $template->assign_var('BB_DIE_APPEND_MSG', $msg);
} }

View file

@ -254,7 +254,7 @@ function topic_delete($mode_or_topic_id, $forum_id = null, $prune_time = 0, $pru
"); ");
DB()->add_shutdown_query("DROP TEMPORARY TABLE IF EXISTS $tmp_delete_topics"); DB()->add_shutdown_query("DROP TEMPORARY TABLE IF EXISTS $tmp_delete_topics");
$where_sql = ($prune) ? "forum_id = $forum_id" : "topic_id IN($topic_csv)"; $where_sql = $prune ? "forum_id = $forum_id" : "topic_id IN($topic_csv)";
$where_sql .= ($prune && $prune_time) ? " AND topic_last_post_time < $prune_time" : ''; $where_sql .= ($prune && $prune_time) ? " AND topic_last_post_time < $prune_time" : '';
$where_sql .= ($prune && !$prune_all) ? " AND topic_type NOT IN(" . POST_ANNOUNCE . "," . POST_STICKY . ")" : ''; $where_sql .= ($prune && !$prune_all) ? " AND topic_type NOT IN(" . POST_ANNOUNCE . "," . POST_STICKY . ")" : '';

View file

@ -38,7 +38,7 @@ function run_jobs($jobs)
while ($row = DB()->sql_fetchrow($result)) { while ($row = DB()->sql_fetchrow($result)) {
$job = $row['cron_script']; $job = $row['cron_script'];
$job_script = INC_DIR . '/cron/jobs/' . $job; $job_script = INC_DIR . '/cron/jobs/' . $job;
require($job_script); require $job_script;
} }
DB()->query(" DB()->query("
UPDATE " . BB_CRON . " SET UPDATE " . BB_CRON . " SET

View file

@ -76,12 +76,12 @@ function set_tpl_vars_bool($default_cfg, $cfg)
foreach ($default_cfg as $config_name => $config_value) { foreach ($default_cfg as $config_name => $config_value) {
// YES/NO 'checked="checked"' // YES/NO 'checked="checked"'
$template->assign_vars(array( $template->assign_vars(array(
strtoupper($config_name) . '_YES' => ($cfg[$config_name]) ? HTML_CHECKED : '', strtoupper($config_name) . '_YES' => $cfg[$config_name] ? HTML_CHECKED : '',
strtoupper($config_name) . '_NO' => (!$cfg[$config_name]) ? HTML_CHECKED : '', strtoupper($config_name) . '_NO' => (!$cfg[$config_name]) ? HTML_CHECKED : '',
)); ));
// YES/NO lang vars // YES/NO lang vars
$template->assign_vars(array( $template->assign_vars(array(
'L_' . strtoupper($config_name) . '_YES' => ($cfg[$config_name]) ? "<u>$lang[YES]</u>" : $lang['YES'], 'L_' . strtoupper($config_name) . '_YES' => $cfg[$config_name] ? "<u>$lang[YES]</u>" : $lang['YES'],
'L_' . strtoupper($config_name) . '_NO' => (!$cfg[$config_name]) ? "<u>$lang[NO]</u>" : $lang['NO'], 'L_' . strtoupper($config_name) . '_NO' => (!$cfg[$config_name]) ? "<u>$lang[NO]</u>" : $lang['NO'],
)); ));
} }
@ -107,7 +107,7 @@ function update_config_table($table_name, $default_cfg, $cfg, $type)
if ($type == 'str') { if ($type == 'str') {
$config_value = $_POST[$config_name]; $config_value = $_POST[$config_name];
} elseif ($type == 'bool') { } elseif ($type == 'bool') {
$config_value = ($_POST[$config_name]) ? 1 : 0; $config_value = $_POST[$config_name] ? 1 : 0;
} elseif ($type == 'num') { } elseif ($type == 'num') {
$config_value = abs((int)$_POST[$config_name]); $config_value = abs((int)$_POST[$config_name]);
} else { } else {

View file

@ -87,7 +87,7 @@ function submit_post($mode, &$post_data, &$forum_id, &$topic_id, &$post_id, &$to
// Flood control // Flood control
$row = null; $row = null;
$where_sql = (IS_GUEST) ? "p.poster_ip = '" . USER_IP . "'" : "p.poster_id = {$userdata['user_id']}"; $where_sql = IS_GUEST ? "p.poster_ip = '" . USER_IP . "'" : "p.poster_id = {$userdata['user_id']}";
if ($mode == 'newtopic' || $mode == 'reply') { if ($mode == 'newtopic' || $mode == 'reply') {
$sql = "SELECT MAX(p.post_time) AS last_post_time FROM " . BB_POSTS . " p WHERE $where_sql"; $sql = "SELECT MAX(p.post_time) AS last_post_time FROM " . BB_POSTS . " p WHERE $where_sql";
@ -247,7 +247,7 @@ function update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $u
} }
if ($row = DB()->sql_fetchrow($result)) { if ($row = DB()->sql_fetchrow($result)) {
$forum_update_sql .= ($row['last_post_id']) ? ', forum_last_post_id = ' . $row['last_post_id'] : ', forum_last_post_id = 0'; $forum_update_sql .= $row['last_post_id'] ? ', forum_last_post_id = ' . $row['last_post_id'] : ', forum_last_post_id = 0';
} }
} }
} elseif ($post_data['first_post']) { } elseif ($post_data['first_post']) {

View file

@ -53,7 +53,7 @@ function send_page($contents)
return compress_output($contents); return compress_output($contents);
} }
define('UA_GZIP_SUPPORTED', (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false)); define('UA_GZIP_SUPPORTED', isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false);
function compress_output($contents) function compress_output($contents)
{ {
@ -408,7 +408,7 @@ function bb_exit($output = '')
function prn_r($var, $title = '', $print = true) function prn_r($var, $title = '', $print = true)
{ {
$r = '<pre>' . (($title) ? "<b>$title</b>\n\n" : '') . htmlspecialchars(print_r($var, true)) . '</pre>'; $r = '<pre>' . ($title ? "<b>$title</b>\n\n" : '') . htmlspecialchars(print_r($var, true)) . '</pre>';
if ($print) { if ($print) {
echo $r; echo $r;
} }
@ -432,7 +432,7 @@ function prn()
function vdump($var, $title = '') function vdump($var, $title = '')
{ {
echo '<pre>' . (($title) ? "<b>$title</b>\n\n" : ''); echo '<pre>' . ($title ? "<b>$title</b>\n\n" : '');
var_dump($var); var_dump($var);
echo '</pre>'; echo '</pre>';
} }
@ -484,7 +484,7 @@ if (!$bb_cfg['board_startdate']) {
if ((empty($_POST) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !file_exists(CRON_RUNNING) && ($bb_cfg['cron_enabled'] || defined('START_CRON'))) || defined('FORCE_CRON')) { if ((empty($_POST) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !file_exists(CRON_RUNNING) && ($bb_cfg['cron_enabled'] || defined('START_CRON'))) || defined('FORCE_CRON')) {
if (TIMENOW - $bb_cfg['cron_last_check'] > $bb_cfg['cron_check_interval']) { if (TIMENOW - $bb_cfg['cron_last_check'] > $bb_cfg['cron_check_interval']) {
// Update cron_last_check // Update cron_last_check
bb_update_config(array('cron_last_check' => (TIMENOW + 10))); bb_update_config(array('cron_last_check' => TIMENOW + 10));
define('CRON_LOG_ENABLED', true); // global ON/OFF define('CRON_LOG_ENABLED', true); // global ON/OFF
define('CRON_FORCE_LOG', false); // always log regardless of job settings define('CRON_FORCE_LOG', false); // always log regardless of job settings
@ -500,7 +500,7 @@ if ((empty($_POST) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !file_exist
bb_log(date('H:i:s - ') . getmypid() . ' --x- DB-LOCK OBTAINED !!!!!!!!!!!!!!!!!' . LOG_LF, CRON_LOG_DIR . '/cron_check'); bb_log(date('H:i:s - ') . getmypid() . ' --x- DB-LOCK OBTAINED !!!!!!!!!!!!!!!!!' . LOG_LF, CRON_LOG_DIR . '/cron_check');
sleep(2); sleep(2);
require(CRON_DIR . 'cron_init.php'); require CRON_DIR . 'cron_init.php';
DB()->release_lock('cron'); DB()->release_lock('cron');
} }

View file

@ -94,7 +94,7 @@ foreach (DB()->fetch_rowset($sql) as $u) {
$stat[] = "t:<span style=\"color: #1E90FF\">$t</span>"; $stat[] = "t:<span style=\"color: #1E90FF\">$t</span>";
} }
$ulist[$level][] = ($stat) ? "$name<span class=\"ou_stat\" style=\"color: #707070\" title=\"{$u['session_ip']}\"> [<b>" . implode(', ', $stat) . '</b>]</span>' : $name; $ulist[$level][] = $stat ? "$name<span class=\"ou_stat\" style=\"color: #707070\" title=\"{$u['session_ip']}\"> [<b>" . implode(', ', $stat) . '</b>]</span>' : $name;
} else { } else {
$guests_online = $u['ips']; $guests_online = $u['ips'];
$users_cnt['guest'] = $guests_online; $users_cnt['guest'] = $guests_online;

View file

@ -33,7 +33,7 @@ if (!empty($template)) {
$template->assign_vars(array( $template->assign_vars(array(
'SIMPLE_FOOTER' => !empty($gen_simple_header), 'SIMPLE_FOOTER' => !empty($gen_simple_header),
'POWERED' => 'Tracker software by <a target="_blank" href="https://torrentpier.me">TorrentPier</a> &copy; 2005-' . date('Y'), 'POWERED' => 'Tracker software by <a target="_blank" href="https://torrentpier.me">TorrentPier</a> &copy; 2005-' . date('Y'),
'SHOW_ADMIN_LINK' => (IS_ADMIN && !defined('IN_ADMIN')), 'SHOW_ADMIN_LINK' => IS_ADMIN && !defined('IN_ADMIN'),
'ADMIN_LINK_HREF' => "admin/index.php", 'ADMIN_LINK_HREF' => "admin/index.php",
)); ));
@ -50,14 +50,14 @@ if (!$bb_cfg['gzip_compress']) {
if ($show_dbg_info) { if ($show_dbg_info) {
$gen_time = utime() - TIMESTART; $gen_time = utime() - TIMESTART;
$gen_time_txt = sprintf('%.3f', $gen_time); $gen_time_txt = sprintf('%.3f', $gen_time);
$gzip_text = (UA_GZIP_SUPPORTED) ? 'GZIP ' : '<s>GZIP</s> '; $gzip_text = UA_GZIP_SUPPORTED ? 'GZIP ' : '<s>GZIP</s> ';
$gzip_text .= ($bb_cfg['gzip_compress']) ? $lang['ON'] : $lang['OFF']; $gzip_text .= $bb_cfg['gzip_compress'] ? $lang['ON'] : $lang['OFF'];
$stat = '[&nbsp; ' . $lang['EXECUTION_TIME'] . " $gen_time_txt " . $lang['SEC']; $stat = '[&nbsp; ' . $lang['EXECUTION_TIME'] . " $gen_time_txt " . $lang['SEC'];
if (!empty($DBS)) { if (!empty($DBS)) {
$sql_t = $DBS->sql_timetotal; $sql_t = $DBS->sql_timetotal;
$sql_time_txt = ($sql_t) ? sprintf('%.3f ' . $lang['SEC'] . ' (%d%%) &middot; ', $sql_t, round($sql_t * 100 / $gen_time)) : ''; $sql_time_txt = $sql_t ? sprintf('%.3f ' . $lang['SEC'] . ' (%d%%) &middot; ', $sql_t, round($sql_t * 100 / $gen_time)) : '';
$num_q = $DBS->num_queries; $num_q = $DBS->num_queries;
$stat .= " &nbsp;|&nbsp; MySQL: {$sql_time_txt}{$num_q} " . $lang['QUERIES']; $stat .= " &nbsp;|&nbsp; MySQL: {$sql_time_txt}{$num_q} " . $lang['QUERIES'];
} }

View file

@ -46,7 +46,7 @@ if ($logged_in) {
// Online userlist // Online userlist
if (defined('SHOW_ONLINE') && SHOW_ONLINE) { if (defined('SHOW_ONLINE') && SHOW_ONLINE) {
$online_full = !empty($_REQUEST['online_full']); $online_full = !empty($_REQUEST['online_full']);
$online_list = ($online_full) ? 'online_' . $userdata['user_lang'] : 'online_short_' . $userdata['user_lang']; $online_list = $online_full ? 'online_' . $userdata['user_lang'] : 'online_short_' . $userdata['user_lang'];
${$online_list} = array( ${$online_list} = array(
'stat' => '', 'stat' => '',
@ -128,13 +128,13 @@ $template->assign_vars(array(
'CONTENT_ENCODING' => $bb_cfg['lang'][$userdata['user_lang']]['encoding'] ?? 'utf-8', 'CONTENT_ENCODING' => $bb_cfg['lang'][$userdata['user_lang']]['encoding'] ?? 'utf-8',
'IN_ADMIN' => defined('IN_ADMIN'), 'IN_ADMIN' => defined('IN_ADMIN'),
'SHOW_ADS' => (!$logged_in || isset($bb_cfg['show_ads_users'][$user->id]) || (!IS_AM && $user->show_ads)), 'SHOW_ADS' => !$logged_in || isset($bb_cfg['show_ads_users'][$user->id]) || (!IS_AM && $user->show_ads),
'USER_HIDE_CAT' => (BB_SCRIPT == 'index'), 'USER_HIDE_CAT' => BB_SCRIPT == 'index',
'USER_LANG' => $userdata['user_lang'], 'USER_LANG' => $userdata['user_lang'],
'INCLUDE_BBCODE_JS' => !empty($page_cfg['include_bbcode_js']), 'INCLUDE_BBCODE_JS' => !empty($page_cfg['include_bbcode_js']),
'USER_OPTIONS_JS' => (IS_GUEST) ? '{}' : json_encode($user->opt_js), 'USER_OPTIONS_JS' => IS_GUEST ? '{}' : json_encode($user->opt_js),
'USE_TABLESORTER' => !empty($page_cfg['use_tablesorter']), 'USE_TABLESORTER' => !empty($page_cfg['use_tablesorter']),
@ -183,8 +183,8 @@ $template->assign_vars(array(
'U_TERMS' => $bb_cfg['terms_and_conditions_url'], 'U_TERMS' => $bb_cfg['terms_and_conditions_url'],
'U_TRACKER' => "tracker.php", 'U_TRACKER' => "tracker.php",
'SHOW_SIDEBAR1' => (!empty($page_cfg['show_sidebar1'][BB_SCRIPT]) || $bb_cfg['show_sidebar1_on_every_page']), 'SHOW_SIDEBAR1' => !empty($page_cfg['show_sidebar1'][BB_SCRIPT]) || $bb_cfg['show_sidebar1_on_every_page'],
'SHOW_SIDEBAR2' => (!empty($page_cfg['show_sidebar2'][BB_SCRIPT]) || $bb_cfg['show_sidebar2_on_every_page']), 'SHOW_SIDEBAR2' => !empty($page_cfg['show_sidebar2'][BB_SCRIPT]) || $bb_cfg['show_sidebar2_on_every_page'],
'HTML_AGREEMENT' => LANG_DIR . 'html/user_agreement.html', 'HTML_AGREEMENT' => LANG_DIR . 'html/user_agreement.html',
'HTML_COPYRIGHT' => LANG_DIR . 'html/copyright_holders.html', 'HTML_COPYRIGHT' => LANG_DIR . 'html/copyright_holders.html',
@ -264,7 +264,7 @@ if ($user->show_ads) {
} }
// Login box // Login box
$in_out = ($logged_in) ? 'in' : 'out'; $in_out = $logged_in ? 'in' : 'out';
$template->assign_block_vars("switch_user_logged_{$in_out}", array()); $template->assign_block_vars("switch_user_logged_{$in_out}", array());
if (!IS_GUEST) { if (!IS_GUEST) {

View file

@ -81,7 +81,7 @@ if ($tpl_data) {
if ($edit_tpl_mode) { if ($edit_tpl_mode) {
$template->assign_vars(array( $template->assign_vars(array(
'NO_TPL_ASSIGNED' => !($f_data['forum_tpl_id']), 'NO_TPL_ASSIGNED' => !$f_data['forum_tpl_id'],
'TPL_SELECT' => get_select('forum_tpl', $f_data['forum_tpl_id']), 'TPL_SELECT' => get_select('forum_tpl', $f_data['forum_tpl_id']),
)); ));

View file

@ -199,13 +199,13 @@ class user_common
$this->session_create($userdata, true); $this->session_create($userdata, true);
} }
define('IS_GUEST', (!$this->data['session_logged_in'])); define('IS_GUEST', !$this->data['session_logged_in']);
define('IS_ADMIN', (!IS_GUEST && $this->data['user_level'] == ADMIN)); define('IS_ADMIN', !IS_GUEST && $this->data['user_level'] == ADMIN);
define('IS_MOD', (!IS_GUEST && $this->data['user_level'] == MOD)); define('IS_MOD', !IS_GUEST && $this->data['user_level'] == MOD);
define('IS_GROUP_MEMBER', (!IS_GUEST && $this->data['user_level'] == GROUP_MEMBER)); define('IS_GROUP_MEMBER', !IS_GUEST && $this->data['user_level'] == GROUP_MEMBER);
define('IS_USER', (!IS_GUEST && $this->data['user_level'] == USER)); define('IS_USER', !IS_GUEST && $this->data['user_level'] == USER);
define('IS_SUPER_ADMIN', (IS_ADMIN && isset($bb_cfg['super_admins'][$this->data['user_id']]))); define('IS_SUPER_ADMIN', IS_ADMIN && isset($bb_cfg['super_admins'][$this->data['user_id']]));
define('IS_AM', (IS_ADMIN || IS_MOD)); define('IS_AM', IS_ADMIN || IS_MOD);
$this->set_shortcuts(); $this->set_shortcuts();
@ -242,7 +242,7 @@ class user_common
preg_match('#(..)(..)(..)(..)#', USER_IP, $ip); preg_match('#(..)(..)(..)(..)#', USER_IP, $ip);
$where_sql = "ban_ip IN('" . USER_IP . "', '$ip[1]$ip[2]$ip[3]ff', '$ip[1]$ip[2]ffff', '$ip[1]ffffff')"; $where_sql = "ban_ip IN('" . USER_IP . "', '$ip[1]$ip[2]$ip[3]ff', '$ip[1]$ip[2]ffff', '$ip[1]ffffff')";
$where_sql .= ($login) ? " OR ban_userid = $user_id" : ''; $where_sql .= $login ? " OR ban_userid = $user_id" : '';
$sql = "SELECT ban_id FROM " . BB_BANLIST . " WHERE $where_sql LIMIT 1"; $sql = "SELECT ban_id FROM " . BB_BANLIST . " WHERE $where_sql LIMIT 1";
@ -281,7 +281,7 @@ class user_common
$last_visit = TIMENOW; $last_visit = TIMENOW;
define('FIRST_LOGON', true); define('FIRST_LOGON', true);
} elseif ($session_time < (TIMENOW - $bb_cfg['last_visit_update_intrv'])) { } elseif ($session_time < (TIMENOW - $bb_cfg['last_visit_update_intrv'])) {
$last_visit = max($session_time, (TIMENOW - 86400 * $bb_cfg['max_last_visit_days'])); $last_visit = max($session_time, TIMENOW - 86400 * $bb_cfg['max_last_visit_days']);
} }
if ($last_visit != $this->data['user_lastvisit']) { if ($last_visit != $this->data['user_lastvisit']) {
@ -476,7 +476,7 @@ class user_common
} }
} else { } else {
$c_sdata_resv = !empty($_COOKIE[COOKIE_DATA]) ? $_COOKIE[COOKIE_DATA] : null; $c_sdata_resv = !empty($_COOKIE[COOKIE_DATA]) ? $_COOKIE[COOKIE_DATA] : null;
$c_sdata_curr = ($this->sessiondata) ? serialize($this->sessiondata) : ''; $c_sdata_curr = $this->sessiondata ? serialize($this->sessiondata) : '';
if ($c_sdata_curr !== $c_sdata_resv) { if ($c_sdata_curr !== $c_sdata_resv) {
bb_setcookie(COOKIE_DATA, $c_sdata_curr, COOKIE_PERSIST, true); bb_setcookie(COOKIE_DATA, $c_sdata_curr, COOKIE_PERSIST, true);
@ -523,7 +523,7 @@ class user_common
*/ */
public function create_autologin_id($userdata, $create_new = true) public function create_autologin_id($userdata, $create_new = true)
{ {
$autologin_id = ($create_new) ? make_rand_str(LOGIN_KEY_LENGTH) : ''; $autologin_id = $create_new ? make_rand_str(LOGIN_KEY_LENGTH) : '';
DB()->query(" DB()->query("
UPDATE " . BB_USERS . " SET UPDATE " . BB_USERS . " SET

View file

@ -95,7 +95,7 @@ function smtpmail($mail_to, $subject, $message, $headers = '')
} }
// Ok we have error checked as much as we can to this point let's get on it already // Ok we have error checked as much as we can to this point let's get on it already
$ssl = ($bb_cfg['smtp_ssl']) ? 'ssl://' : ''; $ssl = $bb_cfg['smtp_ssl'] ? 'ssl://' : '';
if (!$socket = @fsockopen($ssl . $bb_cfg['smtp_host'], $bb_cfg['smtp_port'], $errno, $errstr, 20)) { if (!$socket = @fsockopen($ssl . $bb_cfg['smtp_host'], $bb_cfg['smtp_port'], $errno, $errstr, 20)) {
bb_die('Could not connect to smtp host : ' . $errno . ' : ' . $errstr); bb_die('Could not connect to smtp host : ' . $errno . ' : ' . $errstr);
} }

View file

@ -273,7 +273,7 @@ class template
$V =& $this->vars; $V =& $this->vars;
if ($filename) { if ($filename) {
include($filename); include $filename;
} else { } else {
eval($code); eval($code);
} }

View file

@ -45,7 +45,7 @@ $show_dl_buttons = ($dl_topic && $bb_cfg['bt_show_dl_list_buttons']);
// link to clear DL-List // link to clear DL-List
$template->assign_vars(array('S_DL_DELETE' => false)); $template->assign_vars(array('S_DL_DELETE' => false));
if (($is_auth['auth_mod']) && ($t_data['topic_dl_type'] == TOPIC_DL_TYPE_DL)) { if ($is_auth['auth_mod'] && ($t_data['topic_dl_type'] == TOPIC_DL_TYPE_DL)) {
$s_dl_delete = "<br /><a href=\"dl_list.php?mode=dl_delete&amp;" . POST_TOPIC_URL . "=$topic_id&amp;sid=" . $userdata['session_id'] . '">' . $lang['DL_LIST_DEL'] . '</a>'; $s_dl_delete = "<br /><a href=\"dl_list.php?mode=dl_delete&amp;" . POST_TOPIC_URL . "=$topic_id&amp;sid=" . $userdata['session_id'] . '">' . $lang['DL_LIST_DEL'] . '</a>';
$template->assign_vars(array('S_DL_DELETE' => $s_dl_delete)); $template->assign_vars(array('S_DL_DELETE' => $s_dl_delete));
} }

View file

@ -97,7 +97,7 @@ if ($row = DB()->fetch_row($sql)) {
'USERNAME' => profile_url($row), 'USERNAME' => profile_url($row),
'S_HIDDEN_FIELDS' => '', 'S_HIDDEN_FIELDS' => '',
'S_POST_ACTION' => "profile.php?mode=email&amp;" . POST_USERS_URL . "=$user_id", 'S_POST_ACTION' => "profile.php?mode=email&amp;" . POST_USERS_URL . "=$user_id",
'ERROR_MESSAGE' => ($errors) ? implode('<br />', array_unique($errors)) : '', 'ERROR_MESSAGE' => $errors ? implode('<br />', array_unique($errors)) : '',
)); ));
print_page('usercp_email.tpl'); print_page('usercp_email.tpl');

View file

@ -120,7 +120,7 @@ switch ($mode) {
// field => can_edit // field => can_edit
$profile_fields = array( $profile_fields = array(
'user_active' => IS_ADMIN, 'user_active' => IS_ADMIN,
'username' => (IS_ADMIN || $bb_cfg['allow_namechange']), 'username' => IS_ADMIN || $bb_cfg['allow_namechange'],
'user_password' => true, 'user_password' => true,
'user_email' => true, // должен быть после user_password 'user_email' => true, // должен быть после user_password
'user_lang' => true, 'user_lang' => true,
@ -351,19 +351,19 @@ foreach ($profile_fields as $field => $can_edit) {
$update_user_opt = array( $update_user_opt = array(
# 'user_opt_name' => ($reg_mode) ? #reg_value : #in_login_change # 'user_opt_name' => ($reg_mode) ? #reg_value : #in_login_change
'user_viewemail' => ($reg_mode) ? false : true, 'user_viewemail' => $reg_mode ? false : true,
'user_viewonline' => ($reg_mode) ? false : true, 'user_viewonline' => $reg_mode ? false : true,
'user_notify' => ($reg_mode) ? true : true, 'user_notify' => $reg_mode ? true : true,
'user_notify_pm' => ($reg_mode) ? true : true, 'user_notify_pm' => $reg_mode ? true : true,
'user_porn_forums' => ($reg_mode) ? false : true, 'user_porn_forums' => $reg_mode ? false : true,
'user_dls' => ($reg_mode) ? false : true, 'user_dls' => $reg_mode ? false : true,
'user_callseed' => ($reg_mode) ? true : true, 'user_callseed' => $reg_mode ? true : true,
'user_retracker' => ($reg_mode) ? true : true, 'user_retracker' => $reg_mode ? true : true,
); );
foreach ($update_user_opt as $opt => $can_change_opt) { foreach ($update_user_opt as $opt => $can_change_opt) {
if ($submit && (isset($_POST[$opt]) && $can_change_opt || $reg_mode)) { if ($submit && (isset($_POST[$opt]) && $can_change_opt || $reg_mode)) {
$change_opt = ($reg_mode) ? $can_change_opt : !empty($_POST[$opt]); $change_opt = $reg_mode ? $can_change_opt : !empty($_POST[$opt]);
setbit($user_opt, $bf['user_opt'][$opt], $change_opt); setbit($user_opt, $bf['user_opt'][$opt], $change_opt);
} }
$tp_data[strtoupper($opt)] = bf($user_opt, 'user_opt', $opt); $tp_data[strtoupper($opt)] = bf($user_opt, 'user_opt', $opt);
@ -678,19 +678,19 @@ $template->assign_vars($tp_data);
$template->assign_vars(array( $template->assign_vars(array(
'PAGE_TITLE' => ($mode == 'editprofile') ? $lang['EDIT_PROFILE'] . ($adm_edit ? " :: {$pr_data['username']}" : '') : $lang['REGISTER'], 'PAGE_TITLE' => ($mode == 'editprofile') ? $lang['EDIT_PROFILE'] . ($adm_edit ? " :: {$pr_data['username']}" : '') : $lang['REGISTER'],
'SHOW_REG_AGREEMENT' => ($mode == 'register' && !IS_ADMIN), 'SHOW_REG_AGREEMENT' => $mode == 'register' && !IS_ADMIN,
'ERROR_MESSAGE' => ($errors) ? implode('<br />', array_unique($errors)) : '', 'ERROR_MESSAGE' => $errors ? implode('<br />', array_unique($errors)) : '',
'MODE' => $mode, 'MODE' => $mode,
'EDIT_PROFILE' => ($mode == 'editprofile'), 'EDIT_PROFILE' => $mode == 'editprofile',
'ADM_EDIT' => $adm_edit, 'ADM_EDIT' => $adm_edit,
'SHOW_PASS' => ($adm_edit || ($mode == 'register' && IS_ADMIN)), 'SHOW_PASS' => $adm_edit || ($mode == 'register' && IS_ADMIN),
'CAPTCHA_HTML' => ($need_captcha) ? bb_captcha('get') : '', 'CAPTCHA_HTML' => $need_captcha ? bb_captcha('get') : '',
'LANGUAGE_SELECT' => language_select($pr_data['user_lang'], 'user_lang'), 'LANGUAGE_SELECT' => language_select($pr_data['user_lang'], 'user_lang'),
'TIMEZONE_SELECT' => tz_select($pr_data['user_timezone'], 'user_timezone'), 'TIMEZONE_SELECT' => tz_select($pr_data['user_timezone'], 'user_timezone'),
'USER_TIMEZONE' => $pr_data['user_timezone'], 'USER_TIMEZONE' => $pr_data['user_timezone'],
'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], $bb_cfg['avatars']['max_width'], $bb_cfg['avatars']['max_height'], (round($bb_cfg['avatars']['max_size'] / 1024))), 'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], $bb_cfg['avatars']['max_width'], $bb_cfg['avatars']['max_height'], round($bb_cfg['avatars']['max_size'] / 1024)),
'AVATAR_DISALLOWED' => bf($pr_data['user_opt'], 'user_opt', 'dis_avatar'), 'AVATAR_DISALLOWED' => bf($pr_data['user_opt'], 'user_opt', 'dis_avatar'),
'AVATAR_DIS_EXPLAIN' => sprintf($lang['AVATAR_DISABLE'], $bb_cfg['terms_and_conditions_url']), 'AVATAR_DIS_EXPLAIN' => sprintf($lang['AVATAR_DISABLE'], $bb_cfg['terms_and_conditions_url']),
'AVATAR_IMG' => get_avatar($pr_data['user_id'], $pr_data['avatar_ext_id'], !bf($pr_data['user_opt'], 'user_opt', 'dis_avatar')), 'AVATAR_IMG' => get_avatar($pr_data['user_id'], $pr_data['avatar_ext_id'], !bf($pr_data['user_opt'], 'user_opt', 'dis_avatar')),

View file

@ -94,7 +94,7 @@ if (isset($_POST['submit'])) {
$template->assign_vars(array( $template->assign_vars(array(
'USERNAME' => $username, 'USERNAME' => $username,
'EMAIL' => $email, 'EMAIL' => $email,
'CAPTCHA_HTML' => ($need_captcha) ? bb_captcha('get') : '', 'CAPTCHA_HTML' => $need_captcha ? bb_captcha('get') : '',
'S_HIDDEN_FIELDS' => '', 'S_HIDDEN_FIELDS' => '',
'S_PROFILE_ACTION' => "profile.php?mode=sendpassword", 'S_PROFILE_ACTION' => "profile.php?mode=sendpassword",
)); ));

View file

@ -53,7 +53,7 @@ if (!($result = DB()->sql_query($sql))) {
bb_die('Could not obtain watch topic information #2'); bb_die('Could not obtain watch topic information #2');
} }
$row = DB()->sql_fetchrow($result); $row = DB()->sql_fetchrow($result);
$watch_count = ($row['watch_count']) ?: 0; $watch_count = $row['watch_count'] ?: 0;
DB()->sql_freeresult($result); DB()->sql_freeresult($result);
if ($watch_count > 0) { if ($watch_count > 0) {
@ -99,7 +99,7 @@ if ($watch_count > 0) {
$template->assign_vars(array( $template->assign_vars(array(
'MATCHES' => (count($watch) == 1) ? sprintf($lang['FOUND_SEARCH_MATCH'], count($watch)) : sprintf($lang['FOUND_SEARCH_MATCHES'], count($watch)), 'MATCHES' => (count($watch) == 1) ? sprintf($lang['FOUND_SEARCH_MATCH'], count($watch)) : sprintf($lang['FOUND_SEARCH_MATCHES'], count($watch)),
'PAGINATION' => generate_pagination(BB_ROOT . 'profile.php?mode=watch', $watch_count, $per_page, $start), 'PAGINATION' => generate_pagination(BB_ROOT . 'profile.php?mode=watch', $watch_count, $per_page, $start),
'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], (floor($start / $per_page) + 1), ceil($watch_count / $per_page)), 'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], floor($start / $per_page) + 1, ceil($watch_count / $per_page)),
'U_PER_PAGE' => BB_ROOT . 'profile.php?mode=watch', 'U_PER_PAGE' => BB_ROOT . 'profile.php?mode=watch',
'PER_PAGE' => $per_page, 'PER_PAGE' => $per_page,
)); ));

View file

@ -51,7 +51,7 @@ if (!$ranks = $datastore->get('ranks')) {
$poster_rank = $rank_image = $rank_style = $rank_select = ''; $poster_rank = $rank_image = $rank_style = $rank_select = '';
if ($user_rank = $profiledata['user_rank'] and isset($ranks[$user_rank])) { if ($user_rank = $profiledata['user_rank'] and isset($ranks[$user_rank])) {
$rank_image = ($ranks[$user_rank]['rank_image']) ? '<img src="' . $ranks[$user_rank]['rank_image'] . '" alt="" title="" border="0" />' : ''; $rank_image = $ranks[$user_rank]['rank_image'] ? '<img src="' . $ranks[$user_rank]['rank_image'] . '" alt="" title="" border="0" />' : '';
$poster_rank = $ranks[$user_rank]['rank_title']; $poster_rank = $ranks[$user_rank]['rank_title'];
$rank_style = $ranks[$user_rank]['rank_style']; $rank_style = $ranks[$user_rank]['rank_style'];
} }
@ -64,7 +64,7 @@ if (IS_ADMIN) {
} }
if (bf($profiledata['user_opt'], 'user_opt', 'user_viewemail') || $profiledata['user_id'] == $userdata['user_id'] || IS_AM) { if (bf($profiledata['user_opt'], 'user_opt', 'user_viewemail') || $profiledata['user_id'] == $userdata['user_id'] || IS_AM) {
$email_uri = ($bb_cfg['board_email_form']) ? 'profile.php?mode=email&amp;' . POST_USERS_URL . '=' . $profiledata['user_id'] : 'mailto:' . $profiledata['user_email']; $email_uri = $bb_cfg['board_email_form'] ? 'profile.php?mode=email&amp;' . POST_USERS_URL . '=' . $profiledata['user_id'] : 'mailto:' . $profiledata['user_email'];
$email = '<a class="editable" href="' . $email_uri . '">' . $profiledata['user_email'] . '</a>'; $email = '<a class="editable" href="' . $email_uri . '">' . $profiledata['user_email'] . '</a>';
} else { } else {
$email = ''; $email = '';
@ -94,7 +94,7 @@ $template->assign_vars(array(
'PROFILE_USER_ID' => $profiledata['user_id'], 'PROFILE_USER_ID' => $profiledata['user_id'],
'PROFILE_USER' => $profile_user_id, 'PROFILE_USER' => $profile_user_id,
'USER_REGDATE' => bb_date($profiledata['user_regdate'], 'Y-m-d H:i', false), 'USER_REGDATE' => bb_date($profiledata['user_regdate'], 'Y-m-d H:i', false),
'POSTER_RANK' => ($poster_rank) ? "<span class=\"$rank_style\">" . $poster_rank . "</span>" : $lang['USER'], 'POSTER_RANK' => $poster_rank ? "<span class=\"$rank_style\">" . $poster_rank . "</span>" : $lang['USER'],
'RANK_IMAGE' => $rank_image, 'RANK_IMAGE' => $rank_image,
'RANK_SELECT' => $rank_select, 'RANK_SELECT' => $rank_select,
'POSTS' => $profiledata['user_posts'], 'POSTS' => $profiledata['user_posts'],
@ -102,8 +102,8 @@ $template->assign_vars(array(
'EMAIL' => $email, 'EMAIL' => $email,
'WWW' => $profiledata['user_website'], 'WWW' => $profiledata['user_website'],
'ICQ' => $profiledata['user_icq'], 'ICQ' => $profiledata['user_icq'],
'LAST_VISIT_TIME' => ($profiledata['user_lastvisit']) ? (bf($profiledata['user_opt'], 'user_opt', 'user_viewonline') && !IS_ADMIN) ? $lang['HIDDEN_USER'] : bb_date($profiledata['user_lastvisit'], 'Y-m-d H:i', false) : $lang['NEVER'], 'LAST_VISIT_TIME' => $profiledata['user_lastvisit'] ? (bf($profiledata['user_opt'], 'user_opt', 'user_viewonline') && !IS_ADMIN) ? $lang['HIDDEN_USER'] : bb_date($profiledata['user_lastvisit'], 'Y-m-d H:i', false) : $lang['NEVER'],
'LAST_ACTIVITY_TIME' => ($profiledata['user_session_time']) ? (bf($profiledata['user_opt'], 'user_opt', 'user_viewonline') && !IS_ADMIN) ? $lang['HIDDEN_USER'] : bb_date($profiledata['user_session_time'], 'Y-m-d H:i', false) : $lang['NEVER'], 'LAST_ACTIVITY_TIME' => $profiledata['user_session_time'] ? (bf($profiledata['user_opt'], 'user_opt', 'user_viewonline') && !IS_ADMIN) ? $lang['HIDDEN_USER'] : bb_date($profiledata['user_session_time'], 'Y-m-d H:i', false) : $lang['NEVER'],
'USER_ACTIVE' => $profiledata['user_active'], 'USER_ACTIVE' => $profiledata['user_active'],
'LOCATION' => $profiledata['user_from'], 'LOCATION' => $profiledata['user_from'],
@ -112,7 +112,7 @@ $template->assign_vars(array(
'SKYPE' => $profiledata['user_skype'], 'SKYPE' => $profiledata['user_skype'],
'TWITTER' => $profiledata['user_twitter'], 'TWITTER' => $profiledata['user_twitter'],
'USER_POINTS' => $profiledata['user_points'], 'USER_POINTS' => $profiledata['user_points'],
'GENDER' => ($bb_cfg['gender']) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '', 'GENDER' => $bb_cfg['gender'] ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '',
'BIRTHDAY' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? $profiledata['user_birthday'] : '', 'BIRTHDAY' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? $profiledata['user_birthday'] : '',
'AGE' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? birthday_age($profiledata['user_birthday']) : '', 'AGE' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? birthday_age($profiledata['user_birthday']) : '',
@ -126,8 +126,8 @@ $template->assign_vars(array(
'AVATAR_IMG' => get_avatar($profiledata['user_id'], $profiledata['avatar_ext_id'], !bf($profiledata['user_opt'], 'user_opt', 'dis_avatar')), 'AVATAR_IMG' => get_avatar($profiledata['user_id'], $profiledata['avatar_ext_id'], !bf($profiledata['user_opt'], 'user_opt', 'dis_avatar')),
'SIGNATURE' => $signature, 'SIGNATURE' => $signature,
'SHOW_PASSKEY' => (IS_ADMIN || $profile_user_id), 'SHOW_PASSKEY' => IS_ADMIN || $profile_user_id,
'SHOW_ROLE' => (IS_AM || $profile_user_id || $profiledata['user_active']), 'SHOW_ROLE' => IS_AM || $profile_user_id || $profiledata['user_active'],
'GROUP_MEMBERSHIP' => false, 'GROUP_MEMBERSHIP' => false,
'TRAF_STATS' => !(IS_AM || $profile_user_id), 'TRAF_STATS' => !(IS_AM || $profile_user_id),
)); ));
@ -170,7 +170,7 @@ if (IS_ADMIN) {
)); ));
} elseif (IS_MOD) { } elseif (IS_MOD) {
$template->assign_vars(array( $template->assign_vars(array(
'SHOW_GROUP_MEMBERSHIP' => ($profiledata['user_level'] != USER), 'SHOW_GROUP_MEMBERSHIP' => $profiledata['user_level'] != USER,
)); ));
} }

View file

@ -32,7 +32,7 @@ $releasing_count = $seeding_count = $leeching_count = 0;
// Auth // Auth
$excluded_forums_csv = $user->get_excluded_forums(AUTH_VIEW); $excluded_forums_csv = $user->get_excluded_forums(AUTH_VIEW);
$not_auth_forums_sql = ($excluded_forums_csv) ? " $not_auth_forums_sql = $excluded_forums_csv ? "
AND f.forum_id NOT IN($excluded_forums_csv) AND f.forum_id NOT IN($excluded_forums_csv)
AND f.forum_parent NOT IN($excluded_forums_csv) AND f.forum_parent NOT IN($excluded_forums_csv)
" : ''; " : '';
@ -70,13 +70,13 @@ if ($releasing) {
$template->assign_block_vars('released', array( $template->assign_block_vars('released', array(
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2', 'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
'FORUM_NAME' => htmlCHR($row['forum_name']), 'FORUM_NAME' => htmlCHR($row['forum_name']),
'TOPIC_TITLE' => ($row['update_time']) ? $topic_title : "<s>$topic_title</s>", 'TOPIC_TITLE' => $row['update_time'] ? $topic_title : "<s>$topic_title</s>",
'U_VIEW_FORUM' => FORUM_URL . $row['forum_id'], 'U_VIEW_FORUM' => FORUM_URL . $row['forum_id'],
'U_VIEW_TOPIC' => TOPIC_URL . $row['topic_id'], 'U_VIEW_TOPIC' => TOPIC_URL . $row['topic_id'],
'TOR_TYPE' => is_gold($row['tor_type']), 'TOR_TYPE' => is_gold($row['tor_type']),
'TOPIC_SEEDERS' => ($row['seeders']) ?: 0, 'TOPIC_SEEDERS' => $row['seeders'] ?: 0,
'TOPIC_LEECHERS' => ($row['leechers']) ?: 0, 'TOPIC_LEECHERS' => $row['leechers'] ?: 0,
'SPEED_UP' => ($row['speed_up']) ? humn_size($row['speed_up'], 0, 'KB') . '/s' : '-', 'SPEED_UP' => $row['speed_up'] ? humn_size($row['speed_up'], 0, 'KB') . '/s' : '-',
)); ));
$releasing_count++; $releasing_count++;
@ -90,13 +90,13 @@ if ($seeding) {
$template->assign_block_vars('seed', array( $template->assign_block_vars('seed', array(
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2', 'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
'FORUM_NAME' => htmlCHR($row['forum_name']), 'FORUM_NAME' => htmlCHR($row['forum_name']),
'TOPIC_TITLE' => ($row['update_time']) ? $topic_title : "<s>$topic_title</s>", 'TOPIC_TITLE' => $row['update_time'] ? $topic_title : "<s>$topic_title</s>",
'U_VIEW_FORUM' => FORUM_URL . $row['forum_id'], 'U_VIEW_FORUM' => FORUM_URL . $row['forum_id'],
'U_VIEW_TOPIC' => TOPIC_URL . $row['topic_id'], 'U_VIEW_TOPIC' => TOPIC_URL . $row['topic_id'],
'TOR_TYPE' => is_gold($row['tor_type']), 'TOR_TYPE' => is_gold($row['tor_type']),
'TOPIC_SEEDERS' => ($row['seeders']) ?: 0, 'TOPIC_SEEDERS' => $row['seeders'] ?: 0,
'TOPIC_LEECHERS' => ($row['leechers']) ?: 0, 'TOPIC_LEECHERS' => $row['leechers'] ?: 0,
'SPEED_UP' => ($row['speed_up']) ? humn_size($row['speed_up'], 0, 'KB') . '/s' : '-', 'SPEED_UP' => $row['speed_up'] ? humn_size($row['speed_up'], 0, 'KB') . '/s' : '-',
)); ));
$seeding_count++; $seeding_count++;
@ -106,20 +106,20 @@ if ($seeding) {
if ($leeching) { if ($leeching) {
foreach ($leeching as $i => $row) { foreach ($leeching as $i => $row) {
$compl_size = ($row['remain'] && $row['size'] && $row['size'] > $row['remain']) ? ($row['size'] - $row['remain']) : 0; $compl_size = ($row['remain'] && $row['size'] && $row['size'] > $row['remain']) ? ($row['size'] - $row['remain']) : 0;
$compl_perc = ($compl_size) ? floor($compl_size * 100 / $row['size']) : 0; $compl_perc = $compl_size ? floor($compl_size * 100 / $row['size']) : 0;
$topic_title = wbr($row['topic_title']); $topic_title = wbr($row['topic_title']);
$template->assign_block_vars('leech', array( $template->assign_block_vars('leech', array(
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2', 'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
'FORUM_NAME' => htmlCHR($row['forum_name']), 'FORUM_NAME' => htmlCHR($row['forum_name']),
'TOPIC_TITLE' => ($row['update_time']) ? $topic_title : "<s>$topic_title</s>", 'TOPIC_TITLE' => $row['update_time'] ? $topic_title : "<s>$topic_title</s>",
'U_VIEW_FORUM' => FORUM_URL . $row['forum_id'], 'U_VIEW_FORUM' => FORUM_URL . $row['forum_id'],
'U_VIEW_TOPIC' => TOPIC_URL . $row['topic_id'], 'U_VIEW_TOPIC' => TOPIC_URL . $row['topic_id'],
'COMPL_PERC' => $compl_perc, 'COMPL_PERC' => $compl_perc,
'TOR_TYPE' => is_gold($row['tor_type']), 'TOR_TYPE' => is_gold($row['tor_type']),
'TOPIC_SEEDERS' => ($row['seeders']) ?: 0, 'TOPIC_SEEDERS' => $row['seeders'] ?: 0,
'TOPIC_LEECHERS' => ($row['leechers']) ?: 0, 'TOPIC_LEECHERS' => $row['leechers'] ?: 0,
'SPEED_DOWN' => ($row['speed_down']) ? humn_size($row['speed_down'], 0, 'KB') . '/s' : '-', 'SPEED_DOWN' => $row['speed_down'] ? humn_size($row['speed_down'], 0, 'KB') . '/s' : '-',
)); ));
$leeching_count++; $leeching_count++;
@ -129,8 +129,8 @@ if ($leeching) {
$template->assign_vars(array( $template->assign_vars(array(
'SHOW_SEARCH_DL' => IS_AM || $profile_user_id, 'SHOW_SEARCH_DL' => IS_AM || $profile_user_id,
'USERNAME' => $profiledata['username'], 'USERNAME' => $profiledata['username'],
'L_RELEASINGS' => "{$lang['RELEASING']}: " . (($releasing_count) ? "<b>$releasing_count</b>" : '0'), 'L_RELEASINGS' => "{$lang['RELEASING']}: " . ($releasing_count ? "<b>$releasing_count</b>" : '0'),
'L_SEEDINGS' => "{$lang['SEEDING']}: " . (($seeding_count) ? "<b>$seeding_count</b>" : '0'), 'L_SEEDINGS' => "{$lang['SEEDING']}: " . ($seeding_count ? "<b>$seeding_count</b>" : '0'),
'L_LEECHINGS' => "{$lang['LEECHING']}: " . (($leeching_count) ? "<b>$leeching_count</b>" : '0'), 'L_LEECHINGS' => "{$lang['LEECHING']}: " . ($leeching_count ? "<b>$leeching_count</b>" : '0'),
'USER_DLS' => $releasing_count || $seeding_count || $leeching_count, 'USER_DLS' => $releasing_count || $seeding_count || $leeching_count,
)); ));

View file

@ -73,7 +73,7 @@ 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'] : ($_POST['login_username'] ?? ''); $login_username = $mod_admin_login ? $userdata['username'] : ($_POST['login_username'] ?? '');
$login_password = $_POST['login_password'] ?? ''; $login_password = $_POST['login_password'] ?? '';
// Проверка на неверную комбинацию логин/пароль // Проверка на неверную комбинацию логин/пароль
@ -103,7 +103,7 @@ if (isset($_POST['login'])) {
if (!$login_errors) { if (!$login_errors) {
if ($user->login($_POST, $mod_admin_login)) { if ($user->login($_POST, $mod_admin_login)) {
$redirect_url = (defined('FIRST_LOGON')) ? $bb_cfg['first_logon_redirect_url'] : $redirect_url; $redirect_url = defined('FIRST_LOGON') ? $bb_cfg['first_logon_redirect_url'] : $redirect_url;
// Обнуление при введении правильно комбинации логин/пароль // Обнуление при введении правильно комбинации логин/пароль
CACHE('bb_login_err')->set('l_err_' . USER_IP, 0, 3600); CACHE('bb_login_err')->set('l_err_' . USER_IP, 0, 3600);
@ -123,7 +123,7 @@ if (isset($_POST['login'])) {
if ($login_err > 50) { if ($login_err > 50) {
// TODO temp ban ip // TODO temp ban ip
} }
CACHE('bb_login_err')->set('l_err_' . USER_IP, ($login_err + 1), 3600); CACHE('bb_login_err')->set('l_err_' . USER_IP, $login_err + 1, 3600);
} else { } else {
$need_captcha = false; $need_captcha = false;
} }

View file

@ -152,9 +152,9 @@ for ($i = 224, $cnt = 255; $i <= $cnt; $i++) {
} }
$select_letter .= ':&nbsp;'; $select_letter .= ':&nbsp;';
$select_letter .= ($by_letter == 'others') ? '<b>' . $lang['OTHERS'] . '</b>&nbsp;' : '<a class="genmed" href="' . ("memberlist.php?letter=others&amp;mode=$mode&amp;order=$sort_order") . '">' . $lang['OTHERS'] . '</a>&nbsp;'; $select_letter .= ($by_letter == 'others') ? '<b>' . $lang['OTHERS'] . '</b>&nbsp;' : '<a class="genmed" href="' . "memberlist.php?letter=others&amp;mode=$mode&amp;order=$sort_order" . '">' . $lang['OTHERS'] . '</a>&nbsp;';
$select_letter .= ':&nbsp;'; $select_letter .= ':&nbsp;';
$select_letter .= ($by_letter == 'all') ? '<b>' . $lang['ALL'] . '</b>' : '<a class="genmed" href="' . ("memberlist.php?letter=all&amp;mode=$mode&amp;order=$sort_order") . '">' . $lang['ALL'] . '</a>'; $select_letter .= ($by_letter == 'all') ? '<b>' . $lang['ALL'] . '</b>' : '<a class="genmed" href="' . "memberlist.php?letter=all&amp;mode=$mode&amp;order=$sort_order" . '">' . $lang['ALL'] . '</a>';
$template->assign_vars(array( $template->assign_vars(array(
'S_LETTER_SELECT' => $select_letter, 'S_LETTER_SELECT' => $select_letter,
@ -167,7 +167,7 @@ if ($username) {
$username = preg_replace('/\*/', '%', clean_username($username)); $username = preg_replace('/\*/', '%', clean_username($username));
$letter_sql = "username LIKE '" . DB()->escape($username) . "'"; $letter_sql = "username LIKE '" . DB()->escape($username) . "'";
} }
$sql .= ($letter_sql) ? " AND $letter_sql" : ''; $sql .= $letter_sql ? " AND $letter_sql" : '';
$sql .= " ORDER BY $order_by"; $sql .= " ORDER BY $order_by";
if ($result = DB()->fetch_rowset($sql)) { if ($result = DB()->fetch_rowset($sql)) {
@ -176,17 +176,17 @@ if ($result = DB()->fetch_rowset($sql)) {
$from = $row['user_from']; $from = $row['user_from'];
$joined = bb_date($row['user_regdate'], $bb_cfg['date_format']); $joined = bb_date($row['user_regdate'], $bb_cfg['date_format']);
$posts = $row['user_posts']; $posts = $row['user_posts'];
$pm = ($bb_cfg['text_buttons']) ? '<a class="txtb" href="' . (PM_URL . "?mode=post&amp;" . POST_USERS_URL . "=$user_id") . '">' . $lang['SEND_PM_TXTB'] . '</a>' : '<a href="' . (PM_URL . "?mode=post&amp;" . POST_USERS_URL . "=$user_id") . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['SEND_PRIVATE_MESSAGE'] . '" title="' . $lang['SEND_PRIVATE_MESSAGE'] . '" border="0" /></a>'; $pm = $bb_cfg['text_buttons'] ? '<a class="txtb" href="' . (PM_URL . "?mode=post&amp;" . POST_USERS_URL . "=$user_id") . '">' . $lang['SEND_PM_TXTB'] . '</a>' : '<a href="' . (PM_URL . "?mode=post&amp;" . POST_USERS_URL . "=$user_id") . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['SEND_PRIVATE_MESSAGE'] . '" title="' . $lang['SEND_PRIVATE_MESSAGE'] . '" border="0" /></a>';
if (bf($row['user_opt'], 'user_opt', 'user_viewemail') || IS_ADMIN) { if (bf($row['user_opt'], 'user_opt', 'user_viewemail') || IS_ADMIN) {
$email_uri = ($bb_cfg['board_email_form']) ? ("profile.php?mode=email&amp;" . POST_USERS_URL . "=$user_id") : 'mailto:' . $row['user_email']; $email_uri = $bb_cfg['board_email_form'] ? ("profile.php?mode=email&amp;" . POST_USERS_URL . "=$user_id") : 'mailto:' . $row['user_email'];
$email = '<a class="editable" href="' . $email_uri . '">' . $row['user_email'] . '</a>'; $email = '<a class="editable" href="' . $email_uri . '">' . $row['user_email'] . '</a>';
} else { } else {
$email = ''; $email = '';
} }
if ($row['user_website']) { if ($row['user_website']) {
$www = ($bb_cfg['text_buttons']) ? '<a class="txtb" href="' . $row['user_website'] . '" target="_userwww">' . $lang['VISIT_WEBSITE_TXTB'] . '</a>' : '<a class="txtb" href="' . $row['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['VISIT_WEBSITE'] . '" title="' . $lang['VISIT_WEBSITE'] . '" border="0" /></a>'; $www = $bb_cfg['text_buttons'] ? '<a class="txtb" href="' . $row['user_website'] . '" target="_userwww">' . $lang['VISIT_WEBSITE_TXTB'] . '</a>' : '<a class="txtb" href="' . $row['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['VISIT_WEBSITE'] . '" title="' . $lang['VISIT_WEBSITE'] . '" border="0" /></a>';
} else { } else {
$www = ''; $www = '';
} }
@ -218,7 +218,7 @@ if ($paginationusername) {
} }
if ($mode != 'topten' || $bb_cfg['topics_per_page'] < 10) { if ($mode != 'topten' || $bb_cfg['topics_per_page'] < 10) {
$sql = "SELECT COUNT(*) AS total FROM " . BB_USERS; $sql = "SELECT COUNT(*) AS total FROM " . BB_USERS;
$sql .= ($letter_sql) ? " WHERE $letter_sql" : " WHERE user_id NOT IN(". EXCLUDED_USERS_CSV .")"; $sql .= $letter_sql ? " WHERE $letter_sql" : " WHERE user_id NOT IN(". EXCLUDED_USERS_CSV .")";
if (!$result = DB()->sql_query($sql)) { if (!$result = DB()->sql_query($sql)) {
bb_die('Error getting total users'); bb_die('Error getting total users');
} }

View file

@ -156,14 +156,14 @@ if (isset($_POST['cancel']) || IS_GUEST) {
$redirect = 'index.php'; $redirect = 'index.php';
if ($topic_id || $forum_id) { if ($topic_id || $forum_id) {
$redirect = ($topic_id) ? TOPIC_URL . $topic_id : FORUM_URL . $forum_id; $redirect = $topic_id ? TOPIC_URL . $topic_id : FORUM_URL . $forum_id;
} }
redirect($redirect); redirect($redirect);
} }
// Start auth check // Start auth check
$is_auth = auth(AUTH_ALL, $forum_id, $userdata); $is_auth = auth(AUTH_ALL, $forum_id, $userdata);
$is_moderator = (IS_AM); $is_moderator = IS_AM;
if ($mode == 'ip') { if ($mode == 'ip') {
// Moderator can view IP in all forums // Moderator can view IP in all forums
@ -254,7 +254,7 @@ switch ($mode) {
$datastore->update('network_news'); $datastore->update('network_news');
} }
$msg = ($result) ? $lang['TOPICS_REMOVED'] : $lang['NO_TOPICS_REMOVED']; $msg = $result ? $lang['TOPICS_REMOVED'] : $lang['NO_TOPICS_REMOVED'];
bb_die(return_msg_mcp($msg)); bb_die(return_msg_mcp($msg));
} else { } else {
print_confirmation(array( print_confirmation(array(
@ -285,7 +285,7 @@ switch ($mode) {
$datastore->update('network_news'); $datastore->update('network_news');
} }
$msg = ($result) ? $lang['TOPICS_MOVED'] : $lang['NO_TOPICS_MOVED']; $msg = $result ? $lang['TOPICS_MOVED'] : $lang['NO_TOPICS_MOVED'];
bb_die(return_msg_mcp($msg)); bb_die(return_msg_mcp($msg));
} else { } else {
if (IS_ADMIN) { if (IS_ADMIN) {
@ -318,7 +318,7 @@ switch ($mode) {
case 'lock': case 'lock':
case 'unlock': case 'unlock':
$lock = ($mode == 'lock'); $lock = ($mode == 'lock');
$new_topic_status = ($lock) ? TOPIC_LOCKED : TOPIC_UNLOCKED; $new_topic_status = $lock ? TOPIC_LOCKED : TOPIC_UNLOCKED;
$sql = " $sql = "
SELECT topic_id, topic_title SELECT topic_id, topic_title
@ -347,7 +347,7 @@ switch ($mode) {
"); ");
// Log action // Log action
$type = ($lock) ? 'mod_topic_lock' : 'mod_topic_unlock'; $type = $lock ? 'mod_topic_lock' : 'mod_topic_unlock';
foreach ($log_topics as $topic_id => $topic_title) { foreach ($log_topics as $topic_id => $topic_title) {
$log_action->mod($type, array( $log_action->mod($type, array(
@ -357,7 +357,7 @@ switch ($mode) {
)); ));
} }
$msg = ($lock) ? $lang['TOPICS_LOCKED'] : $lang['TOPICS_UNLOCKED']; $msg = $lock ? $lang['TOPICS_LOCKED'] : $lang['TOPICS_UNLOCKED'];
bb_die(return_msg_mcp($msg)); bb_die(return_msg_mcp($msg));
break; break;
@ -366,7 +366,7 @@ switch ($mode) {
case 'set_download': case 'set_download':
case 'unset_download': case 'unset_download':
$set_download = ($mode == 'set_download'); $set_download = ($mode == 'set_download');
$new_dl_type = ($set_download) ? TOPIC_DL_TYPE_DL : TOPIC_DL_TYPE_NORMAL; $new_dl_type = $set_download ? TOPIC_DL_TYPE_DL : TOPIC_DL_TYPE_NORMAL;
DB()->query(" DB()->query("
UPDATE " . BB_TOPICS . " SET UPDATE " . BB_TOPICS . " SET
@ -380,7 +380,7 @@ switch ($mode) {
clear_dl_list($topic_csv); clear_dl_list($topic_csv);
} }
$msg = ($set_download) ? $lang['TOPICS_DOWN_SETS'] : $lang['TOPICS_DOWN_UNSETS']; $msg = $set_download ? $lang['TOPICS_DOWN_SETS'] : $lang['TOPICS_DOWN_UNSETS'];
bb_die(return_msg_mcp($msg)); bb_die(return_msg_mcp($msg));
break; break;
@ -468,7 +468,7 @@ switch ($mode) {
$sql = "INSERT INTO " . BB_TOPICS . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_first_post_id) $sql = "INSERT INTO " . BB_TOPICS . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_first_post_id)
VALUES ('" . DB()->escape($post_subject) . "', $first_poster, " . $topic_time . ", $new_forum_id, " . TOPIC_UNLOCKED . ", " . POST_NORMAL . ", $first_post_id)"; VALUES ('" . DB()->escape($post_subject) . "', $first_poster, " . $topic_time . ", $new_forum_id, " . TOPIC_UNLOCKED . ", " . POST_NORMAL . ", $first_post_id)";
if (!(DB()->sql_query($sql))) { if (!DB()->sql_query($sql)) {
bb_die('Could not insert new topic'); bb_die('Could not insert new topic');
} }
@ -526,7 +526,7 @@ switch ($mode) {
// Delete posts // Delete posts
$result = post_delete(explode(',', $post_id_sql)); $result = post_delete(explode(',', $post_id_sql));
$msg = ($result) ? $lang['DELETE_POSTS_SUCCESFULLY'] : 'No posts were removed'; $msg = $result ? $lang['DELETE_POSTS_SUCCESFULLY'] : 'No posts were removed';
bb_die(return_msg_mcp($msg)); bb_die(return_msg_mcp($msg));
} else { } else {
$sql = "SELECT u.username, p.*, pt.post_text, p.post_username $sql = "SELECT u.username, p.*, pt.post_text, p.post_username
@ -574,7 +574,7 @@ switch ($mode) {
'POSTER_NAME' => wbr($poster), 'POSTER_NAME' => wbr($poster),
'POST_DATE' => $post_date, 'POST_DATE' => $post_date,
'MESSAGE' => $message, 'MESSAGE' => $message,
'CHECKBOX' => (defined('BEGIN_CHECKBOX')) ? true : false, 'CHECKBOX' => defined('BEGIN_CHECKBOX') ? true : false,
'POST_ID' => $post_id, 'POST_ID' => $post_id,
'ROW_ID' => $i, 'ROW_ID' => $i,
'CB_ID' => 'cb_' . $i, 'CB_ID' => 'cb_' . $i,
@ -694,7 +694,7 @@ switch ($mode) {
case 'post_pin': case 'post_pin':
case 'post_unpin': case 'post_unpin':
$pin = ($mode == 'post_pin'); $pin = ($mode == 'post_pin');
$new_topic_status = ($pin) ? 1 : 0; $new_topic_status = $pin ? 1 : 0;
if (count($topic_csv)) { if (count($topic_csv)) {
$sql = " $sql = "
@ -723,7 +723,7 @@ switch ($mode) {
WHERE topic_id IN($topic_csv) WHERE topic_id IN($topic_csv)
"); ");
$msg = ($pin) ? $lang['POST_PINNED'] : $lang['POST_UNPINNED']; $msg = $pin ? $lang['POST_PINNED'] : $lang['POST_UNPINNED'];
bb_die(return_msg_mcp($msg)); bb_die(return_msg_mcp($msg));
} elseif ($topic_id) { } elseif ($topic_id) {
$sql = " $sql = "
@ -753,7 +753,7 @@ switch ($mode) {
WHERE topic_id IN($topic_csv) WHERE topic_id IN($topic_csv)
"); ");
$msg = ($pin) ? $lang['POST_PINNED'] : $lang['POST_UNPINNED']; $msg = $pin ? $lang['POST_PINNED'] : $lang['POST_UNPINNED'];
bb_die(return_msg_mcp($msg)); bb_die(return_msg_mcp($msg));
} }
break; break;
@ -765,8 +765,8 @@ switch ($mode) {
$template->assign_vars(array('PAGE_TITLE' => $lang['MOD_CP'])); $template->assign_vars(array('PAGE_TITLE' => $lang['MOD_CP']));
require(PAGE_HEADER); require PAGE_HEADER;
$template->pparse('body'); $template->pparse('body');
require(PAGE_FOOTER); require PAGE_FOOTER;

View file

@ -187,7 +187,7 @@ if ($post_info = DB()->fetch_row($sql)) {
$post_data['poster_id'] = $post_info['poster_id']; $post_data['poster_id'] = $post_info['poster_id'];
$selected_rg = $post_info['poster_rg_id']; $selected_rg = $post_info['poster_rg_id'];
$switch_rg_sig = ($post_info['attach_rg_sig']) ? true : false; $switch_rg_sig = $post_info['attach_rg_sig'] ? true : false;
// Can this user edit/delete the post? // Can this user edit/delete the post?
if ($post_info['poster_id'] != $userdata['user_id'] && !$is_auth['auth_mod']) { if ($post_info['poster_id'] != $userdata['user_id'] && !$is_auth['auth_mod']) {
@ -465,13 +465,13 @@ if ($refresh || $error_msg || ($submit && $topic_has_new_posts)) {
} else { } else {
// User default entry point // User default entry point
if ($mode == 'newtopic') { if ($mode == 'newtopic') {
$username = ($userdata['session_logged_in']) ? $userdata['username'] : ''; $username = $userdata['session_logged_in'] ? $userdata['username'] : '';
$subject = $message = ''; $subject = $message = '';
} elseif ($mode == 'reply') { } elseif ($mode == 'reply') {
$username = ($userdata['session_logged_in']) ? $userdata['username'] : ''; $username = $userdata['session_logged_in'] ? $userdata['username'] : '';
$subject = $message = ''; $subject = $message = '';
} elseif ($mode == 'quote' || $mode == 'editpost') { } elseif ($mode == 'quote' || $mode == 'editpost') {
$subject = ($post_data['first_post']) ? $post_info['topic_title'] : ''; $subject = $post_data['first_post'] ? $post_info['topic_title'] : '';
$message = $post_info['post_text']; $message = $post_info['post_text'];
if ($mode == 'quote') { if ($mode == 'quote') {
@ -569,7 +569,7 @@ if ($post_info['allow_reg_tracker'] && $post_data['first_post'] && ($topic_dl_ty
$dl_ds = $dl_ch = $dl_hid = ''; $dl_ds = $dl_ch = $dl_hid = '';
$dl_type_name = 'topic_dl_type'; $dl_type_name = 'topic_dl_type';
$dl_type_val = ($topic_dl_type) ? 1 : 0; $dl_type_val = $topic_dl_type ? 1 : 0;
if (!$post_info['allow_reg_tracker'] && !$is_auth['auth_mod']) { if (!$post_info['allow_reg_tracker'] && !$is_auth['auth_mod']) {
$dl_ds = ' disabled="disabled" '; $dl_ds = ' disabled="disabled" ';
@ -638,16 +638,16 @@ $template->assign_vars(array(
'U_VIEW_FORUM' => "viewforum.php?" . POST_FORUM_URL . "=$forum_id", 'U_VIEW_FORUM' => "viewforum.php?" . POST_FORUM_URL . "=$forum_id",
'USERNAME' => @$username, 'USERNAME' => @$username,
'CAPTCHA_HTML' => (IS_GUEST) ? bb_captcha('get') : '', 'CAPTCHA_HTML' => IS_GUEST ? bb_captcha('get') : '',
'SUBJECT' => $subject, 'SUBJECT' => $subject,
'MESSAGE' => $message, 'MESSAGE' => $message,
'POSTER_RGROUPS' => isset($poster_rgroups) && !empty($poster_rgroups) ? $poster_rgroups : '', 'POSTER_RGROUPS' => isset($poster_rgroups) && !empty($poster_rgroups) ? $poster_rgroups : '',
'ATTACH_RG_SIG' => ($switch_rg_sig) ?: false, 'ATTACH_RG_SIG' => $switch_rg_sig ?: false,
'U_VIEWTOPIC' => ($mode == 'reply') ? "viewtopic.php?" . POST_TOPIC_URL . "=$topic_id&amp;postorder=desc" : '', 'U_VIEWTOPIC' => ($mode == 'reply') ? "viewtopic.php?" . POST_TOPIC_URL . "=$topic_id&amp;postorder=desc" : '',
'S_NOTIFY_CHECKED' => ($notify_user) ? 'checked="checked"' : '', 'S_NOTIFY_CHECKED' => $notify_user ? 'checked="checked"' : '',
'S_TYPE_TOGGLE' => $topic_type_toggle, 'S_TYPE_TOGGLE' => $topic_type_toggle,
'S_TOPIC_ID' => $topic_id, 'S_TOPIC_ID' => $topic_id,
'S_POST_ACTION' => POSTING_URL, 'S_POST_ACTION' => POSTING_URL,
@ -661,8 +661,8 @@ if ($mode == 'newtopic' || $post_data['first_post']) {
// Update post time // Update post time
if ($mode == 'editpost' && $post_data['last_post'] && !$post_data['first_post']) { if ($mode == 'editpost' && $post_data['last_post'] && !$post_data['first_post']) {
$template->assign_vars(array( $template->assign_vars(array(
'SHOW_UPDATE_POST_TIME' => ($is_auth['auth_mod'] || ($post_data['poster_post'] && $post_info['post_time'] + 3600 * 3 > TIMENOW)), 'SHOW_UPDATE_POST_TIME' => $is_auth['auth_mod'] || ($post_data['poster_post'] && $post_info['post_time'] + 3600 * 3 > TIMENOW),
'UPDATE_POST_TIME_CHECKED' => ($post_data['poster_post'] && ($post_info['post_time'] + 3600 * 2 > TIMENOW)), 'UPDATE_POST_TIME_CHECKED' => $post_data['poster_post'] && ($post_info['post_time'] + 3600 * 2 > TIMENOW),
)); ));
} }
@ -671,8 +671,8 @@ if ($mode == 'reply' && $is_auth['auth_read']) {
topic_review($topic_id); topic_review($topic_id);
} }
require(PAGE_HEADER); require PAGE_HEADER;
$template->pparse('body'); $template->pparse('body');
require(PAGE_FOOTER); require PAGE_FOOTER;

View file

@ -50,14 +50,14 @@ if ($bb_cfg['privmsg_disable']) {
// //
//$submit = ( isset($_POST['post']) ) ? TRUE : 0; //$submit = ( isset($_POST['post']) ) ? TRUE : 0;
$submit = (bool)request_var('post', false); //test it! $submit = (bool)request_var('post', false); //test it!
$submit_search = (isset($_POST['usersubmit'])) ? true : 0; $submit_search = isset($_POST['usersubmit']) ? true : 0;
$submit_msgdays = (isset($_POST['submit_msgdays'])) ? true : 0; $submit_msgdays = isset($_POST['submit_msgdays']) ? true : 0;
$cancel = (isset($_POST['cancel'])) ? true : 0; $cancel = isset($_POST['cancel']) ? true : 0;
$preview = (isset($_POST['preview'])) ? true : 0; $preview = isset($_POST['preview']) ? true : 0;
$confirmed = (isset($_POST['confirm'])) ? true : 0; $confirmed = isset($_POST['confirm']) ? true : 0;
$delete = (isset($_POST['delete'])) ? true : 0; $delete = isset($_POST['delete']) ? true : 0;
$delete_all = (isset($_POST['deleteall'])) ? true : 0; $delete_all = isset($_POST['deleteall']) ? true : 0;
$save = (isset($_POST['save'])) ? true : 0; $save = isset($_POST['save']) ? true : 0;
$mode = isset($_REQUEST['mode']) ? (string)$_REQUEST['mode'] : ''; $mode = isset($_REQUEST['mode']) ? (string)$_REQUEST['mode'] : '';
$refresh = $preview || $submit_search; $refresh = $preview || $submit_search;
@ -87,7 +87,7 @@ if (IS_AM) {
$template->assign_vars(array( $template->assign_vars(array(
'IN_PM' => true, 'IN_PM' => true,
'QUICK_REPLY' => ($bb_cfg['show_quick_reply'] && $folder == 'inbox' && $mode == 'read'), 'QUICK_REPLY' => $bb_cfg['show_quick_reply'] && $folder == 'inbox' && $mode == 'read',
)); ));
// //
@ -103,7 +103,7 @@ if ($cancel) {
$start = isset($_REQUEST['start']) ? abs((int)$_REQUEST['start']) : 0; $start = isset($_REQUEST['start']) ? abs((int)$_REQUEST['start']) : 0;
if (isset($_POST[POST_POST_URL]) || isset($_GET[POST_POST_URL])) { if (isset($_POST[POST_POST_URL]) || isset($_GET[POST_POST_URL])) {
$privmsg_id = (isset($_POST[POST_POST_URL])) ? (int)$_POST[POST_POST_URL] : (int)$_GET[POST_POST_URL]; $privmsg_id = isset($_POST[POST_POST_URL]) ? (int)$_POST[POST_POST_URL] : (int)$_GET[POST_POST_URL];
} else { } else {
$privmsg_id = ''; $privmsg_id = '';
} }
@ -957,10 +957,10 @@ if ($mode == 'read') {
// passed to the script, process it a little, do some checks // passed to the script, process it a little, do some checks
// where neccessary, etc. // where neccessary, etc.
// //
$to_username = (isset($_POST['username'])) ? clean_username($_POST['username']) : ''; $to_username = isset($_POST['username']) ? clean_username($_POST['username']) : '';
$privmsg_subject = (isset($_POST['subject'])) ? clean_title($_POST['subject']) : ''; $privmsg_subject = isset($_POST['subject']) ? clean_title($_POST['subject']) : '';
$privmsg_message = (isset($_POST['message'])) ? prepare_message($_POST['message']) : ''; $privmsg_message = isset($_POST['message']) ? prepare_message($_POST['message']) : '';
// //
// Do mode specific things // Do mode specific things
@ -1063,7 +1063,7 @@ if ($mode == 'read') {
// Has admin prevented user from sending PM's? // Has admin prevented user from sending PM's?
// //
if (bf($userdata['user_opt'], 'user_opt', 'dis_pm') && $mode != 'edit') { if (bf($userdata['user_opt'], 'user_opt', 'dis_pm') && $mode != 'edit') {
$message = ($lang['CANNOT_SEND_PRIVMSG']); $message = $lang['CANNOT_SEND_PRIVMSG'];
} }
// //
@ -1352,7 +1352,7 @@ if ($mode == 'read') {
if ($max_pm) { if ($max_pm) {
$box_limit_percent = min(round(($pm_all_total / $max_pm) * 100), 100); $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) * $bb_cfg['privmsg_graphic_length']), $bb_cfg['privmsg_graphic_length']);
$box_limit_remain = max(($max_pm - $pm_all_total), 0); $box_limit_remain = max($max_pm - $pm_all_total, 0);
$template->assign_var('PM_BOX_SIZE_INFO'); $template->assign_var('PM_BOX_SIZE_INFO');
@ -1389,7 +1389,7 @@ if ($mode == 'read') {
'INBOX_LIMIT_IMG_WIDTH' => max(4, $box_limit_img_length), 'INBOX_LIMIT_IMG_WIDTH' => max(4, $box_limit_img_length),
'INBOX_LIMIT_PERCENT' => $box_limit_percent, 'INBOX_LIMIT_PERCENT' => $box_limit_percent,
'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'], 'L_FROM_OR_TO' => ($folder == 'inbox' || $folder == 'savebox') ? $lang['FROM'] : $lang['TO'],
@ -1464,11 +1464,11 @@ if ($mode == 'read') {
$template->assign_vars(array('PAGE_TITLE' => @$page_title)); $template->assign_vars(array('PAGE_TITLE' => @$page_title));
require(PAGE_HEADER); require PAGE_HEADER;
$template->pparse('body'); $template->pparse('body');
require(PAGE_FOOTER); require PAGE_FOOTER;
// //
// Functions // Functions

View file

@ -108,7 +108,7 @@ $url = basename(__FILE__);
$anon_id = GUEST_UID; $anon_id = GUEST_UID;
$user_id = $userdata['user_id']; $user_id = $userdata['user_id'];
$lastvisit = (IS_GUEST) ? TIMENOW : $userdata['user_lastvisit']; $lastvisit = IS_GUEST ? TIMENOW : $userdata['user_lastvisit'];
$search_id = (isset($_GET['id']) && verify_id($_GET['id'], SEARCH_ID_LENGTH)) ? $_GET['id'] : ''; $search_id = (isset($_GET['id']) && verify_id($_GET['id'], SEARCH_ID_LENGTH)) ? $_GET['id'] : '';
$session_id = $userdata['session_id']; $session_id = $userdata['session_id'];
@ -530,7 +530,7 @@ if ($post_mode) {
bb_die($lang['NO_SEARCH_MATCH']); bb_die($lang['NO_SEARCH_MATCH']);
} }
$where_id = ($title_match) ? 'topic_id' : 'post_id'; $where_id = $title_match ? 'topic_id' : 'post_id';
$SQL['WHERE'][] = "$tbl.$where_id IN($search_match_topics_csv)"; $SQL['WHERE'][] = "$tbl.$where_id IN($search_match_topics_csv)";
prevent_huge_searches($SQL); prevent_huge_searches($SQL);
@ -550,7 +550,7 @@ if ($post_mode) {
} }
// Build SQL for displaying posts // Build SQL for displaying posts
$excluded_forums_sql = ($excluded_forums_csv) ? " AND t.forum_id NOT IN($excluded_forums_csv) " : ''; $excluded_forums_sql = $excluded_forums_csv ? " AND t.forum_id NOT IN($excluded_forums_csv) " : '';
$sql = " $sql = "
SELECT SELECT
@ -611,7 +611,7 @@ if ($post_mode) {
)); ));
$quote_btn = true; $quote_btn = true;
$edit_btn = $delpost_btn = $ip_btn = (IS_AM); $edit_btn = $delpost_btn = $ip_btn = IS_AM;
// Topic posts block // Topic posts block
foreach ($topic_posts as $row_num => $post) { foreach ($topic_posts as $row_num => $post) {
@ -653,7 +653,7 @@ else {
$join_t = ($title_match || $my_topics || $new_topics || $dl_search || $new_posts || in_array($order_val, array($ord_last_p, $ord_created, $ord_name, $ord_repl), true)); $join_t = ($title_match || $my_topics || $new_topics || $dl_search || $new_posts || in_array($order_val, array($ord_last_p, $ord_created, $ord_name, $ord_repl), true));
$join_s = ($text_match_sql && !$title_match); $join_s = ($text_match_sql && !$title_match);
$join_p = ($my_posts || $join_s); $join_p = ($my_posts || $join_s);
$join_dl = ($dl_search); $join_dl = $dl_search;
$tbl = ($join_p && !$join_t) ? 'p' : 't'; $tbl = ($join_p && !$join_t) ? 'p' : 't';
$time_field = ($join_p && !$join_t) ? 'post_time' : 'topic_last_post_time'; $time_field = ($join_p && !$join_t) ? 'post_time' : 'topic_last_post_time';
@ -733,7 +733,7 @@ else {
bb_die($lang['NO_SEARCH_MATCH']); bb_die($lang['NO_SEARCH_MATCH']);
} }
$where_id = ($title_match) ? 't.topic_id' : 'p.post_id'; $where_id = $title_match ? 't.topic_id' : 'p.post_id';
$SQL['WHERE'][] = "$where_id IN($search_match_topics_csv)"; $SQL['WHERE'][] = "$where_id IN($search_match_topics_csv)";
prevent_huge_searches($SQL); prevent_huge_searches($SQL);
@ -819,16 +819,16 @@ else {
'FORUM_ID' => $forum_id, 'FORUM_ID' => $forum_id,
'FORUM_NAME' => $forum_name_html[$forum_id], 'FORUM_NAME' => $forum_name_html[$forum_id],
'TOPIC_ID' => $topic_id, 'TOPIC_ID' => $topic_id,
'HREF_TOPIC_ID' => ($moved) ? $topic['topic_moved_id'] : $topic['topic_id'], 'HREF_TOPIC_ID' => $moved ? $topic['topic_moved_id'] : $topic['topic_id'],
'TOPIC_TITLE' => wbr($topic['topic_title']), 'TOPIC_TITLE' => wbr($topic['topic_title']),
'IS_UNREAD' => $is_unread, 'IS_UNREAD' => $is_unread,
'TOPIC_ICON' => get_topic_icon($topic, $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'], $bb_cfg['posts_per_page']),
'REPLIES' => $topic['topic_replies'], 'REPLIES' => $topic['topic_replies'],
'ATTACH' => $topic['topic_attachment'], 'ATTACH' => $topic['topic_attachment'],
'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), 'DL' => $topic['topic_dl_type'] == TOPIC_DL_TYPE_DL,
'POLL' => $topic['topic_vote'], 'POLL' => $topic['topic_vote'],
'DL_CLASS' => isset($topic['dl_status']) ? $dl_link_css[$topic['dl_status']] : '', 'DL_CLASS' => isset($topic['dl_status']) ? $dl_link_css[$topic['dl_status']] : '',
@ -843,19 +843,19 @@ else {
if ($items_display) { if ($items_display) {
$items_count = count($items_found); $items_count = count($items_found);
$pages = (!$items_count) ? 1 : ceil($items_count / $per_page); $pages = (!$items_count) ? 1 : ceil($items_count / $per_page);
$url = ($search_id) ? url_arg($url, 'id', $search_id) : $url; $url = $search_id ? url_arg($url, 'id', $search_id) : $url;
generate_pagination($url, $items_count, $per_page, $start); generate_pagination($url, $items_count, $per_page, $start);
$template->assign_vars(array( $template->assign_vars(array(
'PAGE_TITLE' => $lang['SEARCH'], 'PAGE_TITLE' => $lang['SEARCH'],
'SEARCH_MATCHES' => ($items_count) ? sprintf($lang['FOUND_SEARCH_MATCHES'], $items_count) : '', 'SEARCH_MATCHES' => $items_count ? sprintf($lang['FOUND_SEARCH_MATCHES'], $items_count) : '',
'DISPLAY_AS_POSTS' => $post_mode, 'DISPLAY_AS_POSTS' => $post_mode,
'DL_CONTROLS' => ($dl_search && $dl_user_id_val == $user_id), 'DL_CONTROLS' => $dl_search && $dl_user_id_val == $user_id,
'DL_ACTION' => 'dl_list.php', 'DL_ACTION' => 'dl_list.php',
'MY_POSTS' => (!$post_mode && $my_posts && $user->id == $poster_id_val), 'MY_POSTS' => !$post_mode && $my_posts && $user->id == $poster_id_val,
)); ));
print_page('search_results.tpl'); print_page('search_results.tpl');

View file

@ -44,7 +44,7 @@ $user->session_start(array('req_login' => $bb_cfg['bt_tor_browse_only_reg']));
set_die_append_msg(); set_die_append_msg();
$tor_search_limit = (IS_AM) ? 2000 : 500; $tor_search_limit = IS_AM ? 2000 : 500;
$forum_select_size = 25; // forum select box max rows $forum_select_size = 25; // forum select box max rows
$max_forum_name_len = 60; // inside forum select box $max_forum_name_len = 60; // inside forum select box
$max_forums_selected = 50; $max_forums_selected = 50;
@ -417,7 +417,7 @@ if (!$set_default) {
} }
} elseif ($search_id && $previous_settings[$poster_id_key]) { } elseif ($search_id && $previous_settings[$poster_id_key]) {
$poster_id_val = (int)$previous_settings[$poster_id_key]; $poster_id_val = (int)$previous_settings[$poster_id_key];
$poster_name_val = ($previous_settings[$poster_name_key]) ?: ''; $poster_name_val = $previous_settings[$poster_name_key] ?: '';
} }
if ($req_poster_id) { if ($req_poster_id) {
@ -723,8 +723,8 @@ if ($allowed_forums) {
$size = $tor['size']; $size = $tor['size'];
$tor_magnet = create_magnet($tor['info_hash'], $passkey['auth_key'], $userdata['session_logged_in']); $tor_magnet = create_magnet($tor['info_hash'], $passkey['auth_key'], $userdata['session_logged_in']);
$compl = $tor['complete_count']; $compl = $tor['complete_count'];
$dl_sp = ($dl) ? humn_size($dl, 0, 'KB') . '/s' : '0 KB/s'; $dl_sp = $dl ? humn_size($dl, 0, 'KB') . '/s' : '0 KB/s';
$ul_sp = ($ul) ? humn_size($ul, 0, 'KB') . '/s' : '0 KB/s'; $ul_sp = $ul ? humn_size($ul, 0, 'KB') . '/s' : '0 KB/s';
$dl_class = isset($tor['dl_status']) ? $dl_link_css[$tor['dl_status']] : 'genmed'; $dl_class = isset($tor['dl_status']) ? $dl_link_css[$tor['dl_status']] : 'genmed';
$row_class = !($row_num & 1) ? $row_class_1 : $row_class_2; $row_class = !($row_num & 1) ? $row_class_1 : $row_class_2;
@ -736,21 +736,21 @@ if ($allowed_forums) {
$template->assign_block_vars('tor', array( $template->assign_block_vars('tor', array(
'CAT_ID' => $cat_id, 'CAT_ID' => $cat_id,
'CAT_TITLE' => ($cat_id) ? $cat_title_html[$cat_id] : '', 'CAT_TITLE' => $cat_id ? $cat_title_html[$cat_id] : '',
'FORUM_ID' => $forum_id, 'FORUM_ID' => $forum_id,
'FORUM_NAME' => ($forum_id) ? $forum_name_html[$forum_id] : '', 'FORUM_NAME' => $forum_id ? $forum_name_html[$forum_id] : '',
'TOPIC_ID' => $tor['topic_id'], 'TOPIC_ID' => $tor['topic_id'],
'TOPIC_TITLE' => wbr($tor['topic_title']), 'TOPIC_TITLE' => wbr($tor['topic_title']),
'TOPIC_TIME' => bb_date($tor['topic_time'], 'd-M-y') . ' <b>&middot;</b> ' . delta_time($tor['topic_time']), 'TOPIC_TIME' => bb_date($tor['topic_time'], 'd-M-y') . ' <b>&middot;</b> ' . delta_time($tor['topic_time']),
'POST_ID' => $tor['post_id'], 'POST_ID' => $tor['post_id'],
'POSTER_ID' => $poster_id, 'POSTER_ID' => $poster_id,
'USERNAME' => ($hide_author) ? '' : profile_url(array('username' => $tor['username'], 'user_rank' => $tor['user_rank'])), 'USERNAME' => $hide_author ? '' : profile_url(array('username' => $tor['username'], 'user_rank' => $tor['user_rank'])),
'ROW_CLASS' => $row_class, 'ROW_CLASS' => $row_class,
'ROW_NUM' => $row_num, 'ROW_NUM' => $row_num,
'DL_CLASS' => $dl_class, 'DL_CLASS' => $dl_class,
'IS_NEW' => (!IS_GUEST && $tor['reg_time'] > $lastvisit), 'IS_NEW' => !IS_GUEST && $tor['reg_time'] > $lastvisit,
'USER_AUTHOR' => (!IS_GUEST && $poster_id == $user_id), 'USER_AUTHOR' => !IS_GUEST && $poster_id == $user_id,
'ATTACH_ID' => $att_id, 'ATTACH_ID' => $att_id,
'MAGNET' => $tor_magnet, 'MAGNET' => $tor_magnet,
@ -764,10 +764,10 @@ if ($allowed_forums) {
'TOR_SIZE' => humn_size($size), 'TOR_SIZE' => humn_size($size),
'UL_SPEED' => $ul_sp, 'UL_SPEED' => $ul_sp,
'DL_SPEED' => $dl_sp, 'DL_SPEED' => $dl_sp,
'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'])), 'SEEDS_TITLE' => $seeds ? $lang['SEEDERS'] : ($lang['SEED_NOT_SEEN'] . ":\n " . ($s_last ? bb_date($s_last, $date_format) : $lang['NEVER'])),
'LEECHS' => ($leechs) ?: 0, 'LEECHS' => $leechs ?: 0,
'COMPLETED' => ($compl) ?: 0, 'COMPLETED' => $compl ?: 0,
'REPLIES' => $tor['topic_replies'], 'REPLIES' => $tor['topic_replies'],
'VIEWS' => $tor['topic_views'], 'VIEWS' => $tor['topic_views'],
'ADDED_RAW' => $tor['reg_time'], 'ADDED_RAW' => $tor['reg_time'],
@ -815,7 +815,7 @@ foreach ($cat_forum['c'] as $cat_id => $forums_ary) {
$class .= isset($cat_forum['forums_with_sf'][$forum_id]) ? ' has_sf' : ''; $class .= isset($cat_forum['forums_with_sf'][$forum_id]) ? ' has_sf' : '';
$style = " class=\"$class\""; $style = " class=\"$class\"";
} }
$selected = (isset($search_in_forums_fary[$forum_id])) ? HTML_SELECTED : ''; $selected = isset($search_in_forums_fary[$forum_id]) ? HTML_SELECTED : '';
$opt .= '<option id="fs-' . $forum_id . '" value="' . $forum_id . '"' . $style . $selected . '>' . (isset($cat_forum['subforums'][$forum_id]) ? HTML_SF_SPACER : '') . $forum_name . "&nbsp;</option>\n"; $opt .= '<option id="fs-' . $forum_id . '" value="' . $forum_id . '"' . $style . $selected . '>' . (isset($cat_forum['subforums'][$forum_id]) ? HTML_SF_SPACER : '') . $forum_name . "&nbsp;</option>\n";
} }

View file

@ -50,11 +50,11 @@ $anon = GUEST_UID;
// Start session // Start session
$user->session_start(); $user->session_start();
$lastvisit = (IS_GUEST) ? TIMENOW : $userdata['user_lastvisit']; $lastvisit = IS_GUEST ? TIMENOW : $userdata['user_lastvisit'];
// Caching output // Caching output
$req_page = "forum_f{$forum_id}"; $req_page = "forum_f{$forum_id}";
$req_page .= ($start) ? "_start{$start}" : ''; $req_page .= $start ? "_start{$start}" : '';
define('REQUESTED_PAGE', $req_page); define('REQUESTED_PAGE', $req_page);
caching_output(IS_GUEST, 'send', REQUESTED_PAGE . '_guest'); caching_output(IS_GUEST, 'send', REQUESTED_PAGE . '_guest');
@ -84,7 +84,7 @@ $moderation = (!empty($_REQUEST['mod']) && $is_auth['auth_mod']);
if (!$is_auth['auth_view']) { if (!$is_auth['auth_view']) {
if (IS_GUEST) { if (IS_GUEST) {
$redirect = ($start) ? "&start=$start" : ''; $redirect = $start ? "&start=$start" : '';
redirect(LOGIN_URL . "?redirect=" . FORUM_URL . $forum_id . $redirect); redirect(LOGIN_URL . "?redirect=" . FORUM_URL . $forum_id . $redirect);
} }
// The user is not authed to read this forum ... // The user is not authed to read this forum ...
@ -135,7 +135,7 @@ if ($mark_read && !IS_GUEST) {
} }
// Subforums // Subforums
$show_subforums = ($bb_cfg['sf_on_first_page_only']) ? !$start : true; $show_subforums = $bb_cfg['sf_on_first_page_only'] ? !$start : true;
if (!$forums = $datastore->get('cat_forums')) { if (!$forums = $datastore->get('cat_forums')) {
$datastore->update('cat_forums'); $datastore->update('cat_forums');
@ -148,7 +148,7 @@ if ($forums['forum'][$forum_id]['allow_porno_topic'] && bf($userdata['user_opt']
if (!$forum_data['forum_parent'] && isset($forums['f'][$forum_id]['subforums']) && $show_subforums) { if (!$forum_data['forum_parent'] && isset($forums['f'][$forum_id]['subforums']) && $show_subforums) {
$not_auth_forums = $user->get_excluded_forums(AUTH_VIEW); $not_auth_forums = $user->get_excluded_forums(AUTH_VIEW);
$ignore_forum_sql = ($not_auth_forums) ? "AND f.forum_id NOT IN($not_auth_forums)" : ''; $ignore_forum_sql = $not_auth_forums ? "AND f.forum_id NOT IN($not_auth_forums)" : '';
$sql = " $sql = "
SELECT SELECT
@ -291,7 +291,7 @@ $order_method = get_forum_display_sort_option($order_value, 'field', 'order');
$order_sql = "ORDER BY t.topic_type DESC, $sort_method $order_method"; $order_sql = "ORDER BY t.topic_type DESC, $sort_method $order_method";
$limit_topics_time_sql = ($topic_days) ? "AND t.topic_last_post_time > " . (TIMENOW - 86400 * $topic_days) : ''; $limit_topics_time_sql = $topic_days ? "AND t.topic_last_post_time > " . (TIMENOW - 86400 * $topic_days) : '';
$select_tor_sql = $join_tor_sql = ''; $select_tor_sql = $join_tor_sql = '';
$join_dl = ($bb_cfg['show_dl_status_in_forum'] && !IS_GUEST); $join_dl = ($bb_cfg['show_dl_status_in_forum'] && !IS_GUEST);
@ -306,14 +306,14 @@ if ($forum_data['allow_reg_tracker']) {
bt.auth_key, tor.info_hash, tor.size AS tor_size, tor.reg_time, tor.complete_count, tor.seeder_last_seen, tor.attach_id, tor.tor_status, tor.tor_type, bt.auth_key, tor.info_hash, tor.size AS tor_size, tor.reg_time, tor.complete_count, tor.seeder_last_seen, tor.attach_id, tor.tor_status, tor.tor_type,
sn.seeders, sn.leechers sn.seeders, sn.leechers
'; ';
$select_tor_sql .= ($join_dl) ? ', dl.user_status AS dl_status' : ''; $select_tor_sql .= $join_dl ? ', dl.user_status AS dl_status' : '';
$join_tor_sql = " $join_tor_sql = "
LEFT JOIN " . BB_BT_TORRENTS . " tor ON(t.topic_id = tor.topic_id) LEFT JOIN " . BB_BT_TORRENTS . " tor ON(t.topic_id = tor.topic_id)
LEFT JOIN " . BB_BT_USERS . " bt ON(bt.user_id = {$userdata['user_id']}) LEFT JOIN " . BB_BT_USERS . " bt ON(bt.user_id = {$userdata['user_id']})
LEFT JOIN " . BB_BT_TRACKER_SNAP . " sn ON(tor.topic_id = sn.topic_id) LEFT JOIN " . BB_BT_TRACKER_SNAP . " sn ON(tor.topic_id = sn.topic_id)
"; ";
$join_tor_sql .= ($join_dl) ? " LEFT JOIN " . BB_BT_DLSTATUS . " dl ON(dl.user_id = {$userdata['user_id']} AND dl.topic_id = t.topic_id)" : ''; $join_tor_sql .= $join_dl ? " LEFT JOIN " . BB_BT_DLSTATUS . " dl ON(dl.user_id = {$userdata['user_id']} AND dl.topic_id = t.topic_id)" : '';
} }
// Title match // Title match
@ -394,14 +394,14 @@ $template->assign_vars(array(
// User authorisation levels output // User authorisation levels output
$u_auth = array(); $u_auth = array();
$u_auth[] = ($is_auth['auth_post']) ? $lang['RULES_POST_CAN'] : $lang['RULES_POST_CANNOT']; $u_auth[] = $is_auth['auth_post'] ? $lang['RULES_POST_CAN'] : $lang['RULES_POST_CANNOT'];
$u_auth[] = ($is_auth['auth_reply']) ? $lang['RULES_REPLY_CAN'] : $lang['RULES_REPLY_CANNOT']; $u_auth[] = $is_auth['auth_reply'] ? $lang['RULES_REPLY_CAN'] : $lang['RULES_REPLY_CANNOT'];
$u_auth[] = ($is_auth['auth_edit']) ? $lang['RULES_EDIT_CAN'] : $lang['RULES_EDIT_CANNOT']; $u_auth[] = $is_auth['auth_edit'] ? $lang['RULES_EDIT_CAN'] : $lang['RULES_EDIT_CANNOT'];
$u_auth[] = ($is_auth['auth_delete']) ? $lang['RULES_DELETE_CAN'] : $lang['RULES_DELETE_CANNOT']; $u_auth[] = $is_auth['auth_delete'] ? $lang['RULES_DELETE_CAN'] : $lang['RULES_DELETE_CANNOT'];
$u_auth[] = ($is_auth['auth_vote']) ? $lang['RULES_VOTE_CAN'] : $lang['RULES_VOTE_CANNOT']; $u_auth[] = $is_auth['auth_vote'] ? $lang['RULES_VOTE_CAN'] : $lang['RULES_VOTE_CANNOT'];
$u_auth[] = ($is_auth['auth_attachments']) ? $lang['RULES_ATTACH_CAN'] : $lang['RULES_ATTACH_CANNOT']; $u_auth[] = $is_auth['auth_attachments'] ? $lang['RULES_ATTACH_CAN'] : $lang['RULES_ATTACH_CANNOT'];
$u_auth[] = ($is_auth['auth_download']) ? $lang['RULES_DOWNLOAD_CAN'] : $lang['RULES_DOWNLOAD_CANNOT']; $u_auth[] = $is_auth['auth_download'] ? $lang['RULES_DOWNLOAD_CAN'] : $lang['RULES_DOWNLOAD_CANNOT'];
$u_auth[] = ($is_auth['auth_mod']) ? $lang['RULES_MODERATE'] : ''; $u_auth[] = $is_auth['auth_mod'] ? $lang['RULES_MODERATE'] : '';
$u_auth = implode("<br />\n", $u_auth); $u_auth = implode("<br />\n", $u_auth);
$template->assign_vars(array( $template->assign_vars(array(
@ -420,11 +420,11 @@ $template->assign_vars(array(
'FOLDER_DOWNLOAD_IMG' => $images['folder_dl'], 'FOLDER_DOWNLOAD_IMG' => $images['folder_dl'],
'SHOW_ONLY_NEW_MENU' => true, 'SHOW_ONLY_NEW_MENU' => true,
'ONLY_NEW_POSTS_ON' => ($only_new == ONLY_NEW_POSTS), 'ONLY_NEW_POSTS_ON' => $only_new == ONLY_NEW_POSTS,
'ONLY_NEW_TOPICS_ON' => ($only_new == ONLY_NEW_TOPICS), 'ONLY_NEW_TOPICS_ON' => $only_new == ONLY_NEW_TOPICS,
'TITLE_MATCH' => htmlCHR($title_match), 'TITLE_MATCH' => htmlCHR($title_match),
'SELECT_TPP' => ($select_tpp) ? build_select('tpp', $select_tpp, $topics_per_page, null, null, 'onchange="$(\'#tpp\').submit();"') : '', 'SELECT_TPP' => $select_tpp ? build_select('tpp', $select_tpp, $topics_per_page, null, null, 'onchange="$(\'#tpp\').submit();"') : '',
'T_POST_NEW_TOPIC' => ($forum_data['forum_status'] == FORUM_LOCKED) ? $lang['FORUM_LOCKED'] : $post_new_topic, 'T_POST_NEW_TOPIC' => ($forum_data['forum_status'] == FORUM_LOCKED) ? $lang['FORUM_LOCKED'] : $post_new_topic,
'S_AUTH_LIST' => $u_auth, 'S_AUTH_LIST' => $u_auth,
'U_VIEW_FORUM' => FORUM_URL . $forum_id, 'U_VIEW_FORUM' => FORUM_URL . $forum_id,
@ -459,15 +459,15 @@ foreach ($topic_rowset as $topic) {
$template->assign_block_vars('t', array( $template->assign_block_vars('t', array(
'FORUM_ID' => $forum_id, 'FORUM_ID' => $forum_id,
'TOPIC_ID' => $topic_id, 'TOPIC_ID' => $topic_id,
'HREF_TOPIC_ID' => ($moved) ? $topic['topic_moved_id'] : $topic['topic_id'], 'HREF_TOPIC_ID' => $moved ? $topic['topic_moved_id'] : $topic['topic_id'],
'TOPIC_TITLE' => wbr($topic['topic_title']), 'TOPIC_TITLE' => wbr($topic['topic_title']),
'TOPICS_SEPARATOR' => $separator, 'TOPICS_SEPARATOR' => $separator,
'IS_UNREAD' => $is_unread, 'IS_UNREAD' => $is_unread,
'TOPIC_ICON' => get_topic_icon($topic, $is_unread), 'TOPIC_ICON' => get_topic_icon($topic, $is_unread),
'PAGINATION' => ($moved) ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $replies, $bb_cfg['posts_per_page']), 'PAGINATION' => $moved ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $replies, $bb_cfg['posts_per_page']),
'REPLIES' => $replies, 'REPLIES' => $replies,
'VIEWS' => $topic['topic_views'], 'VIEWS' => $topic['topic_views'],
'TOR_STALED' => ($forum_data['allow_reg_tracker'] && !($t_type == POST_ANNOUNCE || $t_type == POST_STICKY || $topic['tor_size'])), 'TOR_STALED' => $forum_data['allow_reg_tracker'] && !($t_type == POST_ANNOUNCE || $t_type == POST_STICKY || $topic['tor_size']),
'TOR_FROZEN' => isset($topic['tor_status']) ? ((!IS_AM) ? isset($bb_cfg['tor_frozen'][$topic['tor_status']]) : '') : '', 'TOR_FROZEN' => isset($topic['tor_status']) ? ((!IS_AM) ? isset($bb_cfg['tor_frozen'][$topic['tor_status']]) : '') : '',
'TOR_TYPE' => isset($topic['tor_type']) ? is_gold($topic['tor_type']) : '', 'TOR_TYPE' => isset($topic['tor_type']) ? is_gold($topic['tor_type']) : '',
@ -477,7 +477,7 @@ foreach ($topic_rowset as $topic) {
'ATTACH' => $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'],
'POLL' => $topic['topic_vote'], 'POLL' => $topic['topic_vote'],
'DL_CLASS' => isset($topic['dl_status']) ? $dl_link_css[$topic['dl_status']] : '', 'DL_CLASS' => isset($topic['dl_status']) ? $dl_link_css[$topic['dl_status']] : '',
@ -504,14 +504,14 @@ foreach ($topic_rowset as $topic) {
unset($topic_rowset); unset($topic_rowset);
$pg_url = FORUM_URL . $forum_id; $pg_url = FORUM_URL . $forum_id;
$pg_url .= ($sort_value) ? "&sort=$sort_value" : ''; $pg_url .= $sort_value ? "&sort=$sort_value" : '';
$pg_url .= ($order_value) ? "&order=$order_value" : ''; $pg_url .= $order_value ? "&order=$order_value" : '';
$template->assign_var('MOD_URL', $pg_url); $template->assign_var('MOD_URL', $pg_url);
$pg_url = FORUM_URL . $forum_id; $pg_url = FORUM_URL . $forum_id;
$pg_url .= ($topic_days) ? "&amp;topicdays=$topic_days" : ''; $pg_url .= $topic_days ? "&amp;topicdays=$topic_days" : '';
$pg_url .= ($sort_value) ? "&amp;sort=$sort_value" : ''; $pg_url .= $sort_value ? "&amp;sort=$sort_value" : '';
$pg_url .= ($order_value) ? "&amp;order=$order_value" : ''; $pg_url .= $order_value ? "&amp;order=$order_value" : '';
$pg_url .= ($moderation) ? "&amp;mod=1" : ''; $pg_url .= $moderation ? "&amp;mod=1" : '';
$pg_url .= ($topics_per_page != $bb_cfg['topics_per_page']) ? "&amp;tpp=$topics_per_page" : ''; $pg_url .= ($topics_per_page != $bb_cfg['topics_per_page']) ? "&amp;tpp=$topics_per_page" : '';
if ($found_topics) { if ($found_topics) {

View file

@ -146,7 +146,7 @@ if (isset($t_data['topic_attachment'])) {
// Find newest post // Find newest post
if (($next_topic_id || @$_GET['view'] === 'newest') && !IS_GUEST && $topic_id) { if (($next_topic_id || @$_GET['view'] === 'newest') && !IS_GUEST && $topic_id) {
$post_time = 'post_time >= ' . get_last_read($topic_id, $forum_id); $post_time = 'post_time >= ' . get_last_read($topic_id, $forum_id);
$post_id_altern = ($next_topic_id) ? '' : ' OR post_id = ' . $t_data['topic_last_post_id']; $post_id_altern = $next_topic_id ? '' : ' OR post_id = ' . $t_data['topic_last_post_id'];
$sql = "SELECT post_id, post_time $sql = "SELECT post_id, post_time
FROM " . BB_POSTS . " FROM " . BB_POSTS . "
@ -177,7 +177,7 @@ $is_auth = auth(AUTH_ALL, $forum_id, $userdata, $t_data);
if (!$is_auth['auth_read']) { if (!$is_auth['auth_read']) {
if (IS_GUEST) { if (IS_GUEST) {
$redirect = ($post_id) ? POST_URL . "$post_id#$post_id" : TOPIC_URL . $topic_id; $redirect = $post_id ? POST_URL . "$post_id#$post_id" : TOPIC_URL . $topic_id;
$redirect .= ($start && !$post_id) ? "&start=$start" : ''; $redirect .= ($start && !$post_id) ? "&start=$start" : '';
redirect(LOGIN_URL . "?redirect=$redirect"); redirect(LOGIN_URL . "?redirect=$redirect");
} }
@ -413,13 +413,13 @@ $template->set_filenames(array('body' => 'viewtopic.tpl'));
// //
// User authorisation levels output // User authorisation levels output
// //
$s_auth_can = (($is_auth['auth_post']) ? $lang['RULES_POST_CAN'] : $lang['RULES_POST_CANNOT']) . '<br />'; $s_auth_can = ($is_auth['auth_post'] ? $lang['RULES_POST_CAN'] : $lang['RULES_POST_CANNOT']) . '<br />';
$s_auth_can .= (($is_auth['auth_reply']) ? $lang['RULES_REPLY_CAN'] : $lang['RULES_REPLY_CANNOT']) . '<br />'; $s_auth_can .= ($is_auth['auth_reply'] ? $lang['RULES_REPLY_CAN'] : $lang['RULES_REPLY_CANNOT']) . '<br />';
$s_auth_can .= (($is_auth['auth_edit']) ? $lang['RULES_EDIT_CAN'] : $lang['RULES_EDIT_CANNOT']) . '<br />'; $s_auth_can .= ($is_auth['auth_edit'] ? $lang['RULES_EDIT_CAN'] : $lang['RULES_EDIT_CANNOT']) . '<br />';
$s_auth_can .= (($is_auth['auth_delete']) ? $lang['RULES_DELETE_CAN'] : $lang['RULES_DELETE_CANNOT']) . '<br />'; $s_auth_can .= ($is_auth['auth_delete'] ? $lang['RULES_DELETE_CAN'] : $lang['RULES_DELETE_CANNOT']) . '<br />';
$s_auth_can .= (($is_auth['auth_vote']) ? $lang['RULES_VOTE_CAN'] : $lang['RULES_VOTE_CANNOT']) . '<br />'; $s_auth_can .= ($is_auth['auth_vote'] ? $lang['RULES_VOTE_CAN'] : $lang['RULES_VOTE_CANNOT']) . '<br />';
$s_auth_can .= (($is_auth['auth_attachments']) ? $lang['RULES_ATTACH_CAN'] : $lang['RULES_ATTACH_CANNOT']) . '<br />'; $s_auth_can .= ($is_auth['auth_attachments'] ? $lang['RULES_ATTACH_CAN'] : $lang['RULES_ATTACH_CANNOT']) . '<br />';
$s_auth_can .= (($is_auth['auth_download']) ? $lang['RULES_DOWNLOAD_CAN'] : $lang['RULES_DOWNLOAD_CANNOT']) . '<br />'; $s_auth_can .= ($is_auth['auth_download'] ? $lang['RULES_DOWNLOAD_CAN'] : $lang['RULES_DOWNLOAD_CANNOT']) . '<br />';
$topic_mod = ''; $topic_mod = '';
@ -448,19 +448,19 @@ $s_watching_topic = $s_watching_topic_img = '';
if ($can_watch_topic) { if ($can_watch_topic) {
if ($is_watching_topic) { if ($is_watching_topic) {
$s_watching_topic = "<a href=\"" . TOPIC_URL . $topic_id . "&amp;unwatch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '">' . $lang['STOP_WATCHING_TOPIC'] . '</a>'; $s_watching_topic = "<a href=\"" . TOPIC_URL . $topic_id . "&amp;unwatch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '">' . $lang['STOP_WATCHING_TOPIC'] . '</a>';
$s_watching_topic_img = (isset($images['topic_un_watch'])) ? "<a href=\"" . TOPIC_URL . "$topic_id&amp;unwatch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_un_watch'] . '" alt="' . $lang['STOP_WATCHING_TOPIC'] . '" title="' . $lang['STOP_WATCHING_TOPIC'] . '" border="0"></a>' : ''; $s_watching_topic_img = isset($images['topic_un_watch']) ? "<a href=\"" . TOPIC_URL . "$topic_id&amp;unwatch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_un_watch'] . '" alt="' . $lang['STOP_WATCHING_TOPIC'] . '" title="' . $lang['STOP_WATCHING_TOPIC'] . '" border="0"></a>' : '';
} else { } else {
$s_watching_topic = "<a href=\"" . TOPIC_URL . $topic_id . "&amp;watch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '">' . $lang['START_WATCHING_TOPIC'] . '</a>'; $s_watching_topic = "<a href=\"" . TOPIC_URL . $topic_id . "&amp;watch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '">' . $lang['START_WATCHING_TOPIC'] . '</a>';
$s_watching_topic_img = (isset($images['Topic_watch'])) ? "<a href=\"" . TOPIC_URL . "$topic_id&amp;watch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '"><img src="' . $images['Topic_watch'] . '" alt="' . $lang['START_WATCHING_TOPIC'] . '" title="' . $lang['START_WATCHING_TOPIC'] . '" border="0"></a>' : ''; $s_watching_topic_img = isset($images['Topic_watch']) ? "<a href=\"" . TOPIC_URL . "$topic_id&amp;watch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '"><img src="' . $images['Topic_watch'] . '" alt="' . $lang['START_WATCHING_TOPIC'] . '" title="' . $lang['START_WATCHING_TOPIC'] . '" border="0"></a>' : '';
} }
} }
// If we've got a hightlight set pass it on to pagination, // If we've got a hightlight set pass it on to pagination,
$pg_url = TOPIC_URL . $topic_id; $pg_url = TOPIC_URL . $topic_id;
$pg_url .= ($post_days) ? "&amp;postdays=$post_days" : ''; $pg_url .= $post_days ? "&amp;postdays=$post_days" : '';
$pg_url .= ($post_order != 'asc') ? "&amp;postorder=$post_order" : ''; $pg_url .= ($post_order != 'asc') ? "&amp;postorder=$post_order" : '';
$pg_url .= isset($_REQUEST['single']) ? "&amp;single=1" : ''; $pg_url .= isset($_REQUEST['single']) ? "&amp;single=1" : '';
$pg_url .= ($moderation) ? "&amp;mod=1" : ''; $pg_url .= $moderation ? "&amp;mod=1" : '';
$pg_url .= ($posts_per_page != $bb_cfg['posts_per_page']) ? "&amp;ppp=$posts_per_page" : ''; $pg_url .= ($posts_per_page != $bb_cfg['posts_per_page']) ? "&amp;ppp=$posts_per_page" : '';
generate_pagination($pg_url, $total_replies, $posts_per_page, $start); generate_pagination($pg_url, $total_replies, $posts_per_page, $start);
@ -509,7 +509,7 @@ $template->assign_vars(array(
'T_POST_REPLY' => $reply_alt, 'T_POST_REPLY' => $reply_alt,
'HIDE_AVATAR' => $user->opt_js['h_av'], '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'] && $bb_cfg['show_rank_image'],
'HIDE_POST_IMG' => $user->opt_js['h_post_i'], 'HIDE_POST_IMG' => $user->opt_js['h_post_i'],
'HIDE_SMILE' => $user->opt_js['h_smile'], 'HIDE_SMILE' => $user->opt_js['h_smile'],
'HIDE_SIGNATURE' => $user->opt_js['h_sig'], 'HIDE_SIGNATURE' => $user->opt_js['h_sig'],
@ -542,8 +542,8 @@ $template->assign_vars(array(
'U_SEARCH_SELF' => "search.php?uid={$userdata['user_id']}&t=$topic_id&dm=1", 'U_SEARCH_SELF' => "search.php?uid={$userdata['user_id']}&t=$topic_id&dm=1",
'TOPIC_HAS_POLL' => $topic_has_poll, 'TOPIC_HAS_POLL' => $topic_has_poll,
'POLL_IS_EDITABLE' => (!$poll_time_expired), 'POLL_IS_EDITABLE' => !$poll_time_expired,
'POLL_IS_FINISHED' => ($t_data['topic_vote'] == POLL_FINISHED), 'POLL_IS_FINISHED' => $t_data['topic_vote'] == POLL_FINISHED,
'CAN_MANAGE_POLL' => $can_manage_poll, 'CAN_MANAGE_POLL' => $can_manage_poll,
'CAN_ADD_POLL' => $can_add_poll, 'CAN_ADD_POLL' => $can_add_poll,
)); ));
@ -606,10 +606,10 @@ for ($i = 0; $i < $total_posts; $i++) {
$mc_comment = $postrow[$i]['mc_comment']; $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'])); $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']) ?: 0; $rg_id = $postrow[$i]['poster_rg_id'] ?: 0;
$rg_avatar = get_avatar(GROUP_AVATAR_MASK . $rg_id, $postrow[$i]['rg_avatar_id']); $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_name = $postrow[$i]['group_name'] ? htmlCHR($postrow[$i]['group_name']) : '';
$rg_signature = ($postrow[$i]['group_signature']) ? bbcode2html(htmlCHR($postrow[$i]['group_signature'])) : ''; $rg_signature = $postrow[$i]['group_signature'] ? bbcode2html(htmlCHR($postrow[$i]['group_signature'])) : '';
$poster_avatar = ''; $poster_avatar = '';
if (!$user->opt_js['h_av'] && $poster_id != GUEST_UID) { if (!$user->opt_js['h_av'] && $poster_id != GUEST_UID) {
@ -620,7 +620,7 @@ for ($i = 0; $i < $total_posts; $i++) {
$user_rank = $postrow[$i]['user_rank']; $user_rank = $postrow[$i]['user_rank'];
if (!$user->opt_js['h_rnk_i'] and isset($ranks[$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" />' : ''; $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'] : ''; $poster_rank = $bb_cfg['show_rank_text'] ? $ranks[$user_rank]['rank_title'] : '';
} }
// Handle anon users posting with usernames // Handle anon users posting with usernames
@ -719,26 +719,26 @@ for ($i = 0; $i < $total_posts; $i++) {
$template->assign_block_vars('postrow', array( $template->assign_block_vars('postrow', array(
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2', 'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
'POST_ID' => $post_id, 'POST_ID' => $post_id,
'IS_NEWEST' => ($post_id == $newest), 'IS_NEWEST' => $post_id == $newest,
'POSTER_NAME' => profile_url(array('username' => $poster, 'user_rank' => $user_rank)), 'POSTER_NAME' => profile_url(array('username' => $poster, 'user_rank' => $user_rank)),
'POSTER_NAME_JS' => addslashes($poster), 'POSTER_NAME_JS' => addslashes($poster),
'POSTER_RANK' => $poster_rank, 'POSTER_RANK' => $poster_rank,
'RANK_IMAGE' => $rank_image, 'RANK_IMAGE' => $rank_image,
'POSTER_JOINED' => ($bb_cfg['show_poster_joined']) ? $poster_longevity : '', 'POSTER_JOINED' => $bb_cfg['show_poster_joined'] ? $poster_longevity : '',
'POSTER_JOINED_DATE' => $poster_joined, 'POSTER_JOINED_DATE' => $poster_joined,
'POSTER_POSTS' => ($bb_cfg['show_poster_posts']) ? $poster_posts : '', 'POSTER_POSTS' => $bb_cfg['show_poster_posts'] ? $poster_posts : '',
'POSTER_FROM' => ($bb_cfg['show_poster_from']) ? wbr($poster_from) : '', 'POSTER_FROM' => $bb_cfg['show_poster_from'] ? wbr($poster_from) : '',
'POSTER_BOT' => ($poster_id == BOT_UID), 'POSTER_BOT' => $poster_id == BOT_UID,
'POSTER_ID' => $poster_id, 'POSTER_ID' => $poster_id,
'POSTER_AUTHOR' => ($poster_id == $t_data['topic_poster']), 'POSTER_AUTHOR' => $poster_id == $t_data['topic_poster'],
'POSTER_GENDER' => ($bb_cfg['gender']) ? gender_image($postrow[$i]['user_gender']) : '', 'POSTER_GENDER' => $bb_cfg['gender'] ? gender_image($postrow[$i]['user_gender']) : '',
'POSTED_AFTER' => ($prev_post_time) ? delta_time($postrow[$i]['post_time'], $prev_post_time) : '', 'POSTED_AFTER' => $prev_post_time ? delta_time($postrow[$i]['post_time'], $prev_post_time) : '',
'IS_UNREAD' => is_unread($postrow[$i]['post_time'], $topic_id, $forum_id), 'IS_UNREAD' => is_unread($postrow[$i]['post_time'], $topic_id, $forum_id),
'IS_FIRST_POST' => (!$start && ($post_id == $t_data['topic_first_post_id'])), 'IS_FIRST_POST' => !$start && ($post_id == $t_data['topic_first_post_id']),
'MOD_CHECKBOX' => ($moderation && ($start || defined('SPLIT_FORM_START'))), 'MOD_CHECKBOX' => $moderation && ($start || defined('SPLIT_FORM_START')),
'POSTER_AVATAR' => $poster_avatar, 'POSTER_AVATAR' => $poster_avatar,
'POST_NUMBER' => ($i + $start + 1), 'POST_NUMBER' => $i + $start + 1,
'POST_DATE' => $post_date, 'POST_DATE' => $post_date,
'MESSAGE' => $message, 'MESSAGE' => $message,
'SIGNATURE' => $user_sig, 'SIGNATURE' => $user_sig,
@ -754,8 +754,8 @@ for ($i = 0; $i < $total_posts; $i++) {
'POSTER_BIRTHDAY' => ($bb_cfg['birthday_enabled'] && $this_date == $poster_birthday) ? '<img src="' . $images['icon_birthday'] . '" alt="" title="' . $lang['HAPPY_BIRTHDAY'] . '" border="0" />' : '', 'POSTER_BIRTHDAY' => ($bb_cfg['birthday_enabled'] && $this_date == $poster_birthday) ? '<img src="' . $images['icon_birthday'] . '" alt="" title="' . $lang['HAPPY_BIRTHDAY'] . '" border="0" />' : '',
'MC_COMMENT' => ($mc_type) ? bbcode2html($mc_comment) : '', 'MC_COMMENT' => $mc_type ? bbcode2html($mc_comment) : '',
'MC_BBCODE' => ($mc_type) ? $mc_comment : '', 'MC_BBCODE' => $mc_type ? $mc_comment : '',
'MC_CLASS' => $mc_class, 'MC_CLASS' => $mc_class,
'MC_TITLE' => sprintf($lang['MC_COMMENT'][$mc_type]['title'], $mc_user_id), 'MC_TITLE' => sprintf($lang['MC_COMMENT'][$mc_type]['title'], $mc_user_id),
'MC_SELECT_TYPE' => build_select("mc_type_$post_id", array_flip($mc_select_type), $mc_type), 'MC_SELECT_TYPE' => build_select("mc_type_$post_id", array_flip($mc_select_type), $mc_type),
@ -800,14 +800,14 @@ if ($bb_cfg['show_quick_reply']) {
'QUICK_REPLY' => true, 'QUICK_REPLY' => true,
'QR_POST_ACTION' => POSTING_URL, 'QR_POST_ACTION' => POSTING_URL,
'QR_TOPIC_ID' => $topic_id, 'QR_TOPIC_ID' => $topic_id,
'CAPTCHA_HTML' => (IS_GUEST) ? bb_captcha('get') : '', 'CAPTCHA_HTML' => IS_GUEST ? bb_captcha('get') : '',
)); ));
if (!IS_GUEST) { if (!IS_GUEST) {
$notify_user = bf($userdata['user_opt'], 'user_opt', 'user_notify'); $notify_user = bf($userdata['user_opt'], 'user_opt', 'user_notify');
$template->assign_vars(array( $template->assign_vars(array(
'QR_NOTIFY_CHECKED' => ($notify_user) ? $notify_user && $is_watching_topic : $is_watching_topic, 'QR_NOTIFY_CHECKED' => $notify_user ? $notify_user && $is_watching_topic : $is_watching_topic,
)); ));
} }
} }