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

@@ 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;