]> git.mjollnir.org Git - s9y.git/commitdiff
Allow to force feedburner service
authorgarvinhicking <garvinhicking>
Thu, 20 Apr 2006 08:58:04 +0000 (08:58 +0000)
committergarvinhicking <garvinhicking>
Thu, 20 Apr 2006 08:58:04 +0000 (08:58 +0000)
docs/NEWS
include/plugin_internal.inc.php
rss.php

index beb22c322930d8bbd53958fa87f1532ef4fa6bb8..49bba2c4faa0dd4c7d0b076e9f97020bd1e3a4a2 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,10 @@
 Version 1.0 ()
 ------------------------------------------------------------------------
 
+   * Support "Force Feedburner" option to the syndication plugin to
+     let rss.php only be accessible to feedburner and no clients.
+     (garvinhicking)
+
    * Add Akismet antispam support (garvinhicking)
 
    * Saving special crafterd configuration data as Admin superuser 
index 3871d4f9d0cec85f4a9b3339f17b488e382e3c93..902a2240c0512fa965fa6a5a01ab055a6d326e6e 100644 (file)
@@ -655,7 +655,7 @@ class serendipity_syndication_plugin extends serendipity_plugin {
         $propbag->add('description',   SHOWS_RSS_BLAHBLAH);
         $propbag->add('stackable',     true);
         $propbag->add('author',        'Serendipity Team');
-        $propbag->add('version',       '1.0');
+        $propbag->add('version',       '1.1');
         $propbag->add('configuration', array(
                                         'fullfeed',
                                         'show_0.91',
@@ -733,7 +733,7 @@ class serendipity_syndication_plugin extends serendipity_plugin {
 
             case 'show_atom1.0':
                 $propbag->add('type',        'boolean');
-                $propbag->add('name',        SYNDICATION_PLUGIN_ATOM10);
+                $propbag->add('name',        sprintf(SYNDICATION_PLUGIN_GENERIC_FEED, 'Atom 1.0'));
                 $propbag->add('description', '');
                 $propbag->add('default',     'true');
                 break;
@@ -746,7 +746,19 @@ class serendipity_syndication_plugin extends serendipity_plugin {
                 break;
 
             case 'show_feedburner':
-                $propbag->add('type',        'boolean');
+                $radio = array();
+                $radio['value'][] = 'false';
+                $radio['desc'][]  = NO;
+
+                $radio['value'][] = 'true';
+                $radio['desc'][]  = YES;
+
+                $radio['value'][] = 'force';
+                $radio['desc'][]  = FORCE;
+
+                $propbag->add('type',        'radio');
+                $propbag->add('radio_per_row', '3');
+                $propbag->add('radio',       $radio);
                 $propbag->add('name',        sprintf(SYNDICATION_PLUGIN_GENERIC_FEED, 'FeedBurner'));
                 $propbag->add('description', '');
                 $propbag->add('default',     'false');
@@ -916,7 +928,7 @@ class serendipity_syndication_plugin extends serendipity_plugin {
 <?php
         }
 
-        if (serendipity_db_bool($this->get_config('show_feedburner', false))) {
+        if (serendipity_db_bool($this->get_config('show_feedburner', false)) || $this->get_config('show_feedburner', false) === 'force') {
                        $alt = $this->get_config('fb_alt');
                        $url = 'http://feeds.feedburner.com/' . $this->get_config('fb_id');
                        $img = $this->get_config('fb_img');
diff --git a/rss.php b/rss.php
index 05777a0a85cf57bafb616083b675d4608e71ae66..1ea9982b55a10d175b5ccdf4d526baed49907cc4 100644 (file)
--- a/rss.php
+++ b/rss.php
@@ -129,6 +129,12 @@ if (is_array($plugins)) {
                 }
             }
             $metadata['fullFeed']          = $plugin->get_config('fullfeed', false);
+
+            if ($plugin->get_config('show_feedburner') === 'force' && !preg_match('@Mozilla@i', $_SERVER['HTTP_USER_AGENT'])) {
+                       $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;
         }