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; }
public function execute(HTTPRequestCustom $request) { $id = $request->get_getint('id', 0); if (!empty($id) && AppContext::get_current_user()->check_level(User::MEMBER_LEVEL)) { try { $this->downloadfile = DownloadService::get_downloadfile('WHERE download.id = :id', array('id' => $id)); } catch (RowNotFoundException $e) { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } } if ($this->downloadfile !== null && $this->downloadfile->is_visible()) { if (!PersistenceContext::get_querier()->row_exists(PREFIX . 'events', 'WHERE id_in_module=:id_in_module AND module=\'download\' AND current_status = 0', array('id_in_module' => $this->downloadfile->get_id()))) { $contribution = new Contribution(); $contribution->set_id_in_module($this->downloadfile->get_id()); $contribution->set_entitled(StringVars::replace_vars(LangLoader::get_message('contribution.deadlink', 'common'), array('link_name' => $this->downloadfile->get_name()))); $contribution->set_fixing_url(DownloadUrlBuilder::edit($this->downloadfile->get_id())->relative()); $contribution->set_description(LangLoader::get_message('contribution.deadlink_explain', 'common')); $contribution->set_poster_id(AppContext::get_current_user()->get_id()); $contribution->set_module('download'); $contribution->set_type('alert'); $contribution->set_auth(Authorizations::capture_and_shift_bit_auth(DownloadService::get_categories_manager()->get_heritated_authorizations($this->downloadfile->get_id_category(), Category::MODERATION_AUTHORIZATIONS, Authorizations::AUTH_CHILD_PRIORITY), Category::MODERATION_AUTHORIZATIONS, Contribution::CONTRIBUTION_AUTH_BIT)); ContributionService::save_contribution($contribution); } DispatchManager::redirect(new UserContributionSuccessController()); } else { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } }
function _assign(&$template, $mode = LINKS_MENU_ELEMENT__CLASSIC_DISPLAYING) { parent::_assign($template); $template->assign_vars(array('TITLE' => $this->title, 'C_FIRST_LEVEL' => $this->depth == 1, 'DEPTH' => $this->depth, 'PARENT_DEPTH' => $this->depth - 1, 'C_URL' => !empty($this->url), 'C_IMG' => !empty($this->image), 'ABSOLUTE_URL' => $this->get_url(false), 'ABSOLUTE_IMG' => $this->get_image(false), 'RELATIVE_URL' => $this->get_url(true), 'RELATIVE_IMG' => $this->get_image(true), 'ID' => $this->get_uid(), 'ID_VAR' => $this->get_uid())); if ($mode) { $template->assign_vars(array('AUTH_FORM' => Authorizations::generate_select(AUTH_MENUS, $this->get_auth(), array(), 'menu_element_' . $this->uid . '_auth'))); } }
/** * @return string The html code for the free field. */ public function display() { $template = $this->get_template_to_use(); $this->assign_common_template_variables($template); foreach ($this->get_value()->get_actions() as $action) { $template->assign_block_vars('actions', array('ID' => 'auth' . $action->get_bit(), 'HTML_ID' => $this->get_html_id() . 'auth' . $action->get_bit(), 'BIT' => $action->get_bit(), 'LABEL' => $action->get_label(), 'DESCRIPTION' => $action->get_description(), 'AUTH_FORM' => Authorizations::generate_select($action->get_bit(), $action->build_auth_array(), array(), $this->get_html_id() . $action->get_bit(), $this->is_disabled()))); } return $template; }
function auth_array_simple($bit_value, $idselect, $admin_auth_default = true) { $array_auth_all = array(); $sum_auth = 0; Authorizations::_get_auth_array($bit_value, $idselect, $array_auth_all, $sum_auth); if ($admin_auth_default) { $array_auth_all['r2'] = $sum_auth; } ksort($array_auth_all); return $array_auth_all; }
private function save(HTTPRequestCustom $request) { foreach ($this->get_not_installed_langs() as $id) { try { if ($request->get_string('add-' . $id)) { $activated = $request->get_bool('activated-' . $id, false); $authorizations = Authorizations::auth_array_simple(Lang::ACCES_LANG, $id); LangsManager::install($id, $authorizations, $activated); $error = LangsManager::get_error(); if ($error !== null) { $this->view->put('MSG', MessageHelper::display($error, MessageHelper::NOTICE, 10)); } else { $this->view->put('MSG', MessageHelper::display(LangLoader::get_message('process.success', 'status-messages-common'), MessageHelper::SUCCESS, 10)); } } } catch (Exception $e) { } } }
public function save(HTTPRequestCustom $request) { $installed_themes = ThemesManager::get_installed_themes_map(); foreach ($installed_themes as $theme) { if ($request->get_string('delete-' . $theme->get_id(), '')) { AppContext::get_response()->redirect(AdminThemeUrlBuilder::delete_theme($theme->get_id())); } } if ($request->get_bool('update', false)) { foreach ($installed_themes as $theme) { if ($theme->get_id() !== ThemesManager::get_default_theme()) { $id_theme = $theme->get_id(); $activated = $request->get_bool('activated-' . $id_theme, false); $authorizations = Authorizations::auth_array_simple(Theme::ACCES_THEME, $id_theme); ThemesManager::change_informations($id_theme, $activated, $authorizations); } } AppContext::get_response()->redirect(AdminThemeUrlBuilder::list_installed_theme()); } }
public function save(HTTPRequestCustom $request) { $installed_langs = LangsManager::get_installed_langs_map(); foreach ($installed_langs as $lang) { if ($request->get_string('delete-' . $lang->get_id(), '')) { AppContext::get_response()->redirect(AdminLangsUrlBuilder::uninstall($lang->get_id())); } } if ($request->get_bool('update', false)) { foreach ($installed_langs as $lang) { if ($lang->get_id() !== LangsManager::get_default_lang()) { $id = $lang->get_id(); $activated = $request->get_bool('activated-' . $id, false); $authorizations = Authorizations::auth_array_simple(Lang::ACCES_LANG, $id); LangsManager::change_informations($id, $activated, $authorizations); } } AppContext::get_response()->redirect(AdminLangsUrlBuilder::list_installed_langs()); } }
public function check_authorizations(Category $category) { $nbr_bits = count($this->authorizations_bits); if ($nbr_bits == 0) { return true; } else { $authorized_bits = array(); foreach ($this->authorizations_bits as $bit) { if ($this->allow_only_member_level_authorizations && Authorizations::check_auth(RANK_TYPE, User::MEMBER_LEVEL, $category->get_authorizations(), $bit) || $category->check_auth($bit)) { $authorized_bits[] = $bit; } } $nbr_authorized_bits = count($authorized_bits); if ($this->check_all_bits) { return $nbr_authorized_bits == $nbr_bits; } else { return $nbr_authorized_bits >= 1; } } }
private function build_view() { $not_installed_themes = $this->get_not_installed_themes(); foreach ($not_installed_themes as $key => $name) { try { $configuration = ThemeConfigurationManager::get($name); $pictures = $configuration->get_pictures(); $id_theme = $name; $this->view->assign_block_vars('themes_not_installed', array('C_WEBSITE' => $configuration->get_author_link() !== '', 'C_PICTURES' => count($pictures) > 0, 'ID' => $id_theme, 'NAME' => $configuration->get_name(), 'VERSION' => $configuration->get_version(), 'MAIN_PICTURE' => count($pictures) > 0 ? Url::to_rel('/templates/' . $id_theme . '/' . current($pictures)) : '', 'AUTHOR_NAME' => $configuration->get_author_name(), 'AUTHOR_WEBSITE' => $configuration->get_author_link(), 'AUTHOR_EMAIL' => $configuration->get_author_mail(), 'DESCRIPTION' => $configuration->get_description() !== '' ? $configuration->get_description() : $this->lang['themes.bot_informed'], 'COMPATIBILITY' => $configuration->get_compatibility(), 'AUTHORIZATIONS' => Authorizations::generate_select(Theme::ACCES_THEME, array('r-1' => 1, 'r0' => 1, 'r1' => 1), array(2 => true), $id_theme), 'HTML_VERSION' => $configuration->get_html_version() !== '' ? $configuration->get_html_version() : $this->lang['themes.bot_informed'], 'CSS_VERSION' => $configuration->get_css_version() !== '' ? $configuration->get_css_version() : $this->lang['themes.bot_informed'], 'MAIN_COLOR' => $configuration->get_main_color() !== '' ? $configuration->get_main_color() : $this->lang['themes.bot_informed'], 'WIDTH' => $configuration->get_variable_width() ? $this->lang['themes.variable-width'] : $configuration->get_width())); if (count($pictures) > 0) { unset($pictures[0]); foreach ($pictures as $picture) { $this->view->assign_block_vars('themes_not_installed.pictures', array('URL' => Url::to_rel('/templates/' . $id_theme . '/' . $picture))); } } } catch (IOException $e) { unset($not_installed_themes[$key]); } } $this->view->put_all(array('C_THEME_INSTALL' => count($not_installed_themes) > 0, 'L_ADD' => $this->lang['themes.add_theme'])); }
function build_menu_from_form(&$elements_ids, $level = 0) { $menu = null; $menu_element_id = $elements_ids['id']; $menu_name = retrieve(POST, 'menu_element_' . $menu_element_id . '_name', '', TSTRING_UNCHANGE); $menu_url = retrieve(POST, 'menu_element_' . $menu_element_id . '_url', ''); $menu_image = retrieve(POST, 'menu_element_' . $menu_element_id . '_image', ''); $array_size = count($elements_ids); if ($array_size == 1 && $level > 0) { $menu = new LinksMenuLink($menu_name, $menu_url, $menu_image); } else { $menu = new LinksMenu($menu_name, $menu_url, $menu_image); unset($elements_ids['id']); $array_size = count($elements_ids); for ($i = 0; $i < $array_size; $i++) { $menu->add(build_menu_from_form($elements_ids[$i], $level + 1)); } } $menu->set_auth(Authorizations::build_auth_array_from_form(AUTH_MENUS, 'menu_element_' . $menu_element_id . '_auth')); return $menu; }
private function create_module_map_sections($categories, $id_cat, $auth_mode) { $category = $this->categories_manager->get_categories_cache()->get_category($id_cat); $this_category = new SitemapLink($category->get_name(), $this->get_category_url($category)); $section = new SitemapSection($this_category); $i = 0; 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() == $id_cat) { $section->add($this->create_module_map_sections($categories, $id, $auth_mode)); $i++; } } if ($i == 0) { $section = $this_category; } return $section; }
function build_menu_from_form($elements_ids, $level = 0) { $menu = null; $menu_element_id = $elements_ids['id']; $menu_name = retrieve(POST, 'menu_element_' . $menu_element_id . '_name', '', TSTRING_UNCHANGE); $menu_url = retrieve(POST, 'menu_element_' . $menu_element_id . '_url', ''); $menu_image = retrieve(POST, 'menu_element_' . $menu_element_id . '_image', ''); $array_size = count($elements_ids); if ($array_size == 1 && $level > 0) { // If it's a menu, there's only one element; $menu = new LinksMenuLink($menu_name, $menu_url, $menu_image); } else { $menu = new LinksMenu($menu_name, $menu_url, $menu_image); // We unset the id key of the array unset($elements_ids['id']); $array_size = count($elements_ids); for ($i = 0; $i < $array_size; $i++) { // We build all its children and add it to its father $menu->add(build_menu_from_form($elements_ids[$i], $level + 1)); } } $menu->set_auth(Authorizations::build_auth_array_from_form(Menu::MENU_AUTH_BIT, 'menu_element_' . $menu_element_id . '_auth')); return $menu; }
<?php require_once '../admin/admin_begin.php'; define('TITLE', $LANG['administration']); require_once '../admin/admin_header.php'; if (!empty($_POST['submit'])) { $editor = retrieve(POST, 'formatting_language', ''); $CONFIG['editor'] = $editor == 'tinymce' ? 'tinymce' : 'bbcode'; $CONFIG['html_auth'] = Authorizations::build_auth_array_from_form(1); $CONFIG['forbidden_tags'] = isset($_POST['forbidden_tags']) ? $_POST['forbidden_tags'] : array(); $Sql->query_inject("UPDATE " . DB_TABLE_CONFIGS . " SET value = '" . addslashes(serialize($CONFIG)) . "' WHERE name = 'config'", __LINE__, __FILE__); $Cache->Generate_file('config'); redirect(HOST . SCRIPT); } else { $template = new Template('admin/admin_content_config.tpl'); $j = 0; foreach (ContentFormattingFactory::get_available_tags() as $code => $name) { $template->assign_block_vars('tag', array('IDENTIFIER' => $j++, 'CODE' => $code, 'TAG_NAME' => $name, 'C_ENABLED' => in_array($code, $CONFIG['forbidden_tags']))); } $template->assign_vars(array('BBCODE_SELECTED' => $CONFIG['editor'] == 'bbcode' ? 'selected="selected"' : '', 'TINYMCE_SELECTED' => $CONFIG['editor'] == 'tinymce' ? 'selected="selected"' : '', 'SELECT_AUTH_USE_HTML' => Authorizations::generate_select(1, $CONFIG['html_auth']), 'NBR_TAGS' => $j, 'L_CONTENT_CONFIG' => $LANG['content_config_extend'], 'L_DEFAULT_LANGUAGE' => $LANG['default_formatting_language'], 'L_LANGUAGE_CONFIG' => $LANG['content_language_config'], 'L_HTML_LANGUAGE' => $LANG['content_html_language'], 'L_AUTH_USE_HTML' => $LANG['content_auth_use_html'], 'L_FORBIDDEN_TAGS' => $LANG['forbidden_tags'], 'L_EXPLAIN_SELECT_MULTIPLE' => $LANG['explain_select_multiple'], 'L_SELECT_ALL' => $LANG['select_all'], 'L_SELECT_NONE' => $LANG['select_none'], 'L_SUBMIT' => $LANG['submit'], 'L_RESET' => $LANG['reset'])); $template->parse(); } require_once '../admin/admin_footer.php';
$bread_crumb_key = 'wiki_property'; require_once '../wiki/wiki_bread_crumb.php'; require_once '../kernel/header.php'; $Template->set_filenames(array('wiki_properties' => 'wiki/property.tpl')); $Template->assign_vars(array('WIKI_PATH' => $Template->get_module_data_path('wiki'))); if ($random) { $page = $Sql->query("SELECT encoded_title FROM " . PREFIX . "wiki_articles WHERE redirect = 0 ORDER BY rand() " . $Sql->limit(0, 1), __LINE__, __FILE__); if (!empty($page)) { redirect(HOST . DIR . '/wiki/' . url('wiki.php?title=' . $page, $page)); } else { redirect(HOST . DIR . '/wiki/' . url('wiki.php')); } } elseif ($id_auth > 0) { $array_auth = !empty($article_infos['auth']) ? unserialize($article_infos['auth']) : $_WIKI_CONFIG['auth']; $Template->assign_block_vars('auth', array('L_TITLE' => sprintf($LANG['wiki_auth_management_article'], $article_infos['title']), 'ID' => $id_auth)); $Template->assign_vars(array('SELECT_RESTORE_ARCHIVE' => Authorizations::generate_select(WIKI_RESTORE_ARCHIVE, $array_auth), 'SELECT_DELETE_ARCHIVE' => Authorizations::generate_select(WIKI_DELETE_ARCHIVE, $array_auth), 'SELECT_EDIT' => Authorizations::generate_select(WIKI_EDIT, $array_auth), 'SELECT_DELETE' => Authorizations::generate_select(WIKI_DELETE, $array_auth), 'SELECT_RENAME' => Authorizations::generate_select(WIKI_RENAME, $array_auth), 'SELECT_REDIRECT' => Authorizations::generate_select(WIKI_REDIRECT, $array_auth), 'SELECT_MOVE' => Authorizations::generate_select(WIKI_MOVE, $array_auth), 'SELECT_STATUS' => Authorizations::generate_select(WIKI_STATUS, $array_auth), 'SELECT_COM' => Authorizations::generate_select(WIKI_COM, $array_auth), 'L_DEFAULT' => $LANG['wiki_restore_default_auth'], 'L_EXPLAIN_DEFAULT' => $LANG['wiki_explain_restore_default_auth'])); } elseif ($wiki_status > 0) { $Template->assign_block_vars('status', array('L_TITLE' => sprintf($LANG['wiki_status_management_article'], $article_infos['title']), 'UNDEFINED_STATUS' => $article_infos['defined_status'] < 0 ? wiki_unparse($article_infos['undefined_status']) : '', 'ID_ARTICLE' => $wiki_status, 'NO_STATUS' => str_replace('"', '\\"', $LANG['wiki_no_status']), 'CURRENT_STATUS' => $article_infos['defined_status'] == -1 ? $LANG['wiki_undefined_status'] : ($article_infos['defined_status'] > 0 ? $LANG['wiki_status_list'][$article_infos['defined_status'] - 1][1] : $LANG['wiki_no_status']), 'SELECTED_TEXTAREA' => $article_infos['defined_status'] >= 0 ? 'disabled="disabled" style="color:grey"' : '', 'SELECTED_SELECT' => $article_infos['defined_status'] < 0 ? 'disabled="disabled"' : '', 'UNDEFINED' => $article_infos['defined_status'] < 0 ? 'checked="checked"' : '', 'DEFINED' => $article_infos['defined_status'] >= 0 ? 'checked="checked"' : '')); $Template->assign_block_vars('status.list', array('L_STATUS' => $LANG['wiki_no_status'], 'ID_STATUS' => 0, 'SELECTED' => $article_infos['defined_status'] == 0 ? 'selected = "selected"' : '')); foreach ($LANG['wiki_status_list'] as $key => $value) { $Template->assign_block_vars('status.list', array('L_STATUS' => $value[0], 'ID_STATUS' => $key + 1, 'SELECTED' => $article_infos['defined_status'] == $key + 1 ? 'selected = "selected"' : '')); $Template->assign_block_vars('status.status_array', array('ID' => $key + 1, 'TEXT' => str_replace('"', '\\"', $value[1]))); } } elseif ($move > 0) { $cats = array(); $cat_list = display_cat_explorer($article_infos['id_cat'], $cats, 1); $cats = array_reverse($cats); if (array_key_exists(0, $cats)) { unset($cats[0]); } $current_cat = '';
$level = $CAT_FORUM[$parent_category]['level'] + 1; } else { $id_left = $Sql->query("SELECT MAX(id_right) FROM " . PREFIX . "forum_cats", __LINE__, __FILE__); $id_left++; $level = 0; } $Sql->query_inject("INSERT INTO " . PREFIX . "forum_cats (id_left, id_right, level, name, subname, url, nbr_topic, nbr_msg, last_topic_id, status, aprob, auth) VALUES('" . $id_left . "', '" . ($id_left + 1) . "', '" . $level . "', '" . $name . "', '" . $subname . "', '" . $url . "', 0, 0, 0, '" . $status . "', '" . $aprob . "', '" . addslashes(serialize($array_auth_all)) . "')", __LINE__, __FILE__); ###### Regénération du cache des catégories (liste déroulante dans le forum) ####### $Cache->Generate_module_file('forum'); forum_generate_feeds(); redirect(HOST . DIR . '/forum/admin_forum.php'); } else { redirect(HOST . DIR . '/forum/admin_forum_add.php?error=incomplete#errorh'); } } else { $Template->set_filenames(array('admin_forum_add' => 'forum/admin_forum_add.tpl')); $forums = '<option value="0" checked="checked" disabled="disabled">' . $LANG['root'] . '</option>'; $result = $Sql->query_while("SELECT id, name, level\n\tFROM " . PREFIX . "forum_cats\n\tORDER BY id_left", __LINE__, __FILE__); while ($row = $Sql->fetch_assoc($result)) { $margin = $row['level'] > 0 ? str_repeat('--------', $row['level']) : '--'; $forums .= '<option value="' . $row['id'] . '">' . $margin . ' ' . $row['name'] . '</option>'; } $Sql->query_close($result); $get_error = retrieve(GET, 'error', ''); if ($get_error == 'incomplete') { $Errorh->handler($LANG['e_incomplete'], E_USER_NOTICE); } $Template->assign_vars(array('THEME' => get_utheme(), 'MODULE_DATA_PATH' => $Template->get_module_data_path('forum'), 'CATEGORIES' => $forums, 'AUTH_READ' => Authorizations::generate_select(READ_CAT_FORUM, array(), array(-1 => true, 0 => true, 1 => true, 2 => true)), 'AUTH_WRITE' => Authorizations::generate_select(WRITE_CAT_FORUM, array(), array(0 => true, 1 => true, 2 => true)), 'AUTH_EDIT' => Authorizations::generate_select(EDIT_CAT_FORUM, array(), array(1 => true, 2 => true)), 'L_REQUIRE_TITLE' => $LANG['require_title'], 'L_FORUM_MANAGEMENT' => $LANG['forum_management'], 'L_CAT_MANAGEMENT' => $LANG['cat_management'], 'L_ADD_CAT' => $LANG['cat_add'], 'L_FORUM_CONFIG' => $LANG['forum_config'], 'L_FORUM_GROUPS' => $LANG['forum_groups_config'], 'L_REQUIRE' => $LANG['require'], 'L_APROB' => $LANG['visible'], 'L_STATUS' => $LANG['status'], 'L_RANK' => $LANG['rank'], 'L_DELETE' => $LANG['delete'], 'L_PARENT_CATEGORY' => $LANG['parent_category'], 'L_TYPE' => $LANG['type'], 'L_CATEGORY' => $LANG['category'], 'L_FORUM' => $LANG['forum'], 'L_LINK' => $LANG['link'], 'L_NAME' => $LANG['name'], 'L_DESC' => $LANG['description'], 'L_URL' => $LANG['url'], 'L_URL_EXPLAIN' => $LANG['url_explain'], 'L_RESET' => $LANG['reset'], 'L_YES' => $LANG['yes'], 'L_NO' => $LANG['no'], 'L_LOCK' => $LANG['lock'], 'L_UNLOCK' => $LANG['unlock'], 'L_GUEST' => $LANG['guest'], 'L_USER' => $LANG['member'], 'L_MODO' => $LANG['modo'], 'L_ADMIN' => $LANG['admin'], 'L_ADD' => $LANG['add'], 'L_AUTH_READ' => $LANG['auth_read'], 'L_AUTH_WRITE' => $LANG['auth_write'], 'L_AUTH_EDIT' => $LANG['auth_edit'])); $Template->pparse('admin_forum_add'); } require_once '../admin/admin_footer.php';
$Template->set_filenames(array('admin_articles_cat_add' => 'articles/admin_articles_cat_add.tpl')); $galleries = '<option value="0" id="img_default_select" checked="checked">' . $LANG['root'] . '</option>'; $result = $Sql->query_while("SELECT id, name, level\n\tFROM " . PREFIX . "articles_cats \n\tORDER BY id_left", __LINE__, __FILE__); while ($row = $Sql->fetch_assoc($result)) { $margin = $row['level'] > 0 ? str_repeat('--------', $row['level']) : '--'; $galleries .= '<option value="' . $row['id'] . '">' . $margin . ' ' . $row['name'] . '</option>'; } $Sql->query_close($result); $rep = './'; $image_list = ''; if (is_dir($rep)) { $img_array = array(); $dh = @opendir($rep); while (!is_bool($lang = @readdir($dh))) { if (preg_match('`\\.(gif|png|jpg|jpeg|tiff)+$`i', $lang)) { $img_array[] = $lang; } } @closedir($dh); foreach ($img_array as $key => $img_path) { $image_list .= '<option value="' . $img_path . '">' . $img_path . '</option>'; } } $get_error = retrieve(GET, 'error', ''); if ($get_error == 'incomplete') { $Errorh->handler($LANG['e_incomplete'], E_USER_NOTICE); } $Template->assign_vars(array('THEME' => get_utheme(), 'MODULE_DATA_PATH' => $Template->get_module_data_path('articles'), 'CATEGORIES' => $galleries, 'AUTH_READ' => Authorizations::generate_select(READ_CAT_ARTICLES, array(), array(-1 => true, 0 => true, 1 => true, 2 => true)), 'IMG_LIST' => $image_list, 'L_REQUIRE_TITLE' => $LANG['require_title'], 'L_ARTICLES_MANAGEMENT' => $LANG['articles_management'], 'L_ARTICLES_ADD' => $LANG['articles_add'], 'L_ARTICLES_CAT' => $LANG['cat_management'], 'L_ARTICLES_CONFIG' => $LANG['articles_config'], 'L_ARTICLES_CAT_ADD' => $LANG['articles_cats_add'], 'L_REQUIRE' => $LANG['require'], 'L_APROB' => $LANG['aprob'], 'L_ICON' => $LANG['icon_cat'], 'L_ICON_EXPLAIN' => $LANG['icon_cat_explain'], 'L_OR_DIRECT_PATH' => $LANG['or_direct_path'], 'L_RANK' => $LANG['rank'], 'L_DELETE' => $LANG['delete'], 'L_PARENT_CATEGORY' => $LANG['parent_category'], 'L_NAME' => $LANG['name'], 'L_DESC' => $LANG['description'], 'L_RESET' => $LANG['reset'], 'L_YES' => $LANG['yes'], 'L_NO' => $LANG['no'], 'L_LOCK' => $LANG['lock'], 'L_UNLOCK' => $LANG['unlock'], 'L_GUEST' => $LANG['guest'], 'L_USER' => $LANG['member'], 'L_MODO' => $LANG['modo'], 'L_ADMIN' => $LANG['admin'], 'L_ADD' => $LANG['add'], 'L_AUTH_READ' => $LANG['auth_read'])); $Template->pparse('admin_articles_cat_add'); } require_once '../admin/admin_footer.php';
$Errorh->handler($LANG['e_incomplete'], E_USER_NOTICE); } elseif (!empty($get_error) && isset($LANG[$get_error])) { $Errorh->handler($LANG[$get_error], E_USER_WARNING); } $i = 0; $array_modules = array(); $array_info_module = array(); $array_ranks = array(-1 => $LANG['guest'], 0 => $LANG['member'], 1 => $LANG['modo'], 2 => $LANG['admin']); $result = $Sql->query_while("SELECT id, name, auth, activ\n\tFROM " . PREFIX . "modules\n\tORDER BY name", __LINE__, __FILE__); while ($row = $Sql->fetch_assoc($result)) { $array_info_module[$row['name']] = load_ini_file('../' . $row['name'] . '/lang/', get_ulang()); $array_modules[$array_info_module[$row['name']]['name']] = array('id' => $row['id'], 'name' => $row['name'], 'auth' => $row['auth'], 'activ' => $row['activ']); } $Sql->query_close($result); ksort($array_modules); foreach ($array_modules as $name => $array_config) { $row = $array_modules[$name]; $info_module = $array_info_module[$array_config['name']]; $array_auth = !empty($row['auth']) ? unserialize($row['auth']) : array(); $l_tables = $info_module['sql_table'] > 1 ? $LANG['tables'] : $LANG['table']; $Template->assign_block_vars('installed', array('ID' => $row['id'], 'NAME' => ucfirst($info_module['name']), 'ICON' => $row['name'], 'VERSION' => $info_module['version'], 'AUTHOR' => !empty($info_module['author_mail']) ? '<a href="mailto:' . $info_module['author_mail'] . '">' . $info_module['author'] . '</a>' : $info_module['author'], 'AUTHOR_WEBSITE' => !empty($info_module['author_link']) ? '<a href="' . $info_module['author_link'] . '"><img src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/user_web.png" alt="" /></a>' : '', 'DESC' => $info_module['info'], 'COMPAT' => $info_module['compatibility'], 'ADMIN' => $info_module['admin'] ? $LANG['yes'] : $LANG['no'], 'USE_SQL' => $info_module['sql_table'] > 0 ? $LANG['yes'] : $LANG['no'], 'SQL_TABLE' => $info_module['sql_table'] > 0 ? '(' . $info_module['sql_table'] . ' ' . $l_tables . ')' : '', 'USE_CACHE' => $info_module['cache'] ? $LANG['yes'] : $LANG['no'], 'ALTERNATIVE_CSS' => $info_module['css'] ? $LANG['yes'] : $LANG['no'], 'STARTEABLE_PAGE' => $info_module['starteable_page'] ? $LANG['yes'] : $LANG['no'], 'ACTIV_ENABLED' => $row['activ'] == 1 ? 'checked="checked"' : '', 'ACTIV_DISABLED' => $row['activ'] == 0 ? 'checked="checked"' : '', 'AUTH_MODULES' => Authorizations::generate_select(ACCESS_MODULE, $array_auth, array(2 => true), $row['id']))); $i++; } if ($i == 0) { $Template->assign_vars(array('C_NO_MODULE_INSTALLED' => true)); } else { $Template->assign_vars(array('C_MODULES_INSTALLED' => true)); } $Template->pparse('admin_modules_management'); } require_once '../admin/admin_footer.php';
private function check_authorizations() { if (AppContext::get_current_user()->is_guest()) { if ($this->config->are_descriptions_displayed_to_guests() && (!Authorizations::check_auth(RANK_TYPE, User::MEMBER_LEVEL, $this->get_category()->get_authorizations(), Category::READ_AUTHORIZATIONS) || $this->config->get_category_display_type() == DownloadConfig::DISPLAY_ALL_CONTENT) || !$this->config->are_descriptions_displayed_to_guests() && !DownloadAuthorizationsService::check_authorizations($this->get_category()->get_id())->read()) { $error_controller = PHPBoostErrors::user_not_authorized(); DispatchManager::redirect($error_controller); } } else { if (!DownloadAuthorizationsService::check_authorizations($this->get_category()->get_id())->read()) { $error_controller = PHPBoostErrors::user_not_authorized(); DispatchManager::redirect($error_controller); } } }
function compute_heritated_auth($category_id, $bit, $mode) { $ids = array_reverse($this->build_parents_id_list($category_id, ADD_THIS_CATEGORY_IN_LIST)); $length = count($ids); $result = array(); if (count($ids) > 0) { $result = $this->cache_var[$ids[0]]['auth']; for ($i = 1; $i < $length; $i++) { $result = Authorizations::merge_auth($result, $this->cache_var[$ids[$i]]['auth'], $bit, $mode); } } return $result; }
$cats = array(); $id_cat_display = $page_infos['is_cat'] == 1 ? $_PAGES_CATS[$page_infos['id_cat']]['id_parent'] : $page_infos['id_cat']; $cat_list = display_cat_explorer($id_cat_display, $cats, 1); $Template->assign_vars(array('CONTENTS' => !empty($error) ? htmlspecialchars(stripslashes($contents), ENT_COMPAT, 'ISO-8859-1') : pages_unparse($page_infos['contents']), 'COUNT_HITS_CHECKED' => !empty($error) ? $count_hits == 1 ? 'checked="checked"' : '' : ($page_infos['count_hits'] == 1 ? 'checked="checked"' : ''), 'ACTIV_COM_CHECKED' => !empty($error) ? $enable_com == 1 ? 'checked="checked"' : '' : ($page_infos['activ_com'] == 1 ? 'checked="checked"' : ''), 'OWN_AUTH_CHECKED' => !empty($page_infos['auth']) ? 'checked="checked"' : '', 'CAT_0' => $id_cat_display == 0 ? 'pages_selected_cat' : '', 'ID_CAT' => $id_cat_display, 'SELECTED_CAT' => $id_cat_display, 'CHECK_IS_CAT' => 'disabled="disabled"' . ($page_infos['is_cat'] == 1 ? ' checked="checked"' : ''))); } else { if (!$User->check_auth($_PAGES_CONFIG['auth'], EDIT_PAGE)) { redirect(HOST . DIR . '/pages/pages.php?error=e_auth'); } if ($error == 'page_already_exists') { $Errorh->handler($LANG['pages_already_exists'], E_USER_WARNING); } elseif ($error == 'preview') { $Errorh->handler($LANG['pages_notice_previewing'], E_USER_NOTICE); $Template->assign_block_vars('previewing', array('PREVIEWING' => pages_second_parse(stripslashes(pages_parse($contents))), 'TITLE' => stripslashes($title))); } if (!empty($error)) { $Template->assign_vars(array('CONTENTS' => htmlspecialchars(stripslashes($contents), ENT_COMPAT, 'ISO-8859-1'), 'PAGE_TITLE' => stripslashes($title))); } $Template->assign_block_vars('create', array()); $cats = array(); $cat_list = display_cat_explorer(0, $cats, 1); $current_cat = $LANG['pages_root']; $Template->assign_vars(array('COUNT_HITS_CHECKED' => !empty($error) ? $count_hits == 1 ? 'checked="checked"' : '' : ($_PAGES_CONFIG['count_hits'] == 1 ? 'checked="checked"' : ''), 'ACTIV_COM_CHECKED' => !empty($error) ? $enable_com == 1 ? 'checked="checked"' : '' : ($_PAGES_CONFIG['activ_com'] == 1 ? 'checked="checked"' : ''), 'OWN_AUTH_CHECKED' => '', 'CAT_0' => 'pages_selected_cat', 'ID_CAT' => '0', 'SELECTED_CAT' => '0')); } if (!empty($page_infos['auth'])) { $array_auth = unserialize($page_infos['auth']); } else { $array_auth = !empty($_PAGES_CONFIG['auth']) ? $_PAGES_CONFIG['auth'] : array(); } $Template->assign_vars(array('ID_EDIT' => $id_edit, 'SELECT_READ_PAGE' => Authorizations::generate_select(READ_PAGE, $array_auth), 'SELECT_EDIT_PAGE' => Authorizations::generate_select(EDIT_PAGE, $array_auth), 'SELECT_READ_COM' => Authorizations::generate_select(READ_COM, $array_auth), 'OWN_AUTH_DISABLED' => !empty($page_infos['auth']) ? 'false' : 'true', 'DISPLAY' => empty($page_infos['auth']) ? 'display:none;' : '', 'PAGES_PATH' => $Template->get_module_data_path('pages'), 'CAT_LIST' => $cat_list, 'KERNEL_EDITOR' => display_editor(), 'L_AUTH' => $LANG['pages_auth'], 'L_ACTIV_COM' => $LANG['pages_activ_com'], 'L_COUNT_HITS' => $LANG['pages_count_hits'], 'L_ALERT_CONTENTS' => $LANG['page_alert_contents'], 'L_ALERT_TITLE' => $LANG['page_alert_title'], 'L_READ_PAGE' => $LANG['pages_auth_read'], 'L_EDIT_PAGE' => $LANG['pages_auth_edit'], 'L_READ_COM' => $LANG['pages_auth_read_com'], 'L_OWN_AUTH' => $LANG['pages_own_auth'], 'L_IS_CAT' => $LANG['pages_is_cat'], 'L_CAT' => $LANG['pages_parent_cat'], 'L_AUTH' => $LANG['pages_auth'], 'L_PATH' => $LANG['pages_page_path'], 'L_PROPERTIES' => $LANG['pages_properties'], 'L_TITLE_POST' => $id_edit > 0 ? sprintf($LANG['pages_edit_page'], $page_infos['title']) : $LANG['pages_creation'], 'L_TITLE_FIELD' => $LANG['page_title'], 'L_CONTENTS' => $LANG['page_contents'], 'L_RESET' => $LANG['reset'], 'L_PREVIEW' => $LANG['preview'], 'L_SUMBIT' => $LANG['submit'], 'L_ROOT' => $LANG['pages_root'], 'L_PREVIEWING' => $LANG['pages_previewing'], 'L_CONTENTS_PART' => $LANG['pages_contents_part'], 'L_SUBMIT' => $id_edit > 0 ? $LANG['update'] : $LANG['submit'], 'TARGET' => url('post.php?token=' . $Session->get_token()))); $Template->pparse('post'); require_once '../kernel/footer.php';
<?php require_once '../admin/admin_begin.php'; load_module_lang('pages'); define('TITLE', $LANG['administration'] . ' : ' . $LANG['pages']); require_once '../admin/admin_header.php'; include_once 'pages_begin.php'; include_once 'pages_functions.php'; if (!empty($_POST['update'])) { $count_hits = !empty($_POST['count_hits']) ? 1 : 0; $activ_com = !empty($_POST['activ_com']) ? 1 : 0; $array_auth_all = Authorizations::build_auth_array_from_form(READ_PAGE, EDIT_PAGE, READ_COM); $_PAGES_CONFIG['auth'] = serialize($array_auth_all); $_PAGES_CONFIG['count_hits'] = $count_hits; $_PAGES_CONFIG['activ_com'] = $activ_com; $Sql->query_inject("UPDATE " . DB_TABLE_CONFIGS . " SET value = '" . addslashes(serialize($_PAGES_CONFIG)) . "' WHERE name = 'pages'", __LINE__, __FILE__); $Cache->Generate_module_file('pages'); redirect(HOST . SCRIPT); } $Template->set_filenames(array('pages_config' => 'pages/admin_pages.tpl')); $array_auth = isset($_PAGES_CONFIG['auth']) ? $_PAGES_CONFIG['auth'] : array(); $Template->assign_vars(array('HITS_CHECKED' => $_PAGES_CONFIG['count_hits'] == 1 ? 'checked="checked"' : '', 'COM_CHECKED' => $_PAGES_CONFIG['activ_com'] == 1 ? 'checked="checked"' : '', 'SELECT_READ_PAGE' => Authorizations::generate_select(READ_PAGE, $array_auth), 'SELECT_EDIT_PAGE' => Authorizations::generate_select(EDIT_PAGE, $array_auth), 'SELECT_READ_COM' => Authorizations::generate_select(READ_COM, $array_auth), 'L_READ_COM' => $LANG['pages_auth_read_com'], 'L_EDIT_PAGE' => $LANG['pages_auth_edit'], 'L_READ_PAGE' => $LANG['pages_auth_read'], 'L_SELECT_NONE' => $LANG['select_none'], 'L_SELECT_ALL' => $LANG['select_all'], 'L_EXPLAIN_SELECT_MULTIPLE' => $LANG['explain_select_multiple'], 'L_AUTH' => $LANG['pages_auth'], 'L_COUNT_HITS_EXPLAIN' => $LANG['pages_count_hits_explain'], 'L_COUNT_HITS' => $LANG['pages_count_hits'], 'L_PAGES' => $LANG['pages'], 'L_UPDATE' => $LANG['update'], 'L_RESET' => $LANG['reset'], 'L_ACTIV_COM' => $LANG['pages_activ_com'], 'L_PAGES_CONGIG' => $LANG['pages_config'], 'L_PAGES_MANAGEMENT' => $LANG['pages_management'])); $Template->pparse('pages_config'); require_once '../admin/admin_footer.php';
$keyword = $request->get_getint('keyword', 0); $browser = $request->get_getint('browser', 0); $os = $request->get_getint('os', 0); $all = $request->get_getint('all', 0); $user_lang = $request->get_getint('lang', 0); $bot = $request->get_getint('bot', 0); $erase = $request->get_postvalue('erase', false); if ($erase) { $file = new File('../stats/cache/robots.txt'); try { $file->delete(); } catch (IOException $exception) { echo $exception->getMessage(); } } $tpl->put_all(array('L_SITE' => $LANG['site'], 'L_STATS' => $LANG['stats'], 'L_USERS' => $LANG['member_s'], 'L_VISITS' => $LANG['guest_s'], 'L_PAGES' => $LANG['page_s'], 'L_BROWSERS' => $LANG['browser_s'], 'L_OS' => $LANG['os'], 'L_LANG' => $LANG['stat_lang'], 'L_KEYWORD' => $LANG['keyword_s'], 'L_REFERER' => $LANG['referer_s'], 'L_ROBOTS' => $LANG['robots'], 'L_UPDATE' => $LANG['update'], 'L_RESET' => $LANG['reset'], 'L_AUTHORIZATIONS' => $LANG['admin.authorizations'], 'L_READ_AUTHORIZATION' => $LANG['admin.authorizations.read'], 'READ_AUTHORIZATION' => Authorizations::generate_select(StatsAuthorizationsService::READ_AUTHORIZATIONS, StatsConfig::load()->get_authorizations()))); $date_lang = LangLoader::get('date-common'); if (!empty($members)) { $stats_cache = StatsCache::load(); $last_user_group_color = User::get_group_color($stats_cache->get_stats_properties('last_member_groups'), $stats_cache->get_stats_properties('last_member_level')); $tpl->put_all(array('C_STATS_USERS' => true, 'C_LAST_USER_GROUP_COLOR' => !empty($last_user_group_color), 'LAST_USER' => $stats_cache->get_stats_properties('last_member_login'), 'LAST_USER_LEVEL_CLASS' => UserService::get_level_class($stats_cache->get_stats_properties('last_member_level')), 'LAST_USER_GROUP_COLOR' => $last_user_group_color, 'U_LAST_USER_PROFILE' => UserUrlBuilder::profile($stats_cache->get_stats_properties('last_member_id'))->rel(), 'USERS' => $stats_cache->get_stats_properties('nbr_members'), 'GRAPH_RESULT_THEME' => !file_exists('../cache/theme.png') ? '<img src="display_stats.php?theme=1" alt="' . $LANG['theme_s'] . '" />' : '<img src="../cache/theme.png" alt="' . $LANG['theme_s'] . '" />', 'GRAPH_RESULT_SEX' => !file_exists('../cache/sex.png') ? '<img src="display_stats.php?sex=1" alt="' . $LANG['sex'] . '" />' : '<img src="../cache/sex.png" alt="' . $LANG['sex'] . '" />', 'L_LAST_USER' => $LANG['last_member'], 'L_TEMPLATES' => $LANG['theme_s'], 'L_PSEUDO' => LangLoader::get_message('display_name', 'user-common'), 'L_MSG' => $LANG['message_s'], 'L_TOP_TEN_POSTERS' => $LANG['top_10_posters'], 'L_COLORS' => $LANG['colors'], 'L_USERS' => $LANG['member_s'], 'L_SEX' => $LANG['sex'])); $stats_array = array(); foreach (ThemesManager::get_activated_themes_map() as $theme) { $stats_array[$theme->get_id()] = $db_querier->count(DB_TABLE_MEMBER, "WHERE theme = '" . $theme->get_id() . "'"); } $Stats = new ImagesStats(); $Stats->load_data($stats_array, 'ellipse'); foreach ($Stats->data_stats as $name => $angle_value) { $array_color = $Stats->array_allocated_color[$Stats->image_color_allocate_dark(false, NO_ALLOCATE_COLOR)]; $tpl->assign_block_vars('templates', array('NBR_THEME' => NumberHelper::round($angle_value * $Stats->nbr_entry / 360, 0), 'COLOR' => 'RGB(' . $array_color[0] . ', ' . $array_color[1] . ', ' . $array_color[2] . ')', 'THEME' => $name == 'Other' ? $LANG['other'] : $name, 'PERCENT' => NumberHelper::round($angle_value / 3.6, 1))); }
$config->set_authorizations(Authorizations::build_auth_array_from_form(Category::READ_AUTHORIZATIONS, Category::WRITE_AUTHORIZATIONS, Category::MODERATION_AUTHORIZATIONS)); GalleryConfig::save(); GalleryService::get_categories_manager()->regenerate_cache(); ###### Régénération du cache de la gallery ####### GalleryMiniMenuCache::invalidate(); AppContext::get_response()->redirect(HOST . REWRITED_SCRIPT); } elseif ($gallery_cache) { //Recréaction miniatures, et inscrustation du logo sur image. $Gallery = new Gallery(); $Gallery->Clear_cache(); GalleryMiniMenuCache::invalidate(); AppContext::get_response()->redirect('/gallery/admin_gallery_config.php'); } else { $tpl = new FileTemplate('gallery/admin_gallery_config.tpl'); //Vitesse de défilement des miniatures. $mini_pics_speed = ''; for ($i = 1; $i <= 10; $i++) { $selected = $config->get_mini_pics_speed() == $i ? ' selected="selected"' : ''; $mini_pics_speed .= '<option value="' . $i . '"' . $selected . '>' . $i . '</option>'; } //Type de défilemennt $scroll_types = ''; $array_scroll = array(GalleryConfig::STATIC_SCROLL => $LANG['static_scroll'], GalleryConfig::VERTICAL_DYNAMIC_SCROLL => $LANG['vertical_dynamic_scroll'], GalleryConfig::HORIZONTAL_DYNAMIC_SCROLL => $LANG['horizontal_dynamic_scroll'], GalleryConfig::NO_SCROLL => $LANG['no_scroll']); foreach ($array_scroll as $key => $name) { $selected = $config->get_scroll_type() == $key ? ' selected="selected"' : ''; $scroll_types .= '<option value="' . $key . '"' . $selected . '>' . $name . '</option>'; } $tpl->put_all(array('C_LOGO_ENABLED' => $config->is_logo_enabled(), 'C_TITLE_ENABLED' => $config->is_title_enabled(), 'C_COMMENTS_ENABLED' => $config->are_comments_enabled(), 'C_NOTATION_ENABLED' => $config->is_notation_enabled(), 'C_NOTES_NUMBER_DISPLAYED' => $config->are_notes_number_displayed(), 'C_VIEWS_COUNTER_ENABLED' => $config->is_views_counter_enabled(), 'C_AUTHOR_DISPLAYED' => $config->is_author_displayed(), 'C_DISPLAY_PICS_NEW_PAGE' => $config->get_pics_enlargement_mode() == GalleryConfig::NEW_PAGE, 'C_DISPLAY_PICS_RESIZE' => $config->get_pics_enlargement_mode() == GalleryConfig::RESIZE, 'C_DISPLAY_PICS_POPUP' => $config->get_pics_enlargement_mode() == GalleryConfig::POPUP, 'C_DISPLAY_PICS_FULL_SCREEN' => $config->get_pics_enlargement_mode() == GalleryConfig::FULL_SCREEN, 'MINI_MAX_WIDTH' => $config->get_mini_max_width(), 'MINI_MAX_HEIGHT' => $config->get_mini_max_height(), 'MAX_WIDTH' => $config->get_max_width(), 'MAX_HEIGHT' => $config->get_max_height(), 'MAX_WEIGHT' => $config->get_max_weight(), 'QUALITY' => $config->get_quality(), 'LOGO' => $config->get_logo(), 'LOGO_TRANSPARENCY' => $config->get_logo_transparency(), 'LOGO_HORIZONTAL_DISTANCE' => $config->get_logo_horizontal_distance(), 'LOGO_VERTICAL_DISTANCE' => $config->get_logo_vertical_distance(), 'CATEGORIES_NUMBER_PER_PAGE' => $config->get_categories_number_per_page(), 'COLUMNS_NUMBER' => $config->get_columns_number(), 'PICS_NUMBER_PER_PAGE' => $config->get_pics_number_per_page(), 'NOTATION_SCALE' => $config->get_notation_scale(), 'MEMBER_MAX_PICS_NUMBER' => $config->get_member_max_pics_number(), 'MODERATOR_MAX_PICS_NUMBER' => $config->get_moderator_max_pics_number(), 'PICS_NUMBER_IN_MINI' => $config->get_pics_number_in_mini(), 'MINI_PICS_SPEED' => $mini_pics_speed, 'SCROLL_TYPES' => $scroll_types, 'NEW_PAGE' => GalleryConfig::NEW_PAGE, 'RESIZE' => GalleryConfig::RESIZE, 'POPUP' => GalleryConfig::POPUP, 'FULL_SCREEN' => GalleryConfig::FULL_SCREEN, 'AUTH_READ' => Authorizations::generate_select(Category::READ_AUTHORIZATIONS, $config->get_authorizations()), 'AUTH_WRITE' => Authorizations::generate_select(Category::WRITE_AUTHORIZATIONS, $config->get_authorizations()), 'AUTH_MODERATION' => Authorizations::generate_select(Category::MODERATION_AUTHORIZATIONS, $config->get_authorizations()), 'L_AUTH_READ' => $LANG['auth_read'], 'L_AUTH_WRITE' => $LANG['auth_upload'], 'L_AUTH_MODERATION' => $LANG['auth_edit'], 'L_UNAUTH' => $LANG['unauthorized'], 'L_UNLIMITED' => $LANG['illimited'], 'L_REQUIRE_MINI_MAX_HEIGHT' => $LANG['require_height'], 'L_REQUIRE_MINI_MAX_WIDTH' => $LANG['require_width'], 'L_REQUIRE_MAX_HEIGHT' => $LANG['require_height_max'], 'L_REQUIRE_MAX_WIDTH' => $LANG['require_width_max'], 'L_REQUIRE_MAX_WEIGHT' => $LANG['require_weight_max'], 'L_REQUIRE_NOTATION_SCALE' => $LANG['require_notation_scale'], 'L_REQUIRE_CAT_P' => $LANG['require_cat_p'], 'L_REQUIRE_ROW' => $LANG['require_row'], 'L_REQUIRE_IMG_P' => $LANG['require_img_p'], 'L_REQUIRE_QUALITY' => $LANG['require_quality'], 'L_GALLERY_MANAGEMENT' => LangLoader::get_message('gallery.management', 'common', 'gallery'), 'L_GALLERY_PICS_ADD' => LangLoader::get_message('gallery.actions.add', 'common', 'gallery'), 'L_GALLERY_CAT_MANAGEMENT' => LangLoader::get_message('categories.management', 'categories-common'), 'L_GALLERY_CAT_ADD' => LangLoader::get_message('category.add', 'categories-common'), 'L_GALLERY_CONFIG' => $LANG['gallery_config'], 'L_CONFIG_CONFIG' => LangLoader::get_message('general-config', 'admin-config-common'), 'L_REQUIRE' => LangLoader::get_message('form.explain_required_fields', 'status-messages-common'), 'L_MINI_MAX_HEIGHT' => $LANG['height_max_thumb'], 'L_MINI_MAX_HEIGHT_EXPLAIN' => $LANG['height_max_thumb_explain'], 'L_MINI_MAX_WIDTH' => $LANG['width_max_thumb'], 'L_MINI_MAX_WIDTH_EXPLAIN' => $LANG['width_max_thumb_explain'], 'L_MAX_HEIGHT' => $LANG['height_max'], 'L_MAX_HEIGHT_EXPLAIN' => $LANG['height_max_explain'], 'L_MAX_WIDTH' => $LANG['width_max'], 'L_MAX_WIDTH_EXPLAIN' => $LANG['width_max_explain'], 'L_MAX_WEIGHT' => $LANG['weight_max'], 'L_MAX_WEIGHT_EXPLAIN' => $LANG['weight_max_explain'], 'L_QUALITY_THUMB' => $LANG['quality_thumb'], 'L_QUALITY_THUMB_EXPLAIN' => $LANG['quality_thumb_explain'], 'L_COLUMNS_NUMBER' => $LANG['nbr_column'], 'L_COLUMNS_NUMBER_EXPLAIN' => $LANG['nbr_column_explain'], 'L_PICS_NUMBER_PER_PAGE' => $LANG['nbr_pics_max'], 'L_YES' => LangLoader::get_message('yes', 'common'), 'L_NO' => LangLoader::get_message('no', 'common'), 'L_DISPLAY_OPTION' => $LANG['display_option'], 'L_DISPLAY_MODE' => $LANG['display_mode'], 'L_NEW_PAGE' => $LANG['new_page'], 'L_RESIZE' => $LANG['resize'], 'L_POPUP' => $LANG['popup'], 'L_POPUP_FULL' => $LANG['popup_full'], 'L_TITLE_ENABLED' => $LANG['title_enabled'], 'L_TITLE_ENABLED_EXPLAIN' => $LANG['title_enabled_explain'], 'L_AUTHOR_DISPLAYED' => $LANG['img_poster'], 'L_AUTHOR_DISPLAYED_EXPLAIN' => $LANG['img_poster_explain'], 'L_ENABLED' => LangLoader::get_message('enabled', 'common'), 'L_DISABLED' => LangLoader::get_message('disabled', 'common'), 'L_VIEWS_COUNTER_ENABLED' => $LANG['compt_views'], 'L_VIEWS_COUNTER_ENABLED_EXPLAIN' => $LANG['compt_views_explain'], 'L_COMMENTS_ENABLED' => $LANG['activ_com'], 'L_NOTATION_ENABLED' => $LANG['activ_note'], 'L_NOTES_NUMBER_DISPLAYED' => $LANG['display_nbrnote'], 'L_NOTATION_SCALE' => $LANG['note_max'], 'L_NOTATION_SCALE_EXPLAIN' => $LANG['note_max_explain'], 'L_IMG_PROTECT' => $LANG['img_protect'], 'L_LOGO_ENABLED' => $LANG['activ_logo'], 'L_LOGO_ENABLED_EXPLAIN' => $LANG['activ_logo_explain'], 'L_LOGO_URL' => $LANG['logo_url'], 'L_LOGO_URL_EXPLAIN' => $LANG['logo_url_explain'], 'L_LOGO_TRANSPARENCY' => $LANG['logo_trans'], 'L_LOGO_TRANSPARENCY_EXPLAIN' => $LANG['logo_trans_explain'], 'L_WIDTH_BOTTOM_RIGHT' => $LANG['width_bottom_right'], 'L_WIDTH_BOTTOM_RIGHT_EXPLAIN' => $LANG['width_bottom_right_explain'], 'L_HEIGHT_BOTTOM_RIGHT' => $LANG['height_bottom_right'], 'L_HEIGHT_BOTTOM_RIGHT_EXPLAIN' => $LANG['height_bottom_right_explain'], 'L_UPLOAD_PICS' => $LANG['upload_pic'], 'L_MEMBER_MAX_PICS_NUMBER' => $LANG['nbr_img'], 'L_MEMBER_MAX_PICS_NUMBER_EXPLAIN' => $LANG['nbr_img_explain'], 'L_MODERATOR_MAX_PICS_NUMBER' => $LANG['nbr_img_modo'], 'L_MODERATOR_MAX_PICS_NUMBER_EXPLAIN' => $LANG['nbr_img_modo_explain'], 'L_THUMBNAILS_SCROLLING' => $LANG['thumbnails_scolling'], 'L_PICS_NUMBER_IN_MINI' => $LANG['nbr_pics_mini'], 'L_MINI_PICS_SPEED' => $LANG['speed_mini_pics'], 'L_MINI_PICS_SPEED_EXPLAIN' => $LANG['speed_mini_pics_explain'], 'L_SCROLL_TYPE' => $LANG['scrool_type'], 'L_CACHE' => LangLoader::get_message('cache_configuration', 'admin-cache-common'), 'L_EXPLAIN_GALLERY_CACHE' => $LANG['explain_gallery_cache'], 'L_UNIT_PX' => LangLoader::get_message('unit.pixels', 'common'), 'L_UNIT_KO' => LangLoader::get_message('unit.kilobytes', 'common'), 'L_COLUMN' => $LANG['column'], 'L_EMPTY' => $LANG['empty'], 'L_UPDATE' => $LANG['update'], 'L_SUBMIT' => $LANG['submit'], 'L_RESET' => $LANG['reset'])); $tpl->display(); } require_once '../admin/admin_footer.php';
/** * @desc Assign tpl vars * @access protected * @param Template $template the template on which we gonna assign vars * @param int $mode in LinksMenuElement::LINKS_MENU_ELEMENT__CLASSIC_DISPLAYING mode, the links menu is * displayed. With the LinksMenuElement::LINKS_MENU_ELEMENT__FULL_DISPLAYING mode, the authorization form is * also shown. */ protected function _assign($template, $mode = self::LINKS_MENU_ELEMENT__CLASSIC_DISPLAYING) { $image = new Image(Url::to_absolute($this->image)); parent::_assign($template); $template->put_all(array('C_MENU' => false, 'TITLE' => $this->title, 'DEPTH' => $this->depth, 'PARENT_DEPTH' => $this->depth - 1, 'C_URL' => !empty($this->url), 'C_IMG' => !empty($this->image), 'ABSOLUTE_URL' => Url::to_absolute($this->url), 'ABSOLUTE_IMG' => Url::to_absolute($this->image), 'RELATIVE_URL' => Url::to_relative($this->url), 'RELATIVE_IMG' => Url::to_relative($this->image), 'REL_URL' => Url::to_rel($this->url), 'REL_IMG' => Url::to_rel($this->image), 'ID' => $this->get_uid(), 'ID_VAR' => $this->get_uid(), 'IMG_HEIGHT' => $image->get_height(), 'IMG_WIDTH' => $image->get_width())); //Full displaying: we also show the authorization formulary if ($mode) { $template->put_all(array('AUTH_FORM' => Authorizations::generate_select(Menu::MENU_AUTH_BIT, $this->get_auth(), array(), 'menu_element_' . $this->uid . '_auth'))); } }
Feed::clear_cache('media'); AppContext::get_response()->redirect('media' . url('.php?id=' . $media['idedit'])); } elseif (!$media['idedit'] && (($auth_write = MediaAuthorizationsService::check_authorizations($media['idcat'])->write()) || MediaAuthorizationsService::check_authorizations($media['idcat'])->contribution())) { $result = PersistenceContext::get_querier()->insert(PREFIX . "media", array('idcat' => $media['idcat'], 'iduser' => AppContext::get_current_user()->get_id(), 'timestamp' => time(), 'name' => $media['name'], 'contents' => FormatingHelper::strparse($media['contents']), 'url' => $media['url'], 'mime_type' => $media['mime_type'], 'infos' => MediaAuthorizationsService::check_authorizations($media['idcat'])->write() ? MEDIA_STATUS_APROBED : 0, 'width' => $media['width'], 'height' => $media['height'])); $new_id_media = $result->get_last_inserted_id(); // Feeds Regeneration Feed::clear_cache('media'); if (!$auth_write) { $media_contribution = new Contribution(); $media_contribution->set_id_in_module($new_id_media); $media_contribution->set_description(stripslashes($media['counterpart'])); $media_contribution->set_entitled($media['name']); $media_contribution->set_fixing_url('/media/media_action.php?edit=' . $new_id_media); $media_contribution->set_poster_id(AppContext::get_current_user()->get_id()); $media_contribution->set_module('media'); $media_contribution->set_auth(Authorizations::capture_and_shift_bit_auth(MediaService::get_categories_manager()->get_heritated_authorizations($media['idcat'], Category::MODERATION_AUTHORIZATIONS, Authorizations::AUTH_CHILD_PRIORITY), Category::MODERATION_AUTHORIZATIONS, Contribution::CONTRIBUTION_AUTH_BIT)); ContributionService::save_contribution($media_contribution); DispatchManager::redirect(new UserContributionSuccessController()); } else { AppContext::get_response()->redirect('media' . url('.php?id=' . $new_id_media)); } } else { $error_controller = PHPBoostErrors::user_not_authorized(); DispatchManager::redirect($error_controller); } } else { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } $tpl->display(); require_once '../kernel/footer.php';
private function contribution_actions(DownloadFile $downloadfile, $id) { if ($downloadfile->get_id() === null) { if ($this->is_contributor_member()) { $contribution = new Contribution(); $contribution->set_id_in_module($id); $contribution->set_description(stripslashes($this->form->get_value('contribution_description'))); $contribution->set_entitled($downloadfile->get_name()); $contribution->set_fixing_url(DownloadUrlBuilder::edit($id)->relative()); $contribution->set_poster_id(AppContext::get_current_user()->get_id()); $contribution->set_module('download'); $contribution->set_auth(Authorizations::capture_and_shift_bit_auth(DownloadService::get_categories_manager()->get_heritated_authorizations($downloadfile->get_id_category(), Category::MODERATION_AUTHORIZATIONS, Authorizations::AUTH_CHILD_PRIORITY), Category::MODERATION_AUTHORIZATIONS, Contribution::CONTRIBUTION_AUTH_BIT)); ContributionService::save_contribution($contribution); } } else { $corresponding_contributions = ContributionService::find_by_criteria('download', $id); if (count($corresponding_contributions) > 0) { $downloadfile_contribution = $corresponding_contributions[0]; $downloadfile_contribution->set_status(Event::EVENT_STATUS_PROCESSED); ContributionService::save_contribution($downloadfile_contribution); } } $downloadfile->set_id($id); }
<?php require_once '../admin/admin_begin.php'; load_module_lang('forum'); define('TITLE', $LANG['administration']); require_once '../forum/forum_begin.php'; require_once '../admin/admin_header.php'; $class = retrieve(GET, 'id', 0); $top = retrieve(GET, 'top', ''); $bottom = retrieve(GET, 'bot', ''); if (!empty($_POST['valid'])) { $array_auth_all = Authorizations::build_auth_array_from_form(FLOOD_FORUM, EDIT_MARK_FORUM, TRACK_TOPIC_FORUM, ADMIN_NOAUTH_DEFAULT); $CONFIG_FORUM['auth'] = serialize($array_auth_all); $Sql->query_inject("UPDATE " . DB_TABLE_CONFIGS . " SET value = '" . addslashes(serialize($CONFIG_FORUM)) . "' WHERE name = 'forum'", __LINE__, __FILE__); ###### Regénération du cache des catégories (liste déroulante dans le forum) ####### $Cache->Generate_module_file('forum'); redirect(HOST . SCRIPT); } else { $Template->set_filenames(array('admin_forum_groups' => 'forum/admin_forum_groups.tpl')); $array_auth = isset($CONFIG_FORUM['auth']) ? $CONFIG_FORUM['auth'] : array(); $Template->assign_vars(array('FLOOD_AUTH' => Authorizations::generate_select(FLOOD_FORUM, $array_auth), 'EDIT_MARK_AUTH' => Authorizations::generate_select(EDIT_MARK_FORUM, $array_auth), 'TRACK_TOPIC_AUTH' => Authorizations::generate_select(TRACK_TOPIC_FORUM, $array_auth), 'L_FORUM_MANAGEMENT' => $LANG['forum_management'], 'L_CAT_MANAGEMENT' => $LANG['cat_management'], 'L_ADD_CAT' => $LANG['cat_add'], 'L_FORUM_CONFIG' => $LANG['forum_config'], 'L_FORUM_GROUPS' => $LANG['forum_groups_config'], 'EXPLAIN_FORUM_GROUPS' => $LANG['explain_forum_groups'], 'L_FLOOD' => $LANG['flood_auth'], 'L_EDIT_MARK' => $LANG['edit_mark_auth'], 'L_TRACK_TOPIC' => $LANG['track_topic_auth'], 'L_UPDATE' => $LANG['update'], 'L_RESET' => $LANG['reset'])); $Template->pparse('admin_forum_groups'); } require_once '../admin/admin_footer.php';
$tpl = new FileTemplate('admin/menus/feed.tpl'); $tpl->put_all(array('L_REQUIRE' => LangLoader::get_message('form.explain_required_fields', 'status-messages-common'), 'JL_REQUIRE_NAME' => TextHelper::to_js_string($LANG['require_name']), 'JL_REQUIRE_FEED' => TextHelper::to_js_string($LANG['choose_feed_in_list']), 'JL_REQUIRE_ITEMS_NUMBER' => TextHelper::to_js_string($LANG['require_items_number']), 'L_FEED' => $LANG['feed'], 'L_AVAILABLES_FEEDS' => $LANG['availables_feeds'], 'L_NAME' => $LANG['name'], 'L_STATUS' => $LANG['status'], 'L_HIDDEN_WITH_SMALL_SCREENS' => $LANG['hidden_with_small_screens'], 'L_AUTHS' => $LANG['auths'], 'L_ENABLED' => LangLoader::get_message('enabled', 'common'), 'L_DISABLED' => LangLoader::get_message('disabled', 'common'), 'L_GUEST' => $LANG['guest'], 'L_USER' => $LANG['member'], 'L_MODO' => $LANG['modo'], 'L_ADMIN' => $LANG['admin'], 'L_LOCATION' => $LANG['location'], 'L_ACTION_MENUS' => $edit ? $LANG['menus_edit'] : LangLoader::get_message('add', 'common'), 'L_ACTION' => $edit ? $LANG['update'] : $LANG['submit'], 'L_RESET' => $LANG['reset'], 'ACTION' => 'save')); //Localisation possibles. $block = retrieve(GET, 's', Menu::BLOCK_POSITION__HEADER, TINTEGER); $array_location = array(Menu::BLOCK_POSITION__HEADER => $LANG['menu_header'], Menu::BLOCK_POSITION__SUB_HEADER => $LANG['menu_subheader'], Menu::BLOCK_POSITION__LEFT => $LANG['menu_left'], Menu::BLOCK_POSITION__TOP_CENTRAL => $LANG['menu_top_central'], Menu::BLOCK_POSITION__BOTTOM_CENTRAL => $LANG['menu_bottom_central'], Menu::BLOCK_POSITION__RIGHT => $LANG['menu_right'], Menu::BLOCK_POSITION__TOP_FOOTER => $LANG['menu_top_footer'], Menu::BLOCK_POSITION__FOOTER => $LANG['menu_footer']); $feed_url = ''; if ($edit) { $menu = MenuService::load($id); if (!$menu instanceof FeedMenu) { AppContext::get_response()->redirect('menus.php'); } $block = $menu->get_block(); $feed_url = $menu->get_url(true); $tpl->put_all(array('IDMENU' => $id, 'NAME' => $menu->get_title(), 'ITEMS_NUMBER' => $menu->get_number(), 'AUTH_MENUS' => Authorizations::generate_select(Menu::MENU_AUTH_BIT, $menu->get_auth()), 'C_MENU_HIDDEN_WITH_SMALL_SCREENS' => $menu->is_hidden_with_small_screens(), 'C_ENABLED' => $menu->is_enabled(), 'C_EDIT' => true)); } else { $tpl->put_all(array('C_NEW' => true, 'C_ENABLED' => true, 'ITEMS_NUMBER' => 10, 'AUTH_MENUS' => Authorizations::generate_select(Menu::MENU_AUTH_BIT, array(), array(-1 => true, 0 => true, 1 => true, 2 => true)))); // Create a new generic menu $menu = new FeedMenu('', '', ''); } function get_feeds($feed_cat, $module_id, $feed_type, $feed_url_edit = '', $level = 0) { return get_feeds_children($feed_cat->get_children(), $module_id, $feed_type, $feed_url_edit, $level + 1); } function get_feeds_children(array $children, $module_id, $feed_type, $feed_url_edit = '', $level) { if (!empty($children)) { foreach ($children as $id => $feed_cat) { $url = $feed_cat->get_url($feed_type); $urls[] = array('name' => $feed_cat->get_category_name(), 'url' => $url, 'level' => $level, 'feed_name' => $feed_type, 'selected' => $feed_url_edit == $url); } return array_merge($urls, get_feeds_children($feed_cat->get_children(), $module_id, $feed_type, $feed_url_edit, $level + 1));
function Alert_topic($alert_post, $alert_title, $alert_contents) { global $LANG; try { $topic_infos = PersistenceContext::get_querier()->select_single_row(PREFIX . 'forum_topics', array("idcat", "title"), 'WHERE id=:id', array('id' => $alert_post)); } catch (RowNotFoundException $e) { $error_controller = PHPBoostErrors::unexisting_element(); DispatchManager::redirect($error_controller); } $result = PersistenceContext::get_querier()->insert(PREFIX . "forum_alerts", array('idcat' => $topic_infos['idcat'], 'idtopic' => $alert_post, 'title' => $alert_title, 'contents' => $alert_contents, 'user_id' => AppContext::get_current_user()->get_id(), 'status' => 0, 'idmodo' => 0, 'timestamp' => time())); $alert_id = $result->get_last_inserted_id(); $contribution = new Contribution(); //The id of the file in the module. It's useful when the module wants to search a contribution (we will need it in the file edition) $contribution->set_id_in_module($alert_id); //The entitled of the contribution $contribution->set_entitled(sprintf($LANG['contribution_alert_moderators_for_topics'], stripslashes($alert_title))); //The URL where a validator can treat the contribution (in the file edition panel) $contribution->set_fixing_url('/forum/moderation_forum.php?action=alert&id=' . $alert_id); //Description $contribution->set_description(stripslashes($alert_contents)); //Who is the contributor? $contribution->set_poster_id(AppContext::get_current_user()->get_id()); //The module $contribution->set_module('forum'); //It's an alert, we will be able to manage other kinds of contributions in the module if we choose to use a type. $contribution->set_type('alert'); //Assignation des autorisations d'écriture / Writing authorization assignation $contribution->set_auth(Authorizations::capture_and_shift_bit_auth(ForumService::get_categories_manager()->get_heritated_authorizations($topic_infos['idcat'], Category::MODERATION_AUTHORIZATIONS, Authorizations::AUTH_CHILD_PRIORITY), Category::MODERATION_AUTHORIZATIONS, Contribution::CONTRIBUTION_AUTH_BIT)); //Sending the contribution to the kernel. It will place it in the contribution panel to be approved ContributionService::save_contribution($contribution); }