1 | <?php |
||||
2 | /* |
||||
3 | * You may not change or alter any portion of this comment or credits |
||||
4 | * of supporting developers from this source code or any supporting source code |
||||
5 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||||
6 | * |
||||
7 | * This program is distributed in the hope that it will be useful, |
||||
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||
10 | */ |
||||
11 | |||||
12 | /** |
||||
13 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||||
14 | * @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
||||
15 | * @package efqdirectory |
||||
16 | * @since |
||||
17 | * @author Martijn Hertog (aka wtravel) |
||||
18 | * @author XOOPS Development Team, |
||||
19 | */ |
||||
20 | |||||
21 | include __DIR__ . '/header.php'; |
||||
22 | $myts = MyTextSanitizer::getInstance(); // MyTextSanitizer object |
||||
0 ignored issues
–
show
|
|||||
23 | require_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; |
||||
0 ignored issues
–
show
|
|||||
24 | require_once XOOPS_ROOT_PATH . '/include/xoopscodes.php'; |
||||
25 | require_once XOOPS_ROOT_PATH . '/class/module.errorhandler.php'; |
||||
26 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||||
27 | require_once __DIR__ . '/class/class.datafieldmanager.php'; |
||||
28 | require_once __DIR__ . '/class/class.couponhandler.php'; |
||||
29 | require_once __DIR__ . '/class/class.efqtree.php'; |
||||
30 | |||||
31 | $datafieldmanager = new efqDataFieldManager(); |
||||
32 | $moddir = $xoopsModule->getVar('dirname'); |
||||
33 | |||||
34 | $eh = new ErrorHandler; |
||||
0 ignored issues
–
show
The type
ErrorHandler was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
35 | |||||
36 | $mytree = new XoopsTree($xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat'), 'cid', 'pid'); |
||||
0 ignored issues
–
show
The type
XoopsTree was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
37 | $efqtree = new efqTree($xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat'), 'cid', 'pid'); |
||||
38 | |||||
39 | //Check if any option in URL |
||||
40 | if (!empty($_GET['op'])) { |
||||
41 | $op = $_GET['op']; |
||||
42 | } else { |
||||
43 | $op = 0; |
||||
44 | } |
||||
45 | |||||
46 | //Check if a category is selected. |
||||
47 | if (!empty($_GET['catid'])) { |
||||
48 | $get_catid = (int)$_GET['catid']; |
||||
49 | } else { |
||||
50 | $get_catid = '0'; |
||||
51 | } |
||||
52 | |||||
53 | //Check if a directory is selected. |
||||
54 | if (!empty($_GET['dirid'])) { |
||||
55 | $get_dirid = (int)$_GET['dirid']; |
||||
56 | } else { |
||||
57 | $get_dirid = '0'; |
||||
58 | } |
||||
59 | |||||
60 | if ($get_dirid == '0' && $get_catid == '0') { |
||||
61 | //Show an overview of directories with directory title, image and description for each directory. |
||||
62 | $result = $xoopsDB->query('SELECT dirid, name, descr, img FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dir') . " WHERE open = '1' ORDER BY name") or $eh->show('0013'); |
||||
63 | $num_results = $xoopsDB->getRowsNum($result); |
||||
64 | if ($num_results == 1) { |
||||
65 | if ($xoopsModuleConfig['autoshowonedir'] == 1) { |
||||
66 | while (list($dirid, $name, $descr, $img) = $xoopsDB->fetchRow($result)) { |
||||
67 | $get_dirid = $dirid; |
||||
68 | } |
||||
69 | View Code Duplication | } else { |
|||
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. ![]() |
|||||
70 | $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_directories.tpl'; |
||||
71 | include XOOPS_ROOT_PATH . '/header.php'; |
||||
72 | $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
||||
73 | $xoopsTpl->assign('lang_directories', _MD_DIRECTORIES_HEADER); |
||||
74 | $xoopsTpl->assign('moddir', $moddir); |
||||
75 | while (list($dirid, $name, $descr, $img) = $xoopsDB->fetchRow($result)) { |
||||
76 | if ($img != '') { |
||||
77 | $img = XOOPS_URL . "/modules/$moddir/uploads/" . $myts->htmlSpecialChars($img); |
||||
0 ignored issues
–
show
|
|||||
78 | } else { |
||||
79 | $img = XOOPS_URL . "/modules/$moddir/assets/images/nopicture.gif"; |
||||
80 | } |
||||
81 | $xoopsTpl->append('directories', array('image' => $img, 'id' => $dirid, 'title' => $name, 'descr' => $descr)); |
||||
82 | } |
||||
83 | } |
||||
84 | View Code Duplication | } elseif ($num_results >= 2) { |
|||
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. ![]() |
|||||
85 | $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_directories.tpl'; |
||||
86 | include XOOPS_ROOT_PATH . '/header.php'; |
||||
87 | $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
||||
88 | $xoopsTpl->assign('lang_directories', _MD_DIRECTORIES_HEADER); |
||||
89 | $xoopsTpl->assign('moddir', $moddir); |
||||
90 | while (list($dirid, $name, $descr, $img) = $xoopsDB->fetchRow($result)) { |
||||
91 | if ($img != '') { |
||||
92 | $img = XOOPS_URL . "/modules/$moddir/uploads/" . $myts->htmlSpecialChars($img); |
||||
93 | } else { |
||||
94 | $img = XOOPS_URL . "/modules/$moddir/assets/images/nopicture.gif"; |
||||
95 | } |
||||
96 | $xoopsTpl->append('directories', array('image' => $img, 'id' => $dirid, 'title' => $name, 'descr' => $descr)); |
||||
97 | } |
||||
98 | } else { |
||||
99 | redirect_header(XOOPS_URL, 2, _MD_NOACTIVEDIRECTORIES); |
||||
0 ignored issues
–
show
The function
redirect_header was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
100 | exit(); |
||||
101 | } |
||||
102 | } |
||||
103 | if ($get_dirid != 0 || $get_catid != 0) { |
||||
104 | //Get all categories and child categories for selected category |
||||
105 | $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_index.tpl'; |
||||
106 | include XOOPS_ROOT_PATH . '/header.php'; |
||||
107 | $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
||||
108 | $xoopsTpl->assign('moddir', $moddir); |
||||
109 | if ($get_dirid == '0') { |
||||
110 | $dirid = getDirId($get_catid); |
||||
111 | } else { |
||||
112 | $dirid = $get_dirid; |
||||
113 | } |
||||
114 | ob_start(); |
||||
115 | printf(_MD_SEARCH_ADV, $dirid); |
||||
116 | $lang_adv_search = ob_get_contents(); |
||||
117 | ob_end_clean(); |
||||
118 | $searchform = '<form action="search.php" name="search" id="search" method="get">'; |
||||
119 | $searchform .= '<input type="hidden" name="dirid" value="' . $dirid . '"><input type="text" name="q" size="40" maxsize="150" value=""><input type="submit" class="formButton" name="submit" value="' . _MD_SEARCH . '">' . $lang_adv_search . '</form>'; |
||||
120 | $xoopsTpl->assign('searchform', $searchform); |
||||
121 | $pathstring = "<a href='index.php?dirid=" . $dirid . '\'>' . _MD_MAIN . '</a> : '; |
||||
122 | $pathstring .= $efqtree->getNicePathFromId($get_catid, 'title', 'index.php?dirid=' . $dirid . '&op='); |
||||
123 | $xoopsTpl->assign('category_path', $pathstring); |
||||
124 | |||||
125 | if (isset($xoopsUser) && $xoopsUser != null) { |
||||
126 | $submitlink = '<a href="submit.php?dirid=' . $dirid . '"><img src="' . XOOPS_URL . '/modules/' . $moddir . '/assets/images/' . $xoopsConfig['language'] . '/listing-new.gif" alt="' . _MD_SUBMITLISTING . '" title="' . _MD_SUBMITLISTING . '"></a>'; |
||||
127 | $xoopsTpl->assign('submit_link', $submitlink); |
||||
128 | } |
||||
129 | |||||
130 | if ($get_catid == 0) { |
||||
131 | $result = $xoopsDB->query('SELECT cid, title, img FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE pid = '0' AND dirid = '" . $get_dirid . '\' ORDER BY title') or $eh->show('0013'); |
||||
132 | } else { |
||||
133 | $result = $xoopsDB->query('SELECT cid, title, img FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE pid = '" . $get_catid . '\' ORDER BY title') or $eh->show('0013'); |
||||
134 | } |
||||
135 | $num_results = $GLOBALS['xoopsDB']->getRowsNum($result); |
||||
136 | if ($num_results == 0 && isset($_GET['dirid'])) { |
||||
137 | $xoopsTpl->assign('lang_noresults', _MD_NORESULTS); |
||||
138 | } else { |
||||
139 | $count = 1; |
||||
140 | while ($myrow = $xoopsDB->fetchArray($result)) { |
||||
141 | $totallisting = getTotalItems($myrow['cid'], 2); |
||||
142 | $img = ''; |
||||
143 | if ($myrow['img'] && $myrow['img'] != '') { |
||||
144 | $img = XOOPS_URL . "/modules/$moddir/uploads/" . $myts->htmlSpecialChars($myrow['img']); |
||||
145 | } |
||||
146 | $arr = array(); |
||||
147 | $arr = $efqtree->getFirstChild($myrow['cid'], 'title'); |
||||
148 | $space = 0; |
||||
149 | $chcount = 0; |
||||
150 | $subcategories = ''; |
||||
151 | foreach ($arr as $ele) { |
||||
152 | $chtitle = $myts->htmlSpecialChars($ele['title']); |
||||
153 | if ($chcount > 5) { |
||||
154 | $subcategories .= '...'; |
||||
155 | break; |
||||
156 | } |
||||
157 | if ($space > 0) { |
||||
158 | $subcategories .= ', '; |
||||
159 | } |
||||
160 | $subcategories .= '<a class="subcategory" href="' . XOOPS_URL . "/modules/$moddir/index.php?catid=" . $ele['cid'] . '">' . $chtitle . '</a>'; |
||||
161 | ++$space; |
||||
162 | ++$chcount; |
||||
163 | } |
||||
164 | $cattitle = '<a href="' . XOOPS_URL . "/modules/$moddir/index.php?catid=" . $myrow['cid'] . '">' . $myrow['title'] . '</a>'; |
||||
165 | $xoopsTpl->append('categories', array('image' => $img, 'id' => $myrow['cid'], 'title' => $cattitle, 'subcategories' => $subcategories, 'totallisting' => $totallisting, 'count' => $count)); |
||||
166 | ++$count; |
||||
167 | } |
||||
168 | |||||
169 | View Code Duplication | if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) { |
|||
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. ![]() |
|||||
170 | $isadmin = true; |
||||
171 | } else { |
||||
172 | $isadmin = false; |
||||
173 | } |
||||
174 | /*if ($xoopsModuleConfig['allowcomments'] == 1) { |
||||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
65% 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. ![]() |
|||||
175 | $xoopsTpl->assign('allowcomments', true); |
||||
176 | $xoopsTpl->assign('lang_comments' , _COMMENTS); |
||||
177 | } |
||||
178 | if ($xoopsModuleConfig['allowreviews'] == 1) { |
||||
179 | $xoopsTpl->assign('allowreviews', true); |
||||
180 | }*/ |
||||
181 | View Code Duplication | if ($xoopsModuleConfig['allowtellafriend'] == 1) { |
|||
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. ![]() |
|||||
182 | $xoopsTpl->assign('allowtellafriend', true); |
||||
183 | $xoopsTpl->assign('lang_tellafriend', _MD_TELLAFRIEND); |
||||
184 | } |
||||
185 | View Code Duplication | if ($xoopsModuleConfig['allowrating'] == 1) { |
|||
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. ![]() |
|||||
186 | $xoopsTpl->assign('allowrating', true); |
||||
187 | $xoopsTpl->assign('lang_rating', _MD_RATINGC); |
||||
188 | $xoopsTpl->assign('lang_ratethissite', _MD_RATETHISSITE); |
||||
189 | } |
||||
190 | $xoopsTpl->assign('lang_description', _MD_DESCRIPTIONC); |
||||
191 | $xoopsTpl->assign('lang_lastupdate', _MD_LASTUPDATEC); |
||||
192 | $xoopsTpl->assign('lang_hits', _MD_HITSC); |
||||
193 | $xoopsTpl->assign('lang_modify', _MD_MODIFY); |
||||
194 | $xoopsTpl->assign('lang_listings', _MD_LATESTLIST); |
||||
195 | $xoopsTpl->assign('lang_category', _MD_CATEGORYC); |
||||
196 | $xoopsTpl->assign('lang_visit', _MD_VISIT); |
||||
197 | $sections = array(); |
||||
198 | if ($get_catid == 0) { |
||||
199 | $sql = 'SELECT l.itemid, l.logourl, l.uid, l.status, l.created, l.title, l.hits, l.rating, l.votes, l.typeid, l.dirid, t.description FROM ' |
||||
200 | . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') |
||||
201 | . ' c, ' |
||||
202 | . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
||||
203 | . ' x, ' |
||||
204 | . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
||||
205 | . ' l LEFT JOIN ' |
||||
206 | . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
||||
207 | . " t ON (l.itemid=t.itemid) WHERE x.cid=c.cid AND l.itemid=x.itemid AND c.showpopular=1 AND l.status='2' AND l.dirid = '" |
||||
208 | . $get_dirid |
||||
209 | . '\' ORDER BY l.created DESC'; |
||||
210 | $result = $xoopsDB->query($sql) or $eh->show('0013'); |
||||
211 | |||||
212 | while (list($itemid, $logourl, $uid, $status, $created, $ltitle, $hits, $rating, $votes, $type, $dirid, $description) = $xoopsDB->fetchRow($result)) { |
||||
213 | View Code Duplication | if ($isadmin) { |
|||
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 | $adminlink = '<a href="' . XOOPS_URL . '/modules/' . $moddir . '/admin/index.php?op=edit&item=' . $itemid . '"><img src="' . XOOPS_URL . '/modules/' . $moddir . '/assets/images/editicon.gif" border="0" alt="' . _MD_EDITTHISLINK . '"></a>'; |
||||
215 | } else { |
||||
216 | $adminlink = ''; |
||||
217 | } |
||||
218 | View Code Duplication | if ($votes == 1) { |
|||
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. ![]() |
|||||
219 | $votestring = _MD_ONEVOTE; |
||||
220 | } else { |
||||
221 | $votestring = sprintf(_MD_NUMVOTES, $votes); |
||||
222 | } |
||||
223 | |||||
224 | View Code Duplication | if ($xoopsModuleConfig['showdatafieldsincat'] == '1') { |
|||
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. ![]() |
|||||
225 | $xoopsTpl->assign('showdatafieldsincat', true); |
||||
226 | $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, t.icon, f.typeid, f.fieldtype, f.ext, t.options, t.custom, d.itemid, d.value, d.customtitle '; |
||||
227 | $sql .= 'FROM ' |
||||
228 | . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
||||
229 | . ' ic, ' |
||||
230 | . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes_x_cat') |
||||
231 | . ' xc, ' |
||||
232 | . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_fieldtypes') |
||||
233 | . ' f, ' |
||||
234 | . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes') |
||||
235 | . ' t '; |
||||
236 | $sql .= 'LEFT JOIN ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . $itemid . ') '; |
||||
237 | $sql .= "WHERE ic.cid=xc.cid AND ic.active='1' AND xc.dtypeid=t.dtypeid AND t.fieldtypeid=f.typeid AND t.activeyn='1' AND ic.itemid=" . $itemid . ' ORDER BY t.seq ASC'; |
||||
238 | $data_result = $xoopsDB->query($sql) or $eh->show('0013'); |
||||
239 | $numrows = $xoopsDB->getRowsNum($data_result); |
||||
240 | if ($numrows > 0) { |
||||
241 | $xoopsTpl->assign('datatypes', true); |
||||
242 | } |
||||
243 | $sections = array(); |
||||
244 | while (list($dtypeid, $title, $section, $icon, $ftypeid, $fieldtype, $ext, $options, $custom, $ditemid, $value, $customtitle) = $xoopsDB->fetchRow($data_result)) { |
||||
245 | $fieldvalue = $datafieldmanager->getFieldValue($fieldtype, $options, $value); |
||||
246 | if ($icon != '') { |
||||
247 | $iconurl = "<img src=\"uploads/$icon\">"; |
||||
248 | } else { |
||||
249 | $iconurl = ''; |
||||
250 | } |
||||
251 | if ($custom != '0' && $customtitle != '') { |
||||
252 | $title = $customtitle; |
||||
253 | } |
||||
254 | if ($section == '0' or '1') { |
||||
255 | $sections[] = array('icon' => $iconurl, 'label' => $title, 'value' => $fieldvalue, 'fieldtype' => $fieldtype); |
||||
256 | } |
||||
257 | } |
||||
258 | } |
||||
259 | |||||
260 | $couponHandler = new efqCouponHandler(); |
||||
261 | $coupons = $couponHandler->getCountByLink($itemid); |
||||
262 | $path = $efqtree->getPathFromId($get_catid, 'title'); |
||||
263 | $path = substr($path, 1); |
||||
264 | $path = str_replace('/', " <img src='" . XOOPS_URL . '/modules/' . $moddir . "/assets/images/arrow.gif' board='0' alt=''> ", $path); |
||||
265 | $new = newlinkgraphic($created, $status); |
||||
266 | $pop = popgraphic($hits); |
||||
267 | $xoopsTpl->append('listings', array( |
||||
268 | 'fields' => $sections, |
||||
269 | 'coupons' => $coupons, |
||||
270 | 'catid' => $get_catid, |
||||
271 | 'id' => $itemid, |
||||
272 | 'rating' => number_format($rating, 2), |
||||
273 | 'title' => $myts->htmlSpecialChars($ltitle) . $pop, |
||||
274 | 'type' => $type, |
||||
275 | 'logourl' => $myts->htmlSpecialChars($logourl), |
||||
276 | 'description' => $myts->displayTarea($description, 0), |
||||
277 | 'adminlink' => $adminlink, |
||||
278 | 'hits' => $hits, |
||||
279 | 'votes' => $votestring, |
||||
280 | 'mail_subject' => rawurlencode(sprintf(_MD_INTERESTING_LISTING, $xoopsConfig['sitename'])), |
||||
281 | 'mail_body' => rawurlencode(sprintf(_MD_INTERESTING_LISTING_FOUND, $xoopsConfig['sitename']) . ': ' . XOOPS_URL . '/modules/' . $moddir . '/singleitem.php?cid=' . $get_catid . '&item=' . $itemid) |
||||
282 | )); |
||||
283 | } |
||||
284 | } else { |
||||
285 | if (isset($_GET['show'])) { |
||||
286 | $show = (int)$_GET['show']; |
||||
287 | } else { |
||||
288 | $show = $xoopsModuleConfig['perpage']; |
||||
289 | } |
||||
290 | $min = isset($_GET['min']) ? (int)$_GET['min'] : 0; |
||||
291 | if (!isset($max)) { |
||||
292 | $max = $min + $show; |
||||
293 | } |
||||
294 | View Code Duplication | if (isset($_GET['orderby'])) { |
|||
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. ![]() |
|||||
295 | $orderby = convertOrderByIn($_GET['orderby']); |
||||
296 | } else { |
||||
297 | $orderby = 'typelevel DESC'; |
||||
298 | } |
||||
299 | $fullcountresult = $xoopsDB->query('select count(*) from ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' i, ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') . " x WHERE i.itemid=x.itemid AND x.cid=$get_catid AND i.status='2'"); |
||||
300 | list($numrows) = $xoopsDB->fetchRow($fullcountresult); |
||||
301 | $totalcount = $numrows; |
||||
302 | $page_nav = ''; |
||||
303 | if ($numrows > 0) { |
||||
304 | /*if ($xoopsModuleConfig['allowcomments'] == 1) { |
||||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
65% 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. ![]() |
|||||
305 | $xoopsTpl->assign('allowcomments', true); |
||||
306 | $xoopsTpl->assign('lang_comments' , _COMMENTS); |
||||
307 | }*/ |
||||
308 | /*if ($xoopsModuleConfig['allowreviews'] == 1) { |
||||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
67% 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. ![]() |
|||||
309 | $xoopsTpl->assign('allowreviews', true); |
||||
310 | }*/ |
||||
311 | View Code Duplication | if ($xoopsModuleConfig['allowtellafriend'] == 1) { |
|||
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. ![]() |
|||||
312 | $xoopsTpl->assign('allowtellafriend', true); |
||||
313 | $xoopsTpl->assign('lang_tellafriend', _MD_TELLAFRIEND); |
||||
314 | } |
||||
315 | View Code Duplication | if ($xoopsModuleConfig['allowrating'] == 1) { |
|||
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. ![]() |
|||||
316 | $xoopsTpl->assign('allowrating', true); |
||||
317 | $xoopsTpl->assign('lang_rating', _MD_RATINGC); |
||||
318 | $xoopsTpl->assign('lang_ratethissite', _MD_RATETHISSITE); |
||||
319 | } |
||||
320 | $xoopsTpl->assign('lang_listings', _MD_LISTINGS); |
||||
321 | $xoopsTpl->assign('category_id', $get_catid); |
||||
322 | $xoopsTpl->assign('lang_description', _MD_DESCRIPTIONC); |
||||
323 | $xoopsTpl->assign('lang_lastupdate', _MD_LASTUPDATEC); |
||||
324 | $xoopsTpl->assign('lang_hits', _MD_HITSC); |
||||
325 | $xoopsTpl->assign('lang_modify', _MD_MODIFY); |
||||
326 | $xoopsTpl->assign('lang_category', _MD_CATEGORYC); |
||||
327 | $xoopsTpl->assign('lang_visit', _MD_VISIT); |
||||
328 | $xoopsTpl->assign('show_listings', true); |
||||
329 | $sql = 'SELECT i.itemid, i.logourl, i.uid, i.status, i.created, i.title, i.hits, i.rating, i.votes, i.typeid, i.dirid, t.typelevel, txt.description, x.cid FROM ' |
||||
330 | . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
||||
331 | . ' x, ' |
||||
332 | . $xoopsDB->prefix($module->getVar('dirname', 'n') |
||||
333 | . '_items') |
||||
334 | . ' i LEFT JOIN ' |
||||
335 | . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_itemtypes') |
||||
336 | . ' t ON (t.typeid=i.typeid) LEFT JOIN ' |
||||
337 | . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
||||
338 | . " txt ON (txt.itemid=i.itemid) WHERE i.itemid=x.itemid AND x.cid=$get_catid AND x.active='1' AND i.status='2' ORDER BY $orderby"; |
||||
339 | $result = $xoopsDB->query($sql, $show, $min) or $eh->show('0013'); |
||||
340 | $numrows = $xoopsDB->getRowsNum($result); |
||||
341 | |||||
342 | //if 2 or more items in result, show the sort menu |
||||
343 | if ($numrows > 1) { |
||||
344 | $xoopsTpl->assign('show_nav', true); |
||||
345 | $orderbyTrans = convertorderbytrans($orderby); |
||||
346 | $xoopsTpl->assign('lang_sortby', _MD_SORTBY); |
||||
347 | $xoopsTpl->assign('lang_title', _MD_TITLE); |
||||
348 | $xoopsTpl->assign('lang_date', _MD_DATE); |
||||
349 | $xoopsTpl->assign('lang_rating', _MD_RATING); |
||||
350 | $xoopsTpl->assign('lang_popularity', _MD_POPULARITY); |
||||
351 | if ($orderby != 'typelevel DESC') { |
||||
352 | $xoopsTpl->assign('lang_cursortedby', sprintf(_MD_CURSORTEDBY, convertorderbytrans($orderby))); |
||||
353 | } |
||||
354 | } |
||||
355 | if ($xoopsModuleConfig['showlinkimages'] == 1) { |
||||
356 | $xoopsTpl->assign('showlinkimages', 1); |
||||
357 | } |
||||
358 | while (list($itemid, $logourl, $uid, $status, $created, $itemtitle, $hits, $rating, $votes, $typeid, $dirid, $level, $description, $cid) = $xoopsDB->fetchRow($result)) { |
||||
359 | if ($isadmin) { |
||||
360 | View Code Duplication | if ($xoopsModuleConfig['showlinkimages'] == 1) { |
|||
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. ![]() |
|||||
361 | $adminlink = '<a href="' . XOOPS_URL . '/modules/' . $moddir . '/admin/index.php?op=edit&item=' . $itemid . '"><img src="' . XOOPS_URL . '/modules/' . $moddir . '/assets/images/editicon.gif" border="0" alt="' . _MD_EDITTHISLISTING . '"></a>'; |
||||
362 | } else { |
||||
363 | $adminlink = ''; |
||||
364 | } |
||||
365 | } else { |
||||
366 | $adminlink = ''; |
||||
367 | } |
||||
368 | View Code Duplication | if ($votes == 1) { |
|||
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. ![]() |
|||||
369 | $votestring = _MD_ONEVOTE; |
||||
370 | } else { |
||||
371 | $votestring = sprintf(_MD_NUMVOTES, $votes); |
||||
372 | } |
||||
373 | |||||
374 | View Code Duplication | if ($xoopsModuleConfig['showdatafieldsincat'] == '1') { |
|||
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. ![]() |
|||||
375 | $xoopsTpl->assign('showdatafieldsincat', true); |
||||
376 | $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, t.icon, f.typeid, f.fieldtype, f.ext, t.options, t.custom, d.itemid, d.value, d.customtitle '; |
||||
377 | $sql .= 'FROM ' |
||||
378 | . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
||||
379 | . ' ic, ' |
||||
380 | . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes_x_cat') |
||||
381 | . ' xc, ' |
||||
382 | . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_fieldtypes') |
||||
383 | . ' f, ' |
||||
384 | . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes') |
||||
385 | . ' t '; |
||||
386 | $sql .= 'LEFT JOIN ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . $itemid . ') '; |
||||
387 | $sql .= "WHERE ic.cid=xc.cid AND ic.active='1' AND xc.dtypeid=t.dtypeid AND t.fieldtypeid=f.typeid AND t.activeyn='1' AND ic.itemid=" . $itemid . ' ORDER BY t.seq ASC'; |
||||
388 | $data_result = $xoopsDB->query($sql) or $eh->show('0013'); |
||||
389 | $numrows = $xoopsDB->getRowsNum($data_result); |
||||
390 | if ($numrows > 0) { |
||||
391 | $xoopsTpl->assign('datatypes', true); |
||||
392 | } |
||||
393 | $sections = array(); |
||||
394 | while (list($dtypeid, $title, $section, $icon, $ftypeid, $fieldtype, $ext, $options, $custom, $ditemid, $value, $customtitle) = $xoopsDB->fetchRow($data_result)) { |
||||
395 | $fieldvalue = $datafieldmanager->getFieldValue($fieldtype, $options, $value); |
||||
396 | if ($icon != '') { |
||||
397 | $iconurl = "<img src=\"uploads/$icon\">"; |
||||
398 | } else { |
||||
399 | $iconurl = ''; |
||||
400 | } |
||||
401 | if ($custom != '0' && $customtitle != '') { |
||||
402 | $title = $customtitle; |
||||
403 | } |
||||
404 | if ($section == '1' or '1') { |
||||
405 | $sections[] = array('icon' => $iconurl, 'label' => $title, 'value' => $fieldvalue, 'fieldtype' => $fieldtype); |
||||
406 | } |
||||
407 | } |
||||
408 | } |
||||
409 | |||||
410 | $path = $efqtree->getPathFromId($get_catid, 'title'); |
||||
411 | $path = substr($path, 1); |
||||
412 | $path = str_replace('/', " <img src='" . XOOPS_URL . '/modules/' . $moddir . "/assets/images/arrow.gif' board='0' alt=''> ", $path); |
||||
413 | $new = newlinkgraphic($created, $status); |
||||
414 | $pop = popgraphic($hits); |
||||
415 | if ($level == null) { |
||||
416 | $level = '0'; |
||||
417 | } |
||||
418 | switch ($level) { |
||||
419 | case '0': |
||||
420 | $class = 'itemTableLevel0'; |
||||
421 | break; |
||||
422 | case '1': |
||||
423 | $class = 'itemTableLevel1'; |
||||
424 | break; |
||||
425 | case '2': |
||||
426 | $class = 'itemTableLevel2'; |
||||
427 | break; |
||||
428 | case '3': |
||||
429 | $class = 'itemTableLevel3'; |
||||
430 | break; |
||||
431 | } |
||||
432 | $xoopsTpl->append('listings', array( |
||||
433 | 'fields' => $sections, |
||||
434 | 'id' => $itemid, |
||||
435 | 'catid' => $get_catid, |
||||
436 | 'logourl' => $myts->htmlSpecialChars($logourl), |
||||
437 | 'title' => $myts->htmlSpecialChars($itemtitle) . $new . $pop, |
||||
438 | 'status' => $status, |
||||
439 | 'created' => formatTimestamp($created, 'm'), |
||||
0 ignored issues
–
show
The function
formatTimestamp was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
440 | 'rating' => number_format($rating, 2), |
||||
441 | 'category' => $path, |
||||
442 | 'description' => $myts->displayTarea($description, 0), |
||||
443 | 'adminlink' => $adminlink, |
||||
444 | 'hits' => $hits, |
||||
445 | 'rating' => $rating, |
||||
446 | 'votes' => $votestring, |
||||
447 | 'class' => $class, |
||||
448 | 'mail_subject' => rawurlencode(sprintf(_MD_INTERESTING_LISTING, $xoopsConfig['sitename'])), |
||||
449 | 'mail_body' => rawurlencode(sprintf(_MD_INTERESTING_LISTING_FOUND, $xoopsConfig['sitename']) . ': ' . XOOPS_URL . '/modules/' . $moddir . '/listing.php?catid=' . $get_catid . '&item=' . $itemid) |
||||
450 | )); |
||||
451 | } |
||||
452 | $orderby = convertorderbyout($orderby); |
||||
453 | //Calculates how many pages exist. Which page one should be on, etc... |
||||
454 | $listingpages = ceil($totalcount / $show); |
||||
455 | |||||
456 | //Page Numbering |
||||
457 | if ($listingpages != 1 && $listingpages != 0) { |
||||
458 | $get_catid = (int)$_GET['catid']; |
||||
459 | $prev = $min - $show; |
||||
460 | if ($prev >= 0) { |
||||
461 | $page_nav .= "<a href='index.php?catid=" . $get_catid . "&min=$prev&orderby=$orderby&show=$show'><b><u>«</u></b></a> "; |
||||
462 | } |
||||
463 | $counter = 1; |
||||
464 | $currentpage = ($max / $show); |
||||
465 | while ($counter <= $listingpages) { |
||||
466 | $mintemp = ($show * $counter) - $show; |
||||
467 | if ($counter == $currentpage) { |
||||
468 | $page_nav .= '<strong>(' . $counter . ')</strong> '; |
||||
469 | } else { |
||||
470 | $page_nav .= "<a href='index.php?catid=" . $get_catid . '&min=' . $mintemp . '&orderby=' . $orderby . '&show=' . $show . '\'>' . $counter . '</a> '; |
||||
471 | } |
||||
472 | ++$counter; |
||||
473 | } |
||||
474 | if ($numrows > $max) { |
||||
475 | $page_nav .= "<a href='index.php?catid=" . $get_catid . '&min=' . $max . '&orderby=' . $orderby . '&show=' . $show . '\'>'; |
||||
476 | $page_nav .= '<strong><u>»</u></strong></a>'; |
||||
477 | } |
||||
478 | $xoopsTpl->assign('page_nav', $page_nav); |
||||
479 | } |
||||
480 | } |
||||
481 | } |
||||
482 | } |
||||
483 | } |
||||
484 | include XOOPS_ROOT_PATH . '/footer.php'; |
||||
485 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths