function build_kernel_map($mode = SITE_MAP_USER_MODE, $auth_mode = SITE_MAP_AUTH_GUEST) { global $CONFIG, $LANG, $User; $kernel_map = new ModuleMap(new SiteMapLink($LANG['home'], new Url($CONFIG['start_page']))); $kernel_map->set_description(nl2br($CONFIG['site_desc'])); if ($mode == SITE_MAP_USER_MODE) { $kernel_map->add(new SiteMapLink($LANG['members_list'], new Url('/member/member.php'))); if ($auth_mode == SITE_MAP_AUTH_USER && $User->check_level(MEMBER_LEVEL)) { $member_space_section = new SiteMapSection(new SiteMapLink($LANG['my_private_profile'], new Url('/member/' . url('member.php?id=' . $User->get_id() . '&view=1', 'member-' . $User->get_id() . '.php?view=1')))); $member_space_section->add(new SiteMapLink($LANG['profile_edition'], new Url('/member/' . url('member.php?id=' . $User->get_id() . '&edit=1', 'member-' . $User->get_id() . '.php?edit=1')))); $member_space_section->add(new SiteMapLink($LANG['private_messaging'], new Url('/member/' . url('pm.php?pm=' . $User->get_id(), 'pm-' . $User->get_id() . '.php')))); $member_space_section->add(new SiteMapLink($LANG['contribution_panel'], new Url('/member/contribution_panel.php'))); if ($User->check_level(ADMIN_LEVEL)) { $member_space_section->add(new SiteMapLink($LANG['admin_panel'], new Url('/admin/admin_index.php'))); } $kernel_map->add($member_space_section); } } $this->add($kernel_map); }
function _create_module_map_sections($id_cat, $auth_mode) { global $FAQ_CATS, $FAQ_LANG, $LANG, $User, $FAQ_CONFIG; $this_category = new SiteMapLink($FAQ_CATS[$id_cat]['name'], new Url('/faq/' . url('faq.php?id=' . $id_cat, 'faq-' . $id_cat . '+' . url_encode_rewrite($FAQ_CATS[$id_cat]['name']) . '.php'))); $category = new SiteMapSection($this_category); $i = 0; $keys = array_keys($FAQ_CATS); $num_cats = count($FAQ_CATS); $properties = array(); for ($j = 0; $j < $num_cats; $j++) { $id = $keys[$j]; $properties = $FAQ_CATS[$id]; if ($auth_mode == SITE_MAP_AUTH_GUEST) { $this_auth = is_array($properties['auth']) ? Authorizations::check_auth(RANK_TYPE, GUEST_LEVEL, $properties['auth'], AUTH_READ) : Authorizations::check_auth(RANK_TYPE, GUEST_LEVEL, $FAQ_CONFIG['global_auth'], AUTH_READ); } else { $this_auth = is_array($properties['auth']) ? $User->check_auth($properties['auth'], AUTH_READ) : $User->check_auth($FAQ_CONFIG['global_auth'], AUTH_READ); } if ($this_auth && $id != 0 && $properties['visible'] && $properties['id_parent'] == $id_cat) { $category->add($this->_create_module_map_sections($id, $auth_mode)); $i++; } } if ($i == 0) { $category = $this_category; } return $category; }