These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | use Xmf\Request; |
||
4 | |||
5 | // |
||
6 | // ------------------------------------------------------------------------ // |
||
7 | // XOOPS - PHP Content Management System // |
||
8 | // Copyright (c) 2000-2016 XOOPS.org // |
||
9 | // <https://xoops.org/> // |
||
10 | // ------------------------------------------------------------------------ // |
||
11 | // This program is free software; you can redistribute it and/or modify // |
||
12 | // it under the terms of the GNU General Public License as published by // |
||
13 | // the Free Software Foundation; either version 2 of the License, or // |
||
14 | // (at your option) any later version. // |
||
15 | // // |
||
16 | // You may not change or alter any portion of this comment or credits // |
||
17 | // of supporting developers from this source code or any supporting // |
||
18 | // source code which is considered copyrighted (c) material of the // |
||
19 | // original comment or credit authors. // |
||
20 | // // |
||
21 | // This program is distributed in the hope that it will be useful, // |
||
22 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // |
||
23 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
||
24 | // GNU General Public License for more details. // |
||
25 | // // |
||
26 | // You should have received a copy of the GNU General Public License // |
||
27 | // along with this program; if not, write to the Free Software // |
||
28 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
||
29 | // ------------------------------------------------------------------------ // |
||
30 | // Author: phppp (D.J., [email protected]) // |
||
31 | // URL: https://xoops.org // |
||
32 | // Project: Article Project // |
||
33 | // ------------------------------------------------------------------------ // |
||
34 | include_once __DIR__ . '/header.php'; |
||
35 | |||
36 | if (Request::getString('submit', '', 'POST')) { |
||
37 | foreach (['forum', 'newforum', 'newtopic'] as $getint) { |
||
38 | ${$getint} = Request::getInt($getint, 0, 'POST');// (int)(@$_POST[$getint]); |
||
39 | } |
||
40 | foreach (['topic_id'] as $getint) { |
||
41 | ${$getint} = Request::getInt($getint, 0, 'POST');// (int)(@$_POST[$getint]); |
||
42 | } |
||
43 | if (!is_array($topic_id)) { |
||
0 ignored issues
–
show
|
|||
44 | $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. ![]() |
|||
45 | } |
||
46 | } else { |
||
47 | foreach (['forum', 'topic_id'] as $getint) { |
||
48 | ${$getint} = Request::getInt($getint, 0, 'GET');// (int)(@$_GET[$getint]); |
||
49 | } |
||
50 | } |
||
51 | |||
52 | View Code Duplication | if (empty($topic_id)) { |
|
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. ![]() $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 | $redirect = empty($forum_id) ? 'index.php' : 'viewforum.php?forum={$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. ![]() |
|||
54 | $redirect = XOOPS_URL . '/modules/newbb/' . $redirect; |
||
55 | redirect_header($redirect, 2, _MD_NEWBB_ERRORTOPIC); |
||
56 | } |
||
57 | |||
58 | ///** @var \NewbbTopicHandler $topicHandler */ |
||
59 | //$topicHandler = xoops_getModuleHandler('topic', 'newbb'); |
||
60 | ///** @var \NewbbForumHandler $forumHandler */ |
||
61 | //$forumHandler = xoops_getModuleHandler('forum', 'newbb'); |
||
62 | |||
63 | if (!$forum) { |
||
64 | /** @var \Topic $topicObject */ |
||
65 | $topicObject = $topicHandler->get((int)$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. ![]() |
|||
66 | if (is_object($topicObject)) { |
||
67 | $forum = $topicObject->getVar('forum_id'); |
||
68 | } else { |
||
69 | $redirect = XOOPS_URL . '/modules/newbb/viewtopic.php?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. ![]() |
|||
70 | redirect_header($redirect, 2, _MD_NEWBB_FORUMNOEXIST); |
||
71 | } |
||
72 | unset($topicObject); |
||
73 | } |
||
74 | |||
75 | if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { |
||
76 | // /** @var \NewbbOnlineHandler $onlineHandler */ |
||
77 | // $onlineHandler = xoops_getModuleHandler('online', 'newbb'); |
||
78 | $onlineHandler->init($forum); |
||
79 | } |
||
80 | // irmtfan add restore to viewtopic |
||
81 | $action_array = [ |
||
0 ignored issues
–
show
$action_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. ![]() |
|||
82 | 'merge', |
||
83 | 'delete', |
||
84 | 'restore', |
||
85 | 'move', |
||
86 | 'lock', |
||
87 | 'unlock', |
||
88 | 'sticky', |
||
89 | 'unsticky', |
||
90 | 'digest', |
||
91 | 'undigest' |
||
92 | ]; |
||
93 | foreach ($action_array as $_action) { |
||
0 ignored issues
–
show
$action_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. ![]() |
|||
94 | $action[$_action] = [ |
||
0 ignored issues
–
show
$_action 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 | 'name' => $_action, |
||
0 ignored issues
–
show
$_action 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 | 'desc' => constant(strtoupper("_MD_NEWBB_DESC_{$_action}")), |
||
0 ignored issues
–
show
$_action 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. ![]() |
|||
97 | 'submit' => constant(strtoupper("_MD_NEWBB_{$_action}")), |
||
0 ignored issues
–
show
$_action 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. ![]() |
|||
98 | 'sql' => "topic_{$_action}=1", |
||
0 ignored issues
–
show
$_action 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. ![]() |
|||
99 | 'msg' => constant(strtoupper("_MD_NEWBB_TOPIC{$_action}")) |
||
0 ignored issues
–
show
$_action 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. ![]() |
|||
100 | ]; |
||
101 | } |
||
102 | $action['lock']['sql'] = 'topic_status = 1'; |
||
103 | $action['unlock']['sql'] = 'topic_status = 0'; |
||
104 | $action['unsticky']['sql'] = 'topic_sticky = 0'; |
||
105 | $action['undigest']['sql'] = 'topic_digest = 0'; |
||
106 | $action['digest']['sql'] = 'topic_digest = 1, digest_time = ' . time(); |
||
107 | |||
108 | // Disable cache |
||
109 | $GLOBALS['xoopsConfig']['module_cache'][$xoopsModule->getVar('mid')] = 0; |
||
110 | // irmtfan include header.php after defining $xoopsOption['template_main'] |
||
111 | include_once $GLOBALS['xoops']->path('header.php'); |
||
112 | |||
113 | if (Request::getString('submit', '', 'POST')) { |
||
114 | $mode = Request::getString('mode', '', 'POST');// $_POST['mode']; |
||
115 | |||
116 | if ('delete' === $mode) { |
||
117 | foreach ($topic_id as $tid) { |
||
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. ![]() |
|||
118 | $topicObject = $topicHandler->get($tid); |
||
119 | $topicHandler->delete($topicObject, false); |
||
120 | // irmtfan - sync topic after delete |
||
121 | $topicHandler->synchronization($topicObject); |
||
122 | $forumHandler->synchronization($forum); |
||
123 | //$topicObject->loadFilters("delete"); |
||
124 | //sync($topic_id, "topic"); |
||
125 | //xoops_notification_deletebyitem ($xoopsModule->getVar('mid'), 'thread', $topic_id); |
||
126 | } |
||
127 | // irmtfan full URL |
||
128 | echo $action[$mode]['msg'] . "<p><a href='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/viewforum.php?forum=$forum'>" . _MD_NEWBB_RETURNTOTHEFORUM . "</a></p><p><a href='index.php'>" . _MD_NEWBB_RETURNFORUMINDEX . '</a></p>'; |
||
129 | } elseif ('restore' === $mode) { |
||
130 | //$topicHandler = xoops_getModuleHandler('topic', 'newbb'); |
||
131 | $forums = []; |
||
132 | $topicsObject = $topicHandler->getAll(new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); |
||
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. ![]() |
|||
133 | foreach (array_keys($topicsObject) as $id) { |
||
134 | $topicObject = $topicsObject[$id]; |
||
135 | $topicHandler->approve($topicObject); |
||
136 | $topicHandler->synchronization($topicObject); |
||
137 | $forums[$topicObject->getVar('forum_id')] = 1; |
||
138 | } |
||
139 | //irmtfan remove - no need to approve posts manually - see class/post.php approve function |
||
140 | $criteria_forum = new Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); |
||
0 ignored issues
–
show
$criteria_forum 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 | $forumsObject = $forumHandler->getAll($criteria_forum); |
||
0 ignored issues
–
show
$criteria_forum 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. ![]() |
|||
142 | foreach (array_keys($forumsObject) as $id) { |
||
143 | $forumHandler->synchronization($forumsObject[$id]); |
||
144 | } |
||
145 | unset($topicsObject, $forumsObject); |
||
146 | // irmtfan add restore to viewtopic |
||
147 | $restoretopic_id = $topicObject->getVar('topic_id'); |
||
0 ignored issues
–
show
$restoretopic_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. ![]() |
|||
148 | // irmtfan / missing in URL |
||
149 | echo $action[$mode]['msg'] |
||
150 | . "<p><a href='" |
||
151 | . XOOPS_URL |
||
152 | . '/modules/' |
||
153 | . $xoopsModule->getVar('dirname') |
||
154 | . "/viewtopic.php?topic_id=$restoretopic_id'>" |
||
0 ignored issues
–
show
$restoretopic_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. ![]() |
|||
155 | . _MD_NEWBB_VIEWTHETOPIC |
||
156 | . '</a></p>' |
||
157 | . "<p><a href='" |
||
158 | . XOOPS_URL |
||
159 | . '/modules/' |
||
160 | . $xoopsModule->getVar('dirname') |
||
161 | . "/viewforum.php?forum=$forum'>" |
||
162 | . _MD_NEWBB_RETURNTOTHEFORUM |
||
163 | . '</a></p>' |
||
164 | . "<p><a href='index.php'>" |
||
165 | . _MD_NEWBB_RETURNFORUMINDEX |
||
166 | . '</a></p>'; |
||
167 | } elseif ('merge' === $mode) { |
||
168 | // /** @var NewbbPostHandler $postHandler */ |
||
169 | // $postHandler = xoops_getModuleHandler('post', 'newbb'); |
||
170 | // /** @var \NewbbRateHandler $rateHandler */ |
||
171 | // $rateHandler = xoops_getModuleHandler('rate', 'newbb'); |
||
172 | |||
173 | foreach ($topic_id as $tid) { |
||
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. ![]() |
|||
174 | $topicObject = $topicHandler->get($tid); |
||
175 | $newtopicObject = $topicHandler->get($newtopic); |
||
176 | |||
177 | /* return false if destination topic is not existing */ |
||
178 | // irmtfan bug fix: the old topic will be deleted if user input a not exist new topic |
||
179 | if (!is_object($newtopicObject)) { |
||
180 | $redirect = XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $tid; |
||
181 | redirect_header($redirect, 2, _MD_NEWBB_ERRORTOPIC); |
||
182 | } |
||
183 | $criteria_topic = new Criteria('topic_id', $tid); |
||
0 ignored issues
–
show
$criteria_topic 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. ![]() |
|||
184 | $criteria = new CriteriaCompo($criteria_topic); |
||
0 ignored issues
–
show
$criteria_topic 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. ![]() |
|||
185 | $criteria->add(new Criteria('pid', 0)); |
||
186 | // irmtfan OR change to this for less query?: |
||
187 | // $postHandler->updateAll("pid", $newtopicObject->getVar("topic_last_post_id"), $criteria, true); |
||
188 | $postHandler->updateAll('pid', $topicHandler->getTopPostId($newtopic), $criteria, true); |
||
189 | $postHandler->updateAll('topic_id', $newtopic, $criteria_topic, true); |
||
0 ignored issues
–
show
$criteria_topic 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. ![]() |
|||
190 | // irmtfan update vote data instead of deleting them |
||
191 | $rateHandler->updateAll('topic_id', $newtopic, $criteria_topic, true); |
||
0 ignored issues
–
show
$criteria_topic 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. ![]() |
|||
192 | |||
193 | $topic_views = $topicObject->getVar('topic_views') + $newtopicObject->getVar('topic_views'); |
||
0 ignored issues
–
show
$topic_views 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. ![]() |
|||
194 | // irmtfan better method to update topic_views in new topic |
||
195 | //$criteria_newtopic = new Criteria('topic_id', $newtopic); |
||
196 | //$topicHandler->updateAll('topic_views', $topic_views, $criteria_newtopic, true); |
||
197 | $newtopicObject->setVar('topic_views', $topic_views); |
||
0 ignored issues
–
show
$topic_views 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 | // START irmtfan poll_module and rewrite the method |
||
199 | // irmtfan only move poll in old topic to new topic if new topic has not a poll |
||
200 | $poll_id = $topicObject->getVar('poll_id'); |
||
0 ignored issues
–
show
$poll_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. ![]() |
|||
201 | if ($poll_id > 0 && (0 == $newtopicObject->getVar('poll_id'))) { |
||
0 ignored issues
–
show
$poll_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. ![]() |
|||
202 | $newtopicObject->setVar('topic_haspoll', 1); |
||
203 | $newtopicObject->setVar('poll_id', $poll_id); |
||
0 ignored issues
–
show
$poll_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. ![]() |
|||
204 | $poll_id = 0;// set to not delete the poll |
||
0 ignored issues
–
show
$poll_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. ![]() |
|||
205 | $topicObject->setVar('topic_haspoll', 0); // set to not delete the poll |
||
206 | $topicObject->setVar('poll_id', 0);// set to not delete the poll |
||
207 | } |
||
208 | //update and sync newtopic after merge |
||
209 | //$topicHandler->insert($newtopicObject, true); |
||
210 | $topicHandler->synchronization($newtopicObject); // very important: only use object |
||
211 | //sync newforum after merge |
||
212 | $newforum = $newtopicObject->getVar('forum_id'); |
||
213 | $forumHandler->synchronization($newforum); |
||
214 | //hardcode remove force to delete old topic from database |
||
215 | //$topicHandler->delete($topicObject,true); // cannot use this |
||
216 | $topicHandler->deleteAll($criteria_topic, true); // $force = true |
||
0 ignored issues
–
show
$criteria_topic 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. ![]() |
|||
217 | //delete poll if old topic had a poll |
||
218 | $topicObject->deletePoll($poll_id); |
||
0 ignored issues
–
show
$poll_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. ![]() |
|||
219 | //sync forum after delete old topic |
||
220 | $forumHandler->synchronization($forum); |
||
221 | // END irmtfan poll_module and rewrite the method |
||
222 | } |
||
223 | echo $action[$mode]['msg'] |
||
224 | . // irmtfan full URL |
||
225 | "<p><a href='" |
||
226 | . XOOPS_URL |
||
227 | . '/modules/' |
||
228 | . $xoopsModule->getVar('dirname') |
||
229 | . "/viewtopic.php?topic_id=$newtopic'>" |
||
230 | . _MD_NEWBB_VIEWTHETOPIC |
||
231 | . '</a></p>' |
||
232 | . "<p><a href='" |
||
233 | . XOOPS_URL |
||
234 | . '/modules/' |
||
235 | . $xoopsModule->getVar('dirname') |
||
236 | . "/viewforum.php?forum=$forum'>" |
||
237 | . _MD_NEWBB_RETURNTOTHEFORUM |
||
238 | . '</a></p>' |
||
239 | . "<p><a href='" |
||
240 | . XOOPS_URL |
||
241 | . '/modules/' |
||
242 | . $xoopsModule->getVar('dirname') |
||
243 | . "/index.php'>" |
||
244 | . _MD_NEWBB_RETURNFORUMINDEX |
||
245 | . '</a></p>'; |
||
246 | } elseif ('move' === $mode) { |
||
247 | if ($newforum > 0) { |
||
248 | $topic_id = $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. ![]() |
|||
249 | $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. ![]() |
|||
250 | $topicObject->loadFilters('update'); |
||
251 | $topicObject->setVar('forum_id', $newforum, true); |
||
252 | $topicHandler->insert($topicObject, true); |
||
253 | $topicObject->loadFilters('update'); |
||
254 | |||
255 | $sql = sprintf('UPDATE "%s" SET forum_id = "%u" WHERE topic_id = "%u"', $GLOBALS['xoopsDB']->prefix('newbb_posts'), $newforum, $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. ![]() |
|||
256 | if (!$r = $GLOBALS['xoopsDB']->query($sql)) { |
||
257 | return false; |
||
258 | } |
||
259 | $forumHandler->synchronization($forum); |
||
260 | $forumHandler->synchronization($newforum); |
||
261 | // irmtfan full URL |
||
262 | echo $action[$mode]['msg'] . "<p><a href='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/viewtopic.php?topic_id=$topic_id&forum=$newforum'>" . _MD_NEWBB_GOTONEWFORUM . "</a></p><p><a href='" . XOOPS_URL . "/modules/newbb/index.php'>" . _MD_NEWBB_RETURNFORUMINDEX . '</a></p>'; |
||
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. ![]() |
|||
263 | } else { |
||
264 | // irmtfan - issue with javascript:history.go(-1) |
||
265 | redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERRORFORUM); |
||
266 | } |
||
267 | } else { |
||
268 | $topic_id = $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. ![]() |
|||
269 | $forum = $topicHandler->get($topic_id, 'forum_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. ![]() |
|||
270 | $forum_new = !empty($newtopic) ? $topicHandler->get($newtopic, 'forum_id') : 0; |
||
0 ignored issues
–
show
$forum_new 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. ![]() |
|||
271 | |||
272 | if (!$forumHandler->getPermission($forum, 'moderate') |
||
273 | || (!empty($forum_new) |
||
0 ignored issues
–
show
$forum_new 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. ![]() |
|||
274 | && !$forumHandler->getPermission($forum_new, 'reply')) // The forum for the topic to be merged to |
||
0 ignored issues
–
show
$forum_new 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. ![]() |
|||
275 | || (!empty($newforum) && !$forumHandler->getPermission($newforum, 'post')) // The forum to be moved to |
||
276 | ) { |
||
277 | redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?forum=$forum&topic_id=$topic_id", 2, _NOPERM); |
||
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. ![]() |
|||
278 | } |
||
279 | |||
280 | if (!empty($action[$mode]['sql'])) { |
||
281 | $sql = sprintf('UPDATE %s SET ' . $action[$mode]['sql'] . ' WHERE topic_id = %u', $GLOBALS['xoopsDB']->prefix('newbb_topics'), $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. ![]() |
|||
282 | if (!$r = $GLOBALS['xoopsDB']->query($sql)) { |
||
283 | redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?forum=$forum&topic_id=$topic_id&order=$order&viewmode=$viewmode", 2, _MD_NEWBB_ERROR_BACK . '<br />sql: ' . $sql); |
||
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. ![]() |
|||
284 | } |
||
285 | } else { |
||
286 | redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?forum=$forum&topic_id=$topic_id", 2, _MD_NEWBB_ERROR_BACK); |
||
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. ![]() |
|||
287 | } |
||
288 | if ('digest' === $mode && $GLOBALS['xoopsDB']->getAffectedRows()) { |
||
289 | $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. ![]() |
|||
290 | // /** @var \NewbbStatsHandler $statsHandler */ |
||
291 | // $statsHandler = xoops_getModuleHandler('stats', 'newbb'); |
||
292 | $statsHandler->update($topicObject->getVar('forum_id'), 'digest'); |
||
293 | // /** @var \NewbbUserstatsHandler $userstatsHandler */ |
||
294 | // $userstatsHandler = xoops_getModuleHandler('userstats', 'newbb'); |
||
295 | if ($user_stat = $userstatsHandler->get($topicObject->getVar('topic_poster'))) { |
||
0 ignored issues
–
show
$user_stat 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. ![]() |
|||
296 | $z = $user_stat->getVar('user_digests') + 1; |
||
0 ignored issues
–
show
$user_stat 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. ![]() |
|||
297 | $user_stat->setVar('user_digests', (int)$z); |
||
0 ignored issues
–
show
$user_stat 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. ![]() |
|||
298 | $userstatsHandler->insert($user_stat); |
||
0 ignored issues
–
show
$user_stat 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. ![]() |
|||
299 | } |
||
300 | } |
||
301 | // irmtfan full URL |
||
302 | echo $action[$mode]['msg'] |
||
303 | . "<p><a href='" |
||
304 | . XOOPS_URL |
||
305 | . '/modules/' |
||
306 | . $xoopsModule->getVar('dirname') |
||
307 | . "/viewtopic.php?topic_id=$topic_id&forum=$forum'>" |
||
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. ![]() |
|||
308 | . _MD_NEWBB_VIEWTHETOPIC |
||
309 | . "</a></p><p><a href='" |
||
310 | . XOOPS_URL |
||
311 | . "/modules/newbb/viewforum.php?forum=$forum'>" |
||
312 | . _MD_NEWBB_RETURNFORUMINDEX |
||
313 | . '</a></p>'; |
||
314 | } |
||
315 | } else { // No submit |
||
316 | $mode = Request::getString('mode', '', 'GET'); //$_GET['mode']; |
||
317 | echo "<form action='" . Request::getString('PHP_SELF', '', 'SERVER') . "' method='post'>"; |
||
318 | echo "<table border='0' cellpadding='1' cellspacing='0' align='center' width='95%'>"; |
||
319 | echo "<tr><td class='bg2'>"; |
||
320 | echo "<table border='0' cellpadding='1' cellspacing='1' width='100%'>"; |
||
321 | echo "<tr class='bg3' align='left'>"; |
||
322 | echo "<td colspan='2' align='center'>" . $action[$mode]['desc'] . '</td></tr>'; |
||
323 | |||
324 | if ('move' === $mode) { |
||
325 | echo '<tr><td class="bg3">' . _MD_NEWBB_MOVETOPICTO . '</td><td class="bg1">'; |
||
326 | $box = '<select name="newforum" size="1">'; |
||
327 | |||
328 | // /** @var \NewbbCategoryHandler $categoryHandler */ |
||
329 | // $categoryHandler = xoops_getModuleHandler('category', 'newbb'); |
||
330 | $categories = $categoryHandler->getByPermission('access'); |
||
331 | $forums = $forumHandler->getForumsByCategory(array_keys($categories), 'post', false); |
||
332 | |||
333 | View Code Duplication | if (count($categories) > 0 && count($forums) > 0) { |
|
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. ![]() |
|||
334 | foreach (array_keys($forums) as $key) { |
||
335 | /** @var \NewbbCategory[] $categories */ |
||
336 | $box .= "<option value='-1'>[" . $categories[$key]->getVar('cat_title') . ']</option>'; |
||
337 | foreach ($forums[$key] as $forumid => $_forum) { |
||
0 ignored issues
–
show
$_forum 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. ![]() |
|||
338 | $box .= "<option value='" . $forumid . "'>-- " . $_forum['title'] . '</option>'; |
||
0 ignored issues
–
show
$_forum 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. ![]() |
|||
339 | if (!isset($_forum['sub'])) { |
||
0 ignored issues
–
show
$_forum 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. ![]() |
|||
340 | continue; |
||
341 | } |
||
342 | foreach (array_keys($_forum['sub']) as $fid) { |
||
0 ignored issues
–
show
$_forum 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 | $box .= "<option value='" . $fid . "'>---- " . $_forum['sub'][$fid]['title'] . '</option>'; |
||
0 ignored issues
–
show
$_forum 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 | } |
||
345 | } |
||
346 | } |
||
347 | } else { |
||
348 | $box .= "<option value='-1'>" . _MD_NEWBB_NOFORUMINDB . '</option>'; |
||
349 | } |
||
350 | unset($forums, $categories); |
||
351 | |||
352 | echo $box; |
||
353 | echo '</select></td></tr>'; |
||
354 | } |
||
355 | if ('merge' === $mode) { |
||
356 | echo '<tr><td class="bg3">' . _MD_NEWBB_MERGETOPICTO . '</td><td class="bg1">'; |
||
357 | echo _MD_NEWBB_TOPIC . " ID-$topic_id -> ID: <input name='newtopic' value='' />"; |
||
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. ![]() |
|||
358 | echo '</td></tr>'; |
||
359 | } |
||
360 | echo '<tr class="bg3"><td colspan="2" align="center">'; |
||
361 | echo "<input type='hidden' name='mode' value='" . $action[$mode]['name'] . "' />"; |
||
362 | echo "<input type='hidden' name='topic_id' value='" . $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. ![]() |
|||
363 | echo "<input type='hidden' name='forum' value='" . $forum . "' />"; |
||
364 | echo "<input type='submit' name='submit' value='" . $action[$mode]['submit'] . "' />"; |
||
365 | echo '</td></tr></form></table></td></tr></table>'; |
||
366 | } |
||
367 | // irmtfan move to footer.php |
||
368 | include_once __DIR__ . '/footer.php'; |
||
369 | include $GLOBALS['xoops']->path('footer.php'); |
||
370 |
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.