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; }