private function get_module_map($auth_mode)
 {
     global $LANG;
     include PATH_TO_ROOT . '/pages/pages_defines.php';
     load_module_lang('pages');
     $pages_config = PagesConfig::load();
     $categories_cache = PagesCategoriesCache::load();
     $categories = $categories_cache->get_categories();
     //Configuration des authorisations
     $config_authorizations = $pages_config->get_authorizations();
     $pages_link = new SitemapLink($LANG['pages'], new Url('/pages/explorer.php'), Sitemap::FREQ_DEFAULT, Sitemap::PRIORITY_MAX);
     $module_map = new ModuleMap($pages_link, 'pages');
     $id_cat = 0;
     $keys = array_keys($categories);
     $num_cats = $categories_cache->get_number_categories();
     $properties = array();
     for ($j = 0; $j < $num_cats; $j++) {
         $id = $keys[$j];
         $properties = $categories[$id];
         if ($auth_mode == Sitemap::AUTH_PUBLIC) {
             $this_auth = is_array($properties['auth']) ? Authorizations::check_auth(RANK_TYPE, User::VISITOR_LEVEL, $properties['auth'], READ_PAGE) : Authorizations::check_auth(RANK_TYPE, User::VISITOR_LEVEL, $config_authorizations, READ_PAGE);
         } elseif ($auth_mode == Sitemap::AUTH_USER) {
             if (AppContext::get_current_user()->get_level() == User::ADMIN_LEVEL) {
                 $this_auth = true;
             } else {
                 $this_auth = is_array($properties['auth']) ? Authorizations::check_auth(RANK_TYPE, AppContext::get_current_user()->get_level(), $properties['auth'], READ_PAGE) : Authorizations::check_auth(RANK_TYPE, AppContext::get_current_user()->get_level(), $config_authorizations, READ_PAGE);
             }
         }
         if ($this_auth && $id != 0 && $properties['id_parent'] == $id_cat) {
             $module_map->add($this->create_module_map_sections($id, $auth_mode));
         }
     }
     return $module_map;
 }
 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;
 }
 private function get_module_map($auth_mode)
 {
     $module = ModulesManager::get_module($this->categories_manager->get_module_id());
     $module_configuration = $module->get_configuration();
     $link = new SitemapLink($module_configuration->get_name(), new Url('/' . $module->get_id() . '/'), Sitemap::FREQ_DAILY, Sitemap::PRIORITY_MAX);
     $module_map = new ModuleMap($link, $module->get_id());
     $categories = $this->categories_manager->get_categories_cache()->get_categories();
     foreach ($categories as $id => $category) {
         if ($auth_mode == Sitemap::AUTH_PUBLIC) {
             $this_auth = Authorizations::check_auth(RANK_TYPE, User::VISITOR_LEVEL, $category->get_authorizations(), Category::READ_AUTHORIZATIONS);
         } else {
             $this_auth = AppContext::get_current_user()->check_auth($category->get_authorizations(), Category::READ_AUTHORIZATIONS);
         }
         if ($this_auth && $id != Category::ROOT_CATEGORY && $category->get_id_parent() == Category::ROOT_CATEGORY) {
             $module_map->add($this->create_module_map_sections($categories, $id, $auth_mode));
         }
     }
     return $module_map;
 }
Example #4
0
 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() . '&amp;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() . '&amp;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);
 }
 private function get_module_map($auth_mode)
 {
     global $LANG;
     load_module_lang('wiki');
     $categories_cache = WikiCategoriesCache::load();
     $categories = $categories_cache->get_categories();
     $wiki_link = new SitemapLink($LANG['wiki'], new Url('/wiki/wiki.php'), Sitemap::FREQ_DEFAULT, Sitemap::PRIORITY_LOW);
     $module_map = new ModuleMap($wiki_link, 'wiki');
     $id_cat = 0;
     $keys = array_keys($categories);
     $num_cats = $categories_cache->get_number_categories();
     $properties = array();
     for ($j = 0; $j < $num_cats; $j++) {
         $id = $keys[$j];
         $properties = $categories[$id];
         if ($id != 0 && $properties['id_parent'] == $id_cat) {
             $module_map->add($this->create_module_map_sections($id, $auth_mode));
         }
     }
     return $module_map;
 }
 private function get_module_map($auth_mode)
 {
     $lang = LangLoader::get('common', 'bugtracker');
     $config = BugtrackerConfig::load();
     $current_user = AppContext::get_current_user();
     $link = new SitemapLink($lang['module_title'], BugtrackerUrlBuilder::home(), Sitemap::FREQ_DEFAULT, Sitemap::PRIORITY_MAX);
     $module_map = new ModuleMap($link, 'bugtracker');
     if ($auth_mode == Sitemap::AUTH_PUBLIC) {
         $this_auth = Authorizations::check_auth(RANK_TYPE, User::VISITOR_LEVEL, $config->get_authorizations(), BugtrackerAuthorizationsService::READ_AUTHORIZATIONS);
     } else {
         if ($auth_mode == Sitemap::AUTH_USER) {
             if ($current_user->get_level() == User::ADMIN_LEVEL) {
                 $this_auth = true;
             } else {
                 $this_auth = Authorizations::check_auth(RANK_TYPE, $current_user->get_level(), $config->get_authorizations(), BugtrackerAuthorizationsService::READ_AUTHORIZATIONS);
             }
         }
     }
     if ($this_auth) {
         $module_map->add(new SitemapLink($lang['titles.unsolved'], BugtrackerUrlBuilder::unsolved()));
         $module_map->add(new SitemapLink($lang['titles.solved'], BugtrackerUrlBuilder::solved()));
         if ($config->is_roadmap_enabled() && $config->get_versions()) {
             $module_map->add(new SitemapLink($lang['titles.roadmap'], BugtrackerUrlBuilder::roadmap()));
         }
         $module_map->add(new SitemapLink($lang['titles.stats'], BugtrackerUrlBuilder::stats()));
     }
     return $module_map;
 }
Example #7
0
 /**
  * @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);
 }