Skip to content

Commit 15faaf1

Browse files
committed
type casting : replace intval -> (int)
1 parent 0afef56 commit 15faaf1

24 files changed

Lines changed: 73 additions & 73 deletions

action.post.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525

2626
include 'header.php';
2727

28-
$topic_id = isset($_POST['topic_id']) ? intval($_POST['topic_id']) :
28+
$topic_id = isset($_POST['topic_id']) ? (int)$_POST['topic_id'] :
2929
0;
30-
$post_id = !empty($_GET['post_id']) ? intval($_GET['post_id']) :
30+
$post_id = !empty($_GET['post_id']) ? (int)$_GET['post_id'] :
3131
0;
3232
$post_id = !empty($_POST['post_id']) ? $_POST['post_id'] :
3333
$post_id;
@@ -37,7 +37,7 @@
3737
(!empty($_POST['op']) ? $_POST['op']:"");
3838
$op = in_array($op, array("approve", "delete", "restore", "split"))? $op :
3939
"";
40-
$mode = !empty($_GET['mode']) ? intval($_GET['mode']) :
40+
$mode = !empty($_GET['mode']) ? (int)$_GET['mode'] :
4141
1;
4242

4343
if (empty($post_id) || empty($op))

admin/admin_cat_manager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ function editCategory($cat_id = 0)
172172
case "del":
173173
if (empty($_POST['confirm']))
174174
{
175-
xoops_confirm(array('op' => 'del', 'cat_id' => intval($_GET['cat_id']), 'confirm' => 1), 'admin_cat_manager.php', _AM_IFORUM_WAYSYWTDTTAL);
175+
xoops_confirm(array('op' => 'del', 'cat_id' => (int)$_GET['cat_id'], 'confirm' => 1), 'admin_cat_manager.php', _AM_IFORUM_WAYSYWTDTTAL);
176176
break;
177177
}
178178
else

