コード例 #1
0
 public function get_menu_content()
 {
     $tpl = new FileTemplate('calendar/CalendarModuleMiniMenu.tpl');
     $tpl->add_lang(LangLoader::get('common', 'calendar'));
     $tpl->put('CALENDAR', CalendarAjaxCalendarController::get_view(true));
     return $tpl->render();
 }
コード例 #2
0
 public function get_content()
 {
     $tpl = new FileTemplate('newsletter/newsletter_mini.tpl');
     $tpl->add_lang(LangLoader::get('common', 'newsletter'));
     $tpl->put('USER_MAIL', AppContext::get_current_user()->get_email());
     return $tpl;
 }
コード例 #3
0
 /**
  * @param Template $view
  * @return InstallDisplayResponse
  */
 private function create_response()
 {
     $view = new FileTemplate('install/license.tpl');
     $view->put('LICENSE_FORM', $this->form->display());
     $step_title = $this->lang['step.license.title'];
     $response = new InstallDisplayResponse(1, $step_title, $view);
     return $response;
 }
コード例 #4
0
 private function build_view()
 {
     $config_html = new SitemapExportConfig('sitemap/export/sitemap.html.tpl', 'sitemap/export/module_map.html.tpl', 'sitemap/export/sitemap_section.html.tpl', 'sitemap/export/sitemap_link.html.tpl');
     $sitemap = SitemapService::get_personal_sitemap();
     $tpl = new FileTemplate('sitemap/ViewSitemapController.tpl');
     $tpl->add_lang($this->lang);
     $tpl->put('SITEMAP', $sitemap->export($config_html));
     return $tpl;
 }
コード例 #5
0
 private function build_response(View $view)
 {
     $body_view = new FileTemplate('newsletter/NewsletterBody.tpl');
     $body_view->add_lang($this->lang);
     $body_view->put('TEMPLATE', $view);
     $response = new SiteDisplayResponse($body_view);
     $breadcrumb = $response->get_graphical_environment()->get_breadcrumb();
     $breadcrumb->add($this->lang['newsletter'], NewsletterUrlBuilder::home()->rel());
     $breadcrumb->add($this->lang['unsubscribe.newsletter'], NewsletterUrlBuilder::unsubscribe()->rel());
     $graphical_environment = $response->get_graphical_environment();
     $graphical_environment->set_page_title($this->lang['unsubscribe.newsletter'], $this->lang['newsletter']);
     $graphical_environment->get_seo_meta_data()->set_canonical_url(NewsletterUrlBuilder::unsubscribe());
     return $response;
 }
コード例 #6
0
 public function get_menu_content()
 {
     //Create file template
     $tpl = new FileTemplate('guestbook/GuestbookModuleMiniMenu.tpl');
     //Assign the lang file to the tpl
     $tpl->add_lang(LangLoader::get('common', 'guestbook'));
     $tpl->put('U_GUESTBOOK', GuestbookUrlBuilder::home()->rel());
     $guestbook_cache = GuestbookMessagesCache::load();
     $random_message = $guestbook_cache->get_message(array_rand($guestbook_cache->get_messages()));
     if ($random_message !== null) {
         $user_group_color = User::get_group_color($random_message['groups'], $random_message['level']);
         $tpl->put_all(array('C_ANY_MESSAGE_GUESTBOOK' => true, 'C_USER_GROUP_COLOR' => !empty($user_group_color), 'C_MORE_CONTENTS' => strlen($random_message['contents']) >= 200, 'C_VISITOR' => empty($random_message['user_id']), 'CONTENTS' => $random_message['contents'], 'SHORT_CONTENTS' => nl2br(TextHelper::substr_html($random_message['contents'], 0, 200)), 'USER_PSEUDO' => $random_message['login'], 'USER_LEVEL_CLASS' => UserService::get_level_class($random_message['level']), 'USER_GROUP_COLOR' => $user_group_color, 'U_MESSAGE' => GuestbookUrlBuilder::home($random_message['page'], $random_message['id'])->rel(), 'U_PROFILE' => UserUrlBuilder::profile($random_message['user_id'])->rel()));
     }
     return $tpl->render();
 }
コード例 #7
0
 public function get_menu_content()
 {
     //Create file template
     $tpl = new FileTemplate('web/WebModuleMiniMenu.tpl');
     //Assign the lang file to the tpl
     $tpl->add_lang(LangLoader::get('common', 'web'));
     //Load module cache
     $web_cache = WebCache::load();
     $partners_weblinks = $web_cache->get_partners_weblinks();
     $tpl->put('C_PARTNERS', !empty($partners_weblinks));
     foreach ($partners_weblinks as $partner) {
         $partner_picture = new Url($partner['partner_picture']);
         $picture = $partner_picture->rel();
         $tpl->assign_block_vars('partners', array('C_HAS_PARTNER_PICTURE' => !empty($picture), 'NAME' => $partner['name'], 'U_PARTNER_PICTURE' => $picture, 'U_VISIT' => WebUrlBuilder::visit($partner['id'])->rel()));
     }
     return $tpl->render();
 }
コード例 #8
0
 private function get_view()
 {
     global $Bread_crumb, $LANG, $encoded_title, $id_article, $article_infos, $id_cat;
     load_module_lang('wiki');
     include_once PATH_TO_ROOT . '/wiki/wiki_functions.php';
     $bread_crumb_key = 'wiki';
     require_once PATH_TO_ROOT . '/wiki/wiki_bread_crumb.php';
     $config = WikiConfig::load();
     $tpl = new FileTemplate('wiki/index.tpl');
     if ($config->get_number_articles_on_index() > 1) {
         $result = PersistenceContext::get_querier()->select("SELECT a.title, a.encoded_title, a.id\r\n\t\t\tFROM " . PREFIX . "wiki_articles a\r\n\t\t\tLEFT JOIN " . PREFIX . "wiki_contents c ON c.id_contents = a.id_contents\r\n\t\t\tWHERE a.redirect = 0\r\n\t\t\tORDER BY c.timestamp DESC\r\n\t\t\tLIMIT :number_articles_on_index OFFSET 0", array('number_articles_on_index' => $config->get_number_articles_on_index()));
         $tpl->assign_block_vars('last_articles', array('C_ARTICLES' => $result->get_rows_count(), 'L_ARTICLES' => $LANG['wiki_last_articles_list']));
         $i = 0;
         while ($row = $result->fetch()) {
             $tpl->assign_block_vars('last_articles.list', array('ARTICLE' => $row['title'], 'TR' => $i > 0 && $i % 2 == 0 ? '</tr><tr>' : '', 'U_ARTICLE' => url('wiki.php?title=' . $row['encoded_title'], $row['encoded_title'])));
             $i++;
         }
         $result->dispose();
         if ($i == 0) {
             $tpl->put_all(array('L_NO_ARTICLE' => '<td class="center" colspan="2">' . $LANG['wiki_no_article'] . '</td>'));
         }
     }
     //Affichage de toutes les catégories si c'est activé
     if ($config->are_categories_displayed_on_index()) {
         $tpl->assign_block_vars('cat_list', array('L_CATS' => $LANG['wiki_cats_list']));
         $i = 0;
         foreach (WikiCategoriesCache::load()->get_categories() as $id => $cat) {
             //Si c'est une catégorie mère
             if ($cat['id_parent'] == 0) {
                 $tpl->assign_block_vars('cat_list.list', array('CAT' => stripslashes($cat['title']), 'U_CAT' => url('wiki.php?title=' . $cat['encoded_title'], $cat['encoded_title'])));
                 $i++;
             }
         }
         if ($i == 0) {
             $tpl->put_all(array('L_NO_CAT' => $LANG['wiki_no_cat']));
         }
     }
     $tpl->put_all(array('TITLE' => $config->get_wiki_name() ? $config->get_wiki_name() : $LANG['wiki'], 'INDEX_TEXT' => $config->get_index_text() ? FormatingHelper::second_parse(wiki_no_rewrite($config->get_index_text())) : $LANG['wiki_empty_index'], 'L_EXPLORER' => $LANG['wiki_explorer'], 'U_EXPLORER' => url('explorer.php')));
     $page_type = 'index';
     include PATH_TO_ROOT . '/wiki/wiki_tools.php';
     $tpl->put('wiki_tools', $tools_tpl);
     return new StringTemplate($tpl->render());
 }
