Code Duplication    Length = 5-5 lines in 3 locations

blocks/xoopsfaq_rand.php 1 location

@@ 62-66 (lines=5) @@
59
        $cTu             = $catsToUse = array_keys($catListArray);
60
    }
61
    // Remove any cats this user doesn't have rights to view
62
    foreach ($cTu as $key => $thisCat) {
63
        if (false === $permHelper->checkPermission('viewcat', $thisCat)) {
64
            unset($catsToUse[$key]);
65
        }
66
    }
67
    if (!empty($catsToUse)) {
68
        $criteria->add(new \Criteria('contents_cid', '(' . implode(',', $catsToUse) . ')', 'IN'));
69
    } else {

blocks/xoopsfaq_category.php 1 location

@@ 56-60 (lines=5) @@
53
    $catListArray = $categoryHandler->getList();
54
    $cTu          = $catsToUse = array_keys($catListArray);
55
    // Remove any cats this user doesn't have rights to view
56
    foreach ($cTu as $key => $thisCat) {
57
        if (false === $permHelper->checkPermission('viewcat', $thisCat)) {
58
            unset($catsToUse[$key]);
59
        }
60
    }
61
    // catsToUse contains all categories user has rights to view
62
63
    $criteria = new \CriteriaCompo();

blocks/xoopsfaq_recent.php 1 location

@@ 67-71 (lines=5) @@
64
        $cTu             = $catsToUse = array_keys($catListArray);
65
    }
66
    // Remove any cats this user doesn't have rights to view
67
    foreach ($cTu as $key => $thisCat) {
68
        if (false === $permHelper->checkPermission('viewcat', $thisCat)) {
69
            unset($catsToUse[$key]);
70
        }
71
    }
72
    if (!empty($catsToUse)) {
73
        $criteria->add(new \Criteria('contents_cid', '(' . implode(',', $catsToUse) . ')', 'IN'));
74
    } else {