/** * @desc Genera la información para mostrar la Sindicación * @param int Limite de resultados * @return Array */ function &mywords_rssshow($limit) { global $util, $mc; $db = XoopsDatabaseFactory::getDatabaseConnection(); include_once XOOPS_ROOT_PATH . '/modules/mywords/class/mwcategory.class.php'; include_once XOOPS_ROOT_PATH . '/modules/mywords/class/mwpost.class.php'; foreach ($_GET as $k => $v) { ${$k} = $v; } $feed = array(); // Información General $ret = array(); $mc =& $util->moduleConfig('mywords'); if ($show == 'all') { $feed['title'] = htmlspecialchars(_MI_MW_RSSNAME); $feed['link'] = XOOPS_URL . '/modules/mywords'; $feed['description'] = htmlspecialchars($util->filterTags($mc['rssdesc'])); $sql = "SELECT * FROM " . $db->prefix("mw_posts") . " WHERE aprovado='1' AND estado>'0' ORDER BY modificado DESC LIMIT 0,{$limit}"; } else { if ($id == '') { return; } $cat = new MWCategory($id); if ($cat->isNew()) { return; } $feed['title'] = sprintf(_MI_MW_RSSNAMECAT, $cat->getName()); $feed['link'] = $cat->getLink(); $feed['description'] = $cat->getDescription(); $sql = "SELECT b.* FROM " . $db->prefix("mw_catpost") . " a," . $db->prefix("mw_posts") . " b WHERE a.cat='" . $cat->getID() . "' AND b.id_post=a.post AND b.aprovado='1' AND b.estado>'0' ORDER BY b.modificado DESC LIMIT 0,{$limit}"; } // Generamos los elementos $result = $db->query($sql); $posts = array(); while ($row = $db->fetchArray($result)) { $post = new MWPost(); $post->assignVars($row); $rtn = array(); $rtn['title'] = $post->getTitle(); $rtn['link'] = $post->getPermaLink(); $rtn['description'] = xoops_utf8_encode(htmlspecialchars($post->getHomeText(), ENT_QUOTES)); $rtn['pubDate'] = formatTimestamp($post->getDate()); $posts[] = $rtn; } $ret = array('feed' => $feed, 'items' => $posts); return $ret; }