Code Duplication    Length = 7-7 lines in 3 locations

blocks/random_term.php 1 location

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

index.php 1 location

@@ 127-133 (lines=7) @@
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 . ' '));
127
if ($numrows > 1) {
128
    --$numrows;
129
    mt_srand((double)microtime() * 1000000);
130
    $entrynumber = mt_rand(0, $numrows);
131
} else {
132
    $entrynumber = 0;
133
}
134
135
$resultZ = $xoopsDB->query('SELECT entryID, categoryID, term, definition, html, smiley, xcodes, breaks FROM '
136
                           . $xoopsDB->prefix('lxentries')

syndication.php 1 location

@@ 42-48 (lines=7) @@
39
    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' ");
40
$numrows = $xoopsDB->getRowsNum($resultX);
41
42
if ($numrows > 1) {
43
    --$numrows;
44
    mt_srand((double)microtime() * 1000000);
45
    $entrynumber = mt_rand(0, $numrows);
46
} else {
47
    $entrynumber = 0;
48
}
49
//$resultZ = $xoopsDB -> query ( " SELECT entryID, categoryID, term, definition FROM ".$xoopsDB->prefix("lxentries")." WHERE offline = '0' AND submit = '0' AND request = '0' LIMIT $entrynumber, 1");
50
$resultZ = $xoopsDB->query('SELECT a.entryID, a.categoryID, a.term, a.definition, a.offline, b.* FROM '
51
                           . $xoopsDB->prefix('lxentries')