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 (http://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 */ |
||
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 */ |
||
28 | $topicHandler = xoops_getModuleHandler('topic'); |
||
29 | $topicObject = $topicHandler->create(); |
||
30 | $topicObject->setVar('forum_id', $forum); |
||
31 | View Code Duplication | if (!$topicHandler->getPermission($forumObject, 0, 'post')) { |
|
0 ignored issues
–
show
|
|||
32 | /* |
||
33 | * Build the page query |
||
34 | */ |
||
35 | $query_vars = ['forum', 'order', 'mode', 'viewmode']; |
||
36 | $query_array = []; |
||
37 | foreach ($query_vars as $var) { |
||
38 | if (Request::getString($var, '', 'GET')) { |
||
39 | $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); |
||
40 | } |
||
41 | } |
||
42 | $page_query = htmlspecialchars(implode('&', array_values($query_array))); |
||
43 | unset($query_array); |
||
44 | redirect_header(XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query}", 2, _MD_NEWBB_NORIGHTTOPOST); |
||
45 | } |
||
46 | |||
47 | if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { |
||
48 | /** @var \NewbbOnlineHandler $onlineHandler */ |
||
49 | $onlineHandler = xoops_getModuleHandler('online'); |
||
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 ($GLOBALS['xoopsModuleConfig']['disc_show'] == 1 || $GLOBALS['xoopsModuleConfig']['disc_show'] == 3) { |
|
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; |
||
69 | $require_reply = 0; |
||
70 | $attachsig = (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->getVar('attachsig')) ? 1 : 0; |
||
71 | $post_id = 0; |
||
72 | $topic_id = 0; |
||
73 | include __DIR__ . '/include/form.post.php'; |
||
74 | |||
75 | include_once __DIR__ . '/footer.php'; |
||
76 | include $GLOBALS['xoops']->path('footer.php'); |
||
77 |
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.