Code Duplication    Length = 7-7 lines in 3 locations

blocks/random_term.php 1 location

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

index.php 1 location

@@ 117-123 (lines=7) @@
114
115
    // To display the random term block
116
    list($numrows) = $xoopsDB -> fetchRow($xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB -> prefix("lxentries")." WHERE submit = 'O' AND offline = '0' ".$catperms." "));
117
    if ( $numrows > 1) {
118
        $numrows = $numrows-1;
119
        mt_srand((double)microtime()*1000000);
120
        $entrynumber = mt_rand(0, $numrows);
121
    } else {
122
        $entrynumber = 0;
123
    }
124
125
    $resultZ = $xoopsDB -> query ( "SELECT entryID, categoryID, term, definition, html, smiley, xcodes, breaks FROM ".$xoopsDB->prefix("lxentries")." WHERE submit = 'O' AND offline = '0' ".$catperms." LIMIT $entrynumber, 1");
126

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 = $numrows-1;
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 " . $xoopsDB->prefix("lxentries") . " a, ".$xoopsDB->prefix('group_permission')." b 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 a.datesub < ".time()." AND a.offline = '0' AND a.submit = '0' LIMIT $entrynumber, 1");
51