Code Duplication    Length = 14-15 lines in 2 locations

include/functions.php 1 location

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

class/Utility.php 1 location

@@ 252-266 (lines=15) @@
249
     * @param $c
250
     * @return int
251
     */
252
public static function countByCategory($c)
253
{
254
    global $xoopsUser, $xoopsDB, $xoopsModule;
255
    $groups       = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
256
    $gpermHandler = xoops_getHandler('groupperm');
257
    $count        = 0;
258
    $sql          = $xoopsDB->query('SELECT entryID FROM ' . $xoopsDB->prefix('lxentries') . " WHERE offline = '0' AND categoryID = '$c'");
259
    while ($myrow = $xoopsDB->fetchArray($sql)) {
260
            ++$count;
261
    }
262
263
    return $count;
264
}
265
266
    /**
267
     * @return int
268
     */
269
public static function countCats()