function get_feed_data_struct($idcat = 0, $name = '') { global $Cache, $Sql, $LANG, $CONFIG, $CONFIG_NEWS; import('content/syndication/feed_data'); import('util/date'); import('util/url'); load_module_lang('news'); $data = new FeedData(); $data->set_title($LANG['xml_news_desc'] . ' ' . $CONFIG['server_name']); $data->set_date(new Date()); $data->set_link(new Url('/syndication.php?m=news&cat=' . $idcat)); $data->set_host(HOST); $data->set_desc($LANG['xml_news_desc'] . ' ' . $CONFIG['server_name']); $data->set_lang($LANG['xml_lang']); $Cache->load('news'); $result = $Sql->query_while("SELECT id, title, contents, timestamp, img\n FROM " . PREFIX . "news\n WHERE visible = 1\n ORDER BY timestamp DESC" . $Sql->limit(0, 2 * $CONFIG_NEWS['pagination_news']), __LINE__, __FILE__); while ($row = $Sql->fetch_assoc($result)) { $item = new FeedItem(); $item->set_title($row['title']); $link = new Url('/news/news' . url('.php?id=' . $row['id'], '-0-' . $row['id'] . '+' . url_encode_rewrite($row['title']) . '.php')); $item->set_link($link); $item->set_guid($link); $item->set_desc(second_parse($row['contents'])); $item->set_date(new Date(DATE_TIMESTAMP, TIMEZONE_SYSTEM, $row['timestamp'])); $item->set_image_url($row['img']); $data->add_item($item); } $Sql->query_close($result); 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; } }
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 (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; } }
function get_feed_data_struct($idcat = 0, $name = '') { if (GalleryService::get_categories_manager()->get_categories_cache()->category_exists($idcat)) { $category = GalleryService::get_categories_manager()->get_categories_cache()->get_category($idcat); $config = GalleryConfig::load(); $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', 'gallery'); $data = new FeedData(); $data->set_title($feed_module_name . ' - ' . $site_name); $data->set_date(new Date()); $data->set_link(SyndicationUrlBuilder::rss('gallery', $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 = GalleryService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true); $ids_categories = array_keys($categories); $results = PersistenceContext::get_querier()->select('SELECT * FROM ' . GallerySetup::$gallery_table . ' WHERE idcat IN :ids_categories ORDER BY timestamp DESC LIMIT :pics_number_per_page', array('ids_categories' => $ids_categories, 'pics_number_per_page' => $config->get_pics_number_per_page())); foreach ($results as $row) { $link = TextHelper::htmlentities(GalleryUrlBuilder::get_link_item($row['idcat'], $row['id'])); $item = new FeedItem(); $item->set_title($row['name']); $item->set_link($link); $item->set_guid($link); $item->set_date(new Date($row['timestamp'], Timezone::SERVER_TIMEZONE)); $item->set_image_url(Url::to_rel('/gallery/pics/' . $row['path'])); $item->set_auth(GalleryService::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) { global $Cache, $Sql, $LANG, $MEDIA_LANG, $CONFIG, $MEDIA_CONFIG, $MEDIA_CATS; $Cache->load('media'); load_module_lang('media'); require_once PATH_TO_ROOT . '/media/media_constant.php'; require_once PATH_TO_ROOT . '/media/media_cats.class.php'; import('content/syndication/feed_data'); import('util/date'); import('util/url'); $data = new FeedData(); $data->set_title($MEDIA_LANG['xml_media_desc']); $data->set_date(new Date()); $data->set_link(new Url('/syndication.php?m=media&cat=' . $idcat)); $data->set_host(HOST); $data->set_desc($MEDIA_LANG['xml_media_desc']); $data->set_lang($LANG['xml_lang']); $data->set_auth_bit(MEDIA_AUTH_READ); $cats = new MediaCats(); $children_cats = array(); $cats->build_children_id_list($idcat, $children_cats, RECURSIVE_EXPLORATION, ADD_THIS_CATEGORY_IN_LIST); $result = $Sql->query_while("SELECT id, idcat, name, contents, timestamp FROM " . PREFIX . "media WHERE infos = '" . MEDIA_STATUS_APROBED . "' AND idcat IN (" . implode($children_cats, ',') . " ) ORDER BY timestamp DESC" . $Sql->limit(0, $MEDIA_CONFIG['pagin']), __LINE__, __FILE__); while ($row = $Sql->fetch_assoc($result)) { $item = new FeedItem(); $link = new Url('/media/media' . url('.php?id=' . $row['id'], '-' . $row['id'] . '+' . url_encode_rewrite($row['name']) . '.php')); $item->set_title($row['name']); $item->set_link($link); $item->set_guid($link); $item->set_desc(second_parse($row['contents'])); $item->set_date(new Date(DATE_TIMESTAMP, TIMEZONE_SYSTEM, $row['timestamp'])); $item->set_image_url($MEDIA_CATS[$row['idcat']]['image']); $item->set_auth($cats->compute_heritated_auth($row['idcat'], MEDIA_AUTH_READ, AUTH_PARENT_PRIORITY)); $data->add_item($item); } $Sql->query_close($result); 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; }
function get_feed_data_struct($idcat = 0, $name = '') { global $Cache, $Sql, $LANG, $CONFIG, $CONFIG_FORUM, $CAT_FORUM, $User; $_idcat = $idcat; require_once PATH_TO_ROOT . '/forum/forum_init_auth_cats.php'; $idcat = $_idcat; $data = new FeedData(); import('content/syndication/feed_data'); import('util/date'); import('util/url'); $data->set_title($LANG['xml_forum_desc']); $data->set_date(new Date()); $data->set_link(new Url('/syndication.php?m=forum&cat=' . $_idcat)); $data->set_host(HOST); $data->set_desc($LANG['xml_forum_desc']); $data->set_lang($LANG['xml_lang']); $data->set_auth_bit(READ_CAT_FORUM); $req_cats = $idcat > 0 && isset($CAT_FORUM[$idcat]) ? " AND c.id_left >= '" . $CAT_FORUM[$idcat]['id_left'] . "' AND id_right <= '" . $CAT_FORUM[$idcat]['id_right'] . "' " : ""; $req = "SELECT t.id, t.title, t.last_timestamp, t.last_msg_id, t.display_msg, t.nbr_msg AS t_nbr_msg, msg.id mid, msg.contents, c.auth\n\t\tFROM " . PREFIX . "forum_topics t\n\t\tLEFT JOIN " . PREFIX . "forum_cats c ON c.id = t.idcat\n\t\tLEFT JOIN " . PREFIX . "forum_msg msg ON msg.id = t.last_msg_id\n\t\tWHERE c.level != 0 AND c.aprob = 1 " . $req_cats . "\n\t\tORDER BY t.last_timestamp DESC\n\t\t" . $Sql->limit(0, 2 * $CONFIG_FORUM['pagination_msg']); $result = $Sql->query_while($req, __LINE__, __FILE__); while ($row = $Sql->fetch_assoc($result)) { $item = new FeedItem(); $last_page = ceil($row['t_nbr_msg'] / $CONFIG_FORUM['pagination_msg']); $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_FORUM['activ_display_msg'] && !empty($row['display_msg']) ? html_entity_decode($CONFIG_FORUM['display_msg'], ENT_NOQUOTES, 'ISO-8859-1') . ' ' : '') . ucfirst($row['title'])); $item->set_link($link); $item->set_guid($link); $item->set_desc(second_parse($row['contents'])); $item->set_date(new Date(DATE_TIMESTAMP, TIMEZONE_SYSTEM, $row['last_timestamp'])); $item->set_auth(unserialize($row['auth'])); $data->add_item($item); } $Sql->query_close($result); return $data; }
function get_feed_data_struct($idcat = 0, $name = '') { global $Cache, $Sql, $LANG, $CONFIG, $_WIKI_CATS, $_WIKI_CONFIG; load_module_lang('wiki'); $Cache->load('wiki'); if ($idcat > 0 && array_key_exists($idcat, $_WIKI_CATS)) { $desc = sprintf($LANG['wiki_rss_cat'], $_WIKI_CATS[$idcat]['name']); $where = "AND a.id_cat = '" . $idcat . "'"; } else { $desc = sprintf($LANG['wiki_rss_last_articles'], !empty($_WIKI_CONFIG['wiki_name']) ? $_WIKI_CONFIG['wiki_name'] : $LANG['wiki']); $where = ""; } import('content/syndication/feed_data'); import('util/date'); import('util/url'); $data = new FeedData(); $data->set_title(!empty($_WIKI_CONFIG['wiki_name']) ? $_WIKI_CONFIG['wiki_name'] : $LANG['wiki']); $data->set_date(new Date()); $data->set_link(new Url('/syndication.php?m=wiki&cat=' . $idcat)); $data->set_host(HOST); $data->set_desc($desc); $data->set_lang($LANG['xml_lang']); $Cache->load('wiki'); $result = $Sql->query_while("SELECT a.title, a.encoded_title, c.content, c.timestamp\n FROM " . PREFIX . "wiki_articles a\n LEFT JOIN " . PREFIX . "wiki_contents c ON c.id_contents = a.id_contents\n WHERE a.redirect = 0 " . $where . "\n ORDER BY c.timestamp DESC\n " . $Sql->limit(0, 2 * 10), __LINE__, __FILE__); while ($row = $Sql->fetch_assoc($result)) { $item = new FeedItem(); $item->set_title($row['title']); $link = new Url('/wiki/' . url('wiki.php?title=' . url_encode_rewrite($row['title']), url_encode_rewrite($row['title']))); $item->set_link($link); $item->set_guid($link); $item->set_desc(second_parse($row['content'])); $item->set_date(new Date(DATE_TIMESTAMP, TIMEZONE_SYSTEM, $row['timestamp'])); $data->add_item($item); } $Sql->query_close($result); return $data; }
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; }
function get_feed_data_struct($idcat = 0, $name = '') { global $Cache, $Sql, $LANG, $CONFIG, $CONFIG_ARTICLES, $CAT_ARTICLES; $Cache->load('articles'); require_once PATH_TO_ROOT . '/articles/articles_constants.php'; import('content/syndication/feed_data'); import('util/date'); import('util/url'); $data = new FeedData(); $data->set_title($LANG['xml_articles_desc']); $data->set_date(new Date()); $data->set_link(new Url('/syndication.php?m=articles&cat=' . $idcat)); $data->set_host(HOST); $data->set_desc($LANG['xml_articles_desc']); $data->set_lang($LANG['xml_lang']); $data->set_auth_bit(READ_CAT_ARTICLES); $cat_clause = !empty($idcat) ? " AND a.idcat = '" . $idcat . "'" : ''; $result = $Sql->query_while("SELECT a.id, a.idcat, a.title, a.contents, a.timestamp, a.icon, ac.auth\n FROM " . PREFIX . "articles a\n LEFT JOIN " . PREFIX . "articles_cats ac ON ac.id = a.idcat\n WHERE a.visible = 1 AND (ac.aprob = 1 OR a.idcat = 0) " . $cat_clause . "\n ORDER BY a.timestamp DESC\n " . $Sql->limit(0, 2 * $CONFIG_ARTICLES['nbr_articles_max']), __LINE__, __FILE__); while ($row = $Sql->fetch_assoc($result)) { $item = new FeedItem(); $link = new Url('/articles/articles' . url('.php?cat=' . $row['idcat'] . '&id=' . $row['id'], '-' . $row['idcat'] . '-' . $row['id'] . '+' . url_encode_rewrite($row['title']) . '.php')); $item->set_title($row['title']); $item->set_link($link); $item->set_guid($link); $item->set_desc(preg_replace('`\\[page\\](.+)\\[/page\\]`U', '<br /><strong>$1</strong><hr />', second_parse($row['contents']))); $item->set_date(new Date(DATE_TIMESTAMP, TIMEZONE_SYSTEM, $row['timestamp'])); $item->set_image_url($row['icon']); $item->set_auth($row['idcat'] == 0 ? $CONFIG_ARTICLES['auth_root'] : unserialize($row['auth'])); $data->add_item($item); } $Sql->query_close($result); return $data; }
function get_feed_data_struct($idcat = 0, $name = '') { require_once PATH_TO_ROOT . '/download/download_auth.php'; require_once PATH_TO_ROOT . '/download/download_cats.class.php'; import('content/syndication/feed_data'); import('util/date'); import('util/url'); global $Cache, $Sql, $LANG, $DOWNLOAD_LANG, $CONFIG, $CONFIG_DOWNLOAD, $DOWNLOAD_CATS; load_module_lang('download'); $Cache->load('download'); $data = new FeedData(); $data->set_title($DOWNLOAD_LANG['xml_download_desc']); $data->set_date(new Date()); $data->set_link(new Url('/syndication.php?m=download&cat=' . $idcat)); $data->set_host(HOST); $data->set_desc($DOWNLOAD_LANG['xml_download_desc']); $data->set_lang($LANG['xml_lang']); $data->set_auth_bit(DOWNLOAD_READ_CAT_AUTH_BIT); $cats = new DownloadCats(); $children_cats = array(); $cats->build_children_id_list($idcat, $children_cats, RECURSIVE_EXPLORATION, ADD_THIS_CATEGORY_IN_LIST); $req = "SELECT id, idcat, title, contents, timestamp, image\n FROM " . PREFIX . "download\n WHERE visible = 1 AND idcat IN (" . implode($children_cats, ',') . " )\n ORDER BY timestamp DESC" . $Sql->limit(0, $CONFIG_DOWNLOAD['nbr_file_max']); $result = $Sql->query_while($req, __LINE__, __FILE__); while ($row = $Sql->fetch_assoc($result)) { $item = new FeedItem(); $link = new Url('/download/download' . url('.php?id=' . $row['id'], '-' . $row['id'] . '+' . url_encode_rewrite($row['title']) . '.php')); $item->set_title($row['title']); $item->set_link($link); $item->set_guid($link); $item->set_desc(second_parse($row['contents'])); $item->set_date(new Date(DATE_TIMESTAMP, TIMEZONE_SYSTEM, $row['timestamp'])); $item->set_image_url($row['image']); $item->set_auth($cats->compute_heritated_auth($row['idcat'], DOWNLOAD_READ_CAT_AUTH_BIT, AUTH_PARENT_PRIORITY)); $data->add_item($item); } $Sql->query_close($result); return $data; }