Code Duplication    Length = 14-14 lines in 2 locations

class/faq.php 2 locations

@@ 1049-1062 (lines=14) @@
1046
1047
        $userIsAdmin = sf_userIsAdmin();
1048
        // Categories for which user has access
1049
        if (!$userIsAdmin) {
1050
            $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq');
1051
1052
            $categoriesGranted = $smartPermHandler->getPermissions('category');
1053
            $grantedCategories = new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
1054
1055
            $faqsGranted = $smartPermHandler->getPermissions('item');
1056
            $grantedFaq  = new CriteriaCompo();
1057
            $grantedFaq->add(new Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
1058
            // If user is anonymous, check if the FAQ allow partialview
1059
            if (!is_object($xoopsUser)) {
1060
                $grantedFaq->add(new Criteria('partialview', '1'), 'OR');
1061
            }
1062
        }
1063
1064
        if (isset($categoryid) && ($categoryid != -1)) {
1065
            $criteriaCategory = new criteria('categoryid', $categoryid);
@@ 1169-1182 (lines=14) @@
1166
        $ret         = array();
1167
        $userIsAdmin = sf_userIsAdmin();
1168
        // Categories for which user has access
1169
        if (!$userIsAdmin) {
1170
            $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq');
1171
1172
            $categoriesGranted = $smartPermHandler->getPermissions('category');
1173
            $grantedCategories = new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
1174
1175
            $faqsGranted = $smartPermHandler->getPermissions('item');
1176
            $grantedFaq  = new CriteriaCompo();
1177
            $grantedFaq->add(new Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
1178
            // If user is anonymous, check if the FAQ allow partialview
1179
            if (!is_object($xoopsUser)) {
1180
                $grantedFaq->add(new Criteria('partialview', '1'), 'OR');
1181
            }
1182
        }
1183
1184
        if (isset($categoryid) && ($categoryid != -1)) {
1185
            if (is_array($categoryid)) {