admin/admin_forum_manager.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ function editForum($ff, $parent_forum = 0) {
174174

175175
if (!empty($_POST['dest']))
176176
{
177-
if (!empty($_GET['forum'])) $forum_id = intval($_GET['forum']);
177+
if (!empty($_GET['forum'])) $forum_id = (int)$_GET['forum'];
178178
if (!empty($_POST['forum'])) $forum_id = intval($_POST['forum']);
179179

180180
$dest = $_POST['dest'];
@@ -217,14 +217,14 @@ function editForum($ff, $parent_forum = 0) {
217217
{
218218
//loadModuleAdminMenu(2, "");
219219

220-
if (!empty($_POST['forum'])) $forum_id = intval($_POST['forum']);
221-
if (!empty($_GET['forum'])) $forum_id = intval($_GET['forum']);
220+
if (!empty($_POST['forum'])) $forum_id = (int)$_POST['forum'];
221+
if (!empty($_GET['forum'])) $forum_id = (int)$_GET['forum'];
222222
//$forum =$forum_handler->get($forum_id);
223223

224224
$box = '<select name="dest">';
225225
$box .= '<option value=0 selected>' . _AM_IFORUM_SELECT . '</option>';
226226

227-
$category_handler = icms_getmodulehandler('category', basename(dirname(dirname(__FILE__ ) ) ), 'iforum' );
227+
$category_handler = icms_getmodulehandler('category', basename(dirname(__DIR__) ), 'iforum' );
228228
$categories = $category_handler->getAllCats('', true);
229229
$forums = $forum_handler->getForumsByCategory(array_keys($categories), '', false);
230230

@@ -259,8 +259,8 @@ function editForum($ff, $parent_forum = 0) {
259259

260260
if (!empty($_POST['dest_forum']))
261261
{
262-
if (isset($_GET['forum'])) $forum_id = intval($_GET['forum']);
263-
if (isset($_POST['forum'])) $forum_id = intval($_POST['forum']);
262+
if (isset($_GET['forum'])) $forum_id = (int)$_GET['forum'];
263+
if (isset($_POST['forum'])) $forum_id = (int)$_POST['forum'];
264264

265265
$sql = "UPDATE " . icms::$xoopsDB->prefix('bb_posts') . " SET forum_id=" . $_POST['dest_forum'] . " WHERE forum_id=$forum";
266266
$result = icms::$xoopsDB->queryF($sql);
@@ -293,8 +293,8 @@ function editForum($ff, $parent_forum = 0) {
293293
{
294294
//loadModuleAdminMenu(2, "");
295295

296-
if (isset($_GET['forum'])) $forum_id = intval($_GET['forum']);
297-
if (isset($_POST['forum'])) $forum_id = intval($_POST['forum']);
296+
if (isset($_GET['forum'])) $forum_id = (int)$_GET['forum'];
297+
if (isset($_POST['forum'])) $forum_id = (int)$_POST['forum'];
298298
//$forum =$forum_handler->get($forum_id);
299299

300300
$box = '<select name="dest_forum">';
@@ -449,7 +449,7 @@ function editForum($ff, $parent_forum = 0) {
449449

450450
if (isset($_POST['confirm']) != 1)
451451
{
452-
xoops_confirm(array('op' => 'del', 'forum' => intval($_GET['forum']), 'confirm' => 1), 'admin_forum_manager.php', _AM_IFORUM_TWDAFAP);
452+
xoops_confirm(array('op' => 'del', 'forum' => (int)$_GET['forum'], 'confirm' => 1), 'admin_forum_manager.php', _AM_IFORUM_TWDAFAP);
453453
break;
454454
}
455455
else
@@ -547,7 +547,7 @@ function editForum($ff, $parent_forum = 0) {
547547
loadModuleAdminMenu(2, _AM_IFORUM_CREATENEWFORUM);
548548
echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_IFORUM_CREATENEWFORUM . "</legend>";
549549
echo "<br />";
550-
$parent_forum = isset($_GET['parent_forum']) ? intval($_GET['parent_forum']) : null;
550+
$parent_forum = isset($_GET['parent_forum']) ? (int)$_GET['parent_forum'] : null;
551551
552552
newForum($parent_forum);
553553
@@ -563,8 +563,8 @@ function editForum($ff, $parent_forum = 0) {
563563
<legend style='display: inline; font-weight: bold; color: #900;'>" . _AM_IFORUM_CREATENEWFORUM . "</legend>";
564564
echo "<br />";
565565

566-
//$parent_forum = isset($_GET['parent_forum']) ? intval($_GET['parent_forum']) : null;
567-
newForum(@intval($_GET['parent_forum']));
566+
//$parent_forum = isset($_GET['parent_forum']) ? (int)$_GET['parent_forum'] : null;
567+
newForum(@(int)$_GET['parent_forum']);
568568

569569
echo "</fieldset>";
570570
break;

admin/admin_votedata.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
switch ($op) {
3232
case "delvotes":
3333
global $_GET;
34-
$rid = intval($_GET['rid']);
35-
$topic_id = intval($_GET['topic_id']);
34+
$rid = (int)$_GET['rid'];
35+
$topic_id = (int)$_GET['topic_id'];
3636
$sql = icms::$xoopsDB->queryF("DELETE FROM " . icms::$xoopsDB->prefix('bb_votedata') . " WHERE ratingid = $rid");
3737
icms::$xoopsDB->query($sql);
3838
iforum_updaterating($topic_id);
@@ -41,7 +41,7 @@
4141

4242
case 'main':
4343
default:
44-
$start = isset($_GET['start']) ? intval($_GET['start']) :
44+
$start = isset($_GET['start']) ? (int)$_GET['start'] :
4545
0;
4646
$useravgrating = '0';
4747
$uservotes = '0';

archive.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232

3333
include_once("header.php");
3434
include ICMS_ROOT_PATH."/header.php";
35-
$forum = isset($_GET['forum']) ? intval($_GET['forum']) :
35+
$forum = isset($_GET['forum']) ? (int)$_GET['forum'] :
3636
0;
37-
$topic_id = isset($_GET['topic_id']) ? intval($_GET['topic_id']) :
37+
$topic_id = isset($_GET['topic_id']) ? (int)$_GET['topic_id'] :
3838
0;
3939

4040
if ($forum == 0)

delete.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
)?$ {
4545
$getint }
4646
:
47-
(isset($_GET[$getint]) ? intval($_GET[$getint]) : 0);
47+
(isset($_GET[$getint]) ? (int)$_GET[$getint] : 0);
4848
}
4949
$viewmode = (isset($_GET['viewmode']) && $_GET['viewmode'] != 'flat') ? 'thread' :
5050
'flat';

dl_attachment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
$attach_id = isset($_GET['attachid']) ? strval($_GET['attachid']) :
3131
'';
32-
$post_id = isset($_GET['post_id']) ? intval($_GET['post_id']) :
32+
$post_id = isset($_GET['post_id']) ? (int)$_GET['post_id'] :
3333
0;
3434

3535
if (!$post_id || !$attach_id) die(_MD_NO_SUCH_FILE.': post_id:'.$post_id.'; attachid'.$attachid);

edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
{
3232
$ {
3333
$getint }
34-
= isset($_GET[$getint]) ? intval($_GET[$getint]) :
34+
= isset($_GET[$getint]) ? (int)$_GET[$getint] :
3535
0;
3636
}
3737
$viewmode = (isset($_GET['viewmode']) && $_GET['viewmode'] != 'flat') ? 'thread' :

include/forumform.inc.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030

3131
if (empty($forum_obj))
3232
{
33-
$forum_handler = icms_getmodulehandler('forum', basename(dirname(dirname(__FILE__ ) ) ), 'iforum' );
34-
$forum = isset($_GET['forum']) ? intval($_GET['forum']) :
35-
(isset($forum) ? intval($forum) : 0);
33+
$forum_handler = icms_getmodulehandler('forum', basename(dirname(__DIR__) ), 'iforum' );
34+
$forum = isset($_GET['forum']) ? (int)$_GET['forum'] :
35+
(isset($forum) ? (int)$forum : 0);
3636
$forum_obj = $forum_handler->get($forum);
3737
}
3838

@@ -47,7 +47,7 @@
4747
{
4848
$ {
4949
$getint }
50-
= isset($_GET[$getint]) ? intval($_GET[$getint]) :
50+
= isset($_GET[$getint]) ? (int)$_GET[$getint] :
5151
((!empty($ {
5252
$getint }
5353
))?$ {

index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
/* deal with marks */
2929
if (isset($_GET['mark_read']))
3030
{
31-
if (1 == intval($_GET['mark_read']))
31+
if (1 == (int)$_GET['mark_read'])
3232
{
3333
// marked as read
3434
$markvalue = 1;
@@ -45,7 +45,7 @@
4545
redirect_header($url, 2, _MD_ALL_FORUM_MARKED.' '.$markresult);
4646
}
4747

48-
$viewcat = @intval($_GET['cat']);
48+
$viewcat = @(int)$_GET['cat'];
4949
$category_handler = icms_getmodulehandler('category', basename(__DIR__), 'iforum' );
5050

5151
$categories = array();
@@ -186,7 +186,7 @@
186186

187187
$isadmin = iforum_isAdmin();
188188
$icmsTpl->assign('viewer_level', ($isadmin)?2:(is_object(icms::$user)?1:0) );
189-
$mode = (!empty($_GET['mode'])) ? intval($_GET['mode']) :
189+
$mode = (!empty($_GET['mode'])) ? (int)$_GET['mode'] :
190190
0;
191191
$icmsTpl->assign('mode', $mode );
192192

0 commit comments

Comments
 (0)