コード例 #9
0
 public function get_content()
 {
     $user = AppContext::get_current_user();
     $theme_id = AppContext::get_request()->get_string('switchtheme', '');
     if (!empty($theme_id)) {
         $theme = ThemesManager::get_theme($theme_id);
         if ($theme !== null) {
             if ($theme->is_activated() && $theme->check_auth()) {
                 $user->update_theme($theme->get_id());
             }
         }
         $query_string = preg_replace('`switchtheme=[^&]+`', '', QUERY_STRING);
         AppContext::get_response()->redirect(trim(HOST . SCRIPT . (!empty($query_string) ? '?' . $query_string : '')));
     }
     $tpl = new FileTemplate('ThemesSwitcher/themeswitcher.tpl');
     $tpl->add_lang(LangLoader::get('themeswitcher_common', 'ThemesSwitcher'));
     foreach (ThemesManager::get_activated_and_authorized_themes_map() as $id => $theme) {
         $selected = $user->get_theme() == $id ? ' selected="selected"' : '';
         $tpl->assign_block_vars('themes', array('NAME' => $theme->get_configuration()->get_name(), 'IDNAME' => $id, 'SELECTED' => $selected));
     }
     $tpl->put('DEFAULT_THEME', UserAccountsConfig::load()->get_default_theme());
     return $tpl;
 }
