Code Duplication    Length = 14-14 lines in 2 locations

class/faq.php 2 locations

@@ 1037-1050 (lines=14) @@
1034
1035
        $userIsAdmin = sf_userIsAdmin();
1036
        // Categories for which user has access
1037
        if (!$userIsAdmin) {
1038
            $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq');
1039
1040
            $categoriesGranted = $smartPermHandler->getPermissions('category');
1041
            $grantedCategories = new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
1042
1043
            $faqsGranted = $smartPermHandler->getPermissions('item');
1044
            $grantedFaq  = new CriteriaCompo();
1045
            $grantedFaq->add(new Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
1046
            // If user is anonymous, check if the FAQ allow partialview
1047
            if (!is_object($xoopsUser)) {
1048
                $grantedFaq->add(new Criteria('partialview', '1'), 'OR');
1049
            }
1050
        }
1051
1052
        if (isset($categoryid) && ($categoryid != -1)) {
1053
            $criteriaCategory = new criteria('categoryid', $categoryid);
@@ 1157-1170 (lines=14) @@
1154
        $ret         = array();
1155
        $userIsAdmin = sf_userIsAdmin();
1156
        // Categories for which user has access
1157
        if (!$userIsAdmin) {
1158
            $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq');
1159
1160
            $categoriesGranted = $smartPermHandler->getPermissions('category');
1161
            $grantedCategories = new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
1162
1163
            $faqsGranted = $smartPermHandler->getPermissions('item');
1164
            $grantedFaq  = new CriteriaCompo();
1165
            $grantedFaq->add(new Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
1166
            // If user is anonymous, check if the FAQ allow partialview
1167
            if (!is_object($xoopsUser)) {
1168
                $grantedFaq->add(new Criteria('partialview', '1'), 'OR');
1169
            }
1170
        }
1171
1172
        if (isset($categoryid) && ($categoryid != -1)) {
1173
            if (is_array($categoryid)) {