/** * @desc Load Application Classes * @param $checks */ private function load_apps($checks = CHECK_ALL_UPDATES) { if (ServerConfiguration::get_phpversion() > self::PHP_MIN_VERSION_UPDATES) { $user_locale = AppContext::get_current_user()->get_locale(); if ($checks & CHECK_KERNEL) { // Add the kernel to the check list $this->apps[] = new Application('kernel', $user_locale, Application::KERNEL_TYPE, Environment::get_phpboost_version(), Updates::PHPBOOST_OFFICIAL_REPOSITORY); } if ($checks & CHECK_MODULES) { $activated_modules = ModulesManager::get_activated_modules_map_sorted_by_localized_name(); foreach ($activated_modules as $module) { $this->apps[] = new Application($module->get_id(), $user_locale, Application::MODULE_TYPE, $module->get_configuration()->get_version(), $module->get_configuration()->get_repository()); } } if ($checks & CHECK_THEMES) { // Add Themes $activated_themes = ThemesManager::get_activated_themes_map(); foreach ($activated_themes as $id => $value) { $repository = $value->get_configuration()->get_repository(); if (!empty($repository)) { $this->apps[] = new Application($id, $user_locale, Application::TEMPLATE_TYPE, $value->get_configuration()->get_version(), $repository); } } } } }
public static function add_filter_fieldset(Menu $menu, Template $tpl) { $tpl_filter = new FileTemplate('admin/menus/filters.tpl'); $tpl_filter->assign_block_vars('modules', array('ID' => '')); foreach (ModulesManager::get_activated_modules_map_sorted_by_localized_name() as $module) { $configuration = $module->get_configuration(); $home_page = $configuration->get_home_page(); if (!empty($home_page)) { $tpl_filter->assign_block_vars('modules', array('ID' => $module->get_id())); } } //Ajout du menu if ($menu->get_id() == '') { $menu->set_filters(array(new MenuStringFilter('/'))); } // Installed modules foreach ($menu->get_filters() as $key => $filter) { $filter_pattern = $filter->get_pattern(); $filter_infos = explode('/', $filter_pattern); $module_name = $filter_infos[0]; $regex = substr(strstr($filter_pattern, '/'), 1); $tpl_filter->assign_block_vars('filters', array('ID' => $key, 'FILTER' => $regex)); $tpl_filter->assign_block_vars('filters.modules', array('ID' => '', 'SELECTED' => $filter_pattern == '/' ? ' selected="selected"' : '')); foreach (ModulesManager::get_activated_modules_map_sorted_by_localized_name() as $module) { $configuration = $module->get_configuration(); $home_page = $configuration->get_home_page(); if (!empty($home_page)) { $tpl_filter->assign_block_vars('filters.modules', array('ID' => $module->get_id(), 'SELECTED' => $module_name == $module->get_id() ? ' selected="selected"' : '')); } } } $tpl_filter->add_lang(LangLoader::get('admin-menus-common')); $tpl_filter->put_all(array('NBR_FILTER' => $menu->get_id() == '' ? 0 : count($menu->get_filters()) - 1)); $tpl->put('filters', $tpl_filter); }
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; }
private function build_view() { $modules_activated = ModulesManager::get_activated_modules_map_sorted_by_localized_name(); $modules_installed = ModulesManager::get_installed_modules_map_sorted_by_localized_name(); foreach ($modules_installed as $module) { $configuration = $module->get_configuration(); $author = $configuration->get_author(); $author_email = $configuration->get_author_email(); $author_website = $configuration->get_author_website(); if (!in_array($module, $modules_activated)) { $this->view->assign_block_vars('modules_not_activated', array('C_AUTHOR' => !empty($author), 'C_AUTHOR_WEBSITE' => !empty($author_website), 'ID' => $module->get_id(), 'NAME' => ucfirst($configuration->get_name()), 'ICON' => $module->get_id(), 'VERSION' => $module->get_installed_version(), 'AUTHOR' => $author, 'AUTHOR_EMAIL' => $author_email, 'AUTHOR_WEBSITE' => $author_website, 'DESCRIPTION' => $configuration->get_description(), 'COMPATIBILITY' => $configuration->get_compatibility(), 'PHP_VERSION' => $configuration->get_php_version(), 'C_MODULE_ACTIVE' => $module->is_activated())); } else { $this->view->assign_block_vars('modules_activated', array('C_AUTHOR' => !empty($author), 'C_AUTHOR_WEBSITE' => !empty($author_website), 'ID' => $module->get_id(), 'NAME' => ucfirst($configuration->get_name()), 'ICON' => $module->get_id(), 'VERSION' => $module->get_installed_version(), 'AUTHOR' => $author, 'AUTHOR_EMAIL' => $author_email, 'AUTHOR_WEBSITE' => $author_website, 'DESCRIPTION' => $configuration->get_description(), 'COMPATIBILITY' => $configuration->get_compatibility(), 'PHP_VERSION' => $configuration->get_php_version(), 'C_MODULE_ACTIVE' => $module->is_activated())); } } $this->view->put_all(array('C_MODULES_ACTIVATED' => count($modules_activated) > 0, 'C_MODULES_NOT_ACTIVATED' => count($modules_installed) - count($modules_activated) > 0)); }
} $pagination = new ModulePagination($page, $num_contributions, CONTRIBUTIONS_PER_PAGE); $pagination->set_url(new Url('/user/contribution_panel.php?p=%d&criteria=' . $criteria . '&order=' . $order)); if ($pagination->current_page_is_empty() && $page > 1) { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } if ($num_contributions > 1) { $template->put_all(array('C_PAGINATION' => $pagination->has_several_pages(), 'PAGINATION' => $pagination->display())); } else { $template->put_all(array('C_NO_CONTRIBUTION' => true, 'L_NO_CONTRIBUTION_TO_DISPLAY' => LangLoader::get_message('no_item_now', 'common'))); } //Liste des modules proposant de contribuer define('NUMBER_OF_MODULES_PER_LINE', 4); $i_module = 0; $modules = ModulesManager::get_activated_modules_map_sorted_by_localized_name(); foreach ($modules as $name => $module) { $contribution_interface = $module->get_configuration()->get_contribution_interface(); $authorized = true; $authorizations_class = ucfirst($module->get_id()) . 'AuthorizationsService'; if (class_exists($authorizations_class) && method_exists($authorizations_class, 'check_authorizations') && method_exists($authorizations_class, 'contribution') && !$authorizations_class::check_authorizations()->contribution()) { $authorized = false; } if (!empty($contribution_interface) && $authorized) { if ($i_module % NUMBER_OF_MODULES_PER_LINE == 0) { $template->assign_block_vars('row', array()); } $template->assign_block_vars('row.module', array('WIDTH' => (int) (100.0 / NUMBER_OF_MODULES_PER_LINE), 'U_MODULE_LINK' => PATH_TO_ROOT . '/' . $module->get_id() . '/' . url($contribution_interface), 'MODULE_ID' => $module->get_id(), 'MODULE_NAME' => $module->get_configuration()->get_name(), 'LINK_TITLE' => sprintf($LANG['contribute_in_module_name'], $module->get_configuration()->get_name()))); $i_module++; } }
private function list_files($theme_selected) { $files = array(); $files[] = new FormFieldSelectChoiceOption('--', ''); $folder = new Folder(PATH_TO_ROOT . $this->templates_path . $theme_selected . $this->tpl_files_path); foreach ($folder->get_files('`\\.tpl$`') as $file) { $files[] = new FormFieldSelectChoiceOption($file->get_name(), $file->get_name_without_extension()); } foreach (ModulesManager::get_activated_modules_map_sorted_by_localized_name() as $id => $module) { $folder = new Folder(PATH_TO_ROOT . '/' . $module->get_id() . '/templates'); if ($folder->exists()) { foreach ($folder->get_files('`\\.tpl$`') as $file) { $files[] = new FormFieldSelectChoiceOption(LangLoader::get_message('module', 'admin-modules-common') . ' ' . ModulesManager::get_module($module->get_id())->get_configuration()->get_name() . ' : ' . $file->get_name(), $module->get_id() . '/' . $file->get_name_without_extension()); } } } $folder = new Folder(PATH_TO_ROOT . '/user/templates'); if ($folder->exists()) { foreach ($folder->get_files('`\\.tpl$`') as $file) { $files[] = new FormFieldSelectChoiceOption(LangLoader::get_message('users', 'user-common') . ' : ' . $file->get_name(), 'user/' . $file->get_name_without_extension()); } } return $files; }
/** * @desc Return a menu with links to modules * @param int $menu_type the menu type * @return LinksMenu the menu with links to modules */ public static function website_modules($menu_type = LinksMenu::AUTOMATIC_MENU) { $modules_menu = new LinksMenu('PHPBoost', '/', '', $menu_type); $modules = ModulesManager::get_activated_modules_map_sorted_by_localized_name(); foreach ($modules as $module) { $configuration = $module->get_configuration(); $start_page = $configuration->get_home_page(); if (!empty($start_page)) { $img = ''; $img_url = PATH_TO_ROOT . '/' . $module->get_id() . '/' . $module->get_id(); foreach (array('_mini.png', '_mini.gif', '_mini.jpg') as $extension) { $file = new File($img_url . $extension); if ($file->exists()) { $img = '/' . $module->get_id() . '/' . $file->get_name(); break; } } $modules_menu->add(new LinksMenuLink($configuration->get_name(), '/' . $module->get_id() . '/', $img)); } } return $modules_menu; }
* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ###################################################*/ require_once '../admin/admin_begin.php'; define('TITLE', $LANG['administration']); require_once '../admin/admin_header.php'; $template = new FileTemplate('admin/admin_extend.tpl'); $template->add_lang(LangLoader::get('admin-links-common')); //Listing des modules disponibles foreach (ModulesManager::get_activated_modules_map_sorted_by_localized_name() as $module) { $configuration = $module->get_configuration(); $admin_home_page = $configuration->get_admin_main_page(); if (!empty($admin_home_page)) { $template->assign_block_vars('modules_extend', array('NAME' => $configuration->get_name(), 'IMG' => PATH_TO_ROOT . '/' . $module->get_id() . '/' . $module->get_id() . '.png', 'U_ADMIN_MODULE' => PATH_TO_ROOT . '/' . $module->get_id() . '/' . $admin_home_page)); } } $template->display(); require_once '../admin/admin_footer.php';