db; $tpl =& $f->tpl; $messages =& $f->messages; $num_posts = $options['posts_per_rss']; // ugh, send a content-type even if it should not be needed for 304s // http://support.microsoft.com/default.aspx?scid=kb;en-us;831140&Product=ISAS // we seem to be doing it right: http://www.xml.com/pub/a/2004/07/21/dive.html header("Content-type: $feed_content; charset=" . $options['charset'], true); header('X-Pingback: ' . $options['url'] . '/xmlrpc.php'); // check if we are using if no if-modified headers, then try to serve directly from cache if (!isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && !isset($_SERVER['HTTP_IF_NONE_MATCH'])) { // cache code starts here if ($cache && $cache->active) { // override validatity $cache->validity = $cache->feed_validity; // try to fetch the cached snippet $result = $cache->getCache(null,''); if ($result) { echo $result; exit(); } } } // Get GMT timestamp of last post modification $tstamp = $f->getLastModified(false); $last_modified_gmt = $f->doConditionalGet($tstamp); if (empty($f->options['description'])) $tpl->setVar('option_description', 'A WordPress+Lightpress-powered blog'); if ($feed_type == 'atom') { // http://feedvalidator.org/docs/error/InvalidW3CDTFDate.html $last_modified_gmt = $f->ISO8601($tstamp); // http://feedvalidator.org/docs/error/InvalidLanguage.html $tpl->setVar('option_lang', str_replace('_', '-', $f->options['lang'])); $tpl->setVar('option_copyright_notice', htmlentities($f->options['copyright_notice'])); } $posts =& $f->getPosts(null, null, 0, $num_posts, false, true); $tpl->setFile('index', $feed_file); $tpl->setVar('pub_date', $last_modified_gmt); foreach ($posts as $k => $post) { if (!empty($post['post_more'])) { if (!empty($f->options['rss_use_excerpt'])) $posts[$k]['post_content'] .= ' ' . $messages['post_continued'] . ''; else $posts[$k]['post_content'] .= $post['post_more']; } if ($feed_type == 'atom') { $posts[$k]['post_isodate'] = $f->ISO8601((int)$post['post_tstamp_gmt']); } else { $posts[$k]['post_isodate'] = date($feed_date, (int)$post['post_tstamp_gmt']) . ' GMT'; } if (isset($post['tags']) && is_array($post['tags']) && count($post['tags']) > 0) { foreach ($post['tags'] as $i=>$tag) $post['tags'][$i] = htmlspecialchars($tag, ENT_NOQUOTES, $f->options['charset']); $post['tags'] = "<$tag_element>" . implode("<$tag_element>", $post['tags']) . ""; } else { $post['tags'] = ''; } // horrible hack, remember to remove it if/when we implement priority for plugins if (isset($post['_tags_set'])) unset($posts[$k]['_tags_set']); unset($posts[$k]['tags']); $posts[$k]['tags'] =& $post['tags']; } $tpl->parseBlock('ITEM', 'item', $posts, 'index'); $out = $tpl->parse('MAIN', 'index',false); if (!is_null($cache) ) { $cache->user_id = ''; $cache->validity = $cache->feed_validity; $cache->setCache($out); } echo ($out); ?>