コード例 #10
0
ファイル: wiki.php プロジェクト: AroundPBT/PHPBoost
            $tpl->assign_block_vars('cat.no_sub_article', array('NO_SUB_ARTICLE' => $LANG['wiki_no_sub_article']));
        }
        $i = 0;
        foreach (WikiCategoriesCache::load()->get_categories() as $key => $cat) {
            if ($cat['id_parent'] == $id_cat) {
                $tpl->assign_block_vars('cat.list_cats', array('NAME' => stripslashes($cat['title']), 'U_CAT' => url('wiki.php?title=' . $cat['encoded_title'], $cat['encoded_title'])));
                $i++;
            }
        }
        if ($i == 0) {
            $tpl->assign_block_vars('cat.no_sub_cat', array('NO_SUB_CAT' => $LANG['wiki_no_sub_cat']));
        }
    }
    $page_type = $article_infos['is_cat'] == 1 ? 'cat' : 'article';
    include '../wiki/wiki_tools.php';
    $tpl->put('wiki_tools', $tools_tpl);
    $tpl->display();
} elseif (!empty($encoded_title) && $num_rows == 0) {
    $error_controller = PHPBoostErrors::unexisting_page();
    DispatchManager::redirect($error_controller);
} else {
    $modulesLoader = AppContext::get_extension_provider_service();
    $module_name = 'wiki';
    $module = $modulesLoader->get_provider($module_name);
    if ($module->has_extension_point(HomePageExtensionPoint::EXTENSION_POINT)) {
        echo $module->get_extension_point(HomePageExtensionPoint::EXTENSION_POINT)->get_home_page()->get_view()->display();
    } elseif (!$no_alert_on_error) {
        $controller = new UserErrorController(LangLoader::get_message('error', 'status-messages-common'), 'Le module <strong>' . $module_name . '</strong> n\'a pas de fonction get_home_page!', UserErrorController::FATAL);
        DispatchManager::redirect($controller);
    }
}
コード例 #11
0
ファイル: post.php プロジェクト: AroundPBT/PHPBoost
    } else {
        AppContext::get_response()->redirect(HOST . DIR . url('/pages/pages.php?error=delete_failure', '', '&'));
    }
}
$tpl = new FileTemplate('pages/post.tpl');
if ($id_edit > 0) {
    //Autorisation particulière ?
    $special_auth = !empty($page_infos['auth']);
    $array_auth = unserialize($page_infos['auth']);
    //Vérification de l'autorisation d'éditer la page
    if ($special_auth && !AppContext::get_current_user()->check_auth($array_auth, EDIT_PAGE) || !$special_auth && !AppContext::get_current_user()->check_auth($config_authorizations, EDIT_PAGE)) {
        AppContext::get_response()->redirect(HOST . DIR . url('/pages/pages.php?error=e_auth', '', '&'));
    }
    //Erreur d'enregistrement ?
    if ($error == 'cat_contains_cat') {
        $tpl->put('message_helper', MessageHelper::display($LANG['pages_cat_contains_cat'], MessageHelper::WARNING));
    } elseif ($error == 'preview') {
        $tpl->put('message_helper', MessageHelper::display($LANG['pages_notice_previewing'], MessageHelper::NOTICE));
        $tpl->assign_block_vars('previewing', array('PREVIEWING' => pages_second_parse(stripslashes(pages_parse($contents))), 'TITLE' => stripslashes($title)));
    }
    //Génération de l'arborescence des catégories
    $cats = array();
    //numéro de la catégorie de la page ou de la catégorie
    $id_cat_display = $page_infos['is_cat'] == 1 ? $categories[$page_infos['id_cat']]['id_parent'] : $page_infos['id_cat'];
    $cat_list = display_pages_cat_explorer($id_cat_display, $cats, 1);
    $tpl->put_all(array('CONTENTS' => !empty($error) ? stripslashes($contents) : pages_unparse($page_infos['contents']), 'COUNT_HITS_CHECKED' => !empty($error) ? $count_hits == 1 ? 'checked="checked"' : '' : ($page_infos['count_hits'] == 1 ? 'checked="checked"' : ''), 'COMMENTS_ACTIVATED_CHECKED' => !empty($error) ? $enable_com == 1 ? 'checked="checked"' : '' : ($page_infos['activ_com'] == 1 ? 'checked="checked"' : ''), 'DISPLAY_PRINT_LINK_CHECKED' => !empty($error) ? $display_print_link == 1 ? 'checked="checked"' : '' : ($page_infos['display_print_link'] == 1 ? 'checked="checked"' : ''), 'OWN_AUTH_CHECKED' => !empty($page_infos['auth']) ? 'checked="checked"' : '', 'CAT_0' => $id_cat_display == 0 ? 'selected' : '', 'ID_CAT' => $id_cat_display, 'SELECTED_CAT' => $id_cat_display, 'CHECK_IS_CAT' => 'disabled="disabled"' . ($page_infos['is_cat'] == 1 ? ' checked="checked"' : '')));
} else {
    //Autorisations
    if (!AppContext::get_current_user()->check_auth($config_authorizations, EDIT_PAGE)) {
        AppContext::get_response()->redirect('/pages/pages.php?error=e_auth');
    }
コード例 #12
0
            }
        } else {
            $error = 'e_upload_invalid_format';
        }
    } else {
        $error = 'e_upload_failed_unwritable';
    }
    $error = !empty($error) ? '?error=' . $error : '';
    AppContext::get_response()->redirect(HOST . SCRIPT . $error);
} else {
    $template = new FileTemplate('forum/admin_ranks_add.tpl');
    //Gestion erreur.
    $get_error = retrieve(GET, 'error', '');
    $array_error = array('e_upload_invalid_format', 'e_upload_max_weight', 'e_upload_error', 'e_upload_php_code', 'e_upload_failed_unwritable');
    if (in_array($get_error, $array_error)) {
        $template->put('message_helper', MessageHelper::display($LANG[$get_error], MessageHelper::WARNING));
    }
    if ($get_error == 'incomplete') {
        $template->put('message_helper', MessageHelper::display($LANG['e_incomplete'], MessageHelper::NOTICE));
    }
    //On recupère les images des groupes
    $rank_options = '<option value="">--</option>';
    $image_folder_path = new Folder(PATH_TO_ROOT . '/forum/templates/images/ranks/');
    foreach ($image_folder_path->get_files('`\\.(png|jpg|bmp|gif)$`i') as $image) {
        $file = $image->get_name();
        $rank_options .= '<option value="' . $file . '">' . $file . '</option>';
    }
    $template->put_all(array('RANK_OPTIONS' => $rank_options, 'L_REQUIRE' => LangLoader::get_message('form.explain_required_fields', 'status-messages-common'), 'L_REQUIRE_RANK_NAME' => $LANG['require_rank_name'], 'L_REQUIRE_NBR_MSG_RANK' => $LANG['require_nbr_msg_rank'], 'L_FORUM_MANAGEMENT' => $LANG['forum_management'], 'L_CAT_MANAGEMENT' => $LANG['cat_management'], 'L_ADD_CAT' => $LANG['cat_add'], 'L_FORUM_RANKS_MANAGEMENT' => LangLoader::get_message('forum.ranks_management', 'common', 'forum'), 'L_FORUM_ADD_RANKS' => LangLoader::get_message('forum.actions.add_rank', 'common', 'forum'), 'L_UPLOAD_RANKS' => $LANG['upload_rank'], 'L_UPLOAD_FORMAT' => $LANG['explain_upload_img'], 'L_UPLOAD' => $LANG['upload'], 'L_RANK_NAME' => $LANG['rank_name'], 'L_NBR_MSG' => $LANG['nbr_msg'], 'L_IMG_ASSOC' => $LANG['img_assoc'], 'L_DELETE' => LangLoader::get_message('delete', 'common'), 'L_UPDATE' => $LANG['update'], 'L_RESET' => $LANG['reset'], 'L_ADD' => LangLoader::get_message('add', 'common')));
    $template->display();
}
require_once '../admin/admin_footer.php';
コード例 #13
0
ファイル: action.php プロジェクト: AroundPBT/PHPBoost
    } else {
        $current_cat = $LANG['pages_no_selected_cat'];
    }
    $tpl->put_all(array('L_TITLE' => sprintf($LANG['pages_remove_this_cat'], stripslashes($page_infos['title'])), 'L_REMOVE_ALL_CONTENTS' => $LANG['pages_remove_all_contents'], 'L_MOVE_ALL_CONTENTS' => $LANG['pages_move_all_contents'], 'L_FUTURE_CAT' => $LANG['pages_future_cat'], 'L_SELECT_CAT' => $LANG['pages_change_cat'], 'L_SUBMIT' => $LANG['submit'], 'L_ROOT' => $LANG['pages_root'], 'L_ALERT_REMOVING_CAT' => $LANG['pages_confirm_remove_cat']));
    $tpl->assign_block_vars('remove', array('ID_ARTICLE' => $del_cat, 'CATS' => $cat_list, 'CURRENT_CAT' => $current_cat, 'SELECTED_CAT' => $page_infos['id_cat'], 'CAT_0' => $page_infos['id_cat'] == 0 ? 'selected' : '', 'ID_CAT' => $page_infos['id_cat']));
    //Gestion des erreurs
    $error = retrieve(GET, 'error', '');
    if ($error == 'e_cat_contains_cat') {
        $errstr = $LANG['pages_cat_contains_cat'];
    } elseif ($error == 'e_not_a_cat') {
        $errstr = $LANG['pages_not_a_cat'];
    } else {
        $errstr = '';
    }
    if (!empty($errstr)) {
        $tpl->put('message_helper', MessageHelper::display($errstr, MessageHelper::WARNING));
    }
} elseif ($id_rename > 0) {
    $tpl->put_all(array('ID_RENAME' => $id_rename, 'L_SUBMIT' => $LANG['submit'], 'L_TITLE' => sprintf($LANG['pages_rename_page'], stripslashes($page_infos['title'])), 'L_NEW_TITLE' => $LANG['pages_new_title'], 'L_CREATE_REDIRECTION' => $LANG['pages_create_redirection'], 'L_EXPLAIN_RENAME' => $LANG['pages_explain_rename'], 'FORMER_TITLE' => stripslashes($page_infos['title'])));
    $tpl->assign_block_vars('rename', array());
    //Erreur : la page existe déjà
    if ($error == 'title_already_exists') {
        $tpl->put('message_helper', MessageHelper::display($LANG['pages_already_exists'], MessageHelper::WARNING));
    }
} elseif ($id_new > 0) {
    $tpl->put_all(array('ID_NEW' => $id_new, 'L_TITLE' => sprintf($LANG['pages_creation_redirection_title'], stripslashes($page_infos['title'])), 'L_REDIRECTION_NAME' => $LANG['pages_new_title'], 'L_CREATE_REDIRECTION' => $LANG['pages_create_redirection'], 'L_SUBMIT' => $LANG['submit']));
    $tpl->assign_block_vars('new', array());
    //Erreur : la page existe déjà
    if ($error == 'title_already_exists') {
        $tpl->put('message_helper', MessageHelper::display($LANG['pages_already_exists'], MessageHelper::WARNING));
    }
コード例 #14
0
 private function build_response(View $view)
 {
     $body_view = new FileTemplate('newsletter/NewsletterBody.tpl');
     $body_view->add_lang($this->lang);
     $body_view->put('TEMPLATE', $view);
     $response = new SiteDisplayResponse($body_view);
     $breadcrumb = $response->get_graphical_environment()->get_breadcrumb();
     $breadcrumb->add($this->lang['newsletter'], NewsletterUrlBuilder::home()->rel());
     $breadcrumb->add($this->lang['archives.list'], NewsletterUrlBuilder::archives()->rel());
     if ($this->stream->get_id() > 0) {
         $stream = NewsletterStreamsCache::load()->get_stream($this->stream->get_id());
         $breadcrumb->add($stream->get_name(), NewsletterUrlBuilder::archives($this->stream->get_id(), $this->stream->get_rewrited_name())->rel());
     }
     $graphical_environment = $response->get_graphical_environment();
     $graphical_environment->set_page_title($this->lang['archives.list'], $this->lang['newsletter']);
     $graphical_environment->get_seo_meta_data()->set_canonical_url(NewsletterUrlBuilder::archives($this->stream->get_id(), $this->stream->get_rewrited_name()));
     return $response;
 }
コード例 #15
0
ファイル: alert.php プロジェクト: AroundPBT/PHPBoost
    } else {
        $tpl->put_all(array('L_ALERT' => $LANG['alert_topic'], 'L_BACK_TOPIC' => $LANG['alert_back'], 'URL_TOPIC' => 'topic' . url('.php?id=' . $alert, '-' . $alert . '-' . Url::encode_rewrite($topic_name) . '.php')));
        $tpl->assign_block_vars('alert_confirm', array('MSG' => $LANG['alert_topic_already_done']));
    }
}
//Si on enregistre une alerte
if (!empty($alert_post)) {
    $tpl->put_all(array('L_ALERT' => $LANG['alert_topic'], 'L_BACK_TOPIC' => $LANG['alert_back'], 'URL_TOPIC' => 'topic' . url('.php?id=' . $alert_post, '-' . $alert_post . '-' . Url::encode_rewrite($topic_name) . '.php')));
    //On vérifie qu'une alerte sur le même sujet n'ait pas été postée
    $nbr_alert = PersistenceContext::get_querier()->count(PREFIX . 'forum_alerts', 'WHERE idtopic=:idtopic AND status = 0', array('idtopic' => $alert_post));
    if (empty($nbr_alert)) {
        $alert_title = retrieve(POST, 'title', '');
        $alert_contents = retrieve(POST, 'contents', '', TSTRING_PARSE);
        //Instanciation de la class du forum.
        $Forumfct = new Forum();
        $Forumfct->Alert_topic($alert_post, $alert_title, $alert_contents);
        $tpl->assign_block_vars('alert_confirm', array('MSG' => str_replace('%title', $topic_name, $LANG['alert_success'])));
    } else {
        $tpl->assign_block_vars('alert_confirm', array('MSG' => $LANG['alert_topic_already_done']));
    }
}
//Listes les utilisateurs en lignes.
list($users_list, $total_admin, $total_modo, $total_member, $total_visit, $total_online) = forum_list_user_online("AND s.location_script LIKE '/forum/%'");
$vars_tpl = array('FORUM_NAME' => $config->get_forum_name() . ' : ' . $LANG['alert_topic'], 'DESC' => $topic['subtitle'], 'C_USER_CONNECTED' => AppContext::get_current_user()->check_level(User::MEMBER_LEVEL), 'TOTAL_ONLINE' => $total_online, 'USERS_ONLINE' => $total_online - $total_visit == 0 ? '<em>' . $LANG['no_member_online'] . '</em>' : $users_list, 'ADMIN' => $total_admin, 'MODO' => $total_modo, 'MEMBER' => $total_member, 'GUEST' => $total_visit, 'U_FORUM_CAT' => '<a href="forum' . url('.php?id=' . $topic['idcat'], '-' . $topic['idcat'] . '.php') . '">' . $category->get_name() . '</a>', 'U_TITLE_T' => '<a href="topic' . url('.php?id=' . $topic_id, '-' . $topic_id . '.php') . '">' . stripslashes($topic['title']) . '</a>', 'L_FORUM_INDEX' => $LANG['forum_index'], 'L_SUBMIT' => $LANG['submit'], 'L_PREVIEW' => $LANG['preview'], 'L_RESET' => $LANG['reset'], 'L_USER' => $total_online > 1 ? $LANG['user_s'] : $LANG['user'], 'L_ADMIN' => $total_admin > 1 ? $LANG['admin_s'] : $LANG['admin'], 'L_MODO' => $total_modo > 1 ? $LANG['modo_s'] : $LANG['modo'], 'L_MEMBER' => $total_member > 1 ? $LANG['member_s'] : $LANG['member'], 'L_GUEST' => $total_visit > 1 ? $LANG['guest_s'] : $LANG['guest'], 'L_AND' => $LANG['and'], 'L_ONLINE' => strtolower($LANG['online']));
$tpl->put_all($vars_tpl);
$tpl_top->put_all($vars_tpl);
$tpl_bottom->put_all($vars_tpl);
$tpl->put('forum_top', $tpl_top);
$tpl->put('forum_bottom', $tpl_bottom);
$tpl->display();
include '../kernel/footer.php';
コード例 #16
0
 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;
 }
