Code Duplication    Length = 5-5 lines in 3 locations

blocks/xoopsfaq_category.php 1 location

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

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_recent.php 1 location

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