Code Duplication    Length = 7-7 lines in 3 locations

blocks/random_term.php 1 location

@@ 39-45 (lines=7) @@
36
37
    list($numrows) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(entryID) FROM ' . $xoopsDB->prefix('lxentries') . " WHERE offline= '0' AND block = '1' " . $catperms . ' '));
38
39
    if ($numrows > 1) {
40
        --$numrows;
41
        mt_srand((double)microtime() * 1000000);
42
        $entrynumber = mt_rand(0, $numrows);
43
    } else {
44
        $entrynumber = 0;
45
    }
46
47
    $result = $xoopsDB->query('SELECT entryID, categoryID, term, definition FROM ' . $xoopsDB->prefix('lxentries') . " WHERE offline = '0' AND block = '1' " . $catperms . " LIMIT $entrynumber, 1");
48

index.php 1 location

@@ 143-149 (lines=7) @@
140
                                                    . " WHERE submit = 'O' AND offline = '0' "
141
                                                    . $catperms
142
                                                    . ' '));
143
if ($numrows > 1) {
144
    --$numrows;
145
    mt_srand((double)microtime() * 1000000);
146
    $entrynumber = mt_rand(0, $numrows);
147
} else {
148
    $entrynumber = 0;
149
}
150
151
$resultZ = $xoopsDB->query('SELECT entryID, categoryID, term, definition, html, smiley, xcodes, breaks FROM '
152
                           . $xoopsDB->prefix('lxentries')

syndication.php 1 location

@@ 39-45 (lines=7) @@
36
    WHERE a.categoryID = b.gperm_itemid AND b.gperm_modid = $module_id AND b.gperm_name = \"lexikon_view\" AND b.gperm_groupid = $groups[0]  AND offline = '0' AND submit = '0' ");
37
$numrows = $xoopsDB->getRowsNum($resultX);
38
39
if ($numrows > 1) {
40
    --$numrows;
41
    mt_srand((double)microtime() * 1000000);
42
    $entrynumber = mt_rand(0, $numrows);
43
} else {
44
    $entrynumber = 0;
45
}
46
$resultZ = $xoopsDB->query('SELECT a.entryID, a.categoryID, a.term, a.definition, a.offline, b.* FROM '
47
                           . $xoopsDB->prefix('lxentries')
48
                           . ' a, '