Type casting can be used.

(cherry picked from commit b5065ae)
This commit is contained in:
Yuriy Pikhtarev 2017-05-05 01:00:38 +03:00 committed by Vasily Komrakov
commit 21c8e7d48a
No known key found for this signature in database
GPG key ID: 558236680C20A69A
58 changed files with 226 additions and 228 deletions

View file

@ -333,7 +333,7 @@ if ($view === 'attachments') {
// Are we called from Username ?
if ($user_based) {
$sql = "SELECT username FROM " . BB_USERS . " WHERE user_id = " . intval($uid);
$sql = "SELECT username FROM " . BB_USERS . " WHERE user_id = " . (int)$uid;
if (!($result = DB()->sql_query($sql))) {
bb_die('Error getting username');
@ -343,7 +343,7 @@ if ($view === 'attachments') {
DB()->sql_freeresult($result);
$username = $row['username'];
$s_hidden = '<input type="hidden" name="u_id" value="' . intval($uid) . '" />';
$s_hidden = '<input type="hidden" name="u_id" value="' . (int)$uid . '" />';
$template->assign_block_vars('switch_user_based', array());
@ -354,7 +354,7 @@ if ($view === 'attachments') {
$sql = "SELECT attach_id
FROM " . BB_ATTACHMENTS . "
WHERE user_id_1 = " . intval($uid) . "
WHERE user_id_1 = " . (int)$uid . "
GROUP BY attach_id";
if (!($result = DB()->sql_query($sql))) {
@ -374,7 +374,7 @@ if ($view === 'attachments') {
$attach_id = array();
for ($j = 0; $j < $num_attach_ids; $j++) {
$attach_id[] = intval($attach_ids[$j]['attach_id']);
$attach_id[] = (int)$attach_ids[$j]['attach_id'];
}
$sql = "SELECT a.*
@ -396,11 +396,11 @@ if ($view === 'attachments') {
if (count($attachments) > 0) {
for ($i = 0, $iMax = count($attachments); $i < $iMax; $i++) {
$delete_box = '<input type="checkbox" name="delete_id_list[]" value="' . intval($attachments[$i]['attach_id']) . '" />';
$delete_box = '<input type="checkbox" name="delete_id_list[]" value="' . (int)$attachments[$i]['attach_id'] . '" />';
for ($j = 0, $iMax = count($delete_id_list); $j < $iMax; $j++) {
if ($delete_id_list[$j] == $attachments[$i]['attach_id']) {
$delete_box = '<input type="checkbox" name="delete_id_list[]" value="' . intval($attachments[$i]['attach_id']) . '" checked="checked" />';
$delete_box = '<input type="checkbox" name="delete_id_list[]" value="' . (int)$attachments[$i]['attach_id'] . '" checked="checked" />';
break;
}
}
@ -413,7 +413,7 @@ if ($view === 'attachments') {
$sql = "SELECT *
FROM " . BB_ATTACHMENTS . "
WHERE attach_id = " . intval($attachments[$i]['attach_id']);
WHERE attach_id = " . (int)$attachments[$i]['attach_id'];
if (!($result = DB()->sql_query($sql))) {
bb_die('Could not query attachments #3');
@ -427,7 +427,7 @@ if ($view === 'attachments') {
if ($ids[$j]['post_id'] != 0) {
$sql = "SELECT t.topic_title
FROM " . BB_TOPICS . " t, " . BB_POSTS . " p
WHERE p.post_id = " . intval($ids[$j]['post_id']) . " AND p.topic_id = t.topic_id
WHERE p.post_id = " . (int)$ids[$j]['post_id'] . " AND p.topic_id = t.topic_id
GROUP BY t.topic_id, t.topic_title";
if (!($result = DB()->sql_query($sql))) {
@ -452,7 +452,7 @@ if ($view === 'attachments') {
$post_titles = implode('<br />', $post_titles);
$hidden_field = '<input type="hidden" name="attach_id_list[]" value="' . intval($attachments[$i]['attach_id']) . '" />';
$hidden_field = '<input type="hidden" name="attach_id_list[]" value="' . (int)$attachments[$i]['attach_id'] . '" />';
$template->assign_block_vars('attachrow', array(
'ROW_NUMBER' => $i + (@$_GET['start'] + 1),