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 module |
||
4 | * |
||
5 | * You may not change or alter any portion of this comment or credits |
||
6 | * of supporting developers from this source code or any supporting source code |
||
7 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||
8 | * This program is distributed in the hope that it will be useful, |
||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
11 | * |
||
12 | * @copyright XOOPS Project (https://xoops.org) |
||
13 | * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
||
14 | * @package newbb |
||
15 | * @since 4.0 |
||
16 | * @author Taiwen Jiang <[email protected]> |
||
17 | */ |
||
18 | |||
19 | use Xmf\Request; |
||
20 | |||
21 | include_once __DIR__ . '/header.php'; |
||
22 | |||
23 | foreach ([ |
||
24 | 'forum', |
||
25 | 'topic_id', |
||
26 | 'post_id', |
||
27 | 'order', |
||
28 | 'pid', |
||
29 | 'start', |
||
30 | 'isreply', |
||
31 | 'isedit' |
||
32 | ] as $getint) { |
||
33 | ${$getint} = Request::getInt($getint, 0, 'POST'); |
||
34 | } |
||
35 | |||
36 | $op = Request::getCmd('op', '', 'POST'); |
||
37 | $viewmode = ('flat' !== Request::getString('viewmode', '', 'POST')) ? 'thread' : 'flat'; |
||
38 | if (empty($forum)) { |
||
39 | redirect_header('index.php', 2, _MD_NEWBB_ERRORFORUM); |
||
40 | } |
||
41 | |||
42 | ///** @var \NewbbForumHandler $forumHandler */ |
||
0 ignored issues
–
show
|
|||
43 | //$forumHandler = xoops_getModuleHandler('forum', 'newbb'); |
||
44 | ///** @var \NewbbTopicHandler $topicHandler */ |
||
45 | //$topicHandler = xoops_getModuleHandler('topic', 'newbb'); |
||
46 | ///** @var \NewbbPostHandler $postHandler */ |
||
47 | //$postHandler = xoops_getModuleHandler('post', 'newbb'); |
||
48 | |||
49 | if (!empty($isedit) && $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. ![]() |
|||
50 | /** @var NewbbPost $postObject */ |
||
51 | $postObject = $postHandler->get($post_id); |
||
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. ![]() |
|||
52 | $topic_id = $postObject->getVar('topic_id'); |
||
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. ![]() |
|||
53 | } else { |
||
54 | $postObject = $postHandler->create(); |
||
55 | } |
||
56 | $topicObject = $topicHandler->get($topic_id); |
||
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. ![]() |
|||
57 | $forum_id = $topic_id ? $topicObject->getVar('forum_id') : $forum; |
||
0 ignored issues
–
show
$forum_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. ![]() |
|||
58 | $forumObject = $forumHandler->get($forum_id); |
||
0 ignored issues
–
show
$forum_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. ![]() |
|||
59 | if (!$forumHandler->getPermission($forumObject)) { |
||
60 | redirect_header('index.php', 2, _NOPERM); |
||
61 | } |
||
62 | |||
63 | if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { |
||
64 | // /** @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. ![]() |
|||
65 | // $onlineHandler = xoops_getModuleHandler('online', 'newbb'); |
||
66 | $onlineHandler->init($forumObject); |
||
67 | } |
||
68 | |||
69 | $error_message = []; |
||
0 ignored issues
–
show
$error_message 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 | |||
71 | if (Request::getString('contents_submit', '', 'POST')) { |
||
72 | $token_valid = false; |
||
0 ignored issues
–
show
$token_valid 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 | $token_valid = $GLOBALS['xoopsSecurity']->check(); |
||
0 ignored issues
–
show
$token_valid 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. ![]() |
|||
74 | |||
75 | $captcha_invalid = false; |
||
0 ignored issues
–
show
$captcha_invalid 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. ![]() |
|||
76 | if (!is_object($GLOBALS['xoopsUser']) && Request::hasVar('uname', 'POST') && Request::hasVar('pass', 'POST')) { |
||
77 | $uname = Request::getString('uname', '', 'POST'); |
||
78 | $pass = Request::getString('pass', '', 'POST'); |
||
79 | /** @var \XoopsMemberHandler $memberHandler */ |
||
80 | $memberHandler = xoops_getHandler('member'); |
||
81 | $user = $memberHandler->loginUser($uname, $pass); |
||
82 | if (is_object($user) && 0 < $user->getVar('level')) { |
||
83 | if (Request::getString('login', '', 'POST')) { |
||
84 | $user->setVar('last_login', time()); |
||
85 | if (!$memberHandler->insertUser($user)) { |
||
0 ignored issues
–
show
This
if statement is empty and can be removed.
This check looks for the bodies of These if (rand(1, 6) > 3) {
//print "Check failed";
} else {
print "Check succeeded";
}
could be turned into if (rand(1, 6) <= 3) {
print "Check succeeded";
}
This is much more concise to read. ![]() |
|||
86 | } |
||
87 | $_SESSION = []; |
||
88 | $_SESSION['xoopsUserId'] = $user->getVar('uid'); |
||
89 | $_SESSION['xoopsUserGroups'] = $user->getGroups(); |
||
90 | if ($GLOBALS['xoopsConfig']['use_mysession'] && '' !== $GLOBALS['xoopsConfig']['session_name']) { |
||
91 | setcookie($GLOBALS['xoopsConfig']['session_name'], session_id(), time() + (60 * $GLOBALS['xoopsConfig']['session_expire']), '/', '', 0); |
||
92 | } |
||
93 | $user_theme = $user->getVar('theme'); |
||
0 ignored issues
–
show
$user_theme 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. ![]() |
|||
94 | if (in_array($user_theme, $GLOBALS['xoopsConfig']['theme_set_allowed'])) { |
||
0 ignored issues
–
show
$user_theme 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. ![]() |
|||
95 | $_SESSION['xoopsUserTheme'] = $user_theme; |
||
0 ignored issues
–
show
$user_theme 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. ![]() |
|||
96 | } |
||
97 | } |
||
98 | $GLOBALS['xoopsUser'] = $user; |
||
99 | $xoopsUserIsAdmin = $GLOBALS['xoopsUser']->isAdmin($xoopsModule->getVar('mid')); |
||
100 | } |
||
101 | } |
||
102 | View Code Duplication | if (!is_object($GLOBALS['xoopsUser'])) { |
|
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. ![]() |
|||
103 | xoops_load('captcha'); |
||
104 | $xoopsCaptcha = XoopsCaptcha::getInstance(); |
||
105 | if (!$xoopsCaptcha->verify()) { |
||
106 | $captcha_invalid = true; |
||
0 ignored issues
–
show
$captcha_invalid 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. ![]() |
|||
107 | $error_message[] = $xoopsCaptcha->getMessage(); |
||
0 ignored issues
–
show
$error_message 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. ![]() |
|||
108 | } |
||
109 | } |
||
110 | |||
111 | $isAdmin = newbbIsAdmin($forumObject); |
||
112 | |||
113 | $time_valid = true; |
||
0 ignored issues
–
show
$time_valid 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. ![]() |
|||
114 | if (!$isAdmin && !empty($GLOBALS['xoopsModuleConfig']['post_timelimit'])) { |
||
115 | $last_post = newbbGetSession('LP'); |
||
0 ignored issues
–
show
$last_post 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. ![]() |
|||
116 | if (time() - $last_post < $GLOBALS['xoopsModuleConfig']['post_timelimit']) { |
||
0 ignored issues
–
show
$last_post 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. ![]() |
|||
117 | $time_valid = false; |
||
0 ignored issues
–
show
$time_valid 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. ![]() |
|||
118 | } |
||
119 | } |
||
120 | |||
121 | if ($captcha_invalid || !$token_valid || !$time_valid) { |
||
0 ignored issues
–
show
$captcha_invalid 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. ![]() |
|||
122 | $_POST['contents_preview'] = 1; |
||
123 | $_POST['contents_submit'] = null; |
||
124 | $_POST['contents_upload'] = null; |
||
125 | if (!$token_valid) { |
||
0 ignored issues
–
show
$token_valid 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. ![]() |
|||
126 | $error_message[] = _MD_NEWBB_INVALID_SUBMIT; |
||
0 ignored issues
–
show
$error_message 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. ![]() |
|||
127 | } |
||
128 | if (!$time_valid) { |
||
0 ignored issues
–
show
$time_valid 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. ![]() |
|||
129 | $error_message[] = sprintf(_MD_NEWBB_POSTING_LIMITED, $GLOBALS['xoopsModuleConfig']['post_timelimit']); |
||
0 ignored issues
–
show
$error_message 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. ![]() |
|||
130 | } |
||
131 | } |
||
132 | } |
||
133 | |||
134 | if (Request::getString('contents_submit', '', 'POST')) { |
||
135 | $message = Request::getText('message', '', 'POST'); |
||
136 | if (empty($message)) { |
||
137 | // irmtfan - issue with javascript:history.go(-1) - add error message |
||
138 | redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 1, _MD_NEWBB_ERROR_BACK); |
||
139 | } |
||
140 | if (!empty($isedit) && $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. ![]() |
|||
141 | $uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
||
142 | |||
143 | $topic_status = $topicObject->getVar('topic_status'); |
||
0 ignored issues
–
show
$topic_status 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. ![]() |
|||
144 | if ($topicHandler->getPermission($forumObject, $topic_status, 'edit') |
||
0 ignored issues
–
show
This
if statement is empty and can be removed.
This check looks for the bodies of These if (rand(1, 6) > 3) {
//print "Check failed";
} else {
print "Check succeeded";
}
could be turned into if (rand(1, 6) <= 3) {
print "Check succeeded";
}
This is much more concise to read. ![]() $topic_status 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. ![]() |
|||
145 | && ($isAdmin |
||
146 | || ($postObject->checkTimelimit('edit_timelimit') |
||
147 | && $postObject->checkIdentity()))) { |
||
148 | } else { |
||
149 | redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?forum={$forum_id}&topic_id={$topic_id}&post_id={$post_id}&order={$order}&viewmode={$viewmode}", 2, _MD_NEWBB_NORIGHTTOEDIT); |
||
0 ignored issues
–
show
$forum_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. ![]() |
|||
150 | } |
||
151 | |||
152 | $delete_attach = Request::getArray('delete_attach', [], 'POST'); |
||
0 ignored issues
–
show
$delete_attach 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. ![]() |
|||
153 | if (is_array($delete_attach) && count($delete_attach) > 0) { |
||
0 ignored issues
–
show
$delete_attach 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. ![]() |
|||
154 | $postObject->deleteAttachment($delete_attach); |
||
0 ignored issues
–
show
$delete_attach 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. ![]() |
|||
155 | } |
||
156 | } else { |
||
157 | if ($topic_id) { |
||
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. ![]() |
|||
158 | $topic_status = $topicObject->getVar('topic_status'); |
||
0 ignored issues
–
show
$topic_status 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. ![]() |
|||
159 | if (!$topicHandler->getPermission($forumObject, $topic_status, 'reply')) { |
||
0 ignored issues
–
show
$topic_status 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. ![]() |
|||
160 | redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?forum={$forum_id}&topic_id={$topic_id}&post_id={$post_id}&order={$order}&viewmode={$viewmode}", 2, _MD_NEWBB_NORIGHTTOREPLY); |
||
0 ignored issues
–
show
$forum_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. ![]() |
|||
161 | } |
||
162 | } else { |
||
163 | $topic_status = 0; |
||
0 ignored issues
–
show
$topic_status 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. ![]() |
|||
164 | if (!$topicHandler->getPermission($forumObject, $topic_status, 'post')) { |
||
0 ignored issues
–
show
$topic_status 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. ![]() |
|||
165 | redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?forum={$forum_id}", 2, _MD_NEWBB_NORIGHTTOPOST); |
||
0 ignored issues
–
show
$forum_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. ![]() |
|||
166 | } |
||
167 | } |
||
168 | |||
169 | $isreply = 0; |
||
170 | $isnew = 1; |
||
171 | if (!is_object($GLOBALS['xoopsUser']) |
||
172 | || (Request::getString('noname', '', 'POST') |
||
173 | && !empty($GLOBALS['xoopsModuleConfig']['allow_user_anonymous']))) { |
||
174 | $uid = 0; |
||
175 | } else { |
||
176 | $uid = $GLOBALS['xoopsUser']->getVar('uid'); |
||
177 | } |
||
178 | if (!empty($pid)) { |
||
179 | $postObject->setVar('pid', $pid); |
||
180 | } |
||
181 | if (!empty($topic_id)) { |
||
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. ![]() |
|||
182 | $postObject->setVar('topic_id', $topic_id); |
||
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. ![]() |
|||
183 | $isreply = 1; |
||
184 | } |
||
185 | $postObject->setVar('poster_ip', Xmf\IPAddress::fromRequest()->asReadable()); |
||
186 | $postObject->setVar('uid', $uid); |
||
187 | $postObject->setVar('post_time', time()); |
||
188 | } |
||
189 | |||
190 | $approved = $topicHandler->getPermission($forumObject, $topic_status, 'noapprove'); |
||
0 ignored issues
–
show
$topic_status 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. ![]() |
|||
191 | $postObject->setVar('approved', $approved); |
||
192 | |||
193 | $postObject->setVar('forum_id', $forumObject->getVar('forum_id')); |
||
194 | |||
195 | $subject = xoops_trim(Request::getString('subject', '', 'POST')); |
||
196 | $subject = ('' === $subject) ? _NOTITLE : $subject; |
||
197 | $poster_name = xoops_trim(Request::getString('poster_name', '', 'POST')); |
||
0 ignored issues
–
show
$poster_name 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. ![]() |
|||
198 | $dohtml = Request::getInt('dohtml', 0, 'POST') |
||
199 | && $topicHandler->getPermission($forumObject, $topic_status, 'html'); |
||
0 ignored issues
–
show
$topic_status 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. ![]() |
|||
200 | $dosmiley = Request::getInt('dosmiley', 0, 'POST'); |
||
201 | $doxcode = Request::getInt('doxcode', 0, 'POST') ? 1 : 0; |
||
202 | $dobr = Request::getInt('dobr', 0, 'POST') ? 1 : 0; |
||
203 | $icon = (Request::getString('icon', '', 'POST') |
||
204 | && is_file($GLOBALS['xoops']->path('images/subject/' . Request::getString('icon', '', 'POST'))) ? Request::getString('icon', '', 'POST') : ''); |
||
205 | $attachsig = Request::getBool('attachsig', false, 'POST') |
||
206 | && $topicHandler->getPermission($forumObject, $topic_status, 'signature'); |
||
0 ignored issues
–
show
$topic_status 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. ![]() |
|||
207 | $view_require = Request::getString('view_require', '', 'POST'); |
||
0 ignored issues
–
show
$view_require 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. ![]() |
|||
208 | $post_karma = ('require_karma' === $view_require) ? Request::getInt('post_karma', 0, 'POST') : 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. ![]() |
|||
209 | $require_reply = ('require_reply' === $view_require); |
||
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. ![]() |
|||
210 | $postObject->setVar('subject', $subject); |
||
211 | $editwhy = xoops_trim(Request::getString('editwhy', '', 'POST')); // !empty($_POST['editwhy'])) ? xoops_trim($_POST['editwhy']) : ""; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
76% 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. ![]() |
|||
212 | |||
213 | if ($dohtml && !newbbIsAdmin($forumObject)) { |
||
0 ignored issues
–
show
This
if statement is empty and can be removed.
This check looks for the bodies of These if (rand(1, 6) > 3) {
//print "Check failed";
} else {
print "Check succeeded";
}
could be turned into if (rand(1, 6) <= 3) {
print "Check succeeded";
}
This is much more concise to read. ![]() |
|||
214 | //$message=newbb_textFilter($message); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
72% 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. ![]() |
|||
215 | } |
||
216 | $postObject->setVar('post_text', $message); |
||
217 | $postObject->setVar('post_karma', $post_karma); |
||
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. ![]() |
|||
218 | $postObject->setVar('require_reply', $require_reply); |
||
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. ![]() |
|||
219 | $postObject->setVar('poster_name', $poster_name); |
||
0 ignored issues
–
show
$poster_name 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. ![]() |
|||
220 | $postObject->setVar('dohtml', $dohtml); |
||
221 | $postObject->setVar('dosmiley', $dosmiley); |
||
222 | $postObject->setVar('doxcode', $doxcode); |
||
223 | $postObject->setVar('dobr', $dobr); |
||
224 | $postObject->setVar('icon', $icon); |
||
225 | $postObject->setVar('attachsig', $attachsig); |
||
226 | $postObject->setAttachment(); |
||
227 | if (!empty($post_id)) { |
||
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. ![]() |
|||
228 | $postObject->setPostEdit($poster_name, $editwhy); |
||
0 ignored issues
–
show
$poster_name 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. ![]() |
|||
229 | } // is reply |
||
230 | |||
231 | // $attachments_tmp = array(); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
56% 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. ![]() |
|||
232 | // if (!empty($_POST["attachments_tmp"])) { |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
80% 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. ![]() |
|||
233 | View Code Duplication | if (Request::getString('attachments_tmp', '', '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. ![]() |
|||
234 | $attachments_tmp = unserialize(base64_decode(Request::getString('attachments_tmp', '', 'POST'))); |
||
0 ignored issues
–
show
$attachments_tmp 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. ![]() |
|||
235 | if (Request::getArray('delete_tmp', null, 'POST') && count(Request::getArray('delete_tmp', null, 'POST')) > 1) { |
||
236 | foreach (Request::getArray('delete_tmp', null, 'POST') as $key) { |
||
237 | unlink($GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attachments_tmp[$key][0])); |
||
0 ignored issues
–
show
$attachments_tmp 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. ![]() |
|||
238 | unset($attachments_tmp[$key]); |
||
0 ignored issues
–
show
$attachments_tmp 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. ![]() |
|||
239 | } |
||
240 | } |
||
241 | } |
||
242 | if (isset($attachments_tmp) && count($attachments_tmp)) { |
||
0 ignored issues
–
show
$attachments_tmp 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. ![]() |
|||
243 | foreach ($attachments_tmp as $key => $attach) { |
||
0 ignored issues
–
show
$attachments_tmp 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. ![]() |
|||
244 | if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attachments_tmp[$key][0]))) { |
||
0 ignored issues
–
show
$attachments_tmp 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. ![]() |
|||
245 | $postObject->setAttachment($attach[0], $attach[1], $attach[2]); |
||
246 | } |
||
247 | } |
||
248 | } |
||
249 | $error_upload = ''; |
||
0 ignored issues
–
show
$error_upload 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. ![]() |
|||
250 | |||
251 | if (isset($_FILES['userfile']['name']) && '' !== $_FILES['userfile']['name'] |
||
252 | && $topicHandler->getPermission($forumObject, $topic_status, 'attach')) { |
||
0 ignored issues
–
show
$topic_status 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. ![]() |
|||
253 | require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php'); |
||
254 | $maxfilesize = $forumObject->getVar('attach_maxkb') * 1024; |
||
255 | $uploaddir = XOOPS_CACHE_PATH; |
||
256 | |||
257 | $uploader = new NewbbUploader($uploaddir, $forumObject->getVar('attach_ext'), (int)$maxfilesize, (int)$GLOBALS['xoopsModuleConfig']['max_img_width'], (int)$GLOBALS['xoopsModuleConfig']['max_img_height']); |
||
258 | |||
259 | if ($_FILES['userfile']['error'] > 0) { |
||
260 | View Code Duplication | switch ($_FILES['userfile']['error']) { |
|
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. ![]() |
|||
261 | case 1: |
||
262 | $error_message[] = _MD_NEWBB_MAXUPLOADFILEINI; |
||
0 ignored issues
–
show
$error_message 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. ![]() |
|||
263 | break; |
||
264 | case 2: |
||
265 | $error_message[] = sprintf(_MD_NEWBB_MAXKB, $forumObject->getVar('attach_maxkb')); |
||
0 ignored issues
–
show
$error_message 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. ![]() |
|||
266 | break; |
||
267 | default: |
||
268 | $error_message[] = _MD_NEWBB_UPLOAD_ERRNODEF; |
||
0 ignored issues
–
show
$error_message 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. ![]() |
|||
269 | break; |
||
270 | } |
||
271 | } else { |
||
272 | $uploader->setCheckMediaTypeByExt(); |
||
273 | $temp = Request::getArray('xoops_upload_file', [], 'POST'); |
||
274 | if ($uploader->fetchMedia($temp[0])) { |
||
275 | $prefix = is_object($GLOBALS['xoopsUser']) ? (string)$GLOBALS['xoopsUser']->uid() . '_' : 'newbb_'; |
||
276 | $uploader->setPrefix($prefix); |
||
277 | if (!$uploader->upload()) { |
||
278 | $error_message[] = $error_upload = $uploader->getErrors(); |
||
0 ignored issues
–
show
$error_message 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. ![]() |
|||
279 | } else { |
||
280 | if (is_file($uploader->getSavedDestination())) { |
||
281 | if (rename(XOOPS_CACHE_PATH . '/' . $uploader->getSavedFileName(), $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $uploader->getSavedFileName()))) { |
||
282 | $postObject->setAttachment($uploader->getSavedFileName(), $uploader->getMediaName(), $uploader->getMediaType()); |
||
283 | } |
||
284 | } |
||
285 | } |
||
286 | } else { |
||
287 | $error_message[] = $error_upload = $uploader->getErrors(); |
||
0 ignored issues
–
show
$error_message 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. ![]() |
|||
288 | } |
||
289 | } |
||
290 | } |
||
291 | |||
292 | $postid = $postHandler->insert($postObject); |
||
293 | |||
294 | if (!$postid) { |
||
295 | include_once $GLOBALS['xoops']->path('header.php'); |
||
296 | xoops_error($postObject->getErrors()); |
||
297 | include_once $GLOBALS['xoops']->path('footer.php'); |
||
298 | } |
||
299 | newbbSetSession('LP', time()); // Recording last post time |
||
300 | $topicObject = $topicHandler->get($postObject->getVar('topic_id')); |
||
301 | $uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
||
302 | if (newbbIsAdmin($forumObject) |
||
303 | || ($topicHandler->getPermission($forumObject, $topic_status, 'type') |
||
0 ignored issues
–
show
$topic_status 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. ![]() |
|||
304 | && (0 == $topic_id |
||
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. ![]() |
|||
305 | || $uid == $topicObject->getVar('topic_poster')))) { |
||
306 | $topicObject->setVar('type_id', Request::getInt('type_id', 0, 'POST')); |
||
307 | } |
||
308 | |||
309 | if (!empty($GLOBALS['xoopsModuleConfig']['do_tag']) && $postObject->isTopic()) { |
||
310 | $topicObject->setVar('topic_tags', Request::getInt('topic_tags', 0, 'POST')); |
||
311 | } |
||
312 | $topicHandler->insert($topicObject); |
||
313 | |||
314 | // Set read mark |
||
315 | if (!empty($isnew)) { |
||
316 | require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.read.php'); |
||
317 | newbbSetRead('topic', $topicObject->getVar('topic_id'), $postid); |
||
318 | if (!$postObject->getVar('pid')) { |
||
319 | newbbSetRead('forum', $forumObject->getVar('forum_id'), $postid); |
||
320 | } |
||
321 | } |
||
322 | |||
323 | //$postObject->loadFilters(empty($isnew) ? 'update' : 'insert'); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
73% 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. ![]() |
|||
324 | |||
325 | // Define tags for notification message |
||
326 | if (!empty($isnew) && $approved && !empty($GLOBALS['xoopsModuleConfig']['notification_enabled'])) { |
||
327 | $tags = []; |
||
328 | $tags['THREAD_NAME'] = Request::getString('subject', '', 'POST'); |
||
329 | $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/viewtopic.php?post_id=' . $postid; |
||
330 | $tags['POST_URL'] = $tags['THREAD_URL']; // . '#forumpost' . $postid; |
||
331 | include_once __DIR__ . '/include/notification.inc.php'; |
||
332 | $forum_info = newbb_notify_iteminfo('forum', $forumObject->getVar('forum_id')); |
||
0 ignored issues
–
show
$forum_info 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. ![]() |
|||
333 | $tags['FORUM_NAME'] = $forum_info['name']; |
||
0 ignored issues
–
show
$forum_info 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. ![]() |
|||
334 | $tags['FORUM_URL'] = $forum_info['url']; |
||
0 ignored issues
–
show
$forum_info 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. ![]() |
|||
335 | /** @var \XoopsNotificationHandler $notificationHandler */ |
||
336 | $notificationHandler = xoops_getHandler('notification'); |
||
337 | if (empty($isreply)) { |
||
338 | // Notify of new thread |
||
339 | $notificationHandler->triggerEvent('forum', $forumObject->getVar('forum_id'), 'new_thread', $tags); |
||
340 | } else { |
||
341 | // Notify of new post |
||
342 | $notificationHandler->triggerEvent('thread', $topic_id, 'new_post', $tags); |
||
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. ![]() |
|||
343 | $_tags['name'] = $tags['THREAD_NAME']; |
||
0 ignored issues
–
show
$_tags 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. ![]() |
|||
344 | $_tags['url'] = $tags['POST_URL']; |
||
0 ignored issues
–
show
$_tags 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. ![]() |
|||
345 | $_tags['uid'] = $uid; |
||
0 ignored issues
–
show
$_tags 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. ![]() |
|||
346 | $notificationHandler->triggerEvent('thread', $topic_id, 'post', $_tags); |
||
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. ![]() |
|||
347 | } |
||
348 | $notificationHandler->triggerEvent('global', 0, 'new_post', $tags); |
||
349 | $notificationHandler->triggerEvent('forum', $forumObject->getVar('forum_id'), 'new_post', $tags); |
||
350 | $tags['POST_CONTENT'] = Request::getString('message', '', 'POST'); |
||
351 | $tags['POST_NAME'] = Request::getString('subject', '', 'POST'); |
||
352 | $notificationHandler->triggerEvent('global', 0, 'new_fullpost', $tags); |
||
353 | $notificationHandler->triggerEvent('forum', $forumObject->getVar('forum_id'), 'new_fullpost', $tags); |
||
354 | } |
||
355 | |||
356 | // If user checked notification box, subscribe them to the |
||
357 | // appropriate event; if unchecked, then unsubscribe |
||
358 | if (!empty($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsModuleConfig']['notification_enabled'])) { |
||
359 | $notificationHandler = xoops_getHandler('notification'); |
||
360 | if (!Request::getInt('notify', 0, 'POST')) { |
||
361 | $notificationHandler->unsubscribe('thread', $postObject->getVar('topic_id'), 'new_post'); |
||
362 | } elseif (Request::getInt('notify', 0, 'POST') > 0) { |
||
363 | $notificationHandler->subscribe('thread', $postObject->getVar('topic_id'), 'new_post'); |
||
364 | } |
||
365 | // elseif ($_POST['notify']<0) keep it as it is |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
43% 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. ![]() |
|||
366 | } |
||
367 | |||
368 | if ($approved) { |
||
369 | if (!empty($GLOBALS['xoopsModuleConfig']['cache_enabled'])) { |
||
370 | newbbSetSession('t' . $postObject->getVar('topic_id'), null); |
||
371 | } |
||
372 | // Update user |
||
373 | if ($uid > 0) { |
||
374 | $sql = 'SELECT count(*)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' WHERE approved=1 AND topic_poster =' . $uid; |
||
375 | $ret = $GLOBALS['xoopsDB']->query($sql); |
||
376 | list($topics) = $GLOBALS['xoopsDB']->fetchRow($ret); |
||
377 | |||
378 | $sql = ' SELECT count(*)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' WHERE approved=1 AND topic_digest > 0 AND topic_poster =' . $uid; |
||
379 | $ret = $GLOBALS['xoopsDB']->query($sql); |
||
380 | list($digests) = $GLOBALS['xoopsDB']->fetchRow($ret); |
||
381 | |||
382 | $sql = ' SELECT count(*), MAX(post_time)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' WHERE approved=1 AND uid =' . $uid; |
||
383 | $ret = $GLOBALS['xoopsDB']->query($sql); |
||
384 | list($posts, $lastpost) = $GLOBALS['xoopsDB']->fetchRow($ret); |
||
385 | |||
386 | $GLOBALS['xoopsDB']->queryF(' REPLACE INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_user_stats') . " SET uid = '{$uid}', user_topics = '{$topics}', user_posts = '{$posts}', user_digests = '{$digests}', user_lastpost = '{$lastpost}'"); |
||
387 | } |
||
388 | |||
389 | $redirect = XOOPS_URL . '/modules/newbb/viewtopic.php?post_id=' . $postid; |
||
390 | $message = _MD_NEWBB_THANKSSUBMIT . '<br>' . $error_upload; |
||
0 ignored issues
–
show
$error_upload 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. ![]() |
|||
391 | } else { |
||
392 | $redirect = XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $postObject->getVar('forum_id'); |
||
393 | $message = _MD_NEWBB_THANKSSUBMIT . '<br>' . _MD_NEWBB_WAITFORAPPROVAL . '<br>' . $error_upload; |
||
0 ignored issues
–
show
$error_upload 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. ![]() |
|||
394 | } |
||
395 | |||
396 | if ('add' === $op) { |
||
397 | redirect_header(XOOPS_URL . '/modules/newbb/polls.php?op=add&forum=' . $postObject->getVar('forum_id') . '&topic_id=' . $postObject->getVar('topic_id'), 1, _MD_NEWBB_ADDPOLL); |
||
398 | } else { |
||
399 | redirect_header($redirect, 2, $message); |
||
400 | } |
||
401 | } |
||
402 | |||
403 | $xoopsOption['template_main'] = 'newbb_edit_post.tpl'; |
||
404 | $GLOBALS['xoopsConfig']['module_cache'][$xoopsModule->getVar('mid')] = 0; |
||
405 | // irmtfan remove and move to footer.php |
||
406 | //$xoopsOption['xoops_module_header']= $xoops_module_header; |
||
407 | // irmtfan include header.php after defining $xoopsOption['template_main'] |
||
408 | include_once $GLOBALS['xoops']->path('header.php'); |
||
409 | //$xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
80% 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. ![]() |
|||
410 | |||
411 | if (Request::getString('contents_upload', null, 'POST')) { |
||
412 | $attachments_tmp = []; |
||
0 ignored issues
–
show
$attachments_tmp 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. ![]() |
|||
413 | View Code Duplication | if (Request::getArray('attachments_tmp', null, '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. ![]() |
|||
414 | $attachments_tmp = unserialize(base64_decode(Request::getArray('attachments_tmp', [], 'POST'))); |
||
0 ignored issues
–
show
$attachments_tmp 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. ![]() |
|||
415 | if (Request::getArray('delete_tmp', null, 'POST') && count(Request::getArray('delete_tmp', null, 'POST'))) { |
||
416 | foreach (Request::getArray('delete_tmp', '', 'POST') as $key) { |
||
417 | unlink($uploaddir = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attachments_tmp[$key][0])); |
||
0 ignored issues
–
show
$attachments_tmp 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. ![]() |
|||
418 | unset($attachments_tmp[$key]); |
||
0 ignored issues
–
show
$attachments_tmp 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. ![]() |
|||
419 | } |
||
420 | } |
||
421 | } |
||
422 | |||
423 | $error_upload = ''; |
||
0 ignored issues
–
show
$error_upload 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. ![]() |
|||
424 | if (isset($_FILES['userfile']['name']) && '' !== $_FILES['userfile']['name']) { |
||
425 | require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php'); |
||
426 | $maxfilesize = $forumObject->getVar('attach_maxkb') * 1024; |
||
427 | $uploaddir = XOOPS_CACHE_PATH; |
||
428 | |||
429 | $uploader = new NewbbUploader($uploaddir, $forumObject->getVar('attach_ext'), (int)$maxfilesize, (int)$GLOBALS['xoopsModuleConfig']['max_img_width'], (int)$GLOBALS['xoopsModuleConfig']['max_img_height']); |
||
430 | if ($_FILES['userfile']['error'] > 0) { |
||
431 | View Code Duplication | switch ($_FILES['userfile']['error']) { |
|
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. ![]() |
|||
432 | case 1: |
||
433 | $error_message[] = _MD_NEWBB_MAXUPLOADFILEINI; |
||
0 ignored issues
–
show
$error_message 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. ![]() |
|||
434 | break; |
||
435 | case 2: |
||
436 | $error_message[] = sprintf(_MD_NEWBB_MAXKB, $forumObject->getVar('attach_maxkb')); |
||
0 ignored issues
–
show
$error_message 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. ![]() |
|||
437 | break; |
||
438 | default: |
||
439 | $error_message[] = _MD_NEWBB_UPLOAD_ERRNODEF; |
||
0 ignored issues
–
show
$error_message 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. ![]() |
|||
440 | break; |
||
441 | } |
||
442 | } else { |
||
443 | $uploader->setCheckMediaTypeByExt(); |
||
444 | $temp = Request::getArray('xoops_upload_file', [], 'POST'); |
||
445 | if ($uploader->fetchMedia($temp[0])) { |
||
446 | $prefix = is_object($GLOBALS['xoopsUser']) ? (string)$GLOBALS['xoopsUser']->uid() . '_' : 'newbb_'; |
||
447 | $uploader->setPrefix($prefix); |
||
448 | if (!$uploader->upload()) { |
||
449 | $error_message[] = $error_upload = $uploader->getErrors(); |
||
0 ignored issues
–
show
$error_message 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. ![]() |
|||
450 | } else { |
||
451 | if (is_file($uploader->getSavedDestination())) { |
||
452 | $attachments_tmp[(string)time()] = [ |
||
0 ignored issues
–
show
$attachments_tmp 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. ![]() |
|||
453 | $uploader->getSavedFileName(), |
||
454 | $uploader->getMediaName(), |
||
455 | $uploader->getMediaType() |
||
456 | ]; |
||
457 | } |
||
458 | } |
||
459 | } else { |
||
460 | $error_message[] = $error_upload = $uploader->getErrors(); |
||
0 ignored issues
–
show
$error_message 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. ![]() |
|||
461 | } |
||
462 | } |
||
463 | } |
||
464 | } |
||
465 | |||
466 | if (Request::getString('contents_preview', Request::getString('contents_preview', '', 'POST'), 'GET')) { |
||
467 | if (Request::getString('attachments_tmp', '', 'POST')) { |
||
468 | $attachments_tmp = unserialize(base64_decode(Request::getString('attachments_tmp', '', 'POST'))); |
||
0 ignored issues
–
show
$attachments_tmp 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. ![]() |
|||
469 | } |
||
470 | |||
471 | $p_subject = $myts->htmlSpecialChars(Request::getString('subject', '', 'POST')); |
||
0 ignored issues
–
show
$p_subject 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. ![]() |
|||
472 | $dosmiley = Request::getInt('dosmiley', 0, 'POST'); |
||
473 | $dohtml = Request::getInt('dohtml', 0, 'POST'); |
||
474 | $doxcode = Request::getInt('doxcode', 0, 'POST'); |
||
475 | $dobr = Request::getInt('dobr', 0, 'POST'); |
||
476 | $p_message = Request::getString('message', '', 'POST'); |
||
0 ignored issues
–
show
$p_message 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. ![]() |
|||
477 | $p_message = $myts->previewTarea($p_message, $dohtml, $dosmiley, $doxcode, 1, $dobr); |
||
0 ignored issues
–
show
$p_message 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. ![]() |
|||
478 | $p_date = formatTimestamp(time()); |
||
0 ignored issues
–
show
$p_date 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. ![]() |
|||
479 | if ($postObject->isNew()) { |
||
480 | View Code Duplication | if (is_object($GLOBALS['xoopsUser'])) { |
|
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. ![]() |
|||
481 | $p_name = $GLOBALS['xoopsUser']->getVar('uname'); |
||
0 ignored issues
–
show
$p_name 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. ![]() |
|||
482 | if (!empty($GLOBALS['xoopsModuleConfig']['show_realname']) && $GLOBALS['xoopsUser']->getVar('name')) { |
||
483 | $p_name = $GLOBALS['xoopsUser']->getVar('name'); |
||
0 ignored issues
–
show
$p_name 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. ![]() |
|||
484 | } |
||
485 | } |
||
486 | } elseif ($postObject->getVar('uid')) { |
||
487 | $p_name = newbbGetUnameFromId($postObject->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']); |
||
0 ignored issues
–
show
$p_name 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. ![]() |
|||
488 | } |
||
489 | if (empty($p_name)) { |
||
0 ignored issues
–
show
$p_name 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. ![]() |
|||
490 | $p_name = Request::getString('poster_name', '', 'POST') ? htmlspecialchars(Request::getString('poster_name', '', 'POST')) : htmlspecialchars($GLOBALS['xoopsConfig']['anonymous']); |
||
0 ignored issues
–
show
$p_name 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. ![]() |
|||
491 | } |
||
492 | |||
493 | $post_preview = [ |
||
0 ignored issues
–
show
$post_preview 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. ![]() |
|||
494 | 'subject' => $p_subject, |
||
0 ignored issues
–
show
$p_subject 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. ![]() |
|||
495 | 'meta' => _MD_NEWBB_BY . ' ' . $p_name . ' ' . _MD_NEWBB_ON . ' ' . $p_date, |
||
0 ignored issues
–
show
$p_name 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. ![]() |
|||
496 | 'content' => $p_message |
||
0 ignored issues
–
show
$p_message 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. ![]() |
|||
497 | ]; |
||
498 | $xoopsTpl->assign_by_ref('post_preview', $post_preview); |
||
0 ignored issues
–
show
$post_preview 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. ![]() |
|||
499 | } |
||
500 | |||
501 | if (Request::getString('contents_upload', null, 'POST') || Request::getString('contents_preview', null, 'POST') |
||
502 | || Request::getString('contents_preview', null, 'GET') |
||
503 | || Request::getString('editor', '', 'POST')) { |
||
504 | $editor = Request::getString('editor', '', 'POST'); |
||
505 | $dosmiley = Request::getInt('dosmiley', 0, 'POST'); |
||
506 | $dohtml = Request::getInt('dohtml', 0, 'POST'); |
||
507 | $doxcode = Request::getInt('doxcode', 0, 'POST'); |
||
508 | $dobr = Request::getInt('dobr', 0, 'POST'); |
||
509 | $subject = Request::getString('subject', '', 'POST'); |
||
510 | $message = Request::getString('message', '', 'POST'); |
||
511 | $poster_name = Request::getString('poster_name', '', 'POST'); |
||
0 ignored issues
–
show
$poster_name 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. ![]() |
|||
512 | $hidden = Request::getString('hidden', '', 'POST'); |
||
513 | $notify = Request::getInt('notify', 0, 'POST'); |
||
514 | $attachsig = Request::getInt('attachsig', 0, 'POST');//!empty($_POST['attachsig']) ? 1 : 0; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
77% 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. ![]() |
|||
515 | $isreply = Request::getInt('isreply', 0, 'POST'); //!empty($_POST['isreply']) ? 1 : 0; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
77% 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. ![]() |
|||
516 | $isedit = Request::getInt('isedit', 0, 'POST'); //!empty($_POST['isedit']) ? 1 : 0; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
77% 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. ![]() |
|||
517 | $icon = (Request::getString('icon', '', 'POST') |
||
518 | && is_file($GLOBALS['xoops']->path('images/subject/' . Request::getString('icon', '', 'POST'))) ? Request::getString('icon', '', 'POST') : ''); |
||
519 | $view_require = Request::getString('view_require', '', 'POST'); |
||
0 ignored issues
–
show
$view_require 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. ![]() |
|||
520 | $post_karma = (('require_karma' === $view_require) |
||
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. ![]() |
|||
521 | && !Request::getInt('post_karma', 0, 'POST')) ? Request::getInt('post_karma', 0, 'POST') : 0; |
||
522 | $require_reply = ('require_reply' === $view_require) ? 1 : 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. ![]() |
|||
523 | |||
524 | if (!Request::getString('contents_upload', '', 'POST')) { |
||
525 | $contents_preview = 1; |
||
0 ignored issues
–
show
$contents_preview 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. ![]() |
|||
526 | } |
||
527 | $attachments = $postObject->getAttachment(); |
||
528 | $xoopsTpl->assign('error_message', implode('<br>', $error_message)); |
||
0 ignored issues
–
show
$error_message 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. ![]() |
|||
529 | |||
530 | include __DIR__ . '/include/form.post.php'; |
||
531 | } |
||
532 | // irmtfan move to footer.php |
||
533 | include_once __DIR__ . '/footer.php'; |
||
534 | include $GLOBALS['xoops']->path('footer.php'); |
||
535 |
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.