function checkPermissions($accessLevel, $userId = 0, $gid = 0) { global $my, $acl, $mainframe; if ($mainframe->isAdmin()) { return true; } $show = false; $groupAccess = array(); if ($userId > 0) { $userType = subscribers::getUserType($userId); } elseif (!empty($my->usertype)) { $userType = $my->usertype; } else { return false; } $userGrouId = $acl->get_group_id($userType, 'ARO'); if (class_exists('pro') && $gid > 0) { $groupAccess = $acl->get_group_children($gid, 'ARO', 'RECURSE'); $groupAccess[] = $gid; $gidFront = $acl->get_group_id('Public Frontend', 'ARO'); $ex_groups2 = $acl->get_group_children($gidFront, 'ARO', 'RECURSE'); if (in_array($gid, $ex_groups2)) { $gidAdmin = $acl->get_group_id('Public Backend', 'ARO'); $ex_groups3 = $acl->get_group_children($gidAdmin, 'ARO', 'RECURSE'); $ex_groups3[] = $gidAdmin; $groupAccess = array_merge($groupAccess, $ex_groups3); } } else { if ($accessLevel == 'admin') { $accessLevel = 'Administrator'; } $gidAdmin = $acl->get_group_id($accessLevel, 'ARO'); $groupAccess = $acl->get_group_children($gidAdmin, 'ARO', 'RECURSE'); $groupAccess[] = $gidAdmin; $gidAdminP = $acl->get_group_id('Public Frontend', 'ARO'); $ex_groups3 = $acl->get_group_children($gidAdminP, 'ARO', 'RECURSE'); $ex_groups3[] = $gidAdminP; if (in_array($gidAdmin, $ex_groups3)) { $gidFront = $acl->get_group_id('Public Backend', 'ARO'); $ex_groups4 = $acl->get_group_children($gidFront, 'ARO', 'RECURSE'); $ex_groups4[] = $gidFront; $groupAccess = array_merge($groupAccess, $ex_groups4); } } if (in_array($userGrouId, $groupAccess)) { $show = true; } return $show; }