| @@ 28-48 (lines=21) @@ | ||
| 25 | * |
|
| 26 | * @return bool |
|
| 27 | */ |
|
| 28 | function checkBlockGroups($cid = 0, $permType = 'XTubeCatPerm', $redirect = false) |
|
| 29 | { |
|
| 30 | $mydirname = basename(dirname(__DIR__)); |
|
| 31 | global $xoopsUser; |
|
| 32 | ||
| 33 | $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
| 34 | $gperm_handler = & xoops_gethandler('groupperm'); |
|
| 35 | $module_handler = & xoops_gethandler('module'); |
|
| 36 | $module = & $module_handler->getByDirname($mydirname); |
|
| 37 | if (!$gperm_handler->checkRight($permType, $cid, $groups, $module->getVar('mid'))) { |
|
| 38 | if ($redirect == false) { |
|
| 39 | return false; |
|
| 40 | } else { |
|
| 41 | redirect_header('index.php', 3, _NOPERM); |
|
| 42 | exit(); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | unset($module); |
|
| 46 | ||
| 47 | return true; |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * @param int $cid |
|
| @@ 28-52 (lines=25) @@ | ||
| 25 | * @return bool |
|
| 26 | */ |
|
| 27 | ||
| 28 | function xtubeCheckSearchGroups($cid = 0, $permType = 'XTubeCatPerm', $redirect = false) |
|
| 29 | { |
|
| 30 | global $xoopsUser; |
|
| 31 | ||
| 32 | $mydirname = basename(dirname(__DIR__)); |
|
| 33 | // $mydirpath = dirname(__DIR__); |
|
| 34 | ||
| 35 | $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
| 36 | $gperm_handler = & xoops_gethandler('groupperm'); |
|
| 37 | ||
| 38 | $module_handler = & xoops_gethandler('module'); |
|
| 39 | $module = & $module_handler->getByDirname($mydirname); |
|
| 40 | ||
| 41 | if (!$gperm_handler->checkRight($permType, $cid, $groups, $module->getVar('mid'))) { |
|
| 42 | if ($redirect == false) { |
|
| 43 | return false; |
|
| 44 | } else { |
|
| 45 | redirect_header('index.php', 3, _NOPERM); |
|
| 46 | exit(); |
|
| 47 | } |
|
| 48 | } |
|
| 49 | unset($module); |
|
| 50 | ||
| 51 | return true; |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * @param $queryarray |
|