Code Duplication    Length = 35-35 lines in 2 locations

index.php 2 locations

@@ 224-258 (lines=35) @@
221
                    $votestring = sprintf(_MD_NUMVOTES, $votes);
222
                }
223
224
                if ($xoopsModuleConfig['showdatafieldsincat'] == '1') {
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);
@@ 374-408 (lines=35) @@
371
                        $votestring = sprintf(_MD_NUMVOTES, $votes);
372
                    }
373
374
                    if ($xoopsModuleConfig['showdatafieldsincat'] == '1') {
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);