]> git.mjollnir.org Git - s9y.git/commitdiff
fix bad variable call, thanks to stm
authorgarvinhicking <garvinhicking>
Sat, 5 Aug 2006 20:44:05 +0000 (20:44 +0000)
committergarvinhicking <garvinhicking>
Sat, 5 Aug 2006 20:44:05 +0000 (20:44 +0000)
rss.php

diff --git a/rss.php b/rss.php
index 10502ecdd76a66d27601bac51f0ee1f09eb8d490..876bfa301151ad1a58cd3fe8f93d2e04b3189bac 100644 (file)
--- a/rss.php
+++ b/rss.php
@@ -4,8 +4,8 @@
 
 header('Content-Type: text/xml; charset=utf-8');
 session_cache_limiter('public');
-include_once('serendipity_config.inc.php');
-include_once(S9Y_INCLUDE_PATH . 'include/functions_rss.inc.php');
+include('serendipity_config.inc.php');
+include(S9Y_INCLUDE_PATH . 'include/functions_rss.inc.php');
 
 $version         = $_GET['version'];
 $description     = $serendipity['blogDescription'];
@@ -28,17 +28,19 @@ if (!isset($_GET['type'])) {
     $_GET['type'] = 'content';
 }
 
-if (!isset($_GET['nocache'])) {
-    switch ($_GET['type']) {
-        case 'comments':
-            $latest_entry = serendipity_fetchComments(isset($_GET['cid']) ? $_GET['cid'] : null, 1, 'desc');
-            break;
-        case 'content':
-        default:
-            $latest_entry = serendipity_fetchEntries(null, false, 1, false, false, 'last_modified DESC', '', false, true);
+switch ($_GET['type']) {
+    case 'comments_and_trackbacks':
+    case 'trackbacks':
+    case 'comments':
+        $latest_entry = serendipity_fetchComments(isset($_GET['cid']) ? $_GET['cid'] : null, 1, 'desc', false, $_GET['type']);
         break;
-    }
+    case 'content':
+    default:
+        $latest_entry = serendipity_fetchEntries(null, false, 1, false, false, 'last_modified DESC', '', false, true);
+    break;
+}
 
+if (!isset($_GET['nocache'])) {
     /*
      * Caching logic - Do not send feed if nothing has changed
      * Implementation inspired by Simon Willison [http://simon.incutio.com/archive/2003/04/23/conditionalGet], Thiemo Maettig
@@ -69,11 +71,23 @@ if (!isset($_GET['nocache'])) {
     }
 }
 
+if (isset($modified_since) &&
+        (stristr($_SERVER['HTTP_USER_AGENT'], 'planet') !== FALSE || $serendipity['enforce_RFC2616'])) {
+    // People shall get a usual HTTP response according to RFC2616. See serendipity_config.inc.php for details
+    $modified_since = FALSE;
+}
+
 switch ($_GET['type']) {
+case 'comments_and_trackbacks':
+case 'trackbacks':
 case 'comments':
-    $entries     = serendipity_fetchComments(isset($_GET['cid']) ? $_GET['cid'] : null, 15, 'desc');
-    $title       = $title . ' ' . COMMENTS;
-    $description = COMMENTS_FROM . ' ' . $description;
+    $entries     = serendipity_fetchComments(isset($_GET['cid']) ? $_GET['cid'] : null, $serendipity['RSSfetchLimit'], 'desc', false, $_GET['type']);
+    $description = $title . ' - ' . $description;
+    if (isset($_GET['cid'])) {
+        $title       = $title . ' - ' . COMMENTS_FROM . ' "' . $latest_entry[0]['title'] . '"';
+    } else {
+        $title       = $title . ' - ' . COMMENTS;
+    }
     $comments    = TRUE;
     break;
 case 'content':
@@ -82,7 +96,7 @@ default:
         // Fetch all entries in reverse order for later importing. Fetch sticky entries as normal entries.
         $entries = serendipity_fetchEntries(null, true, '', false, false, 'id ASC', '', false, true);
     } else {
-        $entries = serendipity_fetchEntries(null, true, 15, false, (isset($modified_since) ? $modified_since : false), 'timestamp DESC', '', false, true);
+        $entries = serendipity_fetchEntries(null, true, $serendipity['RSSfetchLimit'], false, (isset($modified_since) ? $modified_since : false), 'timestamp DESC', '', false, true);
     }
     break;
 }
@@ -111,7 +125,9 @@ $metadata = array(
     'version'           => $version
 );
 
-include_once(S9Y_INCLUDE_PATH . 'include/plugin_api.inc.php');
+if (!defined('S9Y_FRAMEWORK_PLUGIN_API')) {
+    include(S9Y_INCLUDE_PATH . 'include/plugin_api.inc.php');
+}
 $plugins = serendipity_plugin_api::enum_plugins();
 
 if (is_array($plugins)) {
@@ -129,11 +145,24 @@ if (is_array($plugins)) {
                 }
             }
             $metadata['fullFeed']          = $plugin->get_config('fullfeed', false);
+            if ($metaData['fullFeed'] === 'client') {
+                if ($_GET['fullFeed'] || $serendipity['GET']['fullFeed']) {
+                    $metaData['fullFeed'] = true;
+                } else {
+                    $metaData['fullFeed'] = false;
+                }
+            }
 
-            if ($_GET['type']  == 'content' && $plugin->get_config('show_feedburner') === 'force' && !preg_match('@FeedBurn@i', $_SERVER['HTTP_USER_AGENT'])) {
-                       $url = 'http://feeds.feedburner.com/' . $plugin->get_config('fb_id');
-                       header('Location: ' . $url);
-                       exit;
+            if ($_GET['type']  == 'content' && 
+                !isset($_GET['category']) && 
+                !isset($serendipity['GET']['tag']) && 
+                $plugin->get_config('show_feedburner') === 'force' && 
+                !preg_match('@FeedBurn@i', $_SERVER['HTTP_USER_AGENT']) &&
+                !(serendipity_userLoggedIn() && isset($_GET['forceLocal']))
+               ) {
+                $url = 'http://feeds.feedburner.com/' . $plugin->get_config('fb_id');
+                header('Location: ' . $url);
+                exit;
             }
             $metadata['showMail']          = serendipity_db_bool($plugin->get_config('show_mail', $metadata['showMail']));
             break;
@@ -200,15 +229,16 @@ serendipity_plugin_api::hook_event($namespace_hook, $entries);
 $namespace_display_dat = $entries['display_dat'];
 unset($entries['display_dat']);
 
+$serendipity['smarty']->assign_by_ref('metadata', $metadata);
+$serendipity['smarty']->assign_by_ref('entries', $entries);
+$serendipity['smarty']->assign_by_ref('namespace_display_dat', $namespace_display_dat);
+$serendipity['smarty']->assign_by_ref('once_display_dat', $once_display_dat);
+
 $serendipity['smarty']->assign(
     array(
-        'metadata'              => $metadata,
-        'entries'               => $entries,
         'is_comments'           => $comments,
         'last_modified'         => $gm_modified,
         'self_url'              => $self_url,
-        'namespace_display_dat' => $namespace_display_dat,
-        'once_display_dat'      => $once_display_dat
     )
 );
 $serendipity['smarty']->display($template_file);