fclose($fp);
}
print $data;
-} elseif (preg_match(PAT_FEEDS, $uri) || preg_match(PAT_PERMALINK_FEEDCATEGORIES, $uri, $matches)) {
+} elseif (preg_match(PAT_PERMALINK_FEEDCATEGORIES, $uri, $matches) || preg_match(PAT_FEEDS, $uri)) {
header('Content-Type: text/html; charset=utf-8');
- if (preg_match('@/(index|atom|rss|comments|opml)\.(rss[0-9]?|rdf|rss|xml|atom)$@', $uri, $matches)) {
- list($_GET['version'], $_GET['type']) = serendipity_discover_rss($matches[1], $matches[2]);
+ if (preg_match('@/(index|atom|rss|comments|opml)\.(rss[0-9]?|rdf|rss|xml|atom)$@', $uri, $vmatches)) {
+ list($_GET['version'], $_GET['type']) = serendipity_discover_rss($vmatches[1], $vmatches[2]);
}
if (is_array($matches)) {
- $uri = preg_replace('@(' . preg_quote(PATH_FEEDS, '@') . '/)(.+)\.rss@i', '\2', $uri);
- $catid = serendipity_searchPermalink($serendipity['permalinkFeedCategoryStructure'], $uri, false, 'category');
- if ($catid) {
+ $uri = preg_replace('@(/?' . preg_quote(PATH_FEEDS, '@') . '/)(.+)\.rss@i', '\2', $uri);
+ $catid = serendipity_searchPermalink($serendipity['permalinkFeedCategoryStructure'], $uri, $matches[1], 'category');
+ if (is_numeric($catid) && $catid > 0) {
$_GET['category'] = $catid;
}
}