These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * NewBB 5.0x, the forum module for XOOPS project |
||
4 | * |
||
5 | * @copyright XOOPS Project (https://xoops.org) |
||
6 | * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
||
7 | * @author Taiwen Jiang (phppp or D.J.) <[email protected]> |
||
8 | * @since 4.00 |
||
9 | * @package module::newbb |
||
10 | */ |
||
11 | |||
12 | use Xmf\Request; |
||
13 | |||
14 | include_once __DIR__ . '/header.php'; |
||
15 | |||
16 | if (!$forum = Request::getString('forum', '', 'GET')) { |
||
17 | redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_ERRORFORUM); |
||
18 | } |
||
19 | |||
20 | ///** @var \NewbbForumHandler $forumHandler */ |
||
0 ignored issues
–
show
|
|||
21 | //$forumHandler = xoops_getModuleHandler('forum'); |
||
22 | $forumObject = $forumHandler->get($forum); |
||
23 | if (!$forumHandler->getPermission($forumObject)) { |
||
24 | redirect_header(XOOPS_URL . '/index.php', 2, _NOPERM); |
||
25 | } |
||
26 | |||
27 | ///** @var \NewbbTopicHandler $topicHandler */ |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
54% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
28 | //$topicHandler = xoops_getModuleHandler('topic', 'newbb'); |
||
29 | $topicObject = $topicHandler->create(); |
||
30 | $topicObject->setVar('forum_id', $forum); |
||
31 | View Code Duplication | if (!$topicHandler->getPermission($forumObject, 0, 'post')) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
32 | /* |
||
33 | * Build the page query |
||
34 | */ |
||
35 | $query_vars = ['forum', 'order', 'mode', 'viewmode']; |
||
0 ignored issues
–
show
$query_vars does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() |
|||
36 | $query_array = []; |
||
0 ignored issues
–
show
$query_array does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() |
|||
37 | foreach ($query_vars as $var) { |
||
0 ignored issues
–
show
$query_vars does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() |
|||
38 | if (Request::getString($var, '', 'GET')) { |
||
39 | $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); |
||
0 ignored issues
–
show
$query_array does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() |
|||
40 | } |
||
41 | } |
||
42 | $page_query = htmlspecialchars(implode('&', array_values($query_array))); |
||
0 ignored issues
–
show
$page_query does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() |
|||
43 | unset($query_array); |
||
0 ignored issues
–
show
$query_array does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() |
|||
44 | redirect_header(XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query}", 2, _MD_NEWBB_NORIGHTTOPOST); |
||
0 ignored issues
–
show
$page_query does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() |
|||
45 | } |
||
46 | |||
47 | if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { |
||
48 | // /** @var \NewbbOnlineHandler $onlineHandler */ |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
42% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
49 | // $onlineHandler = xoops_getModuleHandler('online', 'newbb'); |
||
50 | $onlineHandler->init($forumObject); |
||
51 | } |
||
52 | |||
53 | $xoopsOption['template_main'] = 'newbb_edit_post.tpl'; |
||
54 | $GLOBALS['xoopsConfig']['module_cache'][$xoopsModule->getVar('mid')] = 0; // Disable cache |
||
55 | include_once $GLOBALS['xoops']->path('header.php'); |
||
56 | |||
57 | View Code Duplication | if (1 == $GLOBALS['xoopsModuleConfig']['disc_show'] || 3 == $GLOBALS['xoopsModuleConfig']['disc_show']) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
58 | $xoopsTpl->assign('disclaimer', $GLOBALS['xoopsModuleConfig']['disclaimer']); |
||
59 | } |
||
60 | |||
61 | $subject = ''; |
||
62 | $message = ''; |
||
63 | $dohtml = 1; |
||
64 | $dosmiley = 1; |
||
65 | $doxcode = 1; |
||
66 | $dobr = 1; |
||
67 | $icon = ''; |
||
68 | $post_karma = 0; |
||
0 ignored issues
–
show
$post_karma does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() |
|||
69 | $require_reply = 0; |
||
0 ignored issues
–
show
$require_reply does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() |
|||
70 | $attachsig = (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->getVar('attachsig')) ? 1 : 0; |
||
71 | $post_id = 0; |
||
0 ignored issues
–
show
$post_id does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() |
|||
72 | $topic_id = 0; |
||
0 ignored issues
–
show
$topic_id does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() |
|||
73 | include __DIR__ . '/include/form.post.php'; |
||
74 | |||
75 | include_once __DIR__ . '/footer.php'; |
||
76 | include $GLOBALS['xoops']->path('footer.php'); |
||
77 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.