@@ 27-44 (lines=18) @@ | ||
24 | * |
|
25 | * @return bool |
|
26 | */ |
|
27 | function checkBlockGroups($cid = 0, $permType = 'XTubeCatPerm', $redirect = false) |
|
28 | { |
|
29 | $moduleDirName = basename(dirname(__DIR__)); |
|
30 | $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
31 | $gpermHandler = xoops_getHandler('groupperm'); |
|
32 | /** @var XoopsModuleHandler $moduleHandler */ |
|
33 | $moduleHandler = xoops_getHandler('module'); |
|
34 | $module = $moduleHandler->getByDirname($moduleDirName); |
|
35 | if (!$gpermHandler->checkRight($permType, $cid, $groups, $module->getVar('mid'))) { |
|
36 | if (false === $redirect) { |
|
37 | return false; |
|
38 | } else { |
|
39 | redirect_header('index.php', 3, _NOPERM); |
|
40 | } |
|
41 | } |
|
42 | unset($module); |
|
43 | ||
44 | return true; |
|
45 | } |
|
46 | ||
47 | /** |
@@ 27-48 (lines=22) @@ | ||
24 | * @return bool |
|
25 | */ |
|
26 | ||
27 | function xtubeCheckSearchGroups($cid = 0, $permType = 'XTubeCatPerm', $redirect = false) |
|
28 | { |
|
29 | $moduleDirName = basename(dirname(__DIR__)); |
|
30 | // $modulePath = dirname(__DIR__); |
|
31 | ||
32 | $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
33 | $gpermHandler = xoops_getHandler('groupperm'); |
|
34 | ||
35 | /** @var XoopsModuleHandler $moduleHandler */ |
|
36 | $moduleHandler = xoops_getHandler('module'); |
|
37 | $module = $moduleHandler->getByDirname($moduleDirName); |
|
38 | ||
39 | if (!$gpermHandler->checkRight($permType, $cid, $groups, $module->getVar('mid'))) { |
|
40 | if (false === $redirect) { |
|
41 | return false; |
|
42 | } else { |
|
43 | redirect_header('index.php', 3, _NOPERM); |
|
44 | } |
|
45 | } |
|
46 | unset($module); |
|
47 | ||
48 | return true; |
|
49 | } |
|
50 | ||
51 | /** |