Code Duplication    Length = 14-15 lines in 2 locations

class/Utility.php 1 location

@@ 240-254 (lines=15) @@
237
     * @param $c
238
     * @return int
239
     */
240
public static function countByCategory($c)
241
{
242
    global $xoopsUser, $xoopsDB, $xoopsModule;
243
    $groups       = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
244
    $gpermHandler = xoops_getHandler('groupperm');
245
    $count        = 0;
246
    $sql          = $xoopsDB->query('SELECT entryID FROM ' . $xoopsDB->prefix('lxentries') . " WHERE offline = '0' AND categoryID = '$c'");
247
    while ($myrow = $xoopsDB->fetchArray($sql)) {
248
        //if ($gpermHandler->checkRight('lexikon_view', $c, $groups, $xoopsModule->getVar('mid'))) {
249
            ++$count;
250
            //}
251
    }
252
253
    return $count;
254
}
255
256
    /**
257
     * @return int

include/functions.php 1 location

@@ 85-98 (lines=14) @@
82
    }
83
}
84
85
function lx_countByCategory( $c ) {
86
    global $xoopsUser, $xoopsDB, $xoopsModule;
87
    $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
88
    $gperm_handler = xoops_gethandler('groupperm');
89
    $count = 0;
90
    $sql = $xoopsDB -> query( "SELECT entryID FROM " . $xoopsDB -> prefix( "lxentries" ) . " WHERE offline = '0' AND categoryID = '$c'" );
91
    while ( $myrow = $xoopsDB -> fetchArray( $sql ) ) {
92
        //if ($gperm_handler->checkRight('lexikon_view', $c, $groups, $xoopsModule->getVar('mid'))) {
93
        $count++;
94
        //}
95
    }
96
97
    return $count;
98
}
99
100
function lx_countCats () {
101
    global $xoopsUser, $xoopsModule;