Code Duplication    Length = 14-15 lines in 2 locations

class/Utility.php 1 location

@@ 220-234 (lines=15) @@
217
    echo '</select></div>';
218
}
219
220
    public static function calculateTotals()
221
    {
222
        global $xoopsUser, $xoopsDB, $xoopsModule;
223
        $groups       = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
224
        $gpermHandler = xoops_getHandler('groupperm');
225
226
        $result01 = $xoopsDB->query('SELECT categoryID, total FROM ' . $xoopsDB->prefix('lxcategories') . ' ');
227
        list($totalcategories) = $xoopsDB->getRowsNum($result01);
228
        while (list($categoryID, $total) = $xoopsDB->fetchRow($result01)) {
229
            if ($gpermHandler->checkRight('lexikon_view', $categoryID, $groups, $xoopsModule->getVar('mid'))) {
230
                $newcount = LexikonUtility::countByCategory($categoryID);
231
                $xoopsDB->queryF('UPDATE ' . $xoopsDB->prefix('lxcategories') . " SET total = '$newcount' WHERE categoryID = '$categoryID'");
232
            }
233
        }
234
    }
235
236
    /**
237
     * @param $c

include/functions.php 1 location

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