Type casting can be used

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

View file

@ -313,7 +313,7 @@ if (!isset($_REQUEST['dosearch'])) {
$where_sql = ''; $where_sql = '';
$where_sql .= ($ip_in_sql != '') ? "poster_ip IN ($ip_in_sql)" : ''; $where_sql .= ($ip_in_sql != '') ? "poster_ip IN ($ip_in_sql)" : '';
$where_sql .= ($ip_like_sql != '') ? ($where_sql != '') ? " OR $ip_like_sql" : "$ip_like_sql" : ''; $where_sql .= ($ip_like_sql != '') ? ($where_sql != '') ? " OR $ip_like_sql" : (string)$ip_like_sql : '';
if (!$where_sql) { if (!$where_sql) {
bb_die('invalid request'); bb_die('invalid request');

View file

@ -384,7 +384,7 @@ if ($tor_reged && $tor_info) {
define('SEEDER_EXIST', true); define('SEEDER_EXIST', true);
$seed_order_action = "viewtopic.php?" . POST_TOPIC_URL . "=$bt_topic_id&amp;spmode=full#seeders"; $seed_order_action = "viewtopic.php?" . POST_TOPIC_URL . "=$bt_topic_id&amp;spmode=full#seeders";
$template->assign_block_vars("$x_full", array( $template->assign_block_vars((string)$x_full, array(
'SEED_ORD_ACT' => $seed_order_action, 'SEED_ORD_ACT' => $seed_order_action,
'SEEDERS_UP_TOT' => humn_size($sp_up_tot[$x], 0, 'KB') . '/s' 'SEEDERS_UP_TOT' => humn_size($sp_up_tot[$x], 0, 'KB') . '/s'
)); ));
@ -406,7 +406,7 @@ if ($tor_reged && $tor_info) {
define('LEECHER_EXIST', true); define('LEECHER_EXIST', true);
$leech_order_action = "viewtopic.php?" . POST_TOPIC_URL . "=$bt_topic_id&amp;spmode=full#leechers"; $leech_order_action = "viewtopic.php?" . POST_TOPIC_URL . "=$bt_topic_id&amp;spmode=full#leechers";
$template->assign_block_vars("$x_full", array( $template->assign_block_vars((string)$x_full, array(
'LEECH_ORD_ACT' => $leech_order_action, 'LEECH_ORD_ACT' => $leech_order_action,
'LEECHERS_UP_TOT' => humn_size($sp_up_tot[$x], 0, 'KB') . '/s', 'LEECHERS_UP_TOT' => humn_size($sp_up_tot[$x], 0, 'KB') . '/s',
'LEECHERS_DOWN_TOT' => humn_size($sp_down_tot[$x], 0, 'KB') . '/s' 'LEECHERS_DOWN_TOT' => humn_size($sp_down_tot[$x], 0, 'KB') . '/s'

View file

@ -200,7 +200,7 @@ function strip_quotes($text)
do { do {
$pos = strpos($lowertext, '[quote', $curpos); $pos = strpos($lowertext, '[quote', $curpos);
if ($pos !== false) { if ($pos !== false) {
$start_pos["$pos"] = 'start'; $start_pos[(string)$pos] = 'start';
$curpos = $pos + 6; $curpos = $pos + 6;
} }
} while ($pos !== false); } while ($pos !== false);
@ -215,7 +215,7 @@ function strip_quotes($text)
do { do {
$pos = strpos($lowertext, '[/quote', $curpos); $pos = strpos($lowertext, '[/quote', $curpos);
if ($pos !== false) { if ($pos !== false) {
$end_pos["$pos"] = 'end'; $end_pos[(string)$pos] = 'end';
$curpos = $pos + 8; $curpos = $pos + 8;
} }
} while ($pos !== false); } while ($pos !== false);
@ -259,7 +259,7 @@ function strip_quotes($text)
// recursion. // recursion.
if ($stack) { if ($stack) {
foreach ($stack as $pos) { foreach ($stack as $pos) {
unset($pos_list["$pos"]); unset($pos_list[(string)$pos]);
} }
} }
} while ($stack); } while ($stack);

View file

@ -517,7 +517,7 @@ if ($post_mode) {
$SQL['GROUP BY'][] = "item_id"; $SQL['GROUP BY'][] = "item_id";
$SQL['ORDER BY'][] = ($new_posts && $join_p) ? "p.topic_id ASC, p.post_time ASC" : "$order $sort"; $SQL['ORDER BY'][] = ($new_posts && $join_p) ? "p.topic_id ASC, p.post_time ASC" : "$order $sort";
$SQL['LIMIT'][] = "$search_limit"; $SQL['LIMIT'][] = (string)$search_limit;
$items_display = fetch_search_ids($SQL); $items_display = fetch_search_ids($SQL);
} elseif (!$items_display = array_slice($items_found, $start, $per_page)) { } elseif (!$items_display = array_slice($items_found, $start, $per_page)) {
@ -726,7 +726,7 @@ else {
} }
$SQL['GROUP BY'][] = "item_id"; $SQL['GROUP BY'][] = "item_id";
$SQL['LIMIT'][] = "$search_limit"; $SQL['LIMIT'][] = (string)$search_limit;
if ($egosearch) { if ($egosearch) {
$SQL['ORDER BY'][] = 'max_post_time DESC'; $SQL['ORDER BY'][] = 'max_post_time DESC';
@ -767,7 +767,7 @@ else {
$SQL['WHERE'][] = "t.forum_id NOT IN($excluded_forums_csv)"; $SQL['WHERE'][] = "t.forum_id NOT IN($excluded_forums_csv)";
} }
$SQL['LIMIT'][] = "$per_page"; $SQL['LIMIT'][] = (string)$per_page;
// Fetch topics data // Fetch topics data
$topic_rows = array(); $topic_rows = array();

View file

@ -70,7 +70,7 @@ class LogAction
} }
$sql_ary = [ $sql_ary = [
'log_type_id' => (int)$this->log_type["$type_name"], 'log_type_id' => (int)$this->log_type[(string)$type_name],
'log_user_id' => (int)$user_id, 'log_user_id' => (int)$user_id,
'log_user_ip' => (string)$session_ip, 'log_user_ip' => (string)$session_ip,
'log_forum_id' => (int)$forum_id, 'log_forum_id' => (int)$forum_id,

View file

@ -392,7 +392,7 @@ class SqlDb
case is_string($v): case is_string($v):
return "'" . $this->escape_string($v) . "'"; return "'" . $this->escape_string($v) . "'";
case is_int($v): case is_int($v):
return "$v"; return (string)$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):
@ -733,7 +733,7 @@ class SqlDb
} }
if ($this->link and $ext = mysqli_info($this->link)) { if ($this->link and $ext = mysqli_info($this->link)) {
$info[] = "$ext"; $info[] = (string)$ext;
} elseif (!$num && ($aff = $this->affected_rows($this->result) and $aff != -1)) { } elseif (!$num && ($aff = $this->affected_rows($this->result) and $aff != -1)) {
$info[] = "$aff rows"; $info[] = "$aff rows";
} }

View file

@ -864,9 +864,9 @@ class Template
} elseif (!empty($m[4])) { } elseif (!empty($m[4])) {
$token = ($tokens_cnt == 1) ? "!empty(\$V['{$m[4]}'])" : "\$V['{$m[4]}']"; $token = ($tokens_cnt == 1) ? "!empty(\$V['{$m[4]}'])" : "\$V['{$m[4]}']";
} elseif (!empty($m[5])) { } elseif (!empty($m[5])) {
$token = ($tokens_cnt == 1) ? "!empty({$m[5]})" : "{$m[5]}"; $token = ($tokens_cnt == 1) ? "!empty({$m[5]})" : (string)($m[5]);
} elseif (!empty($m[7])) { } elseif (!empty($m[7])) {
$token = ($tokens_cnt == 1) ? "defined('{$m[7]}') && {$m[7]}" : "{$m[7]}"; $token = ($tokens_cnt == 1) ? "defined('{$m[7]}') && {$m[7]}" : (string)($m[7]);
} }
} }
break; break;