/** * Check whether a page is visible or not * This will check page-visibility, user- and group permissions * * @access public * @param integer $page_id * @return boolean **/ public static function isVisible($page_id) { $show_it = false; $page = self::properties($page_id); switch ($page['visibility']) { // never shown in FE case 'none': case 'deleted': $show_it = false; break; // shown if called, but not in menu // shown if called, but not in menu case 'hidden': if (self::selectPage() == $page_id) { $show_it = true; } break; // always visible // always visible case 'public': $show_it = true; break; // shown if user is allowed // shown if user is allowed case 'private': case 'registered': if (CAT_Users::is_authenticated() == true) { // check language if (CAT_Registry::get('PAGE_LANGUAGES') == 'false' || (self::properties($page_id, 'language') == '' || self::properties($page_id, 'language') == LANGUAGE)) { $show_it = CAT_Users::is_group_match(CAT_Users::get_groups_id(), $page['viewing_groups']) || CAT_Users::is_group_match(CAT_Users::get_user_id(), $page['viewing_users']) || CAT_Users::is_root(); } } else { $show_it = false; } break; } return $show_it; }
public function is_group_match($groups_list1 = '', $groups_list2 = '') { return CAT_Users::is_group_match($groups_list1, $groups_list2); }