rsshistory)) { case 'month': $hours = 720; break; case 'year': $hours = 720 * 12; break; default: // default to 1 week for all other values $hours = 168; } $querytime = time() - $hours * 3600; // Limit threads to those who have been posted to in the last month if ($fbConfig->rsstype == 'thread') { $query = "SELECT tmp.thread, tmp.catid, m.id, m.subject, tmp.lastpostid, tmp.lastposttime, u.name AS lastpostname, t.message AS lastpostmessage, tmp.numberposts FROM (SELECT a.thread, a.catid, MAX(a.id) AS lastpostid, MAX(a.time) AS lastposttime, COUNT(*) AS numberposts FROM #__fb_messages AS a JOIN ( SELECT aa.thread FROM #__fb_messages AS aa JOIN #__fb_categories AS bb ON aa.catid = bb.id WHERE aa.time >'{$querytime}' AND aa.hold='0' AND aa.moved='0' AND bb.published='1' AND bb.pub_access='0' GROUP BY 1) AS b ON b.thread = a.thread WHERE a.moved='0' AND a.hold='0' GROUP BY a.thread, a.catid) AS tmp JOIN #__fb_messages_text AS t ON tmp.lastpostid = t.mesid JOIN #__fb_messages AS m ON tmp.thread = m.thread JOIN #__fb_messages AS u ON tmp.lastpostid = u.id WHERE m.parent = 0 ORDER BY lastposttime DESC"; } else { $query = "SELECT l.id AS lastpostid, l.time AS lastposttime, l.thread, count(m.id) AS numberposts, l.subject, l.userid, l.name AS lastpostname, l.catid, l.catname, l.message AS lastpostmessage FROM #__fb_messages AS m, (SELECT m.time, m.thread, m.id, m.catid, m.userid, m.name, m.subject, c.name AS catname, t.message AS message FROM #__fb_messages AS m, #__fb_categories AS c, #__fb_messages_text as t WHERE m.id=t.mesid AND m.catid=c.id AND c.published='1' AND c.pub_access='0' AND m.hold='0' AND m.moved='0' AND m.time >'{$querytime}') AS l WHERE l.time >= m.time AND l.thread=m.thread AND m.hold='0' AND m.moved='0' GROUP BY l.id ORDER BY l.time DESC"; } $kunena_db->setQuery($query); $rows = $kunena_db->loadObjectList(); check_dberror("Unable to load messages."); header ('Content-type: application/xml'); echo "\n"; ?> <?php echo stripslashes(kunena_htmlspecialchars($app->getCfg('sitename'))); ?> - Forum Kunena Site Syndication Kunena rss.gif Powered by Kunena Kunena Site Syndication \n"; echo " " . _GEN_SUBJECT . ": " . stripslashes(kunena_htmlspecialchars($row->subject)) . " - " . _GEN_BY . ": " . stripslashes(kunena_htmlspecialchars($row->lastpostname)) . "" . "\n"; echo " "; $uri =& JURI::getInstance(JURI::base()); $itemlink = $uri->toString(array('scheme', 'host', 'port')) . CKunenaLink::GetThreadPageURL($fbConfig, 'view', $row->catid, $row->thread, ceil($row->numberposts / $fbConfig->messages_per_page), $fbConfig->messages_per_page, $row->lastpostid); echo $itemlink; echo "\n"; $words = $row->lastpostmessage; $words = smile::purify($words); echo " " . kunena_htmlspecialchars($words) . "" . "\n"; echo " " . date('r', $row->lastposttime) . "" . "\n"; echo " \n"; } ?>