Code Duplication    Length = 18-22 lines in 2 locations

blocks/xoopstube_top.php 1 location

@@ 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
    $moduleHandler = xoops_getHandler('module');
33
    $module        = $moduleHandler->getByDirname($moduleDirName);
34
    if (!$gpermHandler->checkRight($permType, $cid, $groups, $module->getVar('mid'))) {
35
        if (false === $redirect) {
36
            return false;
37
        } else {
38
            redirect_header('index.php', 3, _NOPERM);
39
        }
40
    }
41
    unset($module);
42
43
    return true;
44
}
45
46
/**
47
 * @param int    $cid

include/search.inc.php 1 location

@@ 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
    $moduleHandler = xoops_getHandler('module');
36
    $module        = $moduleHandler->getByDirname($moduleDirName);
37
38
    if (!$gpermHandler->checkRight($permType, $cid, $groups, $module->getVar('mid'))) {
39
        if (false === $redirect) {
40
            return false;
41
        } else {
42
            redirect_header('index.php', 3, _NOPERM);
43
        }
44
    }
45
    unset($module);
46
47
    return true;
48
}
49
50
/**
51
 * @param $queryarray