Code Duplication    Length = 12-14 lines in 3 locations

blocks/entries_new.php 1 location

@@ 59-70 (lines=12) @@
56
              . ' DESC';
57
    $result = $xoopsDB->query($sql, $options[1], 0);
58
59
    if ($totalwords > 0) { // If there are definitions
60
        while (list($entryID, $categoryID, $term, $datesub) = $xoopsDB->fetchRow($result)) {
61
            $newentries             = array();
62
            $linktext               = ucfirst($myts->htmlSpecialChars($term));
63
            $newentries['dir']      = $lexikon->dirname();
64
            $newentries['linktext'] = $linktext;
65
            $newentries['id']       = (int)$entryID;
66
            $newentries['date']     = formatTimestamp($datesub, $lxConfig['dateformat']);
67
68
            $block['newstuff'][] = $newentries;
69
        }
70
    }
71
72
    return $block;
73
}

index.php 2 locations

@@ 86-99 (lines=14) @@
83
                            . " AND datesub > 0 AND submit = '0' AND offline = '0' AND request = '0' "
84
                            . $catperms
85
                            . ' ORDER BY datesub DESC', (int)$xoopsModuleConfig['blocksperpage'], 0);
86
if ($publishedwords > 0) { // If there are definitions
87
    //while (list( $entryID, $term, $datesub ) = $xoopsDB->fetchRow($result05)) {
88
    while (list($entryID, $categoryID, $term, $datesub) = $xoopsDB->fetchRow($result05)) {
89
        $newentries             = array();
90
        $xoopsModule            = XoopsModule::getByDirname('lexikon');
91
        $linktext               = ucfirst($myts->htmlSpecialChars($term));
92
        $newentries['linktext'] = $linktext;
93
        $newentries['id']       = $entryID;
94
        $newentries['date']     = formatTimestamp($datesub, 's');
95
96
        $block1['newstuff'][] = $newentries;
97
    }
98
    $xoopsTpl->assign('block', $block1);
99
}
100
101
// To display the most read entries block
102
$block2   = array();
@@ 111-123 (lines=13) @@
108
                            . $catperms
109
                            . ' ORDER BY counter DESC', (int)$xoopsModuleConfig['blocksperpage'], 0);
110
// If there are definitions
111
if ($publishedwords > 0) {
112
    while (list($entryID, $term, $counter) = $xoopsDB->fetchRow($result06)) {
113
        $popentries             = array();
114
        $xoopsModule            = XoopsModule::getByDirname('lexikon');
115
        $linktext               = ucfirst($myts->htmlSpecialChars($term));
116
        $popentries['linktext'] = $linktext;
117
        $popentries['id']       = $entryID;
118
        $popentries['counter']  = (int)$counter;
119
120
        $block2['popstuff'][] = $popentries;
121
    }
122
    $xoopsTpl->assign('block2', $block2);
123
}
124
125
// To display the random term block
126
list($numrows) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('lxentries') . " WHERE submit = 'O' AND offline = '0' " . $catperms . ' '));