@@ 423-437 (lines=15) @@ | ||
420 | ||
421 | $userIsAdmin = Smartfaq\Utility::userIsAdmin(); |
|
422 | // Categories for which user has access |
|
423 | if (!$userIsAdmin) { |
|
424 | /** @var \XoopsModules\Smartfaq\PermissionHandler $smartPermHandler */ |
|
425 | $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission'); |
|
426 | ||
427 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
|
428 | $grantedCategories = new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
429 | ||
430 | $faqsGranted = $smartPermHandler->getPermissions('item'); |
|
431 | $grantedFaq = new \CriteriaCompo(); |
|
432 | $grantedFaq->add(new \Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
433 | // If user is anonymous, check if the FAQ allow partialview |
|
434 | if (!is_object($xoopsUser)) { |
|
435 | $grantedFaq->add(new \Criteria('partialview', '1'), 'OR'); |
|
436 | } |
|
437 | } |
|
438 | ||
439 | if (isset($categoryid) && (-1 != $categoryid)) { |
|
440 | $criteriaCategory = new \Criteria('categoryid', $categoryid); |
|
@@ 544-558 (lines=15) @@ | ||
541 | $ret = []; |
|
542 | $userIsAdmin = Smartfaq\Utility::userIsAdmin(); |
|
543 | // Categories for which user has access |
|
544 | if (!$userIsAdmin) { |
|
545 | /** @var \XoopsModules\Smartfaq\PermissionHandler $smartPermHandler */ |
|
546 | $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission'); |
|
547 | ||
548 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
|
549 | $grantedCategories = new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
550 | ||
551 | $faqsGranted = $smartPermHandler->getPermissions('item'); |
|
552 | $grantedFaq = new \CriteriaCompo(); |
|
553 | $grantedFaq->add(new \Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
554 | // If user is anonymous, check if the FAQ allow partialview |
|
555 | if (!is_object($xoopsUser)) { |
|
556 | $grantedFaq->add(new \Criteria('partialview', '1'), 'OR'); |
|
557 | } |
|
558 | } |
|
559 | ||
560 | if (isset($categoryid) && (-1 != $categoryid)) { |
|
561 | if (is_array($categoryid)) { |