This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | // |
||
3 | // ------------------------------------------------------------------------ // |
||
4 | // This program is free software; you can redistribute it and/or modify // |
||
5 | // it under the terms of the GNU General Public License as published by // |
||
6 | // the Free Software Foundation; either version 2 of the License, or // |
||
7 | // (at your option) any later version. // |
||
8 | // // |
||
9 | // You may not change or alter any portion of this comment or credits // |
||
10 | // of supporting developers from this source code or any supporting // |
||
11 | // source code which is considered copyrighted (c) material of the // |
||
12 | // original comment or credit authors. // |
||
13 | // // |
||
14 | // This program is distributed in the hope that it will be useful, // |
||
15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // |
||
16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
||
17 | // GNU General Public License for more details. // |
||
18 | // // |
||
19 | // You should have received a copy of the GNU General Public License // |
||
20 | // along with this program; if not, write to the Free Software // |
||
21 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
||
22 | // ------------------------------------------------------------------------ // |
||
23 | // Author: phppp (D.J., [email protected]) // |
||
24 | // URL: https://xoops.org // |
||
25 | // Project: Article Project // |
||
26 | // ------------------------------------------------------------------------ // |
||
27 | use Xmf\Request; |
||
28 | use XoopsModules\Planet; |
||
29 | /** @var Planet\Helper $helper */ |
||
30 | $helper = Planet\Helper::getInstance(); |
||
31 | |||
32 | require_once __DIR__ . '/admin_header.php'; |
||
33 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
34 | |||
35 | xoops_cp_header(); |
||
36 | $adminObject = \Xmf\Module\Admin::getInstance(); |
||
37 | $adminObject->displayNavigation(basename(__FILE__)); |
||
38 | /* |
||
39 | * To restore basic parameters in case cloned modules are installed |
||
40 | * reported by programfan |
||
41 | * |
||
42 | * This is a tricky fix for incomplete solution of module cone |
||
43 | * it is expected to have a better solution in article 1.0 |
||
44 | */ |
||
45 | require XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
||
46 | //planet_adminmenu(2); |
||
47 | |||
48 | $op = Request::getString('op', Request::getString('op', '', 'POST'), 'GET');//!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : ''); |
||
49 | $blog_id = Request::getArray('blog', Request::getArray('blog', [], 'POST'), 'GET');//!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0); |
||
50 | $blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int)$blog_id; |
||
51 | $category_id = Request::getInt('category', Request::getInt('category', 0, 'POST'), 'GET');//(int)(!empty($_POST['category']) ? $_POST['category'] : (!empty($_GET['category']) ? $_GET['category'] : 0)); |
||
52 | $start = Request::getInt('start', Request::getInt('start', 0, 'POST'), 'GET');//(int)(!empty($_POST['start']) ? $_POST['start'] : (!empty($_GET['start']) ? $_GET['start'] : 0)); |
||
53 | |||
54 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
||
55 | $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
||
56 | |||
57 | if ('save' === $op && !empty(Request::getString('fetch', '', 'POST'))) { |
||
58 | $op = 'edit'; |
||
59 | } |
||
60 | |||
61 | switch ($op) { |
||
62 | /* save a single blog */ |
||
63 | case 'save': |
||
64 | |||
65 | if ($blog_id) { |
||
66 | $blog_obj = $blogHandler->get($blog_id); |
||
67 | } else { |
||
68 | if ($blog_exists = $blogHandler->getCount(new \Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) { |
||
69 | redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS')); |
||
70 | } |
||
71 | $blog_obj = $blogHandler->create(); |
||
72 | $blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid')); |
||
73 | } |
||
74 | |||
75 | $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']); |
||
76 | $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']); |
||
77 | $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']); |
||
78 | $blog_obj->setVar('blog_feed', Request::getString('blog_feed', '', 'POST')); //$_POST['blog_feed']); |
||
79 | $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']); |
||
80 | $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']); |
||
81 | $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']); |
||
82 | $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']); |
||
83 | $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); //$_POST['blog_status']); |
||
84 | |||
85 | if (!$blogHandler->insert($blog_obj)) { |
||
86 | } elseif (!empty(Request::getArray('categories', [], 'POST'))) { |
||
87 | $blog_id = $blog_obj->getVar('blog_id'); |
||
88 | if (in_array(0, Request::getArray('categories', [], 'POST'))) { |
||
89 | $_POST['categories'] = []; |
||
90 | } |
||
91 | $blogHandler->setCategories($blog_id, Request::getArray('categories', [], 'POST')); |
||
92 | } |
||
93 | $message = planet_constant('AM_DBUPDATED'); |
||
94 | redirect_header('admin.blog.php', 2, $message); |
||
95 | |||
96 | /* fetch and add a list of blogs to a category */ |
||
97 | // no break |
||
98 | case 'add': |
||
99 | $links = PlanetUtility::planetParseLinks(Request::getArray('links', [], 'POST')); |
||
100 | $blogs = []; |
||
101 | foreach ($links as $link) { |
||
102 | if ($blog_exist = $blogHandler->getCount(new \Criteria('blog_feed', $link['url']))) { |
||
103 | continue; |
||
104 | } |
||
105 | $blog_obj = $blogHandler->fetch($link['url']); |
||
106 | if (!empty($link['title'])) { |
||
107 | $blog_obj->setVar('blog_title', $link['title']); |
||
108 | } |
||
109 | $blogHandler->insert($blog_obj); |
||
110 | $blogs[] = $blog_obj->getVar('blog_id'); |
||
111 | unset($blog_obj); |
||
112 | } |
||
113 | View Code Duplication | if (!empty(Request::getArray('categories', [], 'POST'))) { |
|
0 ignored issues
–
show
|
|||
114 | $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
||
115 | foreach (Request::getArray('categories', [], 'POST') as $cat_id) { |
||
116 | $categoryHandler->addBlogs($cat_id, $blogs); |
||
117 | } |
||
118 | } |
||
119 | $message = planet_constant('AM_DBUPDATED'); |
||
120 | redirect_header('admin.blog.php', 2, $message); |
||
121 | |||
122 | /* update a list of blogs */ |
||
123 | // no break |
||
124 | case 'update': |
||
125 | foreach ($blog_id as $bid) { |
||
126 | $blog_obj = $blogHandler->fetch($bid); |
||
127 | if (!$blogHandler->insert($blog_obj)) { |
||
128 | } |
||
129 | unset($blog_obj); |
||
130 | } |
||
131 | $message = planet_constant('AM_DBUPDATED'); |
||
132 | redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
||
133 | |||
134 | /* add a list of blogs to a category */ |
||
135 | // no break |
||
136 | case 'register': |
||
137 | View Code Duplication | if (!empty(Request::getArray('category_dest', [], '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. ![]() |
|||
138 | if (!is_array($blog_id)) { |
||
139 | $blog_id = [$blog_id]; |
||
140 | } |
||
141 | $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
||
142 | $categoryHandler->addBlogs(Request::getArray('category_dest', [], 'POST'), $blog_id); |
||
143 | } |
||
144 | $message = planet_constant('AM_DBUPDATED'); |
||
145 | redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', [], 'POST') . '&start=' . $start, 2, $message); |
||
146 | |||
147 | /* remove a list of blogs from a category */ |
||
148 | // no break |
||
149 | case 'remove': |
||
150 | if (!is_array($blog_id)) { |
||
151 | $blog_id = [$blog_id]; |
||
152 | } |
||
153 | if (!empty($category_id)) { |
||
154 | $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
||
155 | $categoryHandler->removeBlogs($category_id, $blog_id); |
||
156 | } |
||
157 | $message = planet_constant('AM_DBUPDATED'); |
||
158 | redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
||
159 | |||
160 | /* delete a single blog or a list blogs */ |
||
161 | // no break |
||
162 | View Code Duplication | case 'del': |
|
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. ![]() |
|||
163 | if (!is_array($blog_id)) { |
||
164 | $blog_id = [$blog_id]; |
||
165 | } |
||
166 | foreach ($blog_id as $bid) { |
||
167 | $blog_obj = $blogHandler->get($bid); |
||
168 | if (!$blogHandler->delete($blog_obj, true)) { |
||
169 | } |
||
170 | unset($blog_obj); |
||
171 | } |
||
172 | $message = planet_constant('AM_DBUPDATED'); |
||
173 | redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
||
174 | |||
175 | /* empty a single blog or a list blogs */ |
||
176 | // no break |
||
177 | View Code Duplication | case 'empty': |
|
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. ![]() |
|||
178 | if (!is_array($blog_id)) { |
||
179 | $blog_id = [$blog_id]; |
||
180 | } |
||
181 | foreach ($blog_id as $bid) { |
||
182 | $blog_obj = $blogHandler->get($bid); |
||
183 | if (!$blogHandler->do_empty($blog_obj)) { |
||
184 | } |
||
185 | } |
||
186 | $message = planet_constant('AM_DBUPDATED'); |
||
187 | redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
||
188 | |||
189 | /* approve a single blog or a list blogs */ |
||
190 | // no break |
||
191 | View Code Duplication | case 'approve': |
|
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. ![]() |
|||
192 | if (!is_array($blog_id)) { |
||
193 | $blog_id = [$blog_id]; |
||
194 | } |
||
195 | $criteria = new \Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); |
||
196 | $blogHandler->updateAll('blog_status', 1, $criteria, true); |
||
197 | $message = planet_constant('AM_DBUPDATED'); |
||
198 | redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
||
199 | |||
200 | /* mark a single blog or a list blogs as featured */ |
||
201 | // no break |
||
202 | View Code Duplication | case 'feature': |
|
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. ![]() |
|||
203 | if (!is_array($blog_id)) { |
||
204 | $blog_id = [$blog_id]; |
||
205 | } |
||
206 | $criteria = new \Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); |
||
207 | $blogHandler->updateAll('blog_status', 2, $criteria, true); |
||
208 | $message = planet_constant('AM_DBUPDATED'); |
||
209 | redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
||
210 | |||
211 | /* edit a single blog */ |
||
212 | // no break |
||
213 | View Code Duplication | case 'edit': |
|
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. ![]() |
|||
214 | if (!empty(Request::getString('fetch', '', 'POST'))) { |
||
215 | $blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST')); |
||
216 | $blog_obj->setVar('blog_id', $blog_id); |
||
217 | } else { |
||
218 | $blog_obj = $blogHandler->get($blog_id); |
||
219 | } |
||
220 | $categories = Request::getArray('categories', [], 'POST'); |
||
221 | if (empty($categories) && $blog_id > 0) { |
||
222 | $crit = new \Criteria('bc.blog_id', $blog_id); |
||
223 | $categories = array_keys($categoryHandler->getByBlog($crit)); |
||
224 | } |
||
225 | if (empty($categories)) { |
||
226 | $categories = [0 => _NONE]; |
||
227 | } |
||
228 | |||
229 | echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; |
||
230 | echo '<br>'; |
||
231 | if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { |
||
232 | $criteria = new \Criteria('blog_feed', $blog_obj->getVar('blog_feed')); |
||
233 | $blogs_obj = $blogHandler->getList($criteria); |
||
234 | if (count($blogs_obj) > 0) { |
||
235 | echo '<div class="errorMsg">' . planet_constant('AM_BLOGEXISTS'); |
||
236 | foreach (array_keys($blogs_obj) as $bid) { |
||
237 | echo '<br><a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . '" target="_blank">' . $blogs_obj[$bid] . '</a>'; |
||
238 | } |
||
239 | echo '</div>'; |
||
240 | } |
||
241 | unset($blogs_obj, $criteria); |
||
242 | } |
||
243 | include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; |
||
244 | echo '</fieldset>'; |
||
245 | break; |
||
246 | |||
247 | default: |
||
248 | |||
249 | $crit = new \Criteria('1', 1); |
||
250 | $crit->setSort('cat_order'); |
||
251 | $crit->setOrder('ASC'); |
||
252 | $categories = $categoryHandler->getList($crit); |
||
253 | |||
254 | // Display category option form |
||
255 | $opform = new \XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get'); |
||
256 | $op_select = new \XoopsFormSelect('', 'category', $category_id); |
||
257 | $op_select->setExtra('onchange="document.forms.opform.submit()"'); |
||
258 | $options = [ |
||
259 | '0' => _ALL, |
||
260 | '-1' => planet_constant('MD_ACTIVE'), |
||
261 | '-2' => planet_constant('MD_FEATURED'), |
||
262 | '-3' => planet_constant('MD_PENDING') |
||
263 | ]; |
||
264 | foreach (array_keys($categories) as $key) { |
||
265 | $options[$key] = $categories[$key]; |
||
266 | } |
||
267 | $op_select->addOptionArray($options); |
||
268 | $opform->addElement($op_select); |
||
269 | $opform->display(); |
||
270 | |||
271 | if ($category_id > 0) { |
||
272 | $criteria = new \CriteriaCompo(new \Criteria('b.blog_status', 0, '>')); |
||
273 | $criteria->add(new \Criteria('bc.cat_id', $category_id)); |
||
274 | $blog_count = $blogHandler->getCountByCategory($criteria); |
||
275 | $criteria->setStart($start); |
||
276 | $criteria->setLimit($helper->getConfig('list_perpage')); |
||
277 | $blog_objs = $blogHandler->getByCategory($criteria); |
||
278 | } else { |
||
279 | /* All active blogs */ |
||
280 | if (0 == $category_id) { |
||
281 | $criteria = new \Criteria('1', 1); |
||
282 | $criteria->setStart($start); |
||
283 | $criteria->setLimit($helper->getConfig('list_perpage')); |
||
284 | /* Active blogs */ |
||
285 | } elseif (-1 == $category_id) { |
||
286 | $criteria = new \Criteria('blog_status', 1); |
||
287 | $criteria->setStart($start); |
||
288 | $criteria->setLimit($helper->getConfig('list_perpage')); |
||
289 | /* Featured blogs */ |
||
290 | } elseif (-2 == $category_id) { |
||
291 | $criteria = new \Criteria('blog_status', 2); |
||
292 | $criteria->setStart($start); |
||
293 | $criteria->setLimit($helper->getConfig('list_perpage')); |
||
294 | /* Pending blogs */ |
||
295 | } else { |
||
296 | $criteria = new \Criteria('blog_status', 0); |
||
297 | $criteria->setStart($start); |
||
298 | $criteria->setLimit($helper->getConfig('list_perpage')); |
||
299 | } |
||
300 | $blog_count = $blogHandler->getCount($criteria); |
||
301 | $blog_objs = $blogHandler->getAll($criteria); |
||
302 | } |
||
303 | |||
304 | echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>'; |
||
305 | echo '<br style="clear:both">'; |
||
306 | |||
307 | echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
||
308 | echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
||
309 | echo "<tr align='center'>"; |
||
310 | echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox' onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>"; |
||
311 | echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>'; |
||
312 | echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>'; |
||
313 | echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>'; |
||
314 | // echo "<th class='bg3' width='5%'>" . _EDIT . "</td>"; |
||
315 | // echo "<th class='bg3' width='5%'>" . _DELETE . "</td>"; |
||
316 | echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>'; |
||
317 | echo '</tr>'; |
||
318 | |||
319 | $status = [ |
||
320 | '0' => planet_constant('MD_PENDING'), |
||
321 | '1' => planet_constant('MD_ACTIVE'), |
||
322 | '2' => planet_constant('MD_FEATURED') |
||
323 | ]; |
||
324 | foreach (array_keys($blog_objs) as $bid) { |
||
325 | echo "<tr class='odd' align='left'>"; |
||
326 | echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>"; |
||
327 | echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>'; |
||
328 | echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>'; |
||
329 | echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>'; |
||
330 | echo "<td align='center'><a href='admin.blog.php?op=edit&blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a> |
||
331 | <a href='admin.blog.php?op=del&blog=" . $bid . "' title='" . _DELETE . "'><img src='" . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . " title='" . _DELETE . " </a> |
||
332 | <a href='admin.blog.php?op=empty&blog=" . $bid . "' title='" . planet_constant('MD_EMPTY_BLOG') . "'><img src='" . $pathIcon16 . "/empty.png '" . " alt='" . _EDIT . " title='" . planet_constant('MD_EMPTY_BLOG') . '</a></td>'; |
||
333 | |||
334 | echo '</tr>'; |
||
335 | } |
||
336 | echo "<tr class='even' align='center'>"; |
||
337 | echo "<td colspan='7'>"; |
||
338 | echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>"; |
||
339 | echo "<option value=''>" . _SELECT . '</option>'; |
||
340 | echo "<option value='del'>" . _DELETE . '</option>'; |
||
341 | echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>'; |
||
342 | echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>'; |
||
343 | if ($category_id > 0) { |
||
344 | echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>'; |
||
345 | } |
||
346 | echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>'; |
||
347 | echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>'; |
||
348 | echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>'; |
||
349 | |||
350 | echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>'; |
||
351 | echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>'; |
||
352 | |||
353 | echo '</select>'; |
||
354 | echo "<div id='catdiv' style='visibility:hidden;display:inline;'>"; |
||
355 | echo "<select name='category_dest'>"; |
||
356 | echo "<option value=''>" . _SELECT . '</option>'; |
||
357 | foreach ($categories as $cid => $name) { |
||
358 | echo "<option value='" . $cid . "'>" . $name . '</option>'; |
||
359 | } |
||
360 | echo '</select>'; |
||
361 | echo '</div>'; |
||
362 | echo "<input name='start' value='" . $start . "' type='hidden'>"; |
||
363 | echo "<input name='category' value='" . $category_id . "' type='hidden'>"; |
||
364 | echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>"; |
||
365 | echo "<input name='' value='" . _CANCEL . "' type='reset'>"; |
||
366 | echo '</td>'; |
||
367 | echo '</tr>'; |
||
368 | if ($blog_count > $helper->getConfig('list_perpage')) { |
||
369 | include XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||
370 | $nav = new \XoopsPageNav($blog_count, $helper->getConfig('list_perpage'), $start, 'start', 'category=' . $category_id); |
||
371 | $pagenav = $nav->renderNav(4); |
||
372 | echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>'; |
||
373 | } |
||
374 | echo '</table></form>'; |
||
375 | echo "</fieldset><br style='clear:both;'>"; |
||
376 | |||
377 | if (empty($start) && empty($category_id)) { |
||
378 | $form = new \XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF'), 'post', true); |
||
379 | $form->addElement(new \XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true); |
||
380 | $form->addElement(new \XoopsFormHidden('op', 'edit')); |
||
381 | $button_tray = new \XoopsFormElementTray('', ''); |
||
382 | $butt_save = new \XoopsFormButton('', 'fetch', _SUBMIT, 'submit'); |
||
383 | $button_tray->addElement($butt_save); |
||
384 | $butt_cancel = new \XoopsFormButton('', '', _CANCEL, 'reset'); |
||
385 | $button_tray->addElement($butt_cancel); |
||
386 | $form->addElement($button_tray); |
||
387 | |||
388 | $form_add = new \XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF'), 'post', true); |
||
389 | $form_add->addElement(new \XoopsFormTextArea(planet_constant('AM_FEED'), 'links')); |
||
390 | $form_add->addElement(new \XoopsFormHidden('op', 'add')); |
||
391 | $button_tray = new \XoopsFormElementTray('', ''); |
||
392 | $butt_save = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
||
393 | $button_tray->addElement($butt_save); |
||
394 | $butt_cancel = new \XoopsFormButton('', '', _CANCEL, 'reset'); |
||
395 | $button_tray->addElement($butt_cancel); |
||
396 | $form_add->addElement($button_tray); |
||
397 | |||
398 | echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>'; |
||
399 | echo '<br>'; |
||
400 | $form->display(); |
||
401 | $form_add->display(); |
||
402 | echo '</fieldset>'; |
||
403 | } |
||
404 | break; |
||
405 | } |
||
406 | |||
407 | xoops_cp_footer(); |
||
408 |
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.