コード例 #17
0
ファイル: pm.php プロジェクト: AroundPBT/PHPBoost
 }
 $limit_group = $current_user->check_max_value(PM_GROUP_LIMIT, $user_accounts_config->get_max_private_messages_number());
 $unlimited_pm = $current_user->check_level(User::MODERATOR_LEVEL) || $limit_group === -1;
 $pm_max = $unlimited_pm ? $LANG['illimited'] : $limit_group;
 $tpl->assign_block_vars('convers', array('C_PAGINATION' => $pagination->has_several_pages(), 'PAGINATION' => $pagination->display(), 'NBR_PM' => $nbr_pm, 'PM_POURCENT' => '<strong>' . $nbr_pm . '</strong> / <strong>' . $pm_max . '</strong>', 'U_MARK_AS_READ' => 'pm.php?read=1', 'L_MARK_AS_READ' => $LANG['mark_pm_as_read'], 'U_USER_ACTION_PM' => url('.php?del_convers=1&amp;p=' . $page . '&amp;token=' . AppContext::get_session()->get_token()), 'U_PM_BOX' => '<a href="pm.php' . '">' . $LANG['pm_box'] . '</a>', 'U_POST_NEW_CONVERS' => 'pm' . url('.php?post=1', ''), 'L_POST_NEW_CONVERS' => $LANG['post_new_convers']));
 //Aucun message privé.
 if ($nbr_pm == 0) {
     $tpl->assign_block_vars('convers.no_pm', array('L_NO_PM' => LangLoader::get_message('no_item_now', 'common')));
 }
 $nbr_waiting_pm = 0;
 if (!$unlimited_pm && $nbr_pm > $limit_group) {
     $nbr_waiting_pm = $nbr_pm - $limit_group;
     //Nombre de messages privés non visibles.
     //Gestion erreur.
     if ($nbr_waiting_pm > 0) {
         $tpl->put('message_helper', MessageHelper::display(sprintf($LANG['e_pm_full'], $nbr_waiting_pm), MessageHelper::WARNING));
     }
 }
 $tpl->put_all(array('L_REQUIRE_MESSAGE' => $LANG['require_text'], 'L_REQUIRE_TITLE' => $LANG['require_title'], 'L_DELETE_MESSAGE' => $LANG['alert_delete_msg'], 'L_PRIVATE_MSG' => $LANG['private_message'], 'L_PM_BOX' => $LANG['pm_box'], 'L_TITLE' => $LANG['title'], 'L_PARTICIPANTS' => $LANG['participants'], 'L_MESSAGE' => $LANG['replies'], 'L_LAST_MESSAGE' => $LANG['last_message'], 'L_STATUS' => $LANG['status'], 'L_DELETE' => LangLoader::get_message('delete', 'common'), 'L_READ' => $LANG['read'], 'L_TRACK' => $LANG['pm_track'], 'L_NOT_READ' => $LANG['not_read']));
 //Conversation présente chez les deux membres: user_convers_status => 0.
 //Conversation supprimée chez l'expediteur: user_convers_status => 1.
 //Conversation supprimée chez le destinataire: user_convers_status => 2.
 $i = 0;
 $j = 0;
 $result = PersistenceContext::get_querier()->select("SELECT pm.id, pm.title, pm.user_id, pm.user_id_dest, pm.user_convers_status, pm.nbr_msg, pm.last_user_id, pm.last_msg_id, pm.last_timestamp, msg.view_status, m.display_name AS login, m1.display_name AS login_dest, m2.display_name AS last_login, m.level AS level, m1.level AS dest_level, m2.level AS last_level, m.groups AS user_groups, m1.groups AS dest_groups, m2.groups AS last_groups\n\tFROM " . DB_TABLE_PM_TOPIC . "  pm\n\tLEFT JOIN " . DB_TABLE_PM_MSG . " msg ON msg.id = pm.last_msg_id\n\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = pm.user_id\n\tLEFT JOIN " . DB_TABLE_MEMBER . " m1 ON m1.user_id = pm.user_id_dest\n\tLEFT JOIN " . DB_TABLE_MEMBER . " m2 ON m2.user_id = pm.last_user_id\n\tWHERE\n\t(\n\t\t:user_id IN (pm.user_id, pm.user_id_dest)\n\t)\n\tAND\n\t(\n\t\tpm.user_convers_status = 0\n\t\tOR\n\t\t(\n\t\t\t(pm.user_id_dest = :user_id AND pm.user_convers_status = 1)\n\t\t\tOR\n\t\t\t(pm.user_id = :user_id AND pm.user_convers_status = 2)\n\t\t)\n\t)\n\tORDER BY pm.last_timestamp DESC\n\tLIMIT :number_items_per_page OFFSET :display_from", array('user_id' => $current_user->get_id(), 'number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from()));
 while ($row = $result->fetch()) {
     //On saute l'itération si la limite est dépassé, si ce n'est pas un message privé du système.
     if ($row['user_id'] != -1) {
         $j++;
         if (!$unlimited_pm && $nbr_waiting_pm - $j >= 0) {
             continue;
コード例 #18
0
ファイル: admin_database.php プロジェクト: AroundPBT/PHPBoost
 $tpl->put_all(array('C_DATABASE_QUERY' => true));
 if (!empty($query)) {
     AppContext::get_session()->csrf_get_protect();
     //Protection csrf
     $tpl->put_all(array('C_QUERY_RESULT' => true));
     $lower_query = strtolower($query);
     if (strtolower(substr($query, 0, 6)) == 'select') {
         //On éxécute la requête
         try {
             $result = PersistenceContext::get_querier()->select(str_replace('phpboost_', PREFIX, $query));
             $i = 1;
             while ($row = $result->fetch()) {
                 $tpl->assign_block_vars('line', array());
                 //Premier passage: on liste le nom des champs sélectionnés
                 if ($i == 1) {
                     $tpl->put('C_HEAD', true);
                     foreach ($row as $field_name => $field_value) {
                         $tpl->assign_block_vars('head', array('FIELD_NAME' => $field_name));
                     }
                 }
                 //On parse les valeurs de sortie
                 foreach ($row as $field_name => $field_value) {
                     $tpl->assign_block_vars('line.field', array('FIELD_NAME' => TextHelper::strprotect($field_value), 'STYLE' => is_numeric($field_value) ? 'text-align:right;' : ''));
                 }
                 $i++;
             }
             $result->dispose();
         } catch (MySQLQuerierException $e) {
             $tpl->assign_block_vars('line', array());
             $tpl->assign_block_vars('line.field', array('FIELD_NAME' => $e->GetMessage(), 'STYLE' => ''));
         }
コード例 #19
0
ファイル: property.php プロジェクト: AroundPBT/PHPBoost
    }
    if ($article_infos['id_cat'] > 0) {
        $current_cat .= ($nbr_cats > 0 ? ' / ' : '') . stripslashes($categories[$article_infos['id_cat']]['title']);
    } else {
        $current_cat = $LANG['wiki_no_selected_cat'];
    }
    $tpl->assign_block_vars('move', array('L_TITLE' => sprintf($LANG['wiki_moving_this_article'], stripslashes($article_infos['title'])), 'ID_ARTICLE' => $move, 'CATS' => $cat_list, 'CURRENT_CAT' => $current_cat, 'SELECTED_CAT' => $article_infos['id_cat'], 'CAT_0' => $article_infos['id_cat'] == 0 ? 'wiki_selected_cat' : '', 'ID_CAT' => $article_infos['id_cat']));
    //Gestion des erreurs
    $error = retrieve(GET, 'error', '');
    if ($error == 'e_cat_contains_cat') {
        $errstr = $LANG['wiki_cat_contains_cat'];
    } else {
        $errstr = '';
    }
    if (!empty($errstr)) {
        $tpl->put('message_helper', MessageHelper::display($errstr, MessageHelper::WARNING));
    }
} elseif ($rename > 0) {
    $tpl->assign_block_vars('rename', array('L_TITLE' => sprintf($LANG['wiki_renaming_this_article'], stripslashes($article_infos['title'])), 'L_RENAMING_ARTICLE' => $LANG['wiki_explain_renaming'], 'L_CREATE_REDIRECTION' => $LANG['wiki_create_redirection_after_renaming'], 'ID_ARTICLE' => $rename, 'FORMER_NAME' => stripslashes($article_infos['title'])));
    //Gestion des erreurs
    $error = retrieve(GET, 'error', '');
    if ($error == 'title_already_exists') {
        $errstr = $LANG['wiki_title_already_exists'];
    } else {
        $errstr = '';
    }
    if (!empty($errstr)) {
        $tpl->put('message_helper', MessageHelper::display($errstr, MessageHelper::WARNING));
    }
} elseif ($redirect > 0) {
    $tpl->assign_block_vars('redirect', array('L_TITLE' => sprintf($LANG['wiki_redirections_to_this_article'], stripslashes($article_infos['title']))));
コード例 #20
0
ファイル: poll.php プロジェクト: AroundPBT/PHPBoost
 //Gestion des erreurs
 $get_error = retrieve(GET, 'error', '');
 switch ($get_error) {
     case 'e_already_vote':
         $errstr = $LANG['e_already_vote'];
         $type = MessageHelper::WARNING;
         break;
     case 'e_unauth_poll':
         $errstr = $LANG['e_unauth_poll'];
         $type = MessageHelper::WARNING;
         break;
     default:
         $errstr = '';
 }
 if (!empty($errstr)) {
     $tpl->put('message_helper', MessageHelper::display($errstr, $type));
 }
 //Si le cookie existe, ou l'ip est connue on redirige vers les resulats, sinon on prend en compte le vote.
 $array_cookie = array();
 if (AppContext::get_request()->has_cookieparameter($config_cookie_name)) {
     $array_cookie = explode('/', AppContext::get_request()->get_cookie($config_cookie_name));
 }
 if ($show_result || in_array($poll['id'], $array_cookie) === true || $check_bdd) {
     $array_answer = explode('|', $poll['answers']);
     $array_vote = explode('|', $poll['votes']);
     $poll_creation_date = new Date($poll['timestamp'], Timezone::SERVER_TIMEZONE);
     $poll_end_date = new Date($poll['end'], Timezone::SERVER_TIMEZONE);
     $is_admin = AppContext::get_current_user()->check_level(User::ADMIN_LEVEL);
     $results_displayed = $poll_config->are_results_displayed_before_polls_end() && !empty($poll['end']) ? $now->get_timestamp() > $poll_end_date->get_timestamp : true;
     $sum_vote = array_sum($array_vote);
     $tpl->put_all(array('C_POLL_VIEW' => true, 'C_POLL_RESULTS' => true, 'C_IS_ADMIN' => $is_admin, 'C_DISPLAY_RESULTS' => $is_admin || $results_displayed && (!empty($nbr_votes) || !empty($ip)), 'C_NO_VOTE' => !$is_admin && (empty($nbr_votes) && empty($ip)), 'IDPOLL' => $poll['id'], 'QUESTION' => stripslashes($poll['question']), 'DATE' => $poll_creation_date->format(Date::FORMAT_DAY_MONTH_YEAR), 'VOTES' => $sum_vote, 'L_POLL' => $LANG['poll'], 'L_BACK_POLL' => $LANG['poll_back'], 'L_VOTE' => $sum_vote > 1 ? $LANG['poll_vote_s'] : $LANG['poll_vote'], 'L_ON' => $LANG['on'], 'L_NO_VOTE' => $LANG['e_no_vote'], 'L_RESULTS_NOT_DISPLAYED_YET' => StringVars::replace_vars($LANG['e_results_not_displayed_yet'], array('end_date' => $poll_end_date->format(Date::FORMAT_DAY_MONTH_YEAR))), 'L_EDIT' => LangLoader::get_message('edit', 'common'), 'L_DELETE' => LangLoader::get_message('delete', 'common')));
コード例 #21
0
 private function build_response(View $view, $type)
 {
     $body_view = new FileTemplate('newsletter/NewsletterBody.tpl');
     $body_view->add_lang($this->lang);
     $body_view->put('TEMPLATE', $view);
     $response = new SiteDisplayResponse($body_view);
     $breadcrumb = $response->get_graphical_environment()->get_breadcrumb();
     $breadcrumb->add($this->lang['newsletter'], NewsletterUrlBuilder::home()->rel());
     $breadcrumb->add($this->lang['newsletter-add'], NewsletterUrlBuilder::add_newsletter()->rel());
     $breadcrumb->add($this->lang['newsletter.types.' . $type], NewsletterUrlBuilder::add_newsletter($type)->rel());
     $response->get_graphical_environment()->set_page_title($this->lang['newsletter-add'], $this->lang['newsletter']);
     return $response;
 }
コード例 #22
0
ファイル: admin_poll.php プロジェクト: AroundPBT/PHPBoost
} elseif (!empty($id)) {
    $tpl = new FileTemplate('poll/admin_poll_management2.tpl');
    try {
        $row = PersistenceContext::get_querier()->select_single_row(PREFIX . 'poll', array('*'), 'WHERE id=:id', array('id' => $id));
    } catch (RowNotFoundException $e) {
        $error_controller = PHPBoostErrors::unexisting_page();
        DispatchManager::redirect($error_controller);
    }
    $calendar_start = new MiniCalendar('start', !empty($row['start']) ? new Date($row['start'], Timezone::SERVER_TIMEZONE) : null);
    $calendar_end = new MiniCalendar('end', !empty($row['end']) ? new Date($row['end'], Timezone::SERVER_TIMEZONE) : null);
    $calendar_current_date = new MiniCalendar('current_date', !empty($row['timestamp']) ? new Date($row['timestamp'], Timezone::SERVER_TIMEZONE) : new Date());
    $tpl->put_all(array('IDPOLL' => $row['id'], 'QUESTIONS' => stripslashes($row['question']), 'TYPE_UNIQUE' => $row['type'] == '1' ? 'checked="checked"' : '', 'TYPE_MULTIPLE' => $row['type'] == '0' ? 'checked="checked"' : '', 'ARCHIVES_ENABLED' => $row['archive'] == '1' ? 'checked="checked"' : '', 'ARCHIVES_DISABLED' => $row['archive'] == '0' ? 'checked="checked"' : '', 'VISIBLE_WAITING' => $row['visible'] == 2 || !empty($row['end']) ? 'checked="checked"' : '', 'VISIBLE_ENABLED' => $row['visible'] == 1 && empty($row['end']) ? 'checked="checked"' : '', 'VISIBLE_UNAPROB' => $row['visible'] == 0 ? 'checked="checked"' : '', 'CALENDAR_START' => $calendar_start->display(), 'CALENDAR_END' => $calendar_end->display(), 'CALENDAR_CURRENT_DATE' => $calendar_current_date->display(), 'HOUR' => Date::to_format($row['timestamp'], 'H'), 'MIN' => Date::to_format($row['timestamp'], 'i'), 'DATE' => Date::to_format($row['timestamp'], Date::FORMAT_DAY_MONTH_YEAR), 'L_REQUIRE_QUESTION' => $LANG['require_question'], 'L_REQUIRE_ANSWER' => $LANG['require_answer'], 'L_REQUIRE_ANSWER_TYPE' => $LANG['require_answer_type'], 'L_POLL_MANAGEMENT' => $LANG['poll_management'], 'L_POLL_ADD' => $LANG['poll_add'], 'L_POLL_CONFIG' => $LANG['poll_config'], 'L_REQUIRE' => LangLoader::get_message('form.explain_required_fields', 'status-messages-common'), 'L_QUESTION' => $LANG['question'], 'L_ANSWER_TYPE' => $LANG['answer_type'], 'L_ANSWERS' => $LANG['answers'], 'L_SINGLE' => $LANG['single'], 'L_MULTIPLE' => $LANG['multiple'], 'L_YES' => LangLoader::get_message('yes', 'common'), 'L_NO' => LangLoader::get_message('no', 'common'), 'L_NUMBER_VOTE' => $LANG['number_vote'], 'L_DATE' => LangLoader::get_message('date', 'date-common'), 'L_POLL_DATE' => $LANG['poll_date'], 'L_RELEASE_DATE' => $LANG['release_date'], 'L_IMMEDIATE' => $LANG['immediate'], 'L_UNAPROB' => $LANG['unaprob'], 'L_UNTIL' => $LANG['until'], 'L_UPDATE' => $LANG['update'], 'L_RESET' => $LANG['reset'], 'L_DELETE' => LangLoader::get_message('delete', 'common')));
    //Gestion erreur.
    $get_error = retrieve(GET, 'error', '');
    if ($get_error == 'incomplete') {
        $tpl->put('message_helper', MessageHelper::display($LANG['incomplete'], MessageHelper::NOTICE));
    }
    $array_answer = explode('|', $row['answers']);
    $array_vote = explode('|', $row['votes']);
    $sum_vote = array_sum($array_vote);
    $sum_vote = $sum_vote == 0 ? 1 : $sum_vote;
    //Empêche la division par 0.
    //Liste des choix des sondages => 20 maxi
    $i = 0;
    $array_poll = array_combine($array_answer, $array_vote);
    foreach ($array_poll as $answer => $nbrvote) {
        $percent = NumberHelper::round($nbrvote * 100 / $sum_vote, 1);
        $tpl->assign_block_vars('answers', array('ID' => $i, 'ANSWER' => !empty($answer) ? $answer : ''));
        $tpl->assign_block_vars('votes', array('ID' => $i, 'VOTES' => isset($nbrvote) ? $nbrvote : '', 'PERCENT' => isset($percent) ? $percent . '%' : ''));
        $i++;
    }
コード例 #23
0
ファイル: post.php プロジェクト: AroundPBT/PHPBoost
        }
        $contents = trim($contents);
    }
    $l_action_submit = $LANG['update'];
    $tpl->put_all(array('SELECTED_CAT' => $id_edit));
} else {
    //autorisations
    if ($is_cat && !AppContext::get_current_user()->check_auth($config->get_authorizations(), WIKI_CREATE_CAT)) {
        $error_controller = PHPBoostErrors::user_not_authorized();
        DispatchManager::redirect($error_controller);
    } elseif (!$is_cat && !AppContext::get_current_user()->check_auth($config->get_authorizations(), WIKI_CREATE_ARTICLE)) {
        $error_controller = PHPBoostErrors::user_not_authorized();
        DispatchManager::redirect($error_controller);
    }
    if (!empty($encoded_title)) {
        $tpl->put('message_helper', MessageHelper::display($LANG['wiki_article_does_not_exist'], MessageHelper::WARNING));
    }
    if ($id_cat > 0 && array_key_exists($id_cat, $categories)) {
        $tpl->assign_block_vars('create', array());
        $cats = array();
        $cat_list = display_wiki_cat_explorer($id_cat, $cats, 1);
        $cats = array_reverse($cats);
        if (array_key_exists(0, $cats)) {
            unset($cats[0]);
        }
        $nbr_cats = count($cats);
        $current_cat = '';
        $i = 1;
        foreach ($cats as $key => $value) {
            $current_cat .= stripslashes($categories[$value]['title']) . ($i < $nbr_cats ? ' / ' : '');
            $i++;
コード例 #24
0
ファイル: admin_groups.php プロジェクト: AroundPBT/PHPBoost
                $template->assign_block_vars('member', array('C_GROUP_COLOR' => !empty($group_color), 'USER_ID' => $row['user_id'], 'LOGIN' => $row['display_name'], 'LEVEL_CLASS' => UserService::get_level_class($row['level']), 'GROUP_COLOR' => $group_color, 'U_PROFILE' => UserUrlBuilder::profile($row['user_id'])->rel()));
                $number_member++;
            }
            $result->dispose();
        }
        $template->put_all(array('C_NO_MEMBERS' => $number_member == 0, 'NO_MEMBERS' => LangLoader::get_message('no_member', 'user-common')));
    } else {
        AppContext::get_response()->redirect(HOST . REWRITED_SCRIPT);
    }
    $template->display();
} elseif ($add) {
    $template = new FileTemplate('admin/admin_groups_management2.tpl');
    //Gestion erreur.
    $get_error = retrieve(GET, 'error', '');
    if ($get_error == 'incomplete') {
        $template->put('message_helper', MessageHelper::display($LANG['e_incomplete'], MessageHelper::NOTICE));
    } elseif ($get_error == 'group_already_exists') {
        $template->put('message_helper', MessageHelper::display(LangLoader::get_message('element.already_exists', 'status-messages-common'), MessageHelper::NOTICE));
    }
    //On recupère les dossier des images des groupes contenu dans le dossier /images/group.
    $img_groups = '<option value="" selected="selected">--</option>';
    $img_groups = '<option value="">--</option>';
    $image_folder_path = new Folder(PATH_TO_ROOT . '/images/group');
    foreach ($image_folder_path->get_files('`\\.(png|jpg|bmp|gif)$`i') as $image) {
        $file = $image->get_name();
        $img_groups .= '<option value="' . $file . '">' . $file . '</option>';
    }
    $template->put_all(array('IMG_GROUPS' => $img_groups, 'C_ADD_GROUP' => true, 'L_REQUIRE_PSEUDO' => $LANG['require_pseudo'], 'L_REQUIRE_NAME' => $LANG['require_name'], 'L_CONFIRM_DEL_USER_GROUP' => LangLoader::get_message('confirm.delete', 'status-messages-common'), 'L_GROUPS_MANAGEMENT' => $LANG['groups_management'], 'L_ADD_GROUPS' => $LANG['groups_add'], 'L_REQUIRE' => LangLoader::get_message('form.explain_required_fields', 'status-messages-common'), 'L_UPLOAD_GROUPS' => $LANG['upload_group'], 'L_UPLOAD_FORMAT' => $LANG['explain_upload_img'], 'L_UPLOAD' => $LANG['upload'], 'L_NAME' => $LANG['name'], 'L_IMG_ASSOC_GROUP' => $LANG['img_assoc_group'], 'L_IMG_ASSOC_GROUP_EXPLAIN' => $LANG['img_assoc_group_explain'], 'L_AUTH_FLOOD' => $LANG['auth_flood'], 'L_PM_GROUP_LIMIT' => $LANG['pm_group_limit'], 'L_PM_GROUP_LIMIT_EXPLAIN' => $LANG['pm_group_limit_explain'], 'L_DATA_GROUP_LIMIT' => $LANG['data_group_limit'], 'L_DATA_GROUP_LIMIT_EXPLAIN' => $LANG['data_group_limit_explain'], 'L_COLOR_GROUP' => $LANG['color_group'], 'L_MB' => LangLoader::get_message('unit.megabytes', 'common'), 'L_YES' => LangLoader::get_message('yes', 'common'), 'L_NO' => LangLoader::get_message('no', 'common'), 'L_ADD' => LangLoader::get_message('add', 'common')));
    $template->display();
} else {
    $template = new FileTemplate('admin/admin_groups_management.tpl');
コード例 #25
0
 public function get_menu_content()
 {
     global $LANG;
     $tpl = new FileTemplate('gallery/gallery_mini.tpl');
     //Chargement de la langue du module.
     load_module_lang('gallery');
     $config = GalleryConfig::load();
     $array_random_pics = GalleryMiniMenuCache::load()->get_pictures();
     $i = 0;
     //Affichage des miniatures disponibles
     $array_pics_mini = 'var array_pics_mini = new Array();' . "\n";
     list($nbr_pics, $sum_height, $sum_width, $scoll_mode, $height_max, $width_max) = array(0, 0, 0, 0, 142, 142);
     if (isset($array_random_pics) && $array_random_pics !== array()) {
         $gallery_mini = array();
         shuffle($array_random_pics);
         //On mélange les éléments du tableau.
         //Vérification des autorisations.
         $break = 0;
         foreach ($array_random_pics as $array_pics_info) {
             if (GalleryAuthorizationsService::check_authorizations($array_pics_info['idcat'])->read()) {
                 $gallery_mini[] = $array_pics_info;
                 $break++;
             }
             if ($break == $config->get_pics_number_in_mini()) {
                 break;
             }
         }
         //Aucune photo ne correspond, on fait une requête pour vérifier.
         if (count($gallery_mini) == 0) {
             $array_random_pics = array();
             $result = PersistenceContext::get_querier()->select("SELECT g.id, g.name, g.path, g.width, g.height, g.idcat, gc.auth\n\t\t\t\tFROM " . GallerySetup::$gallery_table . " g\n\t\t\t\tLEFT JOIN " . GallerySetup::$gallery_cats_table . " gc on gc.id = g.idcat\n\t\t\t\tWHERE g.aprob = 1 AND gc.aprob = 1\n\t\t\t\tORDER BY RAND()\n\t\t\t\tLIMIT " . $config->get_pics_number_in_mini());
             while ($row = $result->fetch()) {
                 $array_random_pics[] = $row;
             }
             //Vérification des autorisations.
             $break = 0;
             foreach ($array_random_pics as $key => $array_pics_info) {
                 if (GalleryAuthorizationsService::check_authorizations($array_pics_info['idcat'])->read()) {
                     $gallery_mini[] = $array_pics_info;
                     $break++;
                 }
                 if ($break == $config->get_pics_number_in_mini()) {
                     break;
                 }
             }
         }
         $tpl->put_all(array('C_FADE' => false, 'C_VERTICAL_SCROLL' => false, 'C_HORIZONTAL_SCROLL' => false, 'C_STATIC' => false));
         switch ($config->get_scroll_type()) {
             case GalleryConfig::STATIC_SCROLL:
                 $tpl->put('C_FADE', true);
                 break;
             case GalleryConfig::VERTICAL_DYNAMIC_SCROLL:
                 $tpl->put('C_VERTICAL_SCROLL', true);
                 break;
             case GalleryConfig::HORIZONTAL_DYNAMIC_SCROLL:
                 $tpl->put('C_HORIZONTAL_SCROLL', true);
                 break;
             case GalleryConfig::NO_SCROLL:
                 $tpl->put('C_STATIC', true);
                 break;
         }
         $Gallery = new Gallery();
         foreach ($gallery_mini as $key => $row) {
             //Si la miniature n'existe pas (cache vidé) on regénère la miniature à partir de l'image en taille réelle.
             if (!is_file(PATH_TO_ROOT . '/gallery/pics/thumbnails/' . $row['path'])) {
                 $Gallery->Resize_pics(PATH_TO_ROOT . '/gallery/pics/' . $row['path']);
             }
             //Redimensionnement + création miniature
             // On recupère la hauteur et la largeur de l'image.
             if ($row['width'] == 0 || $row['height'] == 0) {
                 list($row['width'], $row['height']) = @getimagesize(PATH_TO_ROOT . '/gallery/pics/thumbnails/' . $row['path']);
             }
             if ($row['width'] == 0 || $row['height'] == 0) {
                 list($row['width'], $row['height']) = array(142, 142);
             }
             $tpl->assign_block_vars('pics_mini', array('ID' => $row['id'], 'PICS' => TPL_PATH_TO_ROOT . '/gallery/pics/thumbnails/' . $row['path'], 'NAME' => TextHelper::strprotect($row['name'], TextHelper::HTML_PROTECT, TextHelper::ADDSLASHES_FORCE), 'HEIGHT' => $row['height'], 'WIDTH' => $row['width'], 'U_PICS' => TPL_PATH_TO_ROOT . '/gallery/gallery' . url('.php?cat=' . $row['idcat'] . '&amp;id=' . $row['id'], '-' . $row['idcat'] . '-' . $row['id'] . '.php')));
             $sum_height += $row['height'] + 5;
             $sum_width += $row['width'] + 5;
             if ($config->get_scroll_type() == GalleryConfig::NO_SCROLL) {
                 break;
             }
             $i++;
         }
     }
     $tpl->put_all(array('ARRAY_PICS' => $array_pics_mini, 'HEIGHT_DIV' => $config->get_mini_max_height(), 'SUM_HEIGHT' => $sum_height + 10, 'HIDDEN_HEIGHT' => $config->get_mini_max_height() + 10, 'WIDTH_DIV' => $config->get_mini_max_width(), 'SUM_WIDTH' => $sum_width + 30, 'HIDDEN_WIDTH' => $config->get_mini_max_width() * 3 + 30, 'SCROLL_DELAY' => $config->get_mini_pics_speed() * 1000, 'L_NO_RANDOM_PICS' => $i == 0 ? '<br /><span class="smaller"><em>' . $LANG['no_random_img'] . '</em></span><br />' : '', 'L_GALLERY' => $LANG['gallery']));
     return $tpl->render();
 }
コード例 #26
0
                $file->delete();
            } else {
                $Gallery->Add_pics($cat, $name, $uniq, AppContext::get_current_user()->get_id());
            }
        }
    }
    //Régénération du cache des photos aléatoires.
    GalleryMiniMenuCache::invalidate();
    AppContext::get_response()->redirect('/gallery/admin_gallery_add.php');
} else {
    $tpl = new FileTemplate('gallery/admin_gallery_add.tpl');
    //Gestion erreur.
    $get_error = $request->get_getvalue('error', '');
    $array_error = array('e_upload_invalid_format', 'e_upload_max_weight', 'e_upload_max_dimension', 'e_upload_error', 'e_upload_php_code', 'e_upload_failed_unwritable', 'e_upload_already_exist', 'e_unlink_disabled', 'e_unsupported_format', 'e_unabled_create_pics', 'e_error_resize', 'e_no_graphic_support', 'e_unabled_incrust_logo', 'delete_thumbnails');
    if (in_array($get_error, $array_error)) {
        $tpl->put('message_helper', MessageHelper::display($LANG[$get_error], MessageHelper::WARNING));
    }
    //Affichage de la photo uploadée.
    if (!empty($add_pic)) {
        $categories = GalleryService::get_categories_manager()->get_categories_cache()->get_categories();
        try {
            $imageup = PersistenceContext::get_querier()->select_single_row(GallerySetup::$gallery_table, array('idcat', 'name', 'path'), 'WHERE id = :id', array('id' => $add_pic));
        } catch (RowNotFoundException $e) {
            $error_controller = PHPBoostErrors::unexisting_element();
            DispatchManager::redirect($error_controller);
        }
        $tpl->assign_block_vars('image_up', array('NAME' => stripslashes($imageup['name']), 'IMG' => '<a href="admin_gallery.php?cat=' . $imageup['idcat'] . '&amp;id=' . $add_pic . '#pics_max"><img src="pics/' . $imageup['path'] . '" alt="' . $imageup['name'] . '" /></a>', 'L_SUCCESS_UPLOAD' => $LANG['success_upload_img'], 'U_CAT' => '<a href="admin_gallery.php?cat=' . $imageup['idcat'] . '">' . $categories[$imageup['idcat']]->get_name() . '</a>'));
    }
    $tpl->put_all(array('WIDTH_MAX' => $config->get_max_width(), 'HEIGHT_MAX' => $config->get_max_height(), 'WEIGHT_MAX' => $config->get_max_weight(), 'AUTH_EXTENSION' => 'JPEG, GIF, PNG', 'IMG_HEIGHT_MAX' => $config->get_mini_max_height() + 10, '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_ADD_IMG' => $LANG['add_pic'], 'L_WEIGHT_MAX' => $LANG['weight_max'], 'L_HEIGHT_MAX' => $LANG['height_max'], 'L_WIDTH_MAX' => $LANG['width_max'], 'L_UPLOAD_IMG' => $LANG['upload_pics'], 'L_AUTH_EXTENSION' => $LANG['auth_extension'], 'L_IMG_DISPO_GALLERY' => $LANG['img_dispo'], 'L_NAME' => $LANG['name'], 'L_UNIT_PX' => LangLoader::get_message('unit.pixels', 'common'), 'L_UNIT_KO' => LangLoader::get_message('unit.kilobytes', 'common'), 'L_SELECT' => $LANG['select'], 'L_SELECT_ALL_PICTURES' => $LANG['select_all_pictures'], 'L_UNSELECT_ALL_PICTURES' => $LANG['unselect_all_pictures'], 'L_GLOBAL_CAT_SELECTION' => $LANG['global_cat_selection'], 'L_GLOBAL_CAT_SELECTION_EXPLAIN' => $LANG['global_cat_selection_explain'], 'L_DELETE' => LangLoader::get_message('delete', 'common'), 'L_SUBMIT' => $LANG['submit'], 'L_NO_IMG' => $LANG['no_pics']));
    //Affichage photos
    $dir = 'pics/';
コード例 #27
0
ファイル: media.php プロジェクト: AroundPBT/PHPBoost
    define('TITLE', $media['name']);
    require_once '../kernel/header.php';
    //MAJ du compteur.
    PersistenceContext::get_querier()->inject("UPDATE " . PREFIX . "media SET counter = counter + 1 WHERE id = :id", array('id' => $id_media));
    $notation = new Notation();
    $notation->set_module_name('media');
    $notation->set_notation_scale($config->get_notation_scale());
    $notation->set_id_in_module($id_media);
    $notation->set_number_notes($media['number_notes']);
    $notation->set_average_notes($media['average_notes']);
    $notation->set_user_already_noted(!empty($media['note']));
    $nbr_notes = $media['number_notes'];
    $group_color = User::get_group_color($media['groups'], $media['level']);
    $tpl->put_all(array('ID' => $id_media, 'C_DISPLAY_MEDIA' => true, 'C_ROOT_CATEGORY' => $media['idcat'] == Category::ROOT_CATEGORY, 'C_MODO' => MediaAuthorizationsService::check_authorizations($media['idcat'])->moderation(), 'C_DISPLAY_NOTATION' => $config->is_notation_enabled(), 'C_DISPLAY_COMMENTS' => $config->are_comments_enabled(), 'ID_MEDIA' => $id_media, 'NAME' => $media['name'], 'CONTENTS' => stripslashes(FormatingHelper::second_parse($media['contents'])), 'COUNT' => $media['counter'], 'KERNEL_NOTATION' => NotationService::display_active_image($notation), 'HITS' => (int) $media['counter'] + 1 > 1 ? sprintf($MEDIA_LANG['n_times'], (int) $media['counter'] + 1) : sprintf($MEDIA_LANG['n_time'], (int) $media['counter'] + 1), 'U_COM' => PATH_TO_ROOT . '/media/media' . url('.php?id=' . $id_media . '&amp;com=0', '-' . $id_media . '-' . $media['idcat'] . '+' . Url::encode_rewrite($media['name']) . '.php?com=0') . '#comments-list', 'L_COM' => CommentsService::get_number_and_lang_comments('media', $id_media), 'L_DATE' => LangLoader::get_message('date', 'date-common'), 'L_SIZE' => $LANG['size'], 'L_MEDIA_INFOS' => $MEDIA_LANG['media_infos'], 'DATE' => Date::to_format($media['timestamp'], Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE), 'L_MODO_PANEL' => $LANG['modo_panel'], 'L_UNAPROBED' => $MEDIA_LANG['unaprobed_media_short'], 'HEIGHT_P' => $media['height'] + 50, 'L_VIEWED' => $LANG['view'], 'L_BY' => $LANG['by'], 'BY' => !empty($media['display_name']) ? '<a href="' . UserUrlBuilder::profile($media['iduser'])->rel() . '" class="' . UserService::get_level_class($media['level']) . '"' . (!empty($group_color) ? ' style="color:' . $group_color . '"' : '') . '>' . $media['display_name'] . '</a>' : $LANG['guest'], 'U_UNVISIBLE_MEDIA' => url('media_action.php?unvisible=' . $id_media . '&amp;token=' . AppContext::get_session()->get_token()), 'U_EDIT_MEDIA' => url('media_action.php?edit=' . $id_media), 'U_DELETE_MEDIA' => url('media_action.php?del=' . $id_media . '&amp;token=' . AppContext::get_session()->get_token()), 'U_POPUP_MEDIA' => url('media_popup.php?id=' . $id_media), 'CATEGORY_NAME' => $media['idcat'] == Category::ROOT_CATEGORY ? LangLoader::get_message('module_title', 'common', 'media') : MediaService::get_categories_manager()->get_categories_cache()->get_category($media['idcat'])->get_name(), 'U_EDIT_CATEGORY' => $media['idcat'] == Category::ROOT_CATEGORY ? MediaUrlBuilder::configuration()->rel() : MediaUrlBuilder::edit_category($media['idcat'])->rel()));
    if (empty($mime_type_tpl[$media['mime_type']])) {
        $media_tpl = new FileTemplate('media/format/media_other.tpl');
    } else {
        $media_tpl = new FileTemplate('media/' . $mime_type_tpl[$media['mime_type']]);
    }
    $media_tpl->put_all(array('URL' => $media['url'], 'MIME' => $media['mime_type'], 'WIDTH' => $media['width'], 'HEIGHT' => $media['height']));
    $tpl->put('media_format', $media_tpl);
    //Affichage commentaires.
    if (AppContext::get_request()->get_getint('com', 0) == 0) {
        $comments_topic = new MediaCommentsTopic();
        $comments_topic->set_id_in_module($id_media);
        $comments_topic->set_url(new Url('/media/media.php?id=' . $id_media . '&com=0'));
        $tpl->put_all(array('COMMENTS' => CommentsService::display($comments_topic)->render()));
    }
    $tpl->display();
}
require_once '../kernel/footer.php';
コード例 #28
0
ファイル: gallery.php プロジェクト: AroundPBT/PHPBoost
 //Niveau d'autorisation de la catégorie, accès en écriture.
 if (!GalleryAuthorizationsService::check_authorizations($id_category)->write()) {
     $error_controller = PHPBoostErrors::user_not_authorized();
     DispatchManager::redirect($error_controller);
 }
 $cat_links = '';
 foreach ($categories as $category) {
     if ($category->get_id() != Category::ROOT_CATEGORY && $category->get_id_parent() == $categories[$id_category]->get_id_parent()) {
         $cat_links .= ' <a href="' . GalleryUrlBuilder::get_link_cat($category->get_id()) . '">' . $category->get_name() . '</a> &raquo;';
     }
 }
 //Gestion erreur.
 $get_error = retrieve(GET, 'error', '');
 $array_error = array('e_upload_invalid_format', 'e_upload_max_weight', 'e_upload_max_dimension', 'e_upload_error', 'e_upload_php_code', 'e_upload_failed_unwritable', 'e_upload_already_exist', 'e_unlink_disabled', 'e_unsupported_format', 'e_unabled_create_pics', 'e_error_resize', 'e_no_graphic_support', 'e_unabled_incrust_logo', 'delete_thumbnails', 'upload_limit');
 if (in_array($get_error, $array_error)) {
     $tpl->put('message_helper', MessageHelper::display(LangLoader::get_message($get_error, 'errors'), MessageHelper::WARNING));
 }
 $module_data_path = $tpl->get_pictures_data_path();
 //Aficchage de la photo uploadée.
 if (!empty($g_idpics)) {
     try {
         $imageup = PersistenceContext::get_querier()->select_single_row(GallerySetup::$gallery_table, array('idcat', 'name', 'path'), 'WHERE id = :id', array('id' => $g_idpics));
     } catch (RowNotFoundException $e) {
         $error_controller = PHPBoostErrors::unexisting_element();
         DispatchManager::redirect($error_controller);
     }
     $tpl->assign_block_vars('image_up', array('NAME' => stripslashes($imageup['name']), 'IMG' => '<a href="gallery.php?cat=' . $imageup['idcat'] . '&amp;id=' . $g_idpics . '#pics_max"><img src="pics/' . $imageup['path'] . '" alt="' . $imageup['name'] . '" /></a>', 'L_SUCCESS_UPLOAD' => $LANG['success_upload_img'], 'U_CAT' => '<a href="gallery.php?cat=' . $imageup['idcat'] . '">' . $categories[$imageup['idcat']]->get_name() . '</a>'));
 }
 //Affichage du quota d'image uploadée.
 $category_authorizations = GalleryService::get_categories_manager()->get_heritated_authorizations($id_category, Category::WRITE_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY);
 $quota = isset($category_authorizations['r-1']) ? $category_authorizations['r-1'] != '3' : true;