function get_module_map($auth_mode = SITE_MAP_AUTH_GUEST) { global $FAQ_CATS, $FAQ_LANG, $LANG, $User, $FAQ_CONFIG, $Cache; import('content/sitemap/module_map'); import('util/url'); include_once PATH_TO_ROOT . '/faq/faq_begin.php'; $faq_link = new SiteMapLink($FAQ_LANG['faq'], new Url('/faq/faq.php'), SITE_MAP_FREQ_DEFAULT, SITE_MAP_PRIORITY_MAX); $module_map = new ModuleMap($faq_link); $module_map->set_description('<em>Test</em>'); $id_cat = 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) { $module_map->add($this->_create_module_map_sections($id, $auth_mode)); } } return $module_map; }
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); }
/** * @desc Adds to the site map all the kernel links. * @param int $mode USER_MODE ou SEARCH_ENGINE_MODE, it depends on if you want to show it to a user in particular or to anybody * @param int $auth_mode AUTH_GUEST or AUTH_USERS, it depends if you want to display only the public pages or also the private ones. */ private function build_kernel_map($mode = self::USER_MODE, $auth_mode = self::AUTH_PUBLIC) { global $LANG; //We consider the kernel as a module $kernel_map = new ModuleMap(new SitemapLink($LANG['home'], new Url(Environment::get_home_page()))); //The site description $kernel_map->set_description(nl2br(GeneralConfig::load()->get_site_description())); //All the links which not need to be present in the search engine results. if ($mode == self::USER_MODE) { if (AppContext::get_current_user()->check_auth(UserAccountsConfig::load()->get_auth_read_members(), UserAccountsConfig::AUTH_READ_MEMBERS_BIT)) { $kernel_map->add(new SitemapLink(LangLoader::get_message('members-list', 'user-common'), UserUrlBuilder::home())); } //Member space if ($auth_mode == self::AUTH_USER && AppContext::get_current_user()->check_level(User::MEMBER_LEVEL)) { //We create a section for that $member_space_section = new SitemapSection(new SitemapLink($LANG['my_private_profile'], UserUrlBuilder::profile(AppContext::get_current_user()->get_id()))); //Profile edition $member_space_section->add(new SitemapLink(LangLoader::get_message('profile.edit', 'user-common'), UserUrlBuilder::edit_profile(AppContext::get_current_user()->get_id()))); //Private messaging $member_space_section->add(new SitemapLink($LANG['private_messaging'], UserUrlBuilder::personnal_message(AppContext::get_current_user()->get_id()))); //Contribution panel $member_space_section->add(new SitemapLink($LANG['contribution_panel'], UserUrlBuilder::contribution_panel())); //Administration panel if (AppContext::get_current_user()->check_level(User::ADMIN_LEVEL)) { $member_space_section->add(new SitemapLink($LANG['admin_panel'], UserUrlBuilder::administration())); } //We add it to the kernel map $kernel_map->add($member_space_section); } } //The kernel map is added to the site map $this->add($kernel_map); }