@@ 387-419 (lines=33) @@ | ||
384 | */ |
|
385 | ||
386 | // TODO : Move this function to sfFaq class |
|
387 | public static function faqAccessGranted($faqObj) |
|
388 | { |
|
389 | global $xoopsUser; |
|
390 | ||
391 | if (sf_userIsAdmin()) { |
|
392 | $result = 1; |
|
393 | } else { |
|
394 | $result = -1; |
|
395 | ||
396 | $groups = $xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
397 | ||
398 | $gpermHandler = xoops_getHandler('groupperm'); |
|
399 | $smartModule = sf_getModuleInfo(); |
|
400 | $module_id = $smartModule->getVar('mid'); |
|
401 | ||
402 | // Do we have access to the parent category |
|
403 | if ($gpermHandler->checkRight('category_read', $faqObj->categoryid(), $groups, $module_id)) { |
|
404 | // Do we have access to the faq? |
|
405 | if ($gpermHandler->checkRight('item_read', $faqObj->faqid(), $groups, $module_id)) { |
|
406 | $result = 1; |
|
407 | } else { // No we don't ! |
|
408 | // Check to see if we have partial view access |
|
409 | if (!is_object($xoopsUser) && $faqObj->partialView()) { |
|
410 | return 0; |
|
411 | } |
|
412 | } |
|
413 | } else { // No we don't ! |
|
414 | $result = false; |
|
415 | } |
|
416 | } |
|
417 | ||
418 | return $result; |
|
419 | } |
|
420 | ||
421 | /** |
|
422 | * Override FAQs permissions of a category by the category read permissions |
@@ 247-279 (lines=33) @@ | ||
244 | */ |
|
245 | ||
246 | // TODO : Move this function to sfFaq class |
|
247 | function faqAccessGranted($faqObj) |
|
248 | { |
|
249 | global $xoopsUser; |
|
250 | ||
251 | if (sf_userIsAdmin()) { |
|
252 | $result = 1; |
|
253 | } else { |
|
254 | $result = -1; |
|
255 | ||
256 | $groups = $xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
257 | ||
258 | $gpermHandler = xoops_getHandler('groupperm'); |
|
259 | $smartModule = sf_getModuleInfo(); |
|
260 | $module_id = $smartModule->getVar('mid'); |
|
261 | ||
262 | // Do we have access to the parent category |
|
263 | if ($gpermHandler->checkRight('category_read', $faqObj->categoryid(), $groups, $module_id)) { |
|
264 | // Do we have access to the faq? |
|
265 | if ($gpermHandler->checkRight('item_read', $faqObj->faqid(), $groups, $module_id)) { |
|
266 | $result = 1; |
|
267 | } else { // No we don't ! |
|
268 | // Check to see if we have partial view access |
|
269 | if (!is_object($xoopsUser) && $faqObj->partialView()) { |
|
270 | return 0; |
|
271 | } |
|
272 | } |
|
273 | } else { // No we don't ! |
|
274 | $result = false; |
|
275 | } |
|
276 | } |
|
277 | ||
278 | return $result; |
|
279 | } |
|
280 | ||
281 | /** |
|
282 | * Override FAQs permissions of a category by the category read permissions |