本文整理汇总了PHP中Environment::get_home_page方法的典型用法代码示例。如果您正苦于以下问题:PHP Environment::get_home_page方法的具体用法?PHP Environment::get_home_page怎么用?PHP Environment::get_home_page使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Environment
的用法示例。
在下文中一共展示了Environment::get_home_page方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute(HTTPRequestCustom $request)
{
$module_id = $request->get_getstring('module_id', '');
if (empty($module_id)) {
AppContext::get_response()->redirect(Environment::get_home_page());
}
$this->init();
$module_category_id = $request->get_getint('module_category_id', 0);
$feed_name = $request->get_getstring('feed_name', Feed::DEFAULT_FEED_NAME);
$feed = new ATOM($module_id, $feed_name, $module_category_id);
if ($feed !== null && $feed->is_in_cache()) {
$this->tpl->put('SYNDICATION', $feed->read());
} else {
$eps = AppContext::get_extension_provider_service();
if ($eps->provider_exists($module_id, FeedProvider::EXTENSION_POINT)) {
$provider = $eps->get_provider($module_id);
$feeds = $provider->feeds();
$data = $feeds->get_feed_data_struct($module_category_id, $feed_name);
if ($data === null) {
AppContext::get_response()->set_header('content-type', 'text/html');
DispatchManager::redirect(PHPBoostErrors::unexisting_element());
} else {
$feed->load_data($data);
$feed->cache();
$this->tpl->put('SYNDICATION', $feed->export());
}
} else {
DispatchManager::redirect(PHPBoostErrors::module_not_installed());
}
}
return $this->build_response($this->tpl);
}
示例2: get_right_controller_regarding_authorizations
public function get_right_controller_regarding_authorizations()
{
if (AppContext::get_current_user()->check_level(User::MEMBER_LEVEL)) {
AppContext::get_response()->redirect(Environment::get_home_page());
}
return $this;
}
示例3: get_subheader_tpl
private static function get_subheader_tpl()
{
$subheader_lang = LangLoader::get('admin-links-common');
$subheader_tpl = new FileTemplate('admin/subheader_menu.tpl');
$subheader_tpl->add_lang($subheader_lang);
$modules = ModulesManager::get_activated_modules_map_sorted_by_localized_name();
$modules_number = 0;
foreach ($modules as $module) {
if ($module->get_configuration()->get_admin_menu() == 'modules') {
$modules_number++;
}
}
$subheader_tpl->put_all(array('L_ADD' => $subheader_lang['add'], 'L_ADMINISTRATION' => $subheader_lang['administration'], 'L_MANAGEMENT' => $subheader_lang['management'], 'L_CONFIGURATION' => $subheader_lang['configuration'], 'L_CONFIG_GENERAL' => $subheader_lang['administration.configuration.general'], 'L_CONFIG_ADVANCED' => $subheader_lang['administration.configuration.advanced'], 'L_MAIL_CONFIG' => $subheader_lang['administration.configuration.mail'], 'L_THEMES' => $subheader_lang['administration.themes'], 'L_LANGS' => $subheader_lang['administration.langs'], 'L_SMILEY' => $subheader_lang['administration.smileys'], 'L_ADMINISTRATOR_ALERTS' => $subheader_lang['administration.alerts'], 'L_TOOLS' => $subheader_lang['tools'], 'L_UPDATES' => $subheader_lang['updates'], 'L_KERNEL' => $subheader_lang['tools.updates.kernel'], 'L_MAINTAIN' => $subheader_lang['tools.maintain'], 'L_CACHE' => $subheader_lang['tools.cache'], 'L_SYNDICATION_CACHE' => $subheader_lang['tools.cache.syndication'], 'L_CSS_CACHE_CONFIG' => $subheader_lang['tools.cache.css'], 'L_ERRORS' => $subheader_lang['tools.errors-archived'], 'L_404_ERRORS' => $subheader_lang['tools.404-errors-archived'], 'L_SERVER' => $subheader_lang['tools.server'], 'L_PHPINFO' => $subheader_lang['tools.server.phpinfo'], 'L_SYSTEM_REPORT' => $subheader_lang['tools.server.system-report'], 'L_USER' => $subheader_lang['users'], 'L_PUNISHEMENT' => $subheader_lang['users.punishement'], 'L_GROUP' => $subheader_lang['users.groups'], 'L_EXTEND_FIELD' => $subheader_lang['users.extended-fields'], 'L_CONTENT' => $subheader_lang['content'], 'L_CONTENT_CONFIG' => $subheader_lang['content'], 'L_MENUS' => $subheader_lang['content.menus'], 'L_ADD_CONTENT_MENU' => $subheader_lang['content.menus.content'], 'L_ADD_LINKS_MENU' => $subheader_lang['content.menus.links'], 'L_ADD_FEED_MENU' => $subheader_lang['content.menus.feed'], 'L_FILES' => $subheader_lang['content.files'], 'L_COMMENTS' => $subheader_lang['content.comments'], 'L_MODULES' => $subheader_lang['modules'], 'U_NBR_MODULES' => ceil(($modules_number + 1) / 7), 'U_INDEX_SITE' => Environment::get_home_page(), 'C_ADMIN_LINKS_1' => false, 'C_ADMIN_LINKS_2' => false, 'C_ADMIN_LINKS_3' => false, 'C_ADMIN_LINKS_4' => false, 'C_ADMIN_LINKS_5' => false, 'C_ADMIN_LINKS_1' => false));
$array_pos = array(0, 4, 4, 3, 3, 1);
$menus_numbers = array('index' => 1, 'administration' => 2, 'tools' => 3, 'members' => 4, 'content' => 5, 'modules' => 6);
foreach ($modules as $module) {
$module_id = $module->get_id();
$configuration = $module->get_configuration();
$menu_pos_name = $configuration->get_admin_menu();
$menu_pos = 0;
if (!empty($menu_pos_name) && !empty($menus_numbers[$menu_pos_name])) {
$menu_pos = $menus_numbers[$menu_pos_name];
}
if ($menu_pos > 0) {
$array_pos[$menu_pos - 1]++;
$idmenu = $array_pos[$menu_pos - 1];
$subheader_tpl->put('C_ADMIN_LINKS_' . $menu_pos, true);
$subheader_tpl->assign_block_vars('admin_links_' . $menu_pos, array('MODULE_MENU' => ModuleTreeLinksService::display_admin_actions_menu($module)));
}
}
return $subheader_tpl;
}
示例4: build_form
private function build_form()
{
$picture_yes = '<i class="fa fa-success fa-2x" title="' . LangLoader::get_message('yes', 'common') . '"></i>';
$picture_no = '<i class="fa fa-error fa-2x" title="' . LangLoader::get_message('no', 'common') . '"></i>';
$picture_unknown = '<i class="fa fa-question fa-2x" title="' . LangLoader::get_message('unknown', 'main') . '"></i>';
$default_lang_config = LangsManager::get_lang(LangsManager::get_default_lang())->get_configuration();
$default_theme_config = ThemesManager::get_theme(ThemesManager::get_default_theme())->get_configuration();
$editors = AppContext::get_content_formatting_service()->get_available_editors();
$default_editor = $editors[ContentFormattingConfig::load()->get_default_editor()];
$server_configuration = new ServerConfiguration();
$general_config = GeneralConfig::load();
$server_environment_config = ServerEnvironmentConfig::load();
$sessions_config = SessionsConfig::load();
$maintenance_config = MaintenanceConfig::load();
$url_rewriting_available = false;
$url_rewriting_known = true;
try {
$url_rewriting_available = $server_configuration->has_url_rewriting();
} catch (UnsupportedOperationException $ex) {
$url_rewriting_known = false;
}
$summerization = "---------------------------------System report---------------------------------\n-----------------------------generated by PHPBoost-----------------------------\nSERVER CONFIGURATION-----------------------------------------------------------\nphp version\t\t\t: " . ServerConfiguration::get_phpversion() . "\ndbms version\t\t\t: " . PersistenceContext::get_dbms_utils()->get_dbms_version() . "\ngd library\t\t\t: " . (int) $server_configuration->has_gd_library() . "\nurl rewriting\t\t\t: " . ($url_rewriting_known ? (int) $url_rewriting_available : 'N/A') . "\napcu cache\t\t\t: " . (int) DataStoreFactory::is_apc_available() . "\nPHPBOOST CONFIGURATION---------------------------------------------------------\nphpboost version\t\t: " . Environment::get_phpboost_version() . "\nserver url\t\t\t: " . $general_config->get_site_url() . "\nsite path\t\t\t: " . $general_config->get_site_path() . "\ndefault theme\t\t\t: " . $default_theme_config->get_name() . " (" . LangLoader::get_message('version', 'admin') . " " . $default_theme_config->get_version() . ")\ndefault language\t\t: " . $default_lang_config->get_name() . "\ndefault editor\t\t\t: " . $default_editor . "\nhome page\t\t\t: " . Environment::get_home_page() . "\nurl rewriting\t\t\t: " . (int) $server_environment_config->is_url_rewriting_enabled() . "\napcu cache\t\t\t: " . (int) DataStoreFactory::is_apc_enabled() . "\noutput gzip\t\t\t: " . (int) $server_environment_config->is_output_gziping_enabled() . "\nsession cookie name\t\t: " . $sessions_config->get_cookie_name() . "\nsession duration\t\t: " . $sessions_config->get_session_duration() . "\nactive session duration\t\t: " . $sessions_config->get_active_session_duration() . "\nDIRECTORIES AUTHORIZATIONS-----------------------------------------------------\n";
$form = new HTMLForm('system-report', '', false);
$this->get_advises($form);
$fieldset = new FormFieldsetHTML('report', $this->admin_lang['server']);
$form->add_fieldset($fieldset);
$fieldset->add_field(new FormFieldFree('php_version', $this->admin_lang['php_version'], ServerConfiguration::get_phpversion()));
$fieldset->add_field(new FormFieldFree('dbms_version', $this->admin_lang['dbms_version'], PersistenceContext::get_dbms_utils()->get_dbms_version()));
$fieldset->add_field(new FormFieldFree('gd_library', $this->admin_lang['gd_library'], $server_configuration->has_gd_library() ? $picture_yes : $picture_no));
$fieldset->add_field(new FormFieldFree('url_rewriting', $this->admin_lang['url_rewriting'], $url_rewriting_known ? $url_rewriting_available ? $picture_yes : $picture_no : $picture_unknown));
$fieldset->add_field(new FormFieldFree('apcu_cache', LangLoader::get_message('apcu_cache', 'admin-cache-common'), DataStoreFactory::is_apc_available() ? $picture_yes : $picture_no));
$fieldset = new FormFieldsetHTML('report', $this->admin_lang['phpboost_config']);
$form->add_fieldset($fieldset);
$fieldset->add_field(new FormFieldFree('kernel_version', $this->admin_lang['kernel_version'], Environment::get_phpboost_version()));
$fieldset->add_field(new FormFieldFree('site_url', LangLoader::get_message('advanced-config.site_url', 'admin-config-common'), $general_config->get_site_url()));
$fieldset->add_field(new FormFieldFree('site_path', LangLoader::get_message('advanced-config.site_path', 'admin-config-common'), $general_config->get_site_path()));
$fieldset->add_field(new FormFieldFree('default_theme', LangLoader::get_message('general-config.default_theme', 'admin-config-common'), $default_theme_config->get_name() . " (" . LangLoader::get_message('version', 'admin') . " " . $default_theme_config->get_version() . ")"));
$fieldset->add_field(new FormFieldFree('default_language', LangLoader::get_message('general-config.default_language', 'admin-config-common'), $default_lang_config->get_name()));
$fieldset->add_field(new FormFieldFree('default_editor', LangLoader::get_message('content.config.default-formatting-language', 'admin-contents-common'), $default_editor));
$fieldset->add_field(new FormFieldFree('start_page', LangLoader::get_message('general-config.start_page', 'admin-config-common'), Environment::get_home_page()));
$fieldset->add_field(new FormFieldFree('phpboost_url_rewriting', $this->admin_lang['url_rewriting'], $server_environment_config->is_url_rewriting_enabled() ? $picture_yes : $picture_no));
$fieldset->add_field(new FormFieldFree('phpboost_apcu_cache', LangLoader::get_message('apcu_cache', 'admin-cache-common'), DataStoreFactory::is_apc_enabled() ? $picture_yes : $picture_no));
$fieldset->add_field(new FormFieldFree('output_gz', $this->admin_lang['output_gz'], $server_environment_config->is_output_gziping_enabled() ? $picture_yes : $picture_no));
$fieldset->add_field(new FormFieldFree('cookie_name', LangLoader::get_message('advanced-config.cookie-name', 'admin-config-common'), $sessions_config->get_cookie_name()));
$fieldset->add_field(new FormFieldFree('session_length', LangLoader::get_message('advanced-config.cookie-duration', 'admin-config-common'), $sessions_config->get_session_duration()));
$fieldset->add_field(new FormFieldFree('session_guest_length', LangLoader::get_message('advanced-config.active-session-duration', 'admin-config-common'), $sessions_config->get_active_session_duration()));
$fieldset = new FormFieldsetHTML('directories_auth', $this->admin_lang['directories_auth']);
$form->add_fieldset($fieldset);
$directories_summerization = '';
foreach (PHPBoostFoldersPermissions::get_permissions() as $key => $folder) {
$fieldset->add_field(new FormFieldFree(str_replace('/', '_', $key), $key, $folder->is_writable() ? $picture_yes : $picture_no));
$directories_summerization .= $key . str_repeat(' ', 5 - strlen($key) / 8) . ": " . (int) $folder->is_writable() . "\n";
}
$fieldset = new FormFieldsetHTML('summerization', $this->admin_lang['system_report_summerization']);
$form->add_fieldset($fieldset);
$fieldset->add_field(new FormFieldLabel($this->admin_lang['system_report_summerization_explain']));
$fieldset->add_field(new FormFieldMultiLineTextEditor('summerization', '', $summerization . $directories_summerization, array('rows' => 20, 'cols' => 15, 'class' => 'system-report')));
$this->form = $form;
}
示例5: execute
public function execute(HTTPRequestCustom $request)
{
$this->init($request);
$this->build_form();
if ($this->request->get_bool('disconnect', false)) {
AppContext::get_session()->csrf_get_protect();
$session = AppContext::get_session();
Session::delete($session);
AppContext::get_response()->redirect($this->get_redirect_url());
}
if (AppContext::get_current_user()->check_level(User::MEMBER_LEVEL)) {
if (!$this->maintain_config->is_under_maintenance() || $this->maintain_config->is_under_maintenance() && $this->maintain_config->is_authorized_in_maintenance()) {
if ($this->request->get_value('redirect', '') || $this->redirect !== null) {
AppContext::get_response()->redirect($this->get_redirect_url());
} else {
AppContext::get_response()->redirect(Environment::get_home_page());
}
}
}
$authenticate_type = $this->request->get_value('authenticate', false);
if ($authenticate_type) {
if ($authenticate_type == PHPBoostAuthenticationMethod::AUTHENTICATION_METHOD) {
$login = $this->request->get_value('login', '');
$password = $this->request->get_value('password', '');
$autoconnect = $this->request->get_bool('autoconnect', false);
$this->phpboost_authenticate($login, $password, $autoconnect);
} else {
try {
$authentication = AuthenticationService::get_authentication_method($authenticate_type);
} catch (Exception $e) {
$error_controller = PHPBoostErrors::unexisting_page();
DispatchManager::redirect($error_controller);
}
$this->authenticate($authentication, true);
}
}
if ($this->submit_button->has_been_submited() && $this->form->validate()) {
$login = $this->form->get_value('login');
$password = $this->form->get_value('password');
$autoconnect = $this->form->get_value('autoconnect');
$this->phpboost_authenticate($login, $password, $autoconnect);
}
$this->init_vars_template();
return $this->build_view();
}
示例6: get_right_controller_regarding_authorizations
public function get_right_controller_regarding_authorizations()
{
if (!UserAccountsConfig::load()->is_registration_enabled() || AppContext::get_current_user()->check_level(User::MEMBER_LEVEL)) {
AppContext::get_response()->redirect(Environment::get_home_page());
}
return $this;
}
示例7: foreach
$menu_template->put_all(array('L_ENABLED' => LangLoader::get_message('enabled', 'common'), 'L_DISABLED' => LangLoader::get_message('disabled', 'common'), 'I_HEADER' => Menu::BLOCK_POSITION__HEADER, 'I_SUBHEADER' => Menu::BLOCK_POSITION__SUB_HEADER, 'I_TOPCENTRAL' => Menu::BLOCK_POSITION__TOP_CENTRAL, 'I_BOTTOMCENTRAL' => Menu::BLOCK_POSITION__BOTTOM_CENTRAL, 'I_TOPFOOTER' => Menu::BLOCK_POSITION__TOP_FOOTER, 'I_FOOTER' => Menu::BLOCK_POSITION__FOOTER, 'I_LEFT' => Menu::BLOCK_POSITION__LEFT, 'I_RIGHT' => Menu::BLOCK_POSITION__RIGHT, 'U_TOKEN' => AppContext::get_session()->get_token()));
foreach ($menus_blocks as $block_id => $menus) {
// For each block
$i = 0;
$max = count($menus);
foreach ($menus as $menu) {
// For each Menu in this block
$menu_tpl = clone $menu_template;
$id = $menu->get_id();
$enabled = $menu->is_enabled();
if (!$enabled) {
$block_id = Menu::BLOCK_POSITION__NOT_ENABLED;
}
$edit_link = menu_admin_link($menu, 'edit');
$del_link = menu_admin_link($menu, 'delete');
$mini = in_array($block_id, array(Menu::BLOCK_POSITION__LEFT, Menu::BLOCK_POSITION__NOT_ENABLED, Menu::BLOCK_POSITION__RIGHT));
$vertical_position = in_array($block_id, array(Menu::BLOCK_POSITION__LEFT, Menu::BLOCK_POSITION__RIGHT));
$menu_tpl->put_all(array('NAME' => $menu->get_formated_title(), 'IDMENU' => $id, 'CONTENTS' => $menu->admin_display(), 'ACTIV' => $enabled ? 'disable' : 'enable', 'UNACTIV' => $enabled ? 'enable' : 'disable', 'C_MENU_ACTIVATED' => $enabled, 'C_EDIT' => !empty($edit_link), 'C_DEL' => !empty($del_link), 'C_UP' => $block_id != Menu::BLOCK_POSITION__NOT_ENABLED && $i > 0, 'C_DOWN' => $block_id != Menu::BLOCK_POSITION__NOT_ENABLED && $i < $max - 1, 'C_VERTICAL' => $vertical_position, 'C_HORIZONTAL' => !$vertical_position, 'L_DEL' => LangLoader::get_message('delete', 'common'), 'L_EDIT' => LangLoader::get_message('edit', 'common'), 'L_ACTIVATE' => LangLoader::get_message('enable', 'common'), 'L_UNACTIVATE' => LangLoader::get_message('disable', 'common'), 'L_MOVE_UP' => $LANG['move_up'], 'L_MOVE_DOWN' => $LANG['move_down'], 'U_EDIT' => menu_admin_link($menu, 'edit'), 'U_DELETE' => menu_admin_link($menu, 'delete'), 'U_UP' => menu_admin_link($menu, 'up'), 'U_DOWN' => menu_admin_link($menu, 'down'), 'U_MOVE' => menu_admin_link($menu, 'move')));
$tpl->assign_block_vars(get_block($block_id), array('MENU' => $menu_tpl->render()));
$i++;
}
}
foreach (ThemesManager::get_activated_themes_map() as $theme => $properties) {
$configuration = $properties->get_configuration();
$selected = empty($name_theme) ? AppContext::get_current_user()->get_theme() == $theme : $name_theme == $theme ? ' selected="selected"' : '';
$tpl->assign_block_vars('themes', array('NAME' => $configuration->get_name(), 'IDNAME' => $theme, 'SELECTED' => $selected));
}
$columns_disable = ThemesManager::get_theme($name_theme)->get_columns_disabled();
$tpl->put_all(array('NAME_THEME' => $name_theme, 'CHECKED_RIGHT_COLUMN' => !$columns_disable->right_columns_is_disabled() ? 'checked="checked"' : '', 'CHECKED_LEFT_COLUMN' => !$columns_disable->left_columns_is_disabled() ? 'checked="checked"' : '', 'CHECKED_FOOTER_COLUMN' => !$columns_disable->footer_is_disabled() ? 'checked="checked"' : '', 'CHECKED_TOP_FOOTER_COLUMN' => !$columns_disable->top_footer_is_disabled() ? 'checked="checked"' : '', 'CHECKED_BOTTOM_CENTRAL_COLUMN' => !$columns_disable->bottom_central_is_disabled() ? 'checked="checked"' : '', 'CHECKED_TOP_CENTRAL_COLUMN' => !$columns_disable->top_central_is_disabled() ? 'checked="checked"' : '', 'CHECKED_SUB_HEADER_COLUMN' => !$columns_disable->sub_header_is_disabled() ? 'checked="checked"' : '', 'CHECKED_HEADER_COLUMN' => !$columns_disable->header_is_disabled() ? 'checked="checked"' : '', 'C_RIGHT_COLUMN' => $columns_disable->right_columns_is_disabled(), 'C_LEFT_COLUMN' => $columns_disable->left_columns_is_disabled(), 'C_FOOTER_COLUMN' => $columns_disable->footer_is_disabled(), 'C_TOP_FOOTER_COLUMN' => $columns_disable->top_footer_is_disabled(), 'C_BOTTOM_CENTRAL_COLUMN' => $columns_disable->bottom_central_is_disabled(), 'C_TOP_CENTRAL_COLUMN' => $columns_disable->top_central_is_disabled(), 'C_SUB_HEADER_COLUMN' => $columns_disable->sub_header_is_disabled(), 'C_HEADER_COLUMN' => $columns_disable->header_is_disabled(), 'L_MENUS_MANAGEMENT' => $LANG['menus_management'], 'START_PAGE' => Environment::get_home_page(), 'L_INDEX' => $LANG['home'], 'L_CONFIRM_DEL_MENU' => LangLoader::get_message('confirm.delete', 'status-messages-common'), 'L_MOVETO' => $LANG['moveto'], 'L_GUEST' => $LANG['guest'], 'L_USER' => $LANG['member'], 'L_MODO' => $LANG['modo'], 'L_ADMIN' => $LANG['admin'], 'L_HEADER' => $LANG['menu_header'], 'L_SUB_HEADER' => $LANG['menu_subheader'], 'L_LEFT_MENU' => $LANG['menu_left'], 'L_RIGHT_MENU' => $LANG['menu_right'], 'L_TOP_CENTRAL_MENU' => $LANG['menu_top_central'], 'L_BOTTOM_CENTRAL_MENU' => $LANG['menu_bottom_central'], 'L_TOP_FOOTER' => $LANG['menu_top_footer'], 'L_FOOTER' => $LANG['menu_footer'], 'L_ADD_MENU' => $LANG['menus_add'], 'L_ADD_CONTENT_MENUS' => $LANG['menus_content_add'], 'L_ADD_LINKS_MENUS' => $LANG['menus_links_add'], 'L_ADD_FEED_MENUS' => $LANG['menus_feed_add'], 'L_VALID_POSTIONS' => $LANG['valid_position_menus'], 'L_THEME_MANAGEMENT' => $LANG['theme_management'], 'I_HEADER' => Menu::BLOCK_POSITION__HEADER, 'I_SUBHEADER' => Menu::BLOCK_POSITION__SUB_HEADER, 'I_TOPCENTRAL' => Menu::BLOCK_POSITION__TOP_CENTRAL, 'I_BOTTOMCENTRAL' => Menu::BLOCK_POSITION__BOTTOM_CENTRAL, 'I_TOPFOOTER' => Menu::BLOCK_POSITION__TOP_FOOTER, 'I_FOOTER' => Menu::BLOCK_POSITION__FOOTER, 'I_LEFT' => Menu::BLOCK_POSITION__LEFT, 'I_RIGHT' => Menu::BLOCK_POSITION__RIGHT, 'L_MENUS_AVAILABLE' => count($menus_blocks[Menu::BLOCK_POSITION__NOT_ENABLED]) ? $LANG['available_menus'] : $LANG['no_available_menus'], 'L_SUBMIT' => $LANG['submit'], 'L_RESET' => $LANG['reset'], 'U_TOKEN' => AppContext::get_session()->get_token()));
$tpl->display();
require_once PATH_TO_ROOT . '/admin/admin_footer.php';
示例8: build_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);
}