Code Duplication    Length = 14-15 lines in 2 locations

include/functions.php 1 location

@@ 68-81 (lines=14) @@
65
    echo "</select></div>";
66
}
67
68
function lx_calculateTotals() {
69
    global $xoopsUser, $xoopsDB, $xoopsModule;
70
    $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
71
    $gperm_handler = xoops_gethandler('groupperm');
72
73
    $result01 = $xoopsDB -> query( "SELECT categoryID, total FROM " . $xoopsDB -> prefix( "lxcategories" ) . " " );
74
    list ( $totalcategories ) = $xoopsDB -> getRowsNum( $result01 );
75
    while (list ( $categoryID, $total ) = $xoopsDB -> fetchRow ( $result01 )) {
76
        if ($gperm_handler->checkRight('lexikon_view', $categoryID, $groups, $xoopsModule->getVar('mid'))) {
77
            $newcount = lx_countByCategory ( $categoryID );
78
            $xoopsDB -> queryF( "UPDATE " . $xoopsDB -> prefix( "lxcategories" ) . " SET total = '$newcount' WHERE categoryID = '$categoryID'");
79
        }
80
    }
81
}
82
83
function lx_countByCategory( $c ) {
84
    global $xoopsUser, $xoopsDB, $xoopsModule;

class/Utility.php 1 location

@@ 232-246 (lines=15) @@
229
    echo '</select></div>';
230
}
231
232
    public static function calculateTotals()
233
    {
234
        global $xoopsUser, $xoopsDB, $xoopsModule;
235
        $groups       = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
236
        $gpermHandler = xoops_getHandler('groupperm');
237
238
        $result01 = $xoopsDB->query('SELECT categoryID, total FROM ' . $xoopsDB->prefix('lxcategories') . ' ');
239
        list($totalcategories) = $xoopsDB->getRowsNum($result01);
240
        while (list($categoryID, $total) = $xoopsDB->fetchRow($result01)) {
241
            if ($gpermHandler->checkRight('lexikon_view', $categoryID, $groups, $xoopsModule->getVar('mid'))) {
242
                $newcount = LexikonUtility::countByCategory($categoryID);
243
                $xoopsDB->queryF('UPDATE ' . $xoopsDB->prefix('lxcategories') . " SET total = '$newcount' WHERE categoryID = '$categoryID'");
244
            }
245
        }
246
    }
247
248
    /**
249
     * @param $c