public function display_field_profile(MemberExtendedField $member_extended_field) { $fieldset = $member_extended_field->get_fieldset(); $value = FormatingHelper::second_parse($member_extended_field->get_value()); if ($value !== null) { $fieldset->add_field(new FormFieldFree($member_extended_field->get_field_name(), $member_extended_field->get_name(), $value)); } }
public function get_feed_data_struct($idcat = 0, $name = '') { $querier = PersistenceContext::get_querier(); $lang = LangLoader::get('common', 'bugtracker'); //Configuration load $config = BugtrackerConfig::load(); $types = $config->get_types(); $categories = $config->get_categories(); $severities = $config->get_severities(); $priorities = $config->get_priorities(); $versions = $config->get_versions_detected(); $site_name = GeneralConfig::load()->get_site_name(); $feed_module_name = $idcat == 1 ? $lang['titles.solved'] : $lang['titles.unsolved']; $data = new FeedData(); $data->set_title($feed_module_name . ' - ' . $site_name); $data->set_date(new Date()); $data->set_link(SyndicationUrlBuilder::rss('bugtracker', $idcat)); $data->set_host(HOST); $data->set_desc($feed_module_name . ' - ' . $site_name); $data->set_lang(LangLoader::get_message('xml_lang', 'main')); $data->set_auth_bit(BugtrackerAuthorizationsService::READ_AUTHORIZATIONS); $results = $querier->select("SELECT bugtracker.*, author.*\r\n\t\tFROM " . BugtrackerSetup::$bugtracker_table . " bugtracker\r\n\t\tLEFT JOIN " . DB_TABLE_MEMBER . " author ON author.user_id = bugtracker.author_id\r\n\t\tWHERE " . ($idcat == 1 ? "(status = '" . Bug::FIXED . "' OR status = '" . Bug::REJECTED . "')" : "status <> '" . Bug::FIXED . "' AND status <> '" . Bug::REJECTED . "'") . "\r\n\t\tORDER BY " . ($idcat == 1 ? "fix_date" : "submit_date") . " DESC"); foreach ($results as $row) { $bug = new Bug(); $bug->set_properties($row); $link = BugtrackerUrlBuilder::detail($bug->get_id() . '-' . $bug->get_rewrited_title()); $description = FormatingHelper::second_parse($bug->get_contents()); $description .= '<br /><br />' . $lang['labels.fields.reproductible'] . ' : ' . ($bug->is_reproductible() ? LangLoader::get_message('yes', 'common') : LangLoader::get_message('no', 'common')); if ($bug->is_reproductible()) { $description .= '<br />' . FormatingHelper::second_parse($bug->get_reproduction_method()) . '<br />'; } if ($types) { $description .= '<br />' . $lang['labels.fields.type'] . ' : ' . (isset($types[$bug->get_type()]) ? stripslashes($types[$bug->get_type()]) : $lang['notice.none']); } if ($categories) { $description .= '<br />' . $lang['labels.fields.category'] . ' : ' . (isset($categories[$bug->get_category()]) ? stripslashes($categories[$bug->get_category()]) : $lang['notice.none_e']); } if ($severities) { $description .= '<br />' . $lang['labels.fields.severity'] . ' : ' . (isset($severities[$bug->get_severity()]) ? stripslashes($severities[$bug->get_severity()]['name']) : $lang['notice.none']); } if ($priorities) { $description .= '<br />' . $lang['labels.fields.priority'] . ' : ' . (isset($priorities[$bug->get_priority()]) ? stripslashes($priorities[$bug->get_priority()]) : $lang['notice.none_e']); } if ($versions) { $description .= '<br />' . $lang['labels.fields.version'] . ' : ' . (isset($versions[$bug->get_detected_in()]) ? stripslashes($versions[$bug->get_detected_in()]['name']) : $lang['notice.not_defined']); } $item = new FeedItem(); $item->set_title($bug->get_title()); $item->set_link($link); $item->set_guid($link); $item->set_desc($description); $item->set_date($bug->get_submit_date()); $item->set_auth(BugtrackerAuthorizationsService::READ_AUTHORIZATIONS); $data->add_item($item); } $results->dispose(); return $data; }
public function build_view() { $this->build_form(); if ($this->submit_button->has_been_submited() && $this->form->validate()) { if ($this->send_mail()) { $this->view->put('MSG', MessageHelper::display($this->lang['message.success_mail'] . ($this->config->is_sender_acknowledgment_enabled() ? ' ' . $this->lang['message.acknowledgment'] : ''), MessageHelper::SUCCESS)); $this->view->put('C_MAIL_SENT', true); } else { $this->view->put('MSG', MessageHelper::display($this->lang['message.error_mail'], MessageHelper::ERROR, 5)); } } $this->view->put('FORM', $this->form->display()); $this->view->put_all(array('C_INFORMATIONS_LEFT' => $this->config->are_informations_enabled() && $this->config->are_informations_left(), 'C_INFORMATIONS_TOP' => $this->config->are_informations_enabled() && $this->config->are_informations_top(), 'C_INFORMATIONS_RIGHT' => $this->config->are_informations_enabled() && $this->config->are_informations_right(), 'C_INFORMATIONS_BOTTOM' => $this->config->are_informations_enabled() && $this->config->are_informations_bottom(), 'C_INFORMATIONS_SIDE' => $this->config->are_informations_enabled() && ($this->config->are_informations_left() || $this->config->are_informations_right()), 'INFORMATIONS' => FormatingHelper::second_parse($this->config->get_informations()))); }
public function synchronize() { $this->messages = array(); $items_number_per_page = GuestbookConfig::load()->get_items_per_page(); $result = PersistenceContext::get_querier()->select("SELECT g.id, g.login, g.contents, g.timestamp, m.user_id, m.display_name, m.level, m.groups\r\n\t\tFROM " . GuestbookSetup::$guestbook_table . " g\r\n\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = g.user_id\r\n\t\tGROUP BY g.id\r\n\t\tORDER BY RAND()\r\n\t\tLIMIT 50"); $page = $i = 1; foreach ($result as $msg) { if ($i > $page * $items_number_per_page) { $page++; } $this->messages[$msg['id']] = array('id' => $msg['id'], 'contents' => strip_tags(FormatingHelper::second_parse($msg['contents'])), 'user_id' => $msg['user_id'], 'login' => $msg['display_name'] ? $msg['display_name'] : $msg['login'], 'level' => $msg['level'], 'groups' => $msg['groups'], 'timestamp' => $msg['timestamp'], 'page' => $page); $i++; } $result->dispose(); }
function get_feed_data_struct($idcat = 0, $name = '') { if (MediaService::get_categories_manager()->get_categories_cache()->category_exists($idcat)) { require_once PATH_TO_ROOT . '/media/media_constant.php'; $category = MediaService::get_categories_manager()->get_categories_cache()->get_category($idcat); $site_name = GeneralConfig::load()->get_site_name(); $site_name = $idcat != Category::ROOT_CATEGORY ? $site_name . ' : ' . $category->get_name() : $site_name; $feed_module_name = LangLoader::get_message('module_title', 'common', 'media'); $data = new FeedData(); $data->set_title($feed_module_name . ' - ' . $site_name); $data->set_date(new Date()); $data->set_link(SyndicationUrlBuilder::rss('media', $idcat)); $data->set_host(HOST); $data->set_desc($feed_module_name . ' - ' . $site_name); $data->set_lang(LangLoader::get_message('xml_lang', 'main')); $data->set_auth_bit(Category::READ_AUTHORIZATIONS); $categories = MediaService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true); $ids_categories = array_keys($categories); $results = PersistenceContext::get_querier()->select('SELECT media.*, cat.image FROM ' . MediaSetup::$media_table . ' media LEFT JOIN ' . MediaSetup::$media_cats_table . ' cat ON cat.id = media.idcat WHERE media.idcat IN :ids_categories AND infos = :status_approved ORDER BY timestamp DESC', array('ids_categories' => $ids_categories, 'status_approved' => MEDIA_STATUS_APROBED)); foreach ($results as $row) { // Rewriting $link = new Url('/media/media' . url('.php?id=' . $row['id'], '-' . $row['id'] . '+' . Url::encode_rewrite($row['name']) . '.php')); $item = new FeedItem(); $item->set_title($row['name']); $item->set_link($link); $item->set_guid($link); $item->set_desc(FormatingHelper::second_parse($row['contents'])); $item->set_date(new Date($row['timestamp'], Timezone::SERVER_TIMEZONE)); $item->set_image_url($row['image']); $item->set_auth(MediaService::get_categories_manager()->get_heritated_authorizations($row['idcat'], Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY)); $enclosure = new FeedItemEnclosure(); $enclosure->set_lenght(@filesize($row['url'])); $enclosure->set_type($row['mime_type']); $enclosure->set_url($row['url']); $item->set_enclosure($enclosure); $data->add_item($item); } $results->dispose(); return $data; } }
public function get_feed_data_struct($idcat = 0, $name = '') { if (CalendarService::get_categories_manager()->get_categories_cache()->category_exists($idcat)) { $now = new Date(); $lang = LangLoader::get('common', 'calendar'); $querier = PersistenceContext::get_querier(); $category = CalendarService::get_categories_manager()->get_categories_cache()->get_category($idcat); $site_name = GeneralConfig::load()->get_site_name(); $site_name = $idcat != Category::ROOT_CATEGORY ? $site_name . ' : ' . $category->get_name() : $site_name; $feed_module_name = $lang['calendar.feed.name']; $data = new FeedData(); $data->set_title($feed_module_name . ' - ' . $site_name); $data->set_date(new Date()); $data->set_link(SyndicationUrlBuilder::rss('calendar', $idcat)); $data->set_host(HOST); $data->set_desc($feed_module_name . ' - ' . $site_name); $data->set_lang(LangLoader::get_message('xml_lang', 'main')); $data->set_auth_bit(Category::READ_AUTHORIZATIONS); $categories = CalendarService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true); $ids_categories = array_keys($categories); $result = $querier->select('SELECT * FROM ' . CalendarSetup::$calendar_events_table . ' event LEFT JOIN ' . CalendarSetup::$calendar_events_content_table . ' event_content ON event_content.id = event.content_id LEFT JOIN ' . DB_TABLE_MEMBER . ' member ON member.user_id = event_content.author_id LEFT JOIN ' . CalendarSetup::$calendar_cats_table . ' cat ON cat.id = event_content.id_category WHERE approved = 1 AND id_category IN :cats_ids ORDER BY start_date DESC', array('cats_ids' => $ids_categories)); while ($row = $result->fetch()) { $event = new CalendarEvent(); $event->set_properties($row); $category = $categories[$event->get_content()->get_category_id()]; $link = CalendarUrlBuilder::display_event($category->get_id(), $category->get_rewrited_name() ? $category->get_rewrited_name() : 'root', $event->get_id(), $event->get_content()->get_rewrited_title()); $item = new FeedItem(); $item->set_title($event->get_content()->get_title()); $item->set_link($link); $item->set_guid($link); $item->set_desc(FormatingHelper::second_parse($event->get_content()->get_contents()) . ($event->get_content()->get_location() ? '<br />' . $lang['calendar.labels.location'] . ' : ' . $event->get_content()->get_location() . '<br />' : '') . '<br />' . $lang['calendar.labels.start_date'] . ' : ' . $event->get_start_date()->format(Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE) . '<br />' . $lang['calendar.labels.end_date'] . ' : ' . $event->get_end_date()->format(Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE)); $item->set_date($event->get_start_date()); $item->set_auth(CalendarService::get_categories_manager()->get_heritated_authorizations($category->get_id(), Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY)); $data->add_item($item); } $result->dispose(); return $data; } }
private function build_children_view($template, $categories, $id_parent) { foreach ($categories as $id => $category) { if ($category->get_id_parent() == $id_parent && $id != Category::ROOT_CATEGORY) { $description = ''; if (method_exists($category, 'get_description')) { $description = FormatingHelper::second_parse($category->get_description()); $description = strlen($description) > 250 ? substr(@strip_tags($description, '<br><br/>'), 0, 250) . '...' : $description; } $description_exists = method_exists($category, 'get_description'); $category_view = new FileTemplate('default/framework/content/categories/category.tpl'); $category_view->add_lang($this->lang); $category_view->put_all(array('C_DESCRIPTION' => !empty($description), 'U_DISPLAY' => $this->get_display_category_url($category)->rel(), 'U_EDIT' => $this->get_edit_category_url($category)->rel(), 'U_DELETE' => $this->get_delete_category_url($category)->rel(), 'ID' => $id, 'NAME' => $category->get_name(), 'DESCRIPTION' => $description)); $this->build_children_view($category_view, $categories, $id); $template->assign_block_vars('childrens', array('child' => $category_view->render())); } } }
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()); }
public function get_feed_data_struct($idcat = 0, $name = '') { if (ArticlesService::get_categories_manager()->get_categories_cache()->category_exists($idcat)) { $querier = PersistenceContext::get_querier(); $category = ArticlesService::get_categories_manager()->get_categories_cache()->get_category($idcat); $site_name = GeneralConfig::load()->get_site_name(); $site_name = $idcat != Category::ROOT_CATEGORY ? $site_name . ' : ' . $category->get_name() : $site_name; $feed_module_name = LangLoader::get_message('articles.feed_name', 'common', 'articles'); $data = new FeedData(); $data->set_title($feed_module_name . ' - ' . $site_name); $data->set_date(new Date()); $data->set_link(SyndicationUrlBuilder::rss('articles', $idcat)); $data->set_host(HOST); $data->set_desc($feed_module_name . ' - ' . $site_name); $data->set_lang(LangLoader::get_message('xml_lang', 'main')); $data->set_auth_bit(Category::READ_AUTHORIZATIONS); $categories = ArticlesService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true); $ids_categories = array_keys($categories); $now = new Date(); $results = $querier->select('SELECT articles.id, articles.id_category, articles.title, articles.rewrited_title, articles.picture_url, articles.contents, articles.description, articles.date_created, cat.rewrited_name AS rewrited_name_cat FROM ' . ArticlesSetup::$articles_table . ' articles LEFT JOIN ' . ArticlesSetup::$articles_cats_table . ' cat ON cat.id = articles.id_category WHERE articles.id_category IN :cats_ids AND (published = 1 OR (published = 2 AND publishing_start_date < :timestamp_now AND (publishing_end_date > :timestamp_now OR publishing_end_date = 0))) ORDER BY articles.date_created DESC', array('cats_ids' => $ids_categories, 'timestamp_now' => $now->get_timestamp())); foreach ($results as $row) { $row['rewrited_name_cat'] = !empty($row['id_category']) ? $row['rewrited_name_cat'] : 'root'; $link = ArticlesUrlBuilder::display_article($row['id_category'], $row['rewrited_name_cat'], $row['id'], $row['rewrited_title']); $item = new FeedItem(); $item->set_title($row['title']); $item->set_link($link); $item->set_guid($link); $item->set_desc(FormatingHelper::second_parse($row['contents'])); $item->set_date(new Date($row['date_created'], Timezone::SERVER_TIMEZONE)); $item->set_image_url($row['picture_url']); $item->set_auth(ArticlesService::get_categories_manager()->get_heritated_authorizations($row['id_category'], Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY)); $data->add_item($item); } $results->dispose(); return $data; } }
public function get_feed_data_struct($idcat = 0, $name = '') { $querier = PersistenceContext::get_querier(); global $LANG; load_module_lang('wiki'); $categories = WikiCategoriesCache::load()->get_categories(); $config = WikiConfig::load(); $parameters = array('limit' => 20); if ($idcat > 0 && array_key_exists($idcat, $categories)) { $desc = sprintf($LANG['wiki_rss_cat'], stripslashes($categories[$idcat]['title'])); $where = 'AND a.id_cat = :idcat'; $parameters['idcat'] = $idcat; } else { $desc = sprintf($LANG['wiki_rss_last_articles'], $config->get_wiki_name() ? $config->get_wiki_name() : $LANG['wiki']); $where = ''; } $data = new FeedData(); $data->set_title($config->get_wiki_name() ? $config->get_wiki_name() : $LANG['wiki']); $data->set_date(new Date()); $data->set_link(SyndicationUrlBuilder::rss('wiki', $idcat)); $data->set_host(HOST); $data->set_desc($desc); $data->set_lang($LANG['xml_lang']); // Last news $results = $querier->select('SELECT a.title, a.encoded_title, c.content, c.timestamp FROM ' . PREFIX . 'wiki_articles a LEFT JOIN ' . PREFIX . 'wiki_contents c ON c.id_contents = a.id_contents WHERE a.redirect = 0 ' . $where . ' ORDER BY c.timestamp DESC LIMIT :limit OFFSET 0', $parameters); // Generation of the feed's items foreach ($results as $row) { $item = new FeedItem(); $item->set_title($row['title']); $link = new Url('/wiki/' . url('wiki.php?title=' . $row['encoded_title'], $row['encoded_title'])); $item->set_link($link); $item->set_guid($link); $item->set_desc(FormatingHelper::second_parse($row['content'])); $item->set_date(new Date($row['timestamp'], Timezone::SERVER_TIMEZONE)); $data->add_item($item); } $results->dispose(); return $data; }
public function get_feed_data_struct($idcat = 0, $name = '') { if (FaqService::get_categories_manager()->get_categories_cache()->category_exists($idcat)) { $querier = PersistenceContext::get_querier(); $category = FaqService::get_categories_manager()->get_categories_cache()->get_category($idcat); $site_name = GeneralConfig::load()->get_site_name(); $site_name = $idcat != Category::ROOT_CATEGORY ? $site_name . ' : ' . $category->get_name() : $site_name; $feed_module_name = LangLoader::get_message('module_title', 'common', 'faq'); $data = new FeedData(); $data->set_title($feed_module_name . ' - ' . $site_name); $data->set_date(new Date()); $data->set_link(SyndicationUrlBuilder::rss('faq', $idcat)); $data->set_host(HOST); $data->set_desc($feed_module_name . ' - ' . $site_name); $data->set_lang(LangLoader::get_message('xml_lang', 'main')); $data->set_auth_bit(Category::READ_AUTHORIZATIONS); $categories = FaqService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true); $ids_categories = array_keys($categories); $results = $querier->select('SELECT faq.id, faq.id_category, faq.question, faq.answer, faq.creation_date, cat.rewrited_name AS rewrited_name_cat FROM ' . FaqSetup::$faq_table . ' faq LEFT JOIN ' . FaqSetup::$faq_cats_table . ' cat ON cat.id = faq.id_category WHERE approved = 1 AND faq.id_category IN :ids_categories ORDER BY faq.creation_date DESC', array('ids_categories' => $ids_categories)); foreach ($results as $row) { $row['rewrited_name_cat'] = !empty($row['id_category']) ? $row['rewrited_name_cat'] : 'root'; $link = FaqUrlBuilder::display($row['id_category'], $row['rewrited_name_cat'], $row['id']); $item = new FeedItem(); $item->set_title($row['question']); $item->set_link($link); $item->set_guid($link); $item->set_desc(FormatingHelper::second_parse($row['answer'])); $item->set_date(new Date($row['creation_date'], Timezone::SERVER_TIMEZONE)); $item->set_auth(FaqService::get_categories_manager()->get_heritated_authorizations($row['id_category'], Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY)); $data->add_item($item); } $results->dispose(); return $data; } }
public function get_feed_data_struct($idcat = 0, $name = '') { $config = ForumConfig::load(); $category = ForumService::get_categories_manager()->get_categories_cache()->get_category($idcat); $data = new FeedData(); $data->set_title(LangLoader::get_message('xml_forum_desc', 'common', 'forum')); $data->set_date(new Date()); $data->set_link(DispatchManager::get_url('/syndication', '/rss/forum/' . $idcat . '/')); $data->set_host(HOST); $data->set_desc(LangLoader::get_message('xml_forum_desc', 'common', 'forum')); $data->set_lang(LangLoader::get_message('xml_lang', 'main')); $data->set_auth_bit(Category::READ_AUTHORIZATIONS); $categories = ForumService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true); $ids_categories = array_keys($categories); $results = PersistenceContext::get_querier()->select('SELECT t.id, t.idcat, t.title, t.last_timestamp, t.last_msg_id, t.display_msg, t.nbr_msg AS t_nbr_msg, msg.id mid, msg.contents FROM ' . PREFIX . 'forum_topics t LEFT JOIN ' . PREFIX . 'forum_msg msg ON msg.id = t.last_msg_id WHERE t.idcat IN :ids_categories ORDER BY t.last_timestamp DESC LIMIT :limit OFFSET 0', array('ids_categories' => $ids_categories, 'limit' => 2 * $config->get_number_messages_per_page())); foreach ($results as $row) { $item = new FeedItem(); //Link $last_page = ceil($row['t_nbr_msg'] / $config->get_number_messages_per_page()); $last_page_rewrite = $last_page > 1 ? '-' . $last_page : ''; $last_page = $last_page > 1 ? 'pt=' . $last_page . '&' : ''; $link = new Url('/forum/topic' . url('.php?' . $last_page . 'id=' . $row['id'], '-' . $row['id'] . $last_page_rewrite . '+' . Url::encode_rewrite($row['title']) . '.php') . '#m' . $row['last_msg_id']); $item->set_title(($config->is_message_before_topic_title_displayed() && !empty($row['display_msg']) ? TextHelper::html_entity_decode($config->get_message_before_topic_title(), ENT_NOQUOTES) . ' ' : '') . stripslashes($row['title'])); $item->set_link($link); $item->set_guid($link); $item->set_desc(FormatingHelper::second_parse($row['contents'])); $item->set_date(new Date($row['last_timestamp'], Timezone::SERVER_TIMEZONE)); $item->set_auth(ForumService::get_categories_manager()->get_heritated_authorizations($row['idcat'], Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY)); $data->add_item($item); } $results->dispose(); return $data; }
function get_feed_data_struct($idcat = 0, $name = '') { global $LANG; $querier = PersistenceContext::get_querier(); $pages_config = PagesConfig::load(); if (!defined('READ_PAGE')) { require_once PATH_TO_ROOT . '/pages/pages_defines.php'; } load_module_lang('pages'); $data = new FeedData(); $data->set_title($LANG['pages_rss_desc']); $data->set_date(new Date()); $data->set_link(SyndicationUrlBuilder::rss('pages', $idcat)); $data->set_host(HOST); $data->set_desc($LANG['pages_rss_desc']); $data->set_lang($LANG['xml_lang']); $data->set_auth_bit(READ_PAGE); $where_clause = !empty($idcat) ? ' WHERE p.id_cat = :idcat' : ''; $results = $querier->select('SELECT p.* FROM ' . PREFIX . 'pages p ' . $where_clause . ' ORDER BY p.timestamp DESC LIMIT :limit OFFSET 0', array('idcat' => $idcat, 'limit' => 10)); // Generation of the feed's items foreach ($results as $row) { $item = new FeedItem(); $link = new Url(PagesUrlBuilder::get_link_item($row['encoded_title'])); $item->set_title(stripslashes($row['title'])); $item->set_link($link); $item->set_guid($link); $item->set_desc(preg_replace('`\\[page\\](.+)\\[/page\\]`U', '<br /><strong>$1</strong><hr />', FormatingHelper::second_parse($row['contents']))); $item->set_date(new Date($row['timestamp'], Timezone::SERVER_TIMEZONE)); $item->set_auth(empty($row['auth']) ? $pages_config->get_authorizations() : unserialize($row['auth'])); $data->add_item($item); } $results->dispose(); return $data; }
} require_once '../kernel/header.php'; $template = new FileTemplate('user/contribution_panel.tpl'); if ($contribution_id > 0) { $template->put_all(array('C_CONSULT_CONTRIBUTION' => true)); $comments_topic = new UserEventsCommentsTopic(); $comments_topic->set_id_in_module($contribution_id); $comments_topic->set_url(new Url('/user/contribution_panel.php?id=' . $contribution_id)); //For PHP 4 :( $contribution_creation_date = $contribution->get_creation_date(); $contribution_fixing_date = $contribution->get_fixing_date(); $contributor = PersistenceContext::get_querier()->select('SELECT * FROM ' . DB_TABLE_MEMBER . ' member WHERE user_id = :user_id', array('user_id' => $contribution->get_poster_id()))->fetch(); $contributor_group_color = User::get_group_color($contributor['groups'], $contributor['level']); $template->put_all(array('C_WRITE_AUTH' => AppContext::get_current_user()->check_auth($contribution->get_auth(), Contribution::CONTRIBUTION_AUTH_BIT), 'C_UNPROCESSED_CONTRIBUTION' => $contribution->get_status() != Event::EVENT_STATUS_PROCESSED, 'C_CONTRIBUTOR_GROUP_COLOR' => !empty($contributor_group_color), 'ENTITLED' => $contribution->get_entitled(), 'DESCRIPTION' => FormatingHelper::second_parse($contribution->get_description()), 'STATUS' => $contribution->get_status_name(), 'CONTRIBUTOR' => $contributor['display_name'], 'CONTRIBUTOR_LEVEL_CLASS' => UserService::get_level_class($contributor['level']), 'CONTRIBUTOR_GROUP_COLOR' => $contributor_group_color, 'COMMENTS' => CommentsService::display($comments_topic)->render(), 'CREATION_DATE' => $contribution_creation_date->format(Date::FORMAT_DAY_MONTH_YEAR), 'MODULE' => $contribution->get_module_name(), 'U_CONTRIBUTOR_PROFILE' => UserUrlBuilder::profile($contribution->get_poster_id())->rel(), 'FIXING_URL' => url(PATH_TO_ROOT . $contribution->get_fixing_url()))); //Si la contribution a été traitée if ($contribution->get_status() == Event::EVENT_STATUS_PROCESSED) { $fixer = PersistenceContext::get_querier()->select('SELECT * FROM ' . DB_TABLE_MEMBER . ' member WHERE user_id = :user_id', array('user_id' => $contribution->get_fixer_id()))->fetch(); $fixer_group_color = User::get_group_color($fixer['groups'], $fixer['level']); $template->put_all(array('C_CONTRIBUTION_FIXED' => true, 'C_FIXER_GROUP_COLOR' => !empty($fixer_group_color), 'FIXER' => $fixer['display_name'], 'FIXER_LEVEL_CLASS' => UserService::get_level_class($fixer['level']), 'FIXER_GROUP_COLOR' => $fixer_group_color, 'FIXING_DATE' => $contribution_fixing_date->format(Date::FORMAT_DAY_MONTH_YEAR), 'U_FIXER_PROFILE' => UserUrlBuilder::profile($contribution->get_fixer_id())->rel())); } $template->put_all(array('L_CONTRIBUTION' => $LANG['contribution'], 'L_ENTITLED' => $LANG['contribution_entitled'], 'L_DESCRIPTION' => $LANG['contribution_description'], 'L_STATUS' => $LANG['contribution_status'], 'L_CONTRIBUTOR' => $LANG['contributor'], 'L_CREATION_DATE' => $LANG['contribution_creation_date'], 'L_FIXER' => $LANG['contribution_fixer'], 'L_FIXING_DATE' => $LANG['contribution_fixing_date'], 'L_MODULE' => $LANG['contribution_module'], 'L_PROCESS_CONTRIBUTION' => $LANG['process_contribution'], 'L_CONFIRM_DELETE_CONTRIBUTION' => $LANG['confirm_delete_contribution'], 'L_DELETE' => LangLoader::get_message('delete', 'common'), 'L_UPDATE' => $LANG['update'], 'U_UPDATE' => url('contribution_panel.php?edit=' . $contribution_id), 'U_DELETE' => url('contribution_panel.php?del=' . $contribution_id . '&token=' . AppContext::get_session()->get_token()))); } elseif ($id_update > 0) { $editor = AppContext::get_content_formatting_service()->get_default_editor(); $editor->set_identifier('contents'); $template->put_all(array('C_EDIT_CONTRIBUTION' => true, 'EDITOR' => $editor->display(), 'ENTITLED' => $contribution->get_entitled(), 'DESCRIPTION' => FormatingHelper::unparse($contribution->get_description()), 'CONTRIBUTION_ID' => $contribution->get_id(), 'EVENT_STATUS_UNREAD_SELECTED' => $contribution->get_status() == Event::EVENT_STATUS_UNREAD ? ' selected="selected"' : '', 'EVENT_STATUS_BEING_PROCESSED_SELECTED' => $contribution->get_status() == Event::EVENT_STATUS_BEING_PROCESSED ? ' selected="selected"' : '', 'EVENT_STATUS_PROCESSED_SELECTED' => $contribution->get_status() == Event::EVENT_STATUS_PROCESSED ? ' selected="selected"' : '', 'L_CONTRIBUTION_STATUS_UNREAD' => $LANG['contribution_status_unread'], 'L_CONTRIBUTION_STATUS_BEING_PROCESSED' => $LANG['contribution_status_being_processed'], 'L_CONTRIBUTION_STATUS_PROCESSED' => $LANG['contribution_status_processed'], 'L_CONTRIBUTION' => $LANG['contribution'], 'L_DESCRIPTION' => $LANG['contribution_description'], 'L_STATUS' => $LANG['contribution_status'], 'L_ENTITLED' => $LANG['contribution_entitled'], 'L_SUBMIT' => $LANG['submit'], 'L_PREVIEW' => $LANG['preview'], 'L_RESET' => $LANG['reset'])); } else { $template->put_all(array('C_CONTRIBUTION_LIST' => true));
} $user_accounts_config = UserAccountsConfig::load(); //Avatar if (empty($row['user_avatar'])) { $user_avatar = $user_accounts_config->is_default_avatar_enabled() == '1' ? '<img src="../templates/' . AppContext::get_current_user()->get_theme() . '/images/' . $user_accounts_config->get_default_avatar_name() . '" alt="' . LangLoader::get_message('avatar', 'user-common') . '" />' : ''; } else { $user_avatar = '<img src="' . Url::to_rel($row['user_avatar']) . '" alt="' . LangLoader::get_message('avatar', 'user-common') . '" />'; } //Affichage du nombre de message. if ($row['posted_msg'] >= 1) { $posted_msg = '<a href="' . UserUrlBuilder::messages($row['user_id'])->rel() . '" class="small">' . $LANG['message_s'] . '</a>: ' . $row['posted_msg']; } else { $posted_msg = !$is_guest ? '<a href="' . PATH_TO_ROOT . '/forum/membermsg' . url('.php?id=' . $row['user_id'], '') . '" class="small">' . $LANG['message'] . '</a>: 0' : $LANG['message'] . ': 0'; } $user_sign_field = $extended_fields_cache->get_extended_field_by_field_name('user_sign'); $tpl->assign_block_vars('list', array('C_GROUP_COLOR' => !empty($group_color), 'C_GUEST' => empty($row['display_name']), 'CONTENTS' => FormatingHelper::second_parse($row['contents']), 'DATE' => $LANG['on'] . ' ' . Date::to_format($row['timestamp'], Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE), 'ID' => $row['id'], 'USER_RANK' => $row['warning_percentage'] < '100' || time() - $row['delay_banned'] < 0 ? $user_rank : LangLoader::get_message('banned', 'user-common'), 'USER_IMG_ASSOC' => $user_assoc_img, 'USER_AVATAR' => $user_avatar, 'USER_GROUP' => $user_groups, 'USER_DATE' => !$is_guest ? $LANG['registered_on'] . ': ' . Date::to_format($row['registered'], Date::FORMAT_DAY_MONTH_YEAR) : '', 'USER_MSG' => !$is_guest ? $posted_msg : '', 'USER_MAIL' => !empty($row['email']) && $row['show_email'] == '1' ? '<a href="mailto:' . $row['email'] . '" class="basic-button smaller">Mail</a>' : '', 'USER_SIGN' => !empty($row['user_sign']) && !empty($user_sign_field) && $user_sign_field['display'] ? '____________________<br />' . FormatingHelper::second_parse($row['user_sign']) : '', 'USER_WARNING' => $row['warning_percentage'], 'USER_PM' => !$is_guest && AppContext::get_current_user()->check_level(User::MEMBER_LEVEL) ? '<a href="' . UserUrlBuilder::personnal_message($row['user_id'])->rel() . '" class="basic-button smaller">MP</a>' : '', 'USER_ONLINE' => '<i class="fa ' . (!empty($row['connect']) ? 'fa-online' : 'fa-offline') . '"></i>', 'USER_PSEUDO' => !empty($row['display_name']) ? wordwrap(TextHelper::html_entity_decode($row['display_name']), 13, '<br />', 1) : $LANG['guest'], 'LEVEL_CLASS' => UserService::get_level_class($row['level']), 'GROUP_COLOR' => $group_color, 'U_USER_PROFILE' => UserUrlBuilder::profile($row['user_id'])->rel(), 'U_VARS_ANCRE' => url('.php?id=' . $row['idtopic'], '-' . $row['idtopic'] . $rewrited_title . '.php'), 'U_FORUM_CAT' => '<a class="forum-mbrmsg-links" href="' . PATH_TO_ROOT . '/forum/forum' . url('.php?id=' . $row['idcat'], '-' . $row['idcat'] . $rewrited_cat_title . '.php') . '">' . $row['name'] . '</a>', 'U_TITLE_T' => '<a class="forum-mbrmsg-links" href="' . PATH_TO_ROOT . '/forum/topic' . url('.php?id=' . $row['idtopic'], '-' . $row['idtopic'] . $rewrited_title . '.php') . '">' . stripslashes($row['title']) . '</a>')); foreach ($displayed_extended_fields as $field_type) { $field = $extended_fields_cache->get_extended_field_by_field_name($field_type); if (!empty($row[$field_type]) && !empty($field) && $field['display']) { $button = ''; if ($field['regex'] == 4) { foreach (MemberShortTextExtendedField::$brands_pictures_list as $id => $parameters) { if (strstr($row[$field_type], $id)) { $button = '<a href="mailto:' . $row[$field_type] . '" class="basic-button smaller"><i class="fa ' . $parameters['picture'] . '"></i> ' . $parameters['title'] . '</a>'; } } } else { if ($field['regex'] == 5) { $button = '<a href="' . $row[$field_type] . '" class="basic-button smaller">' . LangLoader::get_message('regex.website', 'admin-user-common') . '</a>'; foreach (MemberShortTextExtendedField::$brands_pictures_list as $id => $parameters) { if (strstr($row[$field_type], $id)) {
public function get_array_tpl_vars() { $category = $this->get_category(); $contents = FormatingHelper::second_parse($this->contents); $description = $this->get_real_short_contents(); $user = $this->get_author_user(); $user_group_color = User::get_group_color($user->get_groups(), $user->get_level(), true); $number_comments = CommentsService::get_number_comments('download', $this->id); return array('C_VISIBLE' => $this->is_visible(), 'C_EDIT' => $this->is_authorized_to_edit(), 'C_DELETE' => $this->is_authorized_to_delete(), 'C_READ_MORE' => !$this->is_short_contents_enabled() && $description != $contents && strlen($description) >= DownloadConfig::NUMBER_CARACTERS_BEFORE_CUT, 'C_SIZE' => !empty($this->size), 'C_PICTURE' => $this->has_picture(), 'C_CUSTOM_AUTHOR_DISPLAY_NAME' => $this->is_author_display_name_enabled(), 'C_USER_GROUP_COLOR' => !empty($user_group_color), 'C_UPDATED_DATE' => $this->has_updated_date(), 'ID' => $this->id, 'NAME' => $this->name, 'SIZE' => $this->formated_size, 'CONTENTS' => $contents, 'DESCRIPTION' => $description, 'DATE' => $this->creation_date->format(Date::FORMAT_DAY_MONTH_YEAR), 'DATE_DAY' => $this->creation_date->get_day(), 'DATE_MONTH' => $this->creation_date->get_month(), 'DATE_YEAR' => $this->creation_date->get_year(), 'DATE_DAY_MONTH' => $this->creation_date->format(Date::FORMAT_DAY_MONTH), 'DATE_ISO8601' => $this->creation_date->format(Date::FORMAT_ISO8601), 'UPDATED_DATE' => $this->updated_date !== null ? $this->updated_date->format(Date::FORMAT_DAY_MONTH_YEAR) : '', 'UPDATED_DATE_ISO8601' => $this->updated_date !== null ? $this->updated_date->format(Date::FORMAT_ISO8601) : '', 'STATUS' => $this->get_status(), 'CUSTOM_AUTHOR_DISPLAY_NAME' => $this->author_display_name, 'C_AUTHOR_EXIST' => $user->get_id() !== User::VISITOR_LEVEL, 'PSEUDO' => $user->get_display_name(), 'USER_LEVEL_CLASS' => UserService::get_level_class($user->get_level()), 'USER_GROUP_COLOR' => $user_group_color, 'NUMBER_DOWNLOADS' => $this->number_downloads, 'L_DOWNLOADED_TIMES' => StringVars::replace_vars(LangLoader::get_message('downloaded_times', 'common', 'download'), array('number_downloads' => $this->number_downloads)), 'STATIC_NOTATION' => NotationService::display_static_image($this->get_notation()), 'NOTATION' => NotationService::display_active_image($this->get_notation()), 'C_COMMENTS' => !empty($number_comments), 'L_COMMENTS' => CommentsService::get_lang_comments('download', $this->id), 'NUMBER_COMMENTS' => CommentsService::get_number_comments('download', $this->id), 'C_ROOT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY, 'CATEGORY_ID' => $category->get_id(), 'CATEGORY_NAME' => $category->get_name(), 'CATEGORY_DESCRIPTION' => $category->get_description(), 'CATEGORY_IMAGE' => $category->get_image()->rel(), 'U_EDIT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY ? DownloadUrlBuilder::configuration()->rel() : DownloadUrlBuilder::edit_category($category->get_id())->rel(), 'U_SYNDICATION' => SyndicationUrlBuilder::rss('download', $this->id_category)->rel(), 'U_AUTHOR_PROFILE' => UserUrlBuilder::profile($this->get_author_user()->get_id())->rel(), 'U_LINK' => DownloadUrlBuilder::display($category->get_id(), $category->get_rewrited_name(), $this->id, $this->rewrited_name)->rel(), 'U_DOWNLOAD' => DownloadUrlBuilder::download($this->id)->rel(), 'U_DEADLINK' => DownloadUrlBuilder::dead_link($this->id)->rel(), 'U_CATEGORY' => DownloadUrlBuilder::display_category($category->get_id(), $category->get_rewrited_name())->rel(), 'U_EDIT' => DownloadUrlBuilder::edit($this->id)->rel(), 'U_DELETE' => DownloadUrlBuilder::delete($this->id)->rel(), 'U_PICTURE' => $this->get_picture()->rel(), 'U_COMMENTS' => DownloadUrlBuilder::display_comments($category->get_id(), $category->get_rewrited_name(), $this->id, $this->rewrited_name)->rel()); }
* You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ###################################################*/ require_once '../kernel/begin.php'; load_module_lang('wiki'); $config = WikiConfig::load(); include '../wiki/wiki_functions.php'; //Id de l'article à afficher en version imprimable $article_id = retrieve(GET, 'id', 0); //Requêtes préliminaires utiles par la suite if ($article_id > 0) { $result = PersistenceContext::get_querier()->select("SELECT a.id, a.is_cat, a.hits, a.redirect, a.id_cat, a.title, a.encoded_title, a.is_cat, a.defined_status, com_topic.number_comments, f.id AS id_favorite, a.undefined_status, a.auth, c.menu, c.content\n\tFROM " . PREFIX . "wiki_articles a\n\tLEFT JOIN " . PREFIX . "wiki_contents c ON c.id_contents = a.id_contents\n\tLEFT JOIN " . PREFIX . "wiki_favorites f ON f.id_article = a.id\n\tLEFT JOIN " . DB_TABLE_COMMENTS_TOPIC . " com_topic ON a.id = com_topic.id_in_module AND com_topic.module_id = 'wiki'\n\tWHERE a.id = :id\n\tGROUP BY a.id", array('id' => $article_id)); $article_infos = $result->fetch(); $result->dispose(); if (!empty($article_infos['redirect'])) { $id_redirection = $article_infos['id']; $result = PersistenceContext::get_querier()->select("SELECT a.id, a.is_cat, a.hits, a.redirect, a.id_cat, a.title, a.encoded_title, a.is_cat, com_topic.number_comments, a.defined_status, f.id AS id_favorite, a.undefined_status, a.auth, c.menu, c.content\n\t\tFROM " . PREFIX . "wiki_articles a\n\t\tLEFT JOIN " . PREFIX . "wiki_contents c ON c.id_contents = a.id_contents\n\t\tLEFT JOIN " . PREFIX . "wiki_favorites f ON f.id_article = a.id\n\t\tLEFT JOIN " . DB_TABLE_COMMENTS_TOPIC . " com_topic ON a.id = com_topic.id_in_module AND com_topic.module_id = 'wiki'\n\t\tWHERE a.id = :id\n\t\tGROUP BY a.id", array('id' => $article_infos['redirect'])); $article_infos = $result->fetch(); $result->dispose(); } } if (empty($article_infos['id'])) { exit; } require_once PATH_TO_ROOT . '/kernel/header_no_display.php'; $template = new FileTemplate('framework/content/print.tpl'); $template->put_all(array('PAGE_TITLE' => stripslashes($article_infos['title']) . ($config->get_wiki_name() ? $config->get_wiki_name() : $LANG['wiki']), 'TITLE' => stripslashes($article_infos['title']), 'L_XML_LANGUAGE' => $LANG['xml_lang'], 'CONTENT' => FormatingHelper::second_parse($article_infos['content']))); $template->display(); require_once PATH_TO_ROOT . '/kernel/footer_no_display.php';
} } */ //Cet article comporte un type if ($article_infos['defined_status'] != 0) { if ($article_infos['defined_status'] < 0 && !empty($article_infos['undefined_status'])) { $tpl->assign_block_vars('status', array('ARTICLE_STATUS' => FormatingHelper::second_parse(wiki_no_rewrite($article_infos['undefined_status'])))); } elseif ($article_infos['defined_status'] > 0 && is_array($LANG['wiki_status_list'][$article_infos['defined_status'] - 1])) { $tpl->assign_block_vars('status', array('ARTICLE_STATUS' => $LANG['wiki_status_list'][$article_infos['defined_status'] - 1][1])); } } } if (!empty($article_infos['menu'])) { $tpl->assign_block_vars('menu', array('MENU' => $article_infos['menu'])); } $tpl->put_all(array('ID' => $article_infos['id'], 'ID_CAT' => $article_infos['id_cat'], 'TITLE' => stripslashes($article_infos['title']), 'CONTENTS' => FormatingHelper::second_parse(wiki_no_rewrite($article_infos['content'])), 'HITS' => $config->is_hits_counter_enabled() && $id_contents == 0 ? sprintf($LANG['wiki_article_hits'], (int) $article_infos['hits']) : '', 'L_SUB_CATS' => $LANG['wiki_subcats'], 'L_SUB_ARTICLES' => $LANG['wiki_subarticles'], 'L_TABLE_OF_CONTENTS' => $LANG['wiki_table_of_contents'])); if ($article_infos['is_cat'] == 1 && $id_contents == 0) { //On liste les articles de la catégorie et ses sous catégories $result = PersistenceContext::get_querier()->select("SELECT a.title, a.encoded_title, a.id\n\t\tFROM " . PREFIX . "wiki_articles a\n\t\tLEFT JOIN " . PREFIX . "wiki_contents c ON c.id_contents = a.id_contents\n\t\tWHERE a.id_cat = :id_cat AND a.id != :id AND a.redirect = 0\n\t\tORDER BY a.title", array('id_cat' => $article_infos['id_cat'], 'id' => $id_article)); $num_articles = $result->get_rows_count(); $tpl->assign_block_vars('cat', array()); while ($row = $result->fetch()) { $tpl->assign_block_vars('cat.list_art', array('TITLE' => stripslashes($row['title']), 'U_ARTICLE' => url('wiki.php?title=' . $row['encoded_title'], $row['encoded_title']))); } $result->dispose(); if ($num_articles == 0) { $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) {
private function build_form() { $security_config = SecurityConfig::load(); $form = new HTMLForm(__CLASS__); $this->member_extended_fields_service = new MemberExtendedFieldsService($form); $fieldset = new FormFieldsetHTML('registration', $this->lang['registration']); $form->add_fieldset($fieldset); $fieldset->add_field(new FormFieldHTML('validation_method', $this->get_accounts_validation_method_explain())); $fieldset->add_field(new FormFieldTextEditor('display_name', $this->lang['display_name'], '', array('maxlength' => 100, 'required' => true, 'description' => $this->lang['display_name.explain'], 'events' => array('blur' => ' if (!HTMLForms.getField("login").getValue() && HTMLForms.getField("display_name").validate() == "") { HTMLForms.getField("login").setValue(HTMLForms.getField("display_name").getValue().replace(/\\s/g, \'\')); HTMLForms.getField("login").enableValidationMessage(); HTMLForms.getField("login").liveValidate(); }')), array(new FormFieldConstraintLengthRange(3, 100), new FormFieldConstraintDisplayNameExists()))); $fieldset->add_field($email = new FormFieldMailEditor('email', $this->lang['email'], '', array('required' => true), array(new FormFieldConstraintMailExist()))); $fieldset->add_field(new FormFieldCheckbox('user_hide_mail', $this->lang['email.hide'], FormFieldCheckbox::CHECKED)); $fieldset->add_field(new FormFieldCheckbox('custom_login', $this->lang['login.custom'], false, array('description' => $this->lang['login.custom.explain'], 'events' => array('click' => ' if (HTMLForms.getField("custom_login").getValue()) { HTMLForms.getField("login").enable(); } else { HTMLForms.getField("login").disable(); }')))); $fieldset->add_field($login = new FormFieldTextEditor('login', $this->lang['login'], '', array('hidden' => true, 'maxlength' => 25), array(new FormFieldConstraintLengthRange(3, 25), new FormFieldConstraintPHPBoostAuthLoginExists()))); $fieldset->add_field($password = new FormFieldPasswordEditor('password', $this->lang['password'], '', array('description' => StringVars::replace_vars($this->lang['password.explain'], array('number' => $security_config->get_internal_password_min_length())), 'required' => true, 'maxlength' => 500), array(new FormFieldConstraintLengthMin($security_config->get_internal_password_min_length()), new FormFieldConstraintPasswordStrength()))); $fieldset->add_field($password_bis = new FormFieldPasswordEditor('password_bis', $this->lang['password.confirm'], '', array('required' => true, 'maxlength' => 500), array(new FormFieldConstraintLengthMin($security_config->get_internal_password_min_length()), new FormFieldConstraintPasswordStrength()))); $form->add_constraint(new FormConstraintFieldsEquality($password, $password_bis)); if ($security_config->are_login_and_email_forbidden_in_password()) { $form->add_constraint(new FormConstraintFieldsInequality($email, $password)); $form->add_constraint(new FormConstraintFieldsInequality($login, $password)); } $options_fieldset = new FormFieldsetHTML('options', LangLoader::get_message('options', 'main')); $form->add_fieldset($options_fieldset); $options_fieldset->add_field(new FormFieldTimezone('timezone', $this->lang['timezone.choice'], GeneralConfig::load()->get_site_timezone(), array('description' => $this->lang['timezone.choice.explain']))); if (count(ThemesManager::get_activated_and_authorized_themes_map()) > 1) { $options_fieldset->add_field(new FormFieldThemesSelect('theme', $this->lang['theme'], $this->user_accounts_config->get_default_theme(), array('check_authorizations' => true, 'events' => array('change' => $this->build_javascript_picture_themes())))); $options_fieldset->add_field(new FormFieldFree('preview_theme', $this->lang['theme.preview'], '<img id="img_theme" src="' . $this->get_picture_theme() . '" title="' . $this->lang['theme.preview'] . '" alt="' . $this->lang['theme.preview'] . '" class="preview-img" />')); } $options_fieldset->add_field(new FormFieldEditors('text-editor', $this->lang['text-editor'], ContentFormattingConfig::load()->get_default_editor())); $options_fieldset->add_field(new FormFieldLangsSelect('lang', $this->lang['lang'], $this->user_accounts_config->get_default_lang(), array('check_authorizations' => true))); $this->member_extended_fields_service->display_form_fields(); $agreement_text = FormatingHelper::second_parse($this->user_accounts_config->get_registration_agreement()); if (!empty($agreement_text)) { $agreement_fieldset = new FormFieldsetHTML('agreement_fieldset', $this->lang['agreement']); $form->add_fieldset($agreement_fieldset); $agreement = new FormFieldHTML('agreement.required', $this->lang['agreement.agree.required'] . '<br /><br />'); $agreement_fieldset->add_field($agreement); $agreement = new FormFieldHTML('agreement', '<div id="id-message-helper" class="notice user-agreement">' . $agreement_text . '</div>'); $agreement_fieldset->add_field($agreement); $agreement_fieldset->add_field(new FormFieldCheckbox('agree', $this->lang['agreement.agree'], FormFieldCheckbox::UNCHECKED, array('required' => $this->lang['agreement.agree.required']))); } $this->submit_button = new FormButtonDefaultSubmit(); $form->add_button($this->submit_button); $form->add_button(new FormButtonReset()); $this->form = $form; }
public function get_array_tpl_vars() { $category = $this->get_category(); $user = $this->get_author_user(); $user_group_color = User::get_group_color($user->get_groups(), $user->get_level(), true); return array('C_APPROVED' => $this->is_approved(), 'C_EDIT' => $this->is_authorized_to_edit(), 'C_DELETE' => $this->is_authorized_to_delete(), 'C_USER_GROUP_COLOR' => !empty($user_group_color), 'ID' => $this->id, 'QUESTION' => $this->question, 'ANSWER' => FormatingHelper::second_parse($this->answer), 'DATE' => $this->creation_date->format(Date::FORMAT_DAY_MONTH_YEAR), 'DATE_ISO8601' => $this->creation_date->format(Date::FORMAT_ISO8601), 'C_AUTHOR_EXIST' => $user->get_id() !== User::VISITOR_LEVEL, 'PSEUDO' => $user->get_display_name(), 'USER_LEVEL_CLASS' => UserService::get_level_class($user->get_level()), 'USER_GROUP_COLOR' => $user_group_color, 'C_ROOT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY, 'CATEGORY_ID' => $category->get_id(), 'CATEGORY_NAME' => $category->get_name(), 'CATEGORY_DESCRIPTION' => $category->get_description(), 'CATEGORY_IMAGE' => $category->get_image()->rel(), 'U_EDIT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY ? FaqUrlBuilder::configuration()->rel() : FaqUrlBuilder::edit_category($category->get_id())->rel(), 'U_SYNDICATION' => SyndicationUrlBuilder::rss('faq', $this->id_category)->rel(), 'U_AUTHOR_PROFILE' => UserUrlBuilder::profile($this->get_author_user()->get_id())->rel(), 'U_LINK' => FaqUrlBuilder::display($category->get_id(), $category->get_rewrited_name(), $this->id)->rel(), 'U_CATEGORY' => FaqUrlBuilder::display_category($category->get_id(), $category->get_rewrited_name())->rel(), 'U_EDIT' => FaqUrlBuilder::edit($this->id)->rel(), 'U_DELETE' => FaqUrlBuilder::delete($this->id)->rel()); }
public function execute(HTTPRequestCustom $request) { $this->init(); $this->view->put('WELCOME_MESSAGE', FormatingHelper::second_parse($this->lang['welcome_message'])); return $this->generate_response(); }
private function init_vars_template() { $this->view->put_all(array('C_REGISTRATION_ENABLED' => UserAccountsConfig::load()->is_registration_enabled(), 'C_USER_LOGIN' => $this->login_type == self::USER_LOGIN && !$this->maintain_config->is_under_maintenance(), 'C_ADMIN_LOGIN' => $this->login_type == self::ADMIN_LOGIN, 'C_HAS_ERROR' => $this->has_error, 'U_REGISTER' => UserUrlBuilder::registration()->rel(), 'U_FORGET_PASSWORD' => UserUrlBuilder::forget_password()->rel(), 'L_FORGET_PASSWORD' => $this->lang['forget-password'], 'LOGIN_FORM' => $this->form->display())); if ($this->maintain_config->is_under_maintenance()) { $this->init_maintain_delay(); $this->view->put_all(array('C_MAINTAIN' => true, 'L_MAINTAIN' => FormatingHelper::second_parse($this->maintain_config->get_message()))); } }
private function build_view() { global $LANG, $MEDIA_LANG; require_once PATH_TO_ROOT . '/media/media_constant.php'; load_module_lang('media'); $config = MediaConfig::load(); $category = $this->get_category(); $authorized_categories = MediaService::get_authorized_categories($category->get_id()); //Contenu de la catégorie $page = AppContext::get_request()->get_getint('p', 1); $subcategories_page = AppContext::get_request()->get_getint('subcategories_page', 1); $get_sort = retrieve(GET, 'sort', ''); $get_mode = retrieve(GET, 'mode', ''); $mode = $get_mode == 'asc' ? 'ASC' : 'DESC'; $unget = !empty($get_sort) && !empty($mode) ? '?sort=' . $get_sort . '&mode=' . $get_mode : ''; //On crée une pagination si le nombre de sous-catégories est trop important. $subcategories_number = count(MediaService::get_categories_manager()->get_categories_cache()->get_childrens($category->get_id())); $pagination = new ModulePagination($subcategories_page, $subcategories_number, $config->get_categories_number_per_page()); $pagination->set_url(new Url('/media/media.php' . (!empty($unget) ? $unget . '&' : '?') . 'cat=' . $category->get_id() . '&p=' . $page . '&subcategories_page=%d')); if ($pagination->current_page_is_empty() && $subcategories_page > 1) { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } //Children categories $result = PersistenceContext::get_querier()->select('SELECT @id_cat:= media_cats.id, media_cats.*, (SELECT COUNT(*) FROM ' . MediaSetup::$media_table . ' WHERE idcat IN ( @id_cat, (SELECT GROUP_CONCAT(id SEPARATOR \',\') FROM ' . MediaSetup::$media_cats_table . ' WHERE id_parent = @id_cat), (SELECT GROUP_CONCAT(childs.id SEPARATOR \',\') FROM ' . MediaSetup::$media_cats_table . ' parents INNER JOIN ' . MediaSetup::$media_cats_table . ' childs ON parents.id = childs.id_parent WHERE parents.id_parent = @id_cat) ) AND infos = :status ) AS mediafiles_number FROM ' . MediaSetup::$media_cats_table . ' media_cats WHERE id_parent = :id_category AND id IN :authorized_categories ORDER BY id_parent, c_order LIMIT :number_items_per_page OFFSET :display_from', array('id_category' => $category->get_id(), 'status' => MEDIA_STATUS_APROBED, 'authorized_categories' => $authorized_categories, 'number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from())); $nbr_cat_displayed = 0; while ($row = $result->fetch()) { $category_image = new Url($row['image']); $this->tpl->assign_block_vars('sub_categories_list', array('C_CATEGORY_IMAGE' => !empty($row['image']), 'CATEGORY_NAME' => $row['name'], 'CATEGORY_IMAGE' => $category_image->rel(), 'MEDIAFILES_NUMBER' => sprintf($row['mediafiles_number'] > 1 ? $MEDIA_LANG['num_medias'] : $MEDIA_LANG['num_media'], $row['mediafiles_number']), 'U_CATEGORY' => MediaUrlBuilder::display_category($row['id'], $row['rewrited_name'])->rel())); $nbr_cat_displayed++; } $result->dispose(); $nbr_column_cats = $nbr_cat_displayed > $config->get_columns_number_per_line() ? $config->get_columns_number_per_line() : $nbr_cat_displayed; $nbr_column_cats = !empty($nbr_column_cats) ? $nbr_column_cats : 1; $cats_columns_width = floor(100 / $nbr_column_cats); $category_description = FormatingHelper::second_parse($category->get_description()); $this->tpl->put_all(array('C_CATEGORIES' => true, 'C_ROOT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY, 'C_CATEGORY_DESCRIPTION' => $category_description, 'C_SUB_CATEGORIES' => $nbr_cat_displayed > 0, 'C_MODO' => MediaAuthorizationsService::check_authorizations($category->get_id())->moderation(), 'C_SUBCATEGORIES_PAGINATION' => $pagination->has_several_pages(), 'SUBCATEGORIES_PAGINATION' => $pagination->display(), 'L_UNAPROBED' => $MEDIA_LANG['unaprobed_media_short'], 'L_BY' => $MEDIA_LANG['media_added_by'], 'CATS_COLUMNS_WIDTH' => $cats_columns_width, 'CATEGORY_NAME' => $category->get_id() == Category::ROOT_CATEGORY ? LangLoader::get_message('module_title', 'common', 'media') : $category->get_name(), 'CATEGORY_DESCRIPTION' => $category_description, 'U_EDIT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY ? MediaUrlBuilder::configuration()->rel() : MediaUrlBuilder::edit_category($category->get_id())->rel(), 'ID_CAT' => $category->get_id())); $selected_fields = array('alpha' => '', 'date' => '', 'nbr' => '', 'note' => '', 'com' => '', 'asc' => '', 'desc' => ''); switch ($get_sort) { case 'alpha': $sort = 'name'; $selected_fields['alpha'] = ' selected="selected"'; break; default: case 'date': $sort = 'timestamp'; $selected_fields['date'] = ' selected="selected"'; break; case 'nbr': $sort = 'counter'; $selected_fields['nbr'] = ' selected="selected"'; break; case 'note': $sort = 'average_notes'; $selected_fields['note'] = ' selected="selected"'; break; case 'com': $sort = 'com.number_comments'; $selected_fields['com'] = ' selected="selected"'; break; } if ($mode == 'ASC') { $selected_fields['asc'] = ' selected="selected"'; } else { $selected_fields['desc'] = ' selected="selected"'; } $this->tpl->put_all(array('C_DISPLAY_NOTATION' => $config->is_notation_enabled(), 'C_DISPLAY_COMMENTS' => $config->are_comments_enabled(), 'L_ALPHA' => $MEDIA_LANG['sort_title'], 'L_DATE' => LangLoader::get_message('date', 'date-common'), 'L_NBR' => $MEDIA_LANG['sort_popularity'], 'L_NOTE' => LangLoader::get_message('note', 'common'), 'L_COM' => $LANG['com'], 'L_DESC' => $LANG['desc'], 'L_ASC' => $LANG['asc'], 'L_ORDER_BY' => LangLoader::get_message('sort_by', 'common'), 'SELECTED_ALPHA' => $selected_fields['alpha'], 'SELECTED_DATE' => $selected_fields['date'], 'SELECTED_NBR' => $selected_fields['nbr'], 'SELECTED_NOTE' => $selected_fields['note'], 'SELECTED_COM' => $selected_fields['com'], 'SELECTED_ASC' => $selected_fields['asc'], 'SELECTED_DESC' => $selected_fields['desc'])); $condition = 'WHERE idcat = :idcat AND infos = :status'; $parameters = array('idcat' => $category->get_id(), 'status' => MEDIA_STATUS_APROBED); //On crée une pagination si le nombre de fichiers est trop important. $mediafiles_number = MediaService::count($condition, $parameters); $pagination = new ModulePagination($page, $mediafiles_number, $config->get_items_number_per_page()); $pagination->set_url(new Url('/media/media.php' . (!empty($unget) ? $unget . '&' : '?') . 'cat=' . $category->get_id() . '&p=%d&subcategories_page=' . $subcategories_page)); if ($pagination->current_page_is_empty() && $page > 1) { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } $notation = new Notation(); $notation->set_module_name('media'); $notation->set_notation_scale($config->get_notation_scale()); $result = PersistenceContext::get_querier()->select("SELECT v.id, v.iduser, v.name, v.timestamp, v.counter, v.infos, v.contents, mb.display_name, mb.groups, mb.level, notes.average_notes, com.number_comments\n\t\t\tFROM " . PREFIX . "media AS v\n\t\t\tLEFT JOIN " . DB_TABLE_MEMBER . " AS mb ON v.iduser = mb.user_id\n\t\t\tLEFT JOIN " . DB_TABLE_AVERAGE_NOTES . " notes ON v.id = notes.id_in_module AND notes.module_name = 'media'\n\t\t\tLEFT JOIN " . DB_TABLE_COMMENTS_TOPIC . " com ON v.id = com.id_in_module AND com.module_id = 'media'\n\t\t\t" . $condition . "\n\t\t\tORDER BY " . $sort . " " . $mode . "\n\t\t\tLIMIT :number_items_per_page OFFSET :display_from", array_merge($parameters, array('number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from()))); $this->tpl->put_all(array('C_FILES' => $result->get_rows_count() > 0, 'C_DISPLAY_NO_FILE_MSG' => $result->get_rows_count() == 0 && $category->get_id() != Category::ROOT_CATEGORY, 'C_PAGINATION' => $pagination->has_several_pages(), 'PAGINATION' => $pagination->display(), 'TARGET_ON_CHANGE_ORDER' => ServerEnvironmentConfig::load()->is_url_rewriting_enabled() ? 'media-0-' . $category->get_id() . '.php?' : 'media.php?cat=' . $category->get_id() . '&')); while ($row = $result->fetch()) { $notation->set_id_in_module($row['id']); $group_color = User::get_group_color($row['groups'], $row['level']); $this->tpl->assign_block_vars('file', array('ID' => $row['id'], 'NAME' => $row['name'], 'IMG_NAME' => str_replace('"', '\\"', $row['name']), 'C_DESCRIPTION' => !empty($row['contents']), 'DESCRIPTION' => stripslashes(FormatingHelper::second_parse($row['contents'])), 'POSTER' => $MEDIA_LANG['media_added_by'] . ' : ' . !empty($row['display_name']) ? '<a href="' . UserUrlBuilder::profile($row['iduser'])->rel() . '" class="' . UserService::get_level_class($row['level']) . '"' . (!empty($group_color) ? ' style="color:' . $group_color . '"' : '') . '>' . $row['display_name'] . '</a>' : $LANG['guest'], 'DATE' => sprintf($MEDIA_LANG['add_on_date'], Date::to_format($row['timestamp'], Date::FORMAT_DAY_MONTH_YEAR)), 'COUNT' => sprintf($MEDIA_LANG['view_n_times'], $row['counter']), 'NOTE' => NotationService::display_static_image($notation), 'U_MEDIA_LINK' => PATH_TO_ROOT . '/media/' . url('media.php?id=' . $row['id'], 'media-' . $row['id'] . '-' . $category->get_id() . '+' . Url::encode_rewrite($row['name']) . '.php'), 'U_ADMIN_UNVISIBLE_MEDIA' => PATH_TO_ROOT . url('/media/media_action.php?unvisible=' . $row['id'] . '&token=' . AppContext::get_session()->get_token()), 'U_ADMIN_EDIT_MEDIA' => PATH_TO_ROOT . url('/media/media_action.php?edit=' . $row['id']), 'U_ADMIN_DELETE_MEDIA' => PATH_TO_ROOT . url('/media/media_action.php?del=' . $row['id'] . '&token=' . AppContext::get_session()->get_token()), 'U_COM_LINK' => '<a href="' . PATH_TO_ROOT . '/media/media' . url('.php?id=' . $row['id'] . '&com=0', '-' . $row['id'] . '-' . $category->get_id() . '+' . Url::encode_rewrite($row['name']) . '.php?com=0') . '">' . CommentsService::get_number_and_lang_comments('media', $row['id']) . '</a>')); } $result->dispose(); }
$checked_annonce = $type == 2 ? 'checked="ckecked"' : ''; //Liste des choix des sondages => 20 maxi $nbr_poll_field = 0; for ($i = 0; $i < 20; $i++) { $answer = retrieve(POST, 'a' . $i, '', TSTRING_UNCHANGE); if (!empty($answer)) { $tpl->assign_block_vars('answers_poll', array('ID' => $i, 'ANSWER' => $answer)); $nbr_poll_field++; } elseif ($i <= 5) { $tpl->assign_block_vars('answers_poll', array('ID' => $i, 'ANSWER' => '')); $nbr_poll_field++; } } //Type de réponses du sondage. $poll_type = retrieve(POST, 'poll_type', 0); $vars_tpl = array_merge($vars_tpl, array('TITLE' => $title, 'DESC' => $subtitle, 'CONTENTS' => $contents, 'QUESTION' => $question, 'IDM' => $id_post_msg, 'DATE' => $LANG['on'] . ' ' . Date::to_format(Date::DATE_NOW, Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE), 'CONTENTS_PREVIEW' => FormatingHelper::second_parse(stripslashes(FormatingHelper::strparse($contents))), 'CHECKED_NORMAL' => $checked_normal, 'CHECKED_POSTIT' => $checked_postit, 'CHECKED_ANNONCE' => $checked_annonce, 'SELECTED_SIMPLE' => $poll_type == 0 ? 'checked="ckecked"' : '', 'SELECTED_MULTIPLE' => $poll_type == 1 ? 'checked="ckecked"' : '', 'NO_DISPLAY_POLL' => !empty($question) ? 'false' : 'true', 'NBR_POLL_FIELD' => $nbr_poll_field, 'C_FORUM_PREVIEW_MSG' => true, 'C_ADD_POLL_FIELD' => $nbr_poll_field <= 18 ? true : false, 'C_FORUM_POST_TYPE' => true, 'L_PREVIEW' => $LANG['preview'], 'L_TYPE' => '* ' . $LANG['type'], 'L_DEFAULT' => $LANG['default'], 'L_POST_IT' => $LANG['forum_postit'], 'L_ANOUNCE' => $LANG['forum_announce'])); } //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_merge($vars_tpl, array('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, '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(); } elseif (!empty($id_post_msg) && !empty($post_topic)) { try { $msg = PersistenceContext::get_querier()->select_single_row(PREFIX . 'forum_msg', array('idtopic', 'user_id', 'timestamp', 'contents'), 'WHERE id=:id', array('id' => $id_post_msg)); } catch (RowNotFoundException $e) { $error_controller = PHPBoostErrors::unexisting_element();
DispatchManager::redirect($error_controller); } $num_rows = !empty($page_infos['title']) ? 1 : 0; if ($page_infos['redirect'] > 0) { $redirect_title = stripslashes($page_infos['title']); $redirect_id = $page_infos['id']; try { $page_infos = PersistenceContext::get_querier()->select_single_row(PREFIX . 'pages', array('id', 'title', 'auth', 'is_cat', 'id_cat', 'hits', 'count_hits', 'activ_com', 'redirect', 'contents'), 'WHERE id = :id', array('id' => $page_infos['redirect'])); } catch (RowNotFoundException $e) { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } } else { $redirect_title = ''; } //Autorisation particulière ? $special_auth = !empty($page_infos['auth']); $array_auth = unserialize($page_infos['auth']); //Vérification de l'autorisation de voir la page if ($special_auth && !AppContext::get_current_user()->check_auth($array_auth, READ_PAGE) || !$special_auth && !AppContext::get_current_user()->check_auth($pages_config->get_authorizations(), READ_PAGE)) { AppContext::get_response()->redirect(HOST . DIR . url('/pages/pages.php?error=e_auth')); } } if (empty($page_infos['id'])) { exit; } require_once PATH_TO_ROOT . '/kernel/header_no_display.php'; $template = new FileTemplate('framework/content/print.tpl'); $template->put_all(array('PAGE_TITLE' => stripslashes($page_infos['title']) . ' - ' . GeneralConfig::load()->get_site_name(), 'TITLE' => stripslashes($page_infos['title']), 'L_XML_LANGUAGE' => $LANG['xml_lang'], 'CONTENT' => FormatingHelper::second_parse($page_infos['contents']))); $template->display(); require_once PATH_TO_ROOT . '/kernel/footer_no_display.php';
$error = ''; $tpl = new FileTemplate('wiki/post.tpl'); $captcha = AppContext::get_captcha_service()->get_default_factory(); if (!empty($contents)) { include_once '../wiki/wiki_functions.php'; //On crée le menu des paragraphes et on enregistre le menu $menu = ''; //Si on détecte la syntaxe des menus alors on lance les fonctions, sinon le menu sera vide et non affiché if (preg_match('`[\\-]{2,6}`isU', $contents)) { $menu_list = wiki_explode_menu($contents); //On éclate le menu en tableaux $menu = wiki_display_menu($menu_list); //On affiche le menu } if ($preview) { $tpl->assign_block_vars('preview', array('CONTENTS' => FormatingHelper::second_parse(wiki_no_rewrite(stripslashes($contents))), 'TITLE' => stripslashes($title))); if (!empty($menu)) { $tpl->assign_block_vars('preview.menu', array('MENU' => $menu)); } } else { if ($id_edit > 0) { try { $article_infos = PersistenceContext::get_querier()->select_single_row(PREFIX . "wiki_articles", array('encoded_title', 'auth'), 'WHERE id = :id', array('id' => $id_edit)); } catch (RowNotFoundException $e) { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } //Autorisations $general_auth = empty($article_infos['auth']) ? true : false; $article_auth = !empty($article_infos['auth']) ? unserialize($article_infos['auth']) : array(); if (!((!$general_auth || AppContext::get_current_user()->check_auth($config->get_authorizations(), WIKI_EDIT)) && ($general_auth || AppContext::get_current_user()->check_auth($article_auth, WIKI_EDIT)))) {
public function get_array_tpl_vars() { $lang = LangLoader::get('common', 'calendar'); $category = $this->content->get_category(); $author = $this->content->get_author_user(); $author_group_color = User::get_group_color($author->get_groups(), $author->get_level(), true); $missing_participants_number = $this->content->get_max_registered_members() > 0 && $this->get_registered_members_number() < $this->content->get_max_registered_members() ? $this->content->get_max_registered_members() - $this->get_registered_members_number() : 0; $registration_days_left = $this->content->get_last_registration_date() && time() < $this->content->get_last_registration_date()->get_timestamp() ? (int) (($this->content->get_last_registration_date()->get_timestamp() - time()) / 3600 / 24) : 0; return array('C_APPROVED' => $this->content->is_approved(), 'C_EDIT' => $this->is_authorized_to_edit(), 'C_DELETE' => $this->is_authorized_to_delete(), 'C_LOCATION' => $this->content->get_location(), 'C_BELONGS_TO_A_SERIE' => $this->belongs_to_a_serie(), 'C_PARTICIPATION_ENABLED' => $this->content->is_registration_authorized(), 'C_DISPLAY_PARTICIPANTS' => $this->content->is_authorized_to_display_registered_users(), 'C_PARTICIPANTS' => !empty($this->participants), 'C_PARTICIPATE' => $this->content->is_registration_authorized() && $this->content->is_authorized_to_register() && time() < $this->start_date->get_timestamp() && (!$this->content->get_max_registered_members() || $this->content->get_max_registered_members() > 0 && $this->get_registered_members_number() < $this->content->get_max_registered_members()) && (!$this->content->get_last_registration_date() || $this->content->is_last_registration_date_enabled() && time() < $this->content->get_last_registration_date()->get_timestamp()) && !in_array(AppContext::get_current_user()->get_id(), array_keys($this->participants)), 'C_IS_PARTICIPANT' => in_array(AppContext::get_current_user()->get_id(), array_keys($this->participants)), 'C_REGISTRATION_CLOSED' => $this->content->is_last_registration_date_enabled() && $this->content->get_last_registration_date() && time() > $this->content->get_last_registration_date()->get_timestamp(), 'C_MAX_PARTICIPANTS_REACHED' => $this->content->get_max_registered_members() > 0 && $this->get_registered_members_number() == $this->content->get_max_registered_members(), 'C_MISSING_PARTICIPANTS' => !empty($missing_participants_number) && $missing_participants_number <= 5, 'C_REGISTRATION_DAYS_LEFT' => !empty($registration_days_left) && $registration_days_left <= 5, 'C_AUTHOR_GROUP_COLOR' => !empty($author_group_color), 'C_AUTHOR_EXIST' => $author->get_id() !== User::VISITOR_LEVEL, 'ID' => $this->id, 'CONTENT_ID' => $this->content->get_id(), 'TITLE' => $this->content->get_title(), 'CONTENTS' => FormatingHelper::second_parse($this->content->get_contents()), 'LOCATION' => $this->content->get_location(), 'START_DATE' => $this->start_date->format(Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE), 'START_DATE_DAY' => $this->start_date->get_day(), 'START_DATE_MONTH' => $this->start_date->get_month(), 'START_DATE_YEAR' => $this->start_date->get_year(), 'START_DATE_HOUR' => $this->start_date->get_hours(), 'START_DATE_MINUTE' => $this->start_date->get_minutes(), 'START_DATE_ISO8601' => $this->start_date->format(Date::FORMAT_ISO8601), 'END_DATE' => $this->end_date->format(Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE), 'END_DATE_DAY' => $this->end_date->get_day(), 'END_DATE_MONTH' => $this->end_date->get_month(), 'END_DATE_YEAR' => $this->end_date->get_year(), 'END_DATE_HOUR' => $this->end_date->get_hours(), 'END_DATE_MINUTE' => $this->end_date->get_minutes(), 'END_DATE_ISO8601' => $this->end_date->format(Date::FORMAT_ISO8601), 'NUMBER_COMMENTS' => CommentsService::get_number_comments('calendar', $this->id), 'L_COMMENTS' => CommentsService::get_number_and_lang_comments('calendar', $this->id), 'REPEAT_NUMBER' => $this->content->get_repeat_number(), 'AUTHOR' => $author->get_display_name(), 'AUTHOR_LEVEL_CLASS' => UserService::get_level_class($author->get_level()), 'AUTHOR_GROUP_COLOR' => $author_group_color, 'L_MISSING_PARTICIPANTS' => $missing_participants_number > 1 ? StringVars::replace_vars($lang['calendar.labels.remaining_places'], array('missing_number' => $missing_participants_number)) : $lang['calendar.labels.remaining_place'], 'L_REGISTRATION_DAYS_LEFT' => $registration_days_left > 1 ? StringVars::replace_vars($lang['calendar.labels.remaining_days'], array('days_left' => $registration_days_left)) : $lang['calendar.labels.remaining_day'], 'C_ROOT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY, 'CATEGORY_ID' => $category->get_id(), 'CATEGORY_NAME' => $category->get_name(), 'CATEGORY_COLOR' => $category->get_id() != Category::ROOT_CATEGORY ? $category->get_color() : '', 'U_EDIT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY ? CalendarUrlBuilder::configuration()->rel() : CalendarUrlBuilder::edit_category($category->get_id())->rel(), 'U_SYNDICATION' => SyndicationUrlBuilder::rss('calendar', $category->get_id())->rel(), 'U_AUTHOR_PROFILE' => UserUrlBuilder::profile($author->get_id())->rel(), 'U_LINK' => CalendarUrlBuilder::display_event($category->get_id(), $category->get_rewrited_name(), $this->id, $this->content->get_rewrited_title())->rel(), 'U_EDIT' => CalendarUrlBuilder::edit_event(!$this->parent_id ? $this->id : $this->parent_id)->rel(), 'U_DELETE' => CalendarUrlBuilder::delete_event($this->id)->rel(), 'U_SUSCRIBE' => CalendarUrlBuilder::suscribe_event($this->id)->rel(), 'U_UNSUSCRIBE' => CalendarUrlBuilder::unsuscribe_event($this->id)->rel(), 'U_COMMENTS' => CalendarUrlBuilder::display_event_comments($category->get_id(), $category->get_rewrited_name(), $this->id, $this->content->get_rewrited_title())->rel()); }
$writing_pad_content = WritingPadConfig::load(); $writing_pad_content->set_content($content); WritingPadConfig::save(); AppContext::get_response()->redirect(HOST . REWRITED_SCRIPT); } $tpl = new FileTemplate('admin/admin_index.tpl'); $result = PersistenceContext::get_querier()->select("\n\tSELECT comments.*, topic.*, member.*\n\tFROM " . DB_TABLE_COMMENTS . " comments\n\tLEFT JOIN " . DB_TABLE_COMMENTS_TOPIC . " topic ON comments.id_topic = topic.id_topic\n\tLEFT JOIN " . DB_TABLE_MEMBER . " member ON member.user_id = comments.user_id\n\tORDER BY comments.timestamp DESC\n\tLIMIT 30"); $i = 0; while ($row = $result->fetch()) { if (!empty($row['user_id'])) { $group_color = User::get_group_color($row['groups'], $row['level']); $com_pseudo = '<a href="' . UserUrlBuilder::profile($row['user_id'])->rel() . '" title="' . $row['display_name'] . '" class="' . UserService::get_level_class($row['level']) . '"' . (!empty($group_color) ? ' style="color:' . $group_color . '"' : '') . '>' . TextHelper::wordwrap_html($row['display_name'], 13) . '</a>'; } else { $com_pseudo = '<span style="font-style:italic;">' . (!empty($row['display_name']) ? TextHelper::wordwrap_html($row['display_name'], 13) : $LANG['guest']) . '</span>'; } $tpl->assign_block_vars('comments_list', array('CONTENT' => FormatingHelper::second_parse($row['message']), 'U_PSEUDO' => $com_pseudo, 'U_LINK' => Url::to_rel($row['path']) . '#com' . $row['id'])); $i++; } $result->dispose(); //Advises $advises_form = new HTMLForm('advises_list', '', false); AdminServerSystemReportController::get_advises($advises_form); //Header logo $theme = ThemesManager::get_theme(AppContext::get_current_user()->get_theme()); $customize_interface = $theme->get_customize_interface(); $header_logo_path = $customize_interface->get_header_logo_path(); $tpl->put_all(array('L_QUICK_ACCESS' => $LANG['quick_access'], 'L_ADD_CONTENT' => $LANG['add_content'], 'L_MODULES_MANAGEMENT' => $LANG['modules_management'], 'L_ADD_ARTICLES' => $LANG['add_articles'], 'L_ADD_NEWS' => $LANG['add_news'], 'L_CUSTOMIZE_SITE' => $LANG['customize_site'], 'L_ADD_TEMPLATE' => $LANG['add_template'], 'L_MENUS_MANAGEMENT' => $LANG['menus_management'], 'L_CUSTOMIZE_TEMPLATE' => $LANG['customize_template'], 'L_SITE_MANAGEMENT' => $LANG['site_management'], 'L_GENERAL_CONFIG' => $LANG['general_config'], 'L_EMPTY_CACHE' => $LANG['empty_cache'], 'L_SAVE_DATABASE' => $LANG['save_database'], 'L_WELCOME_TITLE' => $LANG['welcome_title'], 'L_WELCOME_DESC' => $LANG['welcome_desc'], 'WRITING_PAD_CONTENT' => WritingPadConfig::load()->get_content(), 'C_HEADER_LOGO' => !empty($header_logo_path), 'HEADER_LOGO' => Url::to_rel($header_logo_path), 'C_NO_COM' => $i == 0, 'C_UNREAD_ALERTS' => (bool) AdministratorAlertService::get_number_unread_alerts(), 'L_INDEX_ADMIN' => $LANG['administration'], 'L_ADMIN_ALERTS' => $LANG['administrator_alerts'], 'L_NO_UNREAD_ALERT' => $LANG['no_unread_alert'], 'L_UNREAD_ALERT' => $LANG['unread_alerts'], 'L_DISPLAY_ALL_ALERTS' => $LANG['display_all_alerts'], 'L_ADMINISTRATOR_ALERTS' => $LANG['administrator_alerts'], 'L_QUICK_LINKS' => $LANG['quick_links'], 'L_ACTION_USERS_MANAGEMENT' => $LANG['action.members_management'], 'L_ACTION_MENUS_MANAGEMENT' => $LANG['action.menus_management'], 'L_ACTION_MODULES_MANAGEMENT' => $LANG['action.modules_management'], 'L_ACTION_THEMES_MANAGEMENT' => $LANG['action.themes_management'], 'L_ACTION_LANGS_MANAGEMENT' => $LANG['action.langs_management'], 'L_NO_COMMENT' => LangLoader::get_message('no_item_now', 'common'), 'L_LAST_COMMENTS' => $LANG['last_comments'], 'L_VIEW_ALL_COMMENTS' => $LANG['view_all_comments'], 'L_WRITING_PAD' => $LANG['writing_pad'], 'L_STATS' => $LANG['stats'], 'L_USER_ONLINE' => $LANG['user_online'], 'L_USER_IP' => $LANG['user_ip'], 'L_LOCALISATION' => $LANG['localisation'], 'L_LAST_UPDATE' => $LANG['last_update'], 'L_WEBSITE_UPDATES' => $LANG['website_updates'], 'L_BY' => $LANG['by'], 'L_UPDATE' => $LANG['update'], 'L_RESET' => $LANG['reset'], 'ADVISES' => $advises_form->display())); //Liste des personnes en lignes. $result = PersistenceContext::get_querier()->select("SELECT s.user_id, s.ip, s.timestamp, s.location_script, s.location_title, m.display_name, m.groups, m.level\nFROM " . DB_TABLE_SESSIONS . " s\nLEFT JOIN " . DB_TABLE_MEMBER . " m ON s.user_id = m.user_id\nWHERE s.timestamp > :timestamp\nORDER BY s.timestamp DESC", array('timestamp' => time() - SessionsConfig::load()->get_active_session_duration())); while ($row = $result->fetch()) { //On vérifie que la session ne correspond pas à un robot.
private function build_view() { global $LANG, $Bread_crumb; load_module_lang('gallery'); $g_idpics = retrieve(GET, 'id', 0); $g_views = retrieve(GET, 'views', false); $g_notes = retrieve(GET, 'notes', false); $g_sort = retrieve(GET, 'sort', ''); $g_sort = !empty($g_sort) ? 'sort=' . $g_sort : ''; //Récupération du mode d'ordonnement. if (preg_match('`([a-z]+)_([a-z]+)`', $g_sort, $array_match)) { $g_type = $array_match[1]; $g_mode = $array_match[2]; } else { list($g_type, $g_mode) = array('date', 'desc'); } $comments_topic = new GalleryCommentsTopic(); $config = GalleryConfig::load(); $category = $this->get_category(); $categories = GalleryService::get_categories_manager()->get_categories_cache()->get_childrens($category->get_id()); $authorized_categories = GalleryService::get_authorized_categories($category->get_id()); $Gallery = new Gallery(); $nbr_pics = $this->db_querier->count(GallerySetup::$gallery_table, 'WHERE idcat=:idcat AND aprob = 1', array('idcat' => $category->get_id())); $total_cat = count($categories); //On crée une pagination si le nombre de catégories est trop important. $page = AppContext::get_request()->get_getint('p', 1); $pagination = new ModulePagination($page, $total_cat, $config->get_categories_number_per_page()); $pagination->set_url(new Url('/gallery/gallery.php?p=%d&cat=' . $category->get_id() . '&id=' . $g_idpics . '&' . $g_sort)); if ($pagination->current_page_is_empty() && $page > 1) { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } //Colonnes des catégories. $nbr_column_cats = $total_cat > $config->get_columns_number() ? $config->get_columns_number() : $total_cat; $nbr_column_cats = !empty($nbr_column_cats) ? $nbr_column_cats : 1; $column_width_cats = floor(100 / $nbr_column_cats); //Colonnes des images. $nbr_column_pics = $nbr_pics > $config->get_columns_number() ? $config->get_columns_number() : $nbr_pics; $nbr_column_pics = !empty($nbr_column_pics) ? $nbr_column_pics : 1; $column_width_pics = floor(100 / $nbr_column_pics); $is_admin = AppContext::get_current_user()->check_level(User::ADMIN_LEVEL); $is_modo = GalleryAuthorizationsService::check_authorizations($category->get_id())->moderation(); $module_data_path = $this->tpl->get_pictures_data_path(); $rewrite_title = Url::encode_rewrite($category->get_name()); ##### Catégorie disponibles ##### $nbr_cat_displayed = 0; if ($total_cat > 0 && empty($g_idpics)) { $this->tpl->put('C_GALLERY_CATS', true); $j = 0; $result = $this->db_querier->select('SELECT @id_cat:= gallery_cats.id, gallery_cats.*, (SELECT COUNT(*) FROM ' . GallerySetup::$gallery_table . ' WHERE idcat IN ( @id_cat, (SELECT GROUP_CONCAT(id SEPARATOR \',\') FROM ' . GallerySetup::$gallery_cats_table . ' WHERE id_parent = @id_cat), (SELECT GROUP_CONCAT(childs.id SEPARATOR \',\') FROM ' . GallerySetup::$gallery_cats_table . ' parents INNER JOIN ' . GallerySetup::$gallery_cats_table . ' childs ON parents.id = childs.id_parent WHERE parents.id_parent = @id_cat) ) AND aprob = 1 ) AS nbr_pics FROM ' . GallerySetup::$gallery_cats_table . ' gallery_cats WHERE id_parent = :id_category AND id IN :authorized_categories ORDER BY id_parent, c_order LIMIT :number_items_per_page OFFSET :display_from', array('id_category' => $category->get_id(), 'authorized_categories' => $authorized_categories, 'number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from())); while ($row = $result->fetch()) { $category_image = new Url($row['image']); $this->tpl->assign_block_vars('sub_categories_list', array('C_CATEGORY_IMAGE' => !empty($row['image']), 'CATEGORY_NAME' => $row['name'], 'CATEGORY_IMAGE' => $category_image->rel(), 'PICTURES_NUMBER' => sprintf($LANG['nbr_pics_info'], $row['nbr_pics']), 'U_CATEGORY' => GalleryUrlBuilder::get_link_cat($row['id'], $row['name']))); $nbr_cat_displayed++; } $result->dispose(); } $category_description = FormatingHelper::second_parse($category->get_description()); $this->tpl->put_all(array('C_ROOT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY, 'C_CATEGORY_DESCRIPTION' => $category_description, 'C_SUB_CATEGORIES' => $nbr_cat_displayed > 0, 'C_SUBCATEGORIES_PAGINATION' => $pagination->has_several_pages(), 'SUBCATEGORIES_PAGINATION' => $pagination->display(), 'ARRAY_JS' => '', 'NBR_PICS' => 0, 'MAX_START' => 0, 'START_THUMB' => 0, 'END_THUMB' => 0, 'COLUMNS_NUMBER' => $nbr_column_pics, 'CATS_COLUMNS_WIDTH' => $column_width_cats, 'COLUMN_WIDTH_PICS' => $column_width_pics, 'CATEGORY_DESCRIPTION' => $category_description, 'U_EDIT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY ? GalleryUrlBuilder::configuration()->rel() : GalleryUrlBuilder::edit_category($category->get_id())->rel(), 'CAT_ID' => $category->get_id(), 'DISPLAY_MODE' => $config->get_pics_enlargement_mode(), 'GALLERY' => $category->get_id() != Category::ROOT_CATEGORY ? $this->lang['module_title'] . ' - ' . $category->get_name() : $this->lang['module_title'], 'HEIGHT_MAX' => $config->get_mini_max_height(), 'WIDTH_MAX' => $column_width_pics, 'MODULE_DATA_PATH' => $module_data_path, 'L_APROB' => $LANG['aprob'], 'L_UNAPROB' => $LANG['unaprob'], 'L_FILE_FORBIDDEN_CHARS' => $LANG['file_forbidden_chars'], 'L_TOTAL_IMG' => $category->get_id() != Category::ROOT_CATEGORY ? sprintf($LANG['total_img_cat'], $nbr_pics) : '', 'L_ADD_IMG' => $LANG['add_pic'], 'L_GALLERY' => $this->lang['module_title'], 'L_CATEGORIES' => $category->get_id_parent() >= 0 ? $LANG['sub_album'] : $LANG['album'], 'L_NAME' => $LANG['name'], 'L_EDIT' => LangLoader::get_message('edit', 'common'), 'L_MOVETO' => $LANG['moveto'], 'L_DELETE' => LangLoader::get_message('delete', 'common'), 'L_SUBMIT' => $LANG['submit'], 'L_ALREADY_VOTED' => $LANG['already_vote'], 'L_ORDER_BY' => LangLoader::get_message('sort_by', 'common') . (isset($LANG[$g_type]) ? ' ' . strtolower($LANG[$g_type]) : ''), 'L_DIRECTION' => $LANG['direction'], 'L_DISPLAY' => LangLoader::get_message('display', 'common'), 'U_INDEX' => url('.php'), 'U_BEST_VIEWS' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?views=1&cat=' . $category->get_id(), '-' . $category->get_id() . '.php?views=1'), 'U_BEST_NOTES' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?notes=1&cat=' . $category->get_id(), '-' . $category->get_id() . '.php?notes=1'), 'U_ASC' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?cat=' . $category->get_id() . '&sort=' . $g_type . '_' . 'asc', '-' . $category->get_id() . '.php?sort=' . $g_type . '_' . 'asc'), 'U_DESC' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?cat=' . $category->get_id() . '&sort=' . $g_type . '_' . 'desc', '-' . $category->get_id() . '.php?sort=' . $g_type . '_' . 'desc'), 'U_ORDER_BY_NAME' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?sort=name_desc&cat=' . $category->get_id(), '-' . $category->get_id() . '+' . $rewrite_title . '.php?sort=name_desc'), 'U_ORDER_BY_DATE' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?sort=date_desc&cat=' . $category->get_id(), '-' . $category->get_id() . '+' . $rewrite_title . '.php?sort=date_desc'), 'U_ORDER_BY_VIEWS' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?sort=views_desc&cat=' . $category->get_id(), '-' . $category->get_id() . '+' . $rewrite_title . '.php?sort=views_desc'), 'U_ORDER_BY_NOTES' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?sort=notes_desc&cat=' . $category->get_id(), '-' . $category->get_id() . '+' . $rewrite_title . '.php?sort=notes_desc'), 'U_ORDER_BY_COM' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?sort=com_desc&cat=' . $category->get_id(), '-' . $category->get_id() . '+' . $rewrite_title . '.php?sort=com_desc'), 'L_BEST_VIEWS' => $LANG['best_views'], 'L_BEST_NOTES' => $LANG['best_notes'], 'L_ASC' => $LANG['asc'], 'L_DESC' => $LANG['desc'], 'L_DATE' => LangLoader::get_message('date', 'date-common'), 'L_VIEWS' => $LANG['views'], 'L_NOTES' => LangLoader::get_message('notes', 'common'), 'L_COM' => $LANG['com_s'])); ##### Affichage des photos ##### if ($nbr_pics > 0) { switch ($g_type) { case 'name': $sort_type = 'g.name'; break; case 'date': $sort_type = 'g.timestamp'; break; case 'views': $sort_type = 'g.views'; break; case 'notes': $sort_type = 'notes.average_notes'; break; case 'com': $sort_type = 'com.number_comments'; break; default: $sort_type = 'g.timestamp'; } switch ($g_mode) { case 'desc': $sort_mode = 'DESC'; break; case 'asc': $sort_mode = 'ASC'; break; default: $sort_mode = 'DESC'; } $g_sql_sort = ' ORDER BY ' . $sort_type . ' ' . $sort_mode; if ($g_views) { $g_sql_sort = ' ORDER BY g.views DESC'; } elseif ($g_notes) { $g_sql_sort = ' ORDER BY notes.average_notes DESC'; } $this->tpl->put('C_GALLERY_PICS', true); //Affichage d'une photo demandée. if (!empty($g_idpics)) { $info_pics = $this->db_querier->select_single_row_query("SELECT g.*, m.display_name, m.groups, m.level, notes.average_notes, notes.number_notes, note.note\n\t\t\t\t\tFROM " . GallerySetup::$gallery_table . " g\n\t\t\t\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = g.user_id\n\t\t\t\t\tLEFT JOIN " . DB_TABLE_COMMENTS_TOPIC . " com ON com.id_in_module = g.id AND com.module_id = 'gallery'\n\t\t\t\t\tLEFT JOIN " . DB_TABLE_AVERAGE_NOTES . " notes ON notes.id_in_module = g.id AND notes.module_name = 'gallery'\n\t\t\t\t\tLEFT JOIN " . DB_TABLE_NOTE . " note ON note.id_in_module = g.id AND note.module_name = 'gallery' AND note.user_id = :user_id\n\t\t\t\t\tWHERE g.idcat = :idcat AND g.id = :id AND g.aprob = 1\n\t\t\t\t\t" . $g_sql_sort, array('user_id' => AppContext::get_current_user()->get_id(), 'idcat' => $category->get_id(), 'id' => $g_idpics)); if (!empty($info_pics['id'])) { $Bread_crumb->add(stripslashes($info_pics['name']), PATH_TO_ROOT . '/gallery/gallery' . url('.php?cat=' . $info_pics['idcat'] . '&id=' . $info_pics['id'], '-' . $info_pics['idcat'] . '-' . $info_pics['id'] . '.php')); //Affichage miniatures. $id_previous = 0; $id_next = 0; $nbr_pics_display_before = floor(($nbr_column_pics - 1) / 2); //Nombres de photos de chaque côté de la miniature de la photo affichée. $nbr_pics_display_after = $nbr_column_pics - 1 - floor($nbr_pics_display_before); list($i, $reach_pics_pos, $pos_pics, $thumbnails_before, $thumbnails_after, $start_thumbnails, $end_thumbnails) = array(0, false, 0, 0, 0, $nbr_pics_display_before, $nbr_pics_display_after); $array_pics = array(); $array_js = 'var array_pics = new Array();'; $result = $this->db_querier->select("SELECT g.id, g.idcat, g.path\n\t\t\t\t\tFROM " . GallerySetup::$gallery_table . " g\n\t\t\t\t\tWHERE g.idcat = :idcat AND g.aprob = 1\n\t\t\t\t\t" . $g_sql_sort, array('idcat' => $category->get_id())); while ($row = $result->fetch()) { //Si la miniature n'existe pas (cache vidé) on regénère la miniature à partir de l'image en taille réelle. if (!file_exists(PATH_TO_ROOT . '/gallery/pics/thumbnails/' . $row['path'])) { $Gallery->Resize_pics(PATH_TO_ROOT . '/gallery/pics/' . $row['path']); } //Redimensionnement + création miniature //Affichage de la liste des miniatures sous l'image. $array_pics[] = '<td class="center" style="height:' . ($config->get_mini_max_height() + 16) . 'px"><span id="thumb' . $i . '"><a href="gallery' . url('.php?cat=' . $row['idcat'] . '&id=' . $row['id'] . '&sort=' . $g_sort, '-' . $row['idcat'] . '-' . $row['id'] . '.php?sort=' . $g_sort) . '#pics_max' . '"><img src="pics/thumbnails/' . $row['path'] . '" alt="' . $row['path'] . '" /></a></span></td>'; if ($row['id'] == $g_idpics) { $reach_pics_pos = true; $pos_pics = $i; } else { if (!$reach_pics_pos) { $thumbnails_before++; $id_previous = $row['id']; } else { $thumbnails_after++; if (empty($id_next)) { $id_next = $row['id']; } } } $array_js .= 'array_pics[' . $i . '] = new Array();' . "\n"; $array_js .= 'array_pics[' . $i . '][\'link\'] = \'' . GalleryUrlBuilder::get_link_item($row['idcat'], $row['id']) . '#pics_max' . "';\n"; $array_js .= 'array_pics[' . $i . '][\'path\'] = \'' . $row['path'] . "';\n"; $i++; } $result->dispose(); $activ_note = $config->is_notation_enabled() && AppContext::get_current_user()->check_level(User::MEMBER_LEVEL); if ($activ_note) { //Affichage notation. $notation = new Notation(); $notation->set_module_name('gallery'); $notation->set_id_in_module($info_pics['id']); $notation->set_notation_scale($config->get_notation_scale()); $notation->set_number_notes($info_pics['number_notes']); $notation->set_average_notes($info_pics['average_notes']); $notation->set_user_already_noted(!empty($info_pics['note'])); } if ($thumbnails_before < $nbr_pics_display_before) { $end_thumbnails += $nbr_pics_display_before - $thumbnails_before; } if ($thumbnails_after < $nbr_pics_display_after) { $start_thumbnails += $nbr_pics_display_after - $thumbnails_after; } $html_protected_name = $info_pics['name']; $comments_topic->set_id_in_module($info_pics['id']); $comments_topic->set_url(new Url('/gallery/gallery.php?cat=' . $category->get_id() . '&id=' . $g_idpics . '&com=0')); //Liste des catégories. $search_category_children_options = new SearchCategoryChildrensOptions(); $search_category_children_options->add_authorizations_bits(Category::READ_AUTHORIZATIONS); $search_category_children_options->add_authorizations_bits(Category::WRITE_AUTHORIZATIONS); $categories_tree = GalleryService::get_categories_manager()->get_select_categories_form_field($info_pics['id'] . 'cat', '', $info_pics['idcat'], $search_category_children_options); $method = new ReflectionMethod('AbstractFormFieldChoice', 'get_options'); $method->setAccessible(true); $categories_tree_options = $method->invoke($categories_tree); $cat_list = ''; foreach ($categories_tree_options as $option) { $cat_list .= $option->display()->render(); } $group_color = User::get_group_color($info_pics['groups'], $info_pics['level']); //Affichage de l'image et de ses informations. $this->tpl->put_all(array('C_GALLERY_PICS_MAX' => true, 'C_GALLERY_PICS_MODO' => $is_modo, 'C_AUTHOR_DISPLAYED' => $config->is_author_displayed(), 'C_VIEWS_COUNTER_ENABLED' => $config->is_views_counter_enabled(), 'C_TITLE_ENABLED' => $config->is_title_enabled(), 'C_COMMENTS_ENABLED' => $config->are_comments_enabled(), 'C_NOTATION_ENABLED' => $config->is_notation_enabled(), 'ID' => $info_pics['id'], 'NAME' => '<span id="fi_' . $info_pics['id'] . '">' . stripslashes($info_pics['name']) . '</span> <span id="fi' . $info_pics['id'] . '"></span>', 'POSTOR' => '<a class="small ' . UserService::get_level_class($info_pics['level']) . '"' . (!empty($group_color) ? ' style="color:' . $group_color . '"' : '') . ' href="' . UserUrlBuilder::profile($info_pics['user_id'])->rel() . '">' . $info_pics['display_name'] . '</a>', 'DATE' => Date::to_format($info_pics['timestamp'], Date::FORMAT_DAY_MONTH_YEAR), 'VIEWS' => $info_pics['views'] + 1, 'DIMENSION' => $info_pics['width'] . ' x ' . $info_pics['height'], 'SIZE' => NumberHelper::round($info_pics['weight'] / 1024, 1), 'L_COMMENTS' => CommentsService::get_number_and_lang_comments('gallery', $info_pics['id']), 'KERNEL_NOTATION' => $activ_note ? NotationService::display_active_image($notation) : '', 'COLSPAN' => $config->get_columns_number() + 2, 'CAT' => $cat_list, 'RENAME' => $html_protected_name, 'RENAME_CUT' => $html_protected_name, 'IMG_APROB' => $info_pics['aprob'] == 1 ? 'fa fa-eye-slash' : 'fa fa-eye', 'ARRAY_JS' => $array_js, 'NBR_PICS' => $i - 1, 'MAX_START' => $i - 1 - $nbr_column_pics, 'START_THUMB' => $pos_pics - $start_thumbnails > 0 ? $pos_pics - $start_thumbnails : 0, 'END_THUMB' => $pos_pics + $end_thumbnails, 'L_KB' => LangLoader::get_message('unit.kilobytes', 'common'), 'L_INFORMATIONS' => $LANG['informations'], 'L_NAME' => $LANG['name'], 'L_POSTOR' => $LANG['postor'], 'L_VIEWS' => $LANG['views'], 'L_ADD_ON' => $LANG['add_on'], 'L_DIMENSION' => $LANG['dimension'], 'L_SIZE' => $LANG['size'], 'L_NOTE' => LangLoader::get_message('note', 'common'), 'L_COM' => $LANG['com'], 'L_EDIT' => LangLoader::get_message('edit', 'common'), 'L_APROB_IMG' => $info_pics['aprob'] == 1 ? $LANG['unaprob'] : $LANG['aprob'], 'L_THUMBNAILS' => $LANG['thumbnails'], 'U_DEL' => url('gallery.php?del=' . $info_pics['id'] . '&token=' . AppContext::get_session()->get_token() . '&cat=' . $category->get_id()), 'U_MOVE' => url('gallery.php?id=' . $info_pics['id'] . '&token=' . AppContext::get_session()->get_token() . '&move=\' + this.options[this.selectedIndex].value'), 'U_PREVIOUS' => $pos_pics > 0 ? '<a href="' . GalleryUrlBuilder::get_link_item($category->get_id(), $id_previous) . '#pics_max"><i class="fa fa-arrow-left fa-2x"></i></a> <a href="' . GalleryUrlBuilder::get_link_item($category->get_id(), $id_previous) . '#pics_max">' . $LANG['previous'] . '</a>' : '', 'U_NEXT' => $pos_pics < $i - 1 ? '<a href="' . GalleryUrlBuilder::get_link_item($category->get_id(), $id_next) . '#pics_max">' . $LANG['next'] . '</a> <a href="' . GalleryUrlBuilder::get_link_item($category->get_id(), $id_next) . '#pics_max"><i class="fa fa-arrow-right fa-2x"></i></a>' : '', 'U_LEFT_THUMBNAILS' => $pos_pics - $start_thumbnails > 0 ? '<span id="display_left"><a href="javascript:display_thumbnails(\'left\')"><i class="fa fa-arrow-left fa-2x"></i></a></span>' : '<span id="display_left"></span>', 'U_RIGHT_THUMBNAILS' => $pos_pics - $start_thumbnails <= $i - 1 - $nbr_column_pics ? '<span id="display_right"><a href="javascript:display_thumbnails(\'right\')"><i class="fa fa-arrow-right fa-2x"></i></a></span>' : '<span id="display_right"></span>', 'U_COMMENTS' => GalleryUrlBuilder::get_link_item($info_pics['idcat'], $info_pics['id'], 0, $g_sort) . '#comments-list', 'U_IMG_MAX' => 'show_pics.php?id=' . $info_pics['id'] . '&cat=' . $info_pics['idcat'])); //Affichage de la liste des miniatures sous l'image. $i = 0; foreach ($array_pics as $pics) { if ($i >= $pos_pics - $start_thumbnails && $i <= $pos_pics + $end_thumbnails) { $this->tpl->assign_block_vars('list_preview_pics', array('PICS' => $pics)); } $i++; } //Commentaires if (AppContext::get_request()->get_getint('com', 0) == 0 && $config->are_comments_enabled()) { $this->tpl->put_all(array('COMMENTS' => CommentsService::display($comments_topic)->render())); } } } else { $sort = retrieve(GET, 'sort', ''); //On crée une pagination si le nombre de photos est trop important. $page = AppContext::get_request()->get_getint('pp', 1); $pagination = new ModulePagination($page, $nbr_pics, $config->get_pics_number_per_page()); $pagination->set_url(new Url('/gallery/gallery.php?pp=%d' . (!empty($sort) ? '&sort=' . $sort : '') . '&cat=' . $category->get_id())); if ($pagination->current_page_is_empty() && $page > 1) { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } $this->tpl->put_all(array('C_GALLERY_MODO' => $is_modo, 'C_PICTURE_NAME_DISPLAYED' => $config->is_title_enabled(), 'C_AUTHOR_DISPLAYED' => $config->is_author_displayed(), 'C_VIEWS_COUNTER_ENABLED' => $config->is_views_counter_enabled(), 'C_COMMENTS_ENABLED' => $config->are_comments_enabled(), 'C_PAGINATION' => $pagination->has_several_pages(), 'PAGINATION' => $pagination->display(), 'L_EDIT' => LangLoader::get_message('edit', 'common'), 'L_VIEW' => $LANG['view'], 'L_VIEWS' => $LANG['views'])); $is_connected = AppContext::get_current_user()->check_level(User::MEMBER_LEVEL); $j = 0; $result = $this->db_querier->select("SELECT g.id, g.idcat, g.name, g.path, g.timestamp, g.aprob, g.width, g.height, g.user_id, g.views, g.aprob, m.display_name, m.groups, m.level, notes.average_notes, notes.number_notes, note.note\n\t\t\t\tFROM " . GallerySetup::$gallery_table . " g\n\t\t\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = g.user_id\n\t\t\t\tLEFT JOIN " . DB_TABLE_COMMENTS_TOPIC . " com ON com.id_in_module = g.id AND com.module_id = 'gallery'\n\t\t\t\tLEFT JOIN " . DB_TABLE_AVERAGE_NOTES . " notes ON notes.id_in_module = g.id AND notes.module_name = 'gallery'\n\t\t\t\tLEFT JOIN " . DB_TABLE_NOTE . " note ON note.id_in_module = g.id AND note.module_name = 'gallery' AND note.user_id = :user_id\n\t\t\t\tWHERE g.idcat = :idcat AND g.aprob = 1\n\t\t\t\t" . $g_sql_sort . "\n\t\t\t\tLIMIT :number_items_per_page OFFSET :display_from", array('user_id' => AppContext::get_current_user()->get_id(), 'idcat' => $category->get_id(), 'number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from())); while ($row = $result->fetch()) { //Si la miniature n'existe pas (cache vidé) on regénère la miniature à partir de l'image en taille réelle. if (!file_exists(PATH_TO_ROOT . '/gallery/pics/thumbnails/' . $row['path'])) { $Gallery->Resize_pics(PATH_TO_ROOT . '/gallery/pics/' . $row['path']); } //Redimensionnement + création miniature $onclick = ''; //Affichage de l'image en grand. if ($config->get_pics_enlargement_mode() == GalleryConfig::FULL_SCREEN) { $display_link = PATH_TO_ROOT . '/gallery/pics/' . $row['path'] . '" onmousedown="increment_view(' . $row['id'] . ');" title="' . str_replace('"', '', stripslashes($row['name'])); } elseif ($config->get_pics_enlargement_mode() == GalleryConfig::POPUP) { $onclick = 'increment_view(' . $row['id'] . ');display_pics_popup(\'' . PATH_TO_ROOT . '/gallery/show_pics' . url('.php?id=' . $row['id'] . '&cat=' . $row['idcat']) . '\', \'' . $row['width'] . '\', \'' . $row['height'] . '\');return false;'; $display_link = ''; } elseif ($config->get_pics_enlargement_mode() == GalleryConfig::RESIZE) { $onclick = 'increment_view(' . $row['id'] . ');display_pics(' . $row['id'] . ', \'' . PATH_TO_ROOT . '/gallery/show_pics' . url('.php?id=' . $row['id'] . '&cat=' . $row['idcat']) . '\');return false;'; $display_link = ''; } else { $onclick = true; $display_link = url('gallery.php?cat=' . $row['idcat'] . '&id=' . $row['id'], 'gallery-' . $row['idcat'] . '-' . $row['id'] . '.php') . '#pics_max'; } //Liste des catégories. $search_category_children_options = new SearchCategoryChildrensOptions(); $search_category_children_options->add_authorizations_bits(Category::READ_AUTHORIZATIONS); $search_category_children_options->add_authorizations_bits(Category::WRITE_AUTHORIZATIONS); $categories_tree = GalleryService::get_categories_manager()->get_select_categories_form_field($row['id'] . 'cat', '', $row['idcat'], $search_category_children_options); $method = new ReflectionMethod('AbstractFormFieldChoice', 'get_options'); $method->setAccessible(true); $categories_tree_options = $method->invoke($categories_tree); $cat_list = ''; foreach ($categories_tree_options as $option) { $cat_list .= $option->display()->render(); } $notation = new Notation(); $notation->set_module_name('gallery'); $notation->set_notation_scale($config->get_notation_scale()); $notation->set_id_in_module($row['id']); $notation->set_number_notes($row['number_notes']); $notation->set_average_notes($row['average_notes']); $notation->set_user_already_noted(!empty($row['note'])); $group_color = User::get_group_color($row['groups'], $row['level']); $comments_topic->set_id_in_module($row['id']); $html_protected_name = $row['name']; $this->tpl->assign_block_vars('pics_list', array('C_IMG_APROB' => $row['aprob'] == 1, 'C_OPEN_TR' => is_int($j++ / $nbr_column_pics), 'C_CLOSE_TR' => is_int($j / $nbr_column_pics), 'ID' => $row['id'], 'APROB' => $row['aprob'], 'PATH' => $row['path'], 'NAME' => stripslashes($row['name']), 'SHORT_NAME' => TextHelper::wordwrap_html(stripslashes($row['name']), 22, ' '), 'POSTOR' => $LANG['by'] . (!empty($row['display_name']) ? ' <a class="small ' . UserService::get_level_class($row['level']) . '"' . (!empty($group_color) ? ' style="color:' . $group_color . '"' : '') . ' href="' . UserUrlBuilder::profile($row['user_id'])->rel() . '">' . $row['display_name'] . '</a>' : ' ' . $LANG['guest']), 'VIEWS' => $row['views'], 'L_VIEWS' => $row['views'] > 1 ? $LANG['views'] : $LANG['view'], 'L_COMMENTS' => CommentsService::get_number_and_lang_comments('gallery', $row['id']), 'KERNEL_NOTATION' => $config->is_notation_enabled() && $is_connected ? NotationService::display_active_image($notation) : NotationService::display_static_image($notation), 'CAT' => $cat_list, 'ONCLICK' => $onclick, 'RENAME' => $html_protected_name, 'RENAME_CUT' => $html_protected_name, 'L_APROB_IMG' => $row['aprob'] == 1 ? $LANG['unaprob'] : $LANG['aprob'], 'U_PICTURE_LINK' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?cat=' . $row['idcat'] . '&id=' . $row['id'], '-' . $row['idcat'] . '-' . $row['id'] . '.php'), 'U_PICTURE' => PATH_TO_ROOT . '/gallery/pics/thumbnails/' . $row['path'], 'U_DEL' => url('gallery.php?del=' . $row['id'] . '&token=' . AppContext::get_session()->get_token() . '&cat=' . $category->get_id()), 'U_MOVE' => url('gallery.php?id=' . $row['id'] . '&token=' . AppContext::get_session()->get_token() . '&move=\' + this.options[this.selectedIndex].value'), 'U_DISPLAY' => $display_link, 'U_COMMENTS' => PATH_TO_ROOT . '/gallery/gallery' . url('.php?cat=' . $row['idcat'] . '&id=' . $row['id'] . '&com=0', '-' . $row['idcat'] . '-' . $row['id'] . '.php?com=0') . '#comments-list')); } $result->dispose(); //Création des cellules du tableau si besoin est. while (!is_int($j / $nbr_column_pics)) { $this->tpl->assign_block_vars('end_table', array('TD_END' => '<td class="td-end" style="width:' . $column_width_pics . '%"> </td>', 'TR_END' => is_int(++$j / $nbr_column_pics) ? '</tr>' : '')); } } } }
private function build_view(HTTPRequestCustom $request) { $now = new Date(); $authorized_categories = DownloadService::get_authorized_categories($this->get_category()->get_id()); $mode = $request->get_getstring('sort', DownloadUrlBuilder::DEFAULT_SORT_MODE); $field = $request->get_getstring('field', DownloadUrlBuilder::DEFAULT_SORT_FIELD); $page = AppContext::get_request()->get_getint('page', 1); $subcategories_page = AppContext::get_request()->get_getint('subcategories_page', 1); $subcategories_number = count(DownloadService::get_categories_manager()->get_categories_cache()->get_childrens($this->get_category()->get_id())); $subcategories_pagination = $this->get_subcategories_pagination($subcategories_number, $this->config->get_categories_number_per_page(), $field, $mode, $page, $subcategories_page); //Children categories $result = PersistenceContext::get_querier()->select('SELECT @id_cat:= download_cats.id, download_cats.*, (SELECT COUNT(*) FROM ' . DownloadSetup::$download_table . ' WHERE id_category IN ( @id_cat, (SELECT GROUP_CONCAT(id SEPARATOR \',\') FROM ' . DownloadSetup::$download_cats_table . ' WHERE id_parent = @id_cat), (SELECT GROUP_CONCAT(childs.id SEPARATOR \',\') FROM ' . DownloadSetup::$download_cats_table . ' parents INNER JOIN ' . DownloadSetup::$download_cats_table . ' childs ON parents.id = childs.id_parent WHERE parents.id_parent = @id_cat) ) AND (approbation_type = 1 OR (approbation_type = 2 AND start_date < :timestamp_now AND (end_date > :timestamp_now OR end_date = 0))) ) AS downloadfiles_number FROM ' . DownloadSetup::$download_cats_table . ' download_cats WHERE id_parent = :id_category AND id IN :authorized_categories ORDER BY id_parent, c_order LIMIT :number_items_per_page OFFSET :display_from', array('timestamp_now' => $now->get_timestamp(), 'id_category' => $this->category->get_id(), 'authorized_categories' => $authorized_categories, 'number_items_per_page' => $subcategories_pagination->get_number_items_per_page(), 'display_from' => $subcategories_pagination->get_display_from())); $nbr_cat_displayed = 0; while ($row = $result->fetch()) { $category_image = new Url($row['image']); $this->tpl->assign_block_vars('sub_categories_list', array('C_CATEGORY_IMAGE' => !empty($row['image']), 'C_MORE_THAN_ONE_DOWNLOADFILE' => $row['downloadfiles_number'] > 1, 'CATEGORY_NAME' => $row['name'], 'CATEGORY_IMAGE' => $category_image->rel(), 'DOWNLOADFILES_NUMBER' => $row['downloadfiles_number'], 'U_CATEGORY' => DownloadUrlBuilder::display_category($row['id'], $row['rewrited_name'])->rel())); $nbr_cat_displayed++; } $result->dispose(); $nbr_column_cats = $nbr_cat_displayed > $this->config->get_columns_number_per_line() ? $this->config->get_columns_number_per_line() : $nbr_cat_displayed; $nbr_column_cats = !empty($nbr_column_cats) ? $nbr_column_cats : 1; $cats_columns_width = floor(100 / $nbr_column_cats); $condition = 'WHERE id_category = :id_category AND (approbation_type = 1 OR (approbation_type = 2 AND start_date < :timestamp_now AND (end_date > :timestamp_now OR end_date = 0)))'; $parameters = array('id_category' => $this->get_category()->get_id(), 'timestamp_now' => $now->get_timestamp()); $pagination = $this->get_pagination($condition, $parameters, $field, $mode, $page, $subcategories_page); $sort_mode = $mode == 'asc' ? 'ASC' : 'DESC'; switch ($field) { case 'name': $sort_field = DownloadFile::SORT_ALPHABETIC; break; case 'download': $sort_field = DownloadFile::SORT_NUMBER_DOWNLOADS; break; case 'com': $sort_field = DownloadFile::SORT_NUMBER_COMMENTS; break; case 'note': $sort_field = DownloadFile::SORT_NOTATION; break; case 'author': $sort_field = DownloadFile::SORT_AUTHOR; break; case 'date': $sort_field = DownloadFile::SORT_DATE; break; default: $sort_field = DownloadFile::SORT_UPDATED_DATE; break; } $result = PersistenceContext::get_querier()->select('SELECT download.*, member.*, com.number_comments, notes.average_notes, notes.number_notes, note.note FROM ' . DownloadSetup::$download_table . ' download LEFT JOIN ' . DB_TABLE_MEMBER . ' member ON member.user_id = download.author_user_id LEFT JOIN ' . DB_TABLE_COMMENTS_TOPIC . ' com ON com.id_in_module = download.id AND com.module_id = \'download\' LEFT JOIN ' . DB_TABLE_AVERAGE_NOTES . ' notes ON notes.id_in_module = download.id AND notes.module_name = \'download\' LEFT JOIN ' . DB_TABLE_NOTE . ' note ON note.id_in_module = download.id AND note.module_name = \'download\' AND note.user_id = :user_id ' . $condition . ' ORDER BY ' . $sort_field . ' ' . $sort_mode . ' LIMIT :number_items_per_page OFFSET :display_from', array_merge($parameters, array('user_id' => AppContext::get_current_user()->get_id(), 'number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from()))); $category_description = FormatingHelper::second_parse($this->get_category()->get_description()); $this->tpl->put_all(array('C_FILES' => $result->get_rows_count() > 0, 'C_MORE_THAN_ONE_FILE' => $result->get_rows_count() > 1, 'C_CATEGORY_DISPLAYED_SUMMARY' => $this->config->is_category_displayed_summary(), 'C_CATEGORY_DISPLAYED_TABLE' => $this->config->is_category_displayed_table(), 'C_CATEGORY_DESCRIPTION' => !empty($category_description), 'C_AUTHOR_DISPLAYED' => $this->config->is_author_displayed(), 'C_COMMENTS_ENABLED' => $this->config->are_comments_enabled(), 'C_NOTATION_ENABLED' => $this->config->is_notation_enabled(), 'C_MODERATION' => DownloadAuthorizationsService::check_authorizations($this->get_category()->get_id())->moderation(), 'C_PAGINATION' => $pagination->has_several_pages(), 'C_CATEGORY' => true, 'C_ROOT_CATEGORY' => $this->get_category()->get_id() == Category::ROOT_CATEGORY, 'C_HIDE_NO_ITEM_MESSAGE' => $this->get_category()->get_id() == Category::ROOT_CATEGORY && ($nbr_cat_displayed != 0 || !empty($category_description)), 'C_SUB_CATEGORIES' => $nbr_cat_displayed > 0, 'C_SUBCATEGORIES_PAGINATION' => $subcategories_pagination->has_several_pages(), 'SUBCATEGORIES_PAGINATION' => $subcategories_pagination->display(), 'CATS_COLUMNS_WIDTH' => $cats_columns_width, 'PAGINATION' => $pagination->display(), 'TABLE_COLSPAN' => 4 + (int) $this->config->are_comments_enabled() + (int) $this->config->is_notation_enabled(), 'ID_CAT' => $this->get_category()->get_id(), 'CATEGORY_NAME' => $this->get_category()->get_name(), 'CATEGORY_IMAGE' => $this->get_category()->get_image()->rel(), 'CATEGORY_DESCRIPTION' => $category_description, 'U_EDIT_CATEGORY' => $this->get_category()->get_id() == Category::ROOT_CATEGORY ? DownloadUrlBuilder::configuration()->rel() : DownloadUrlBuilder::edit_category($this->get_category()->get_id())->rel())); while ($row = $result->fetch()) { $downloadfile = new DownloadFile(); $downloadfile->set_properties($row); $keywords = $downloadfile->get_keywords(); $has_keywords = count($keywords) > 0; $this->tpl->assign_block_vars('downloadfiles', array_merge($downloadfile->get_array_tpl_vars(), array('C_KEYWORDS' => $has_keywords))); if ($has_keywords) { $this->build_keywords_view($keywords); } } $result->dispose(); $this->build_sorting_form($field, $mode); }