]> git.mjollnir.org Git - s9y.git/commitdiff
Hide emails in RSS feeds by default
authorgarvinhicking <garvinhicking>
Fri, 21 Oct 2005 12:19:42 +0000 (12:19 +0000)
committergarvinhicking <garvinhicking>
Fri, 21 Oct 2005 12:19:42 +0000 (12:19 +0000)
docs/NEWS
include/functions_rss.inc.php
include/plugin_internal.inc.php
rss.php

index 9149dadfc10fcf5780a6514202c3ef826748f5a9..67a634674ecc974bb02975874735fda3abb058f5 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,9 @@
 Version 0.9-beta3 ()
 ------------------------------------------------------------------------
  
+    * Syndication plugin: Do not show E-Mail adress in RSS feed by default
+      (garvinhicking)
+
     * Fix Bug where siteConfiguration was not available to chief
       editors. Thanks to Jannis! :) (garvinhicking)
 
index 62aacdc318a5923e9e2addb64530ad5badac8aea..d400da5b33bdf634799f299b59585bf884a41f77 100644 (file)
@@ -16,15 +16,15 @@ function serendipity_printEntries_rss($entries, $version, $comments = false, $fu
     if (is_array($entries)) {
         foreach ($entries as $entry) {
             $id   = (isset($entry['entryid']) && !empty($entry['entryid']) ? $entry['entryid'] : $entry['id']);
-            $guid = serendipity_rss_getguid($entry, $comments);
+            $guid = serendipity_rss_getguid($entry, $options['comments']);
             $entryLink = serendipity_archiveURL($id, $entry['title'], 'baseURL', true, array('timestamp' => $entry['timestamp']));
-            if ($comments == true) {
+            if ($options['comments'] == true) {
                 // Display username as part of the title for easier feed-readability
                 $entry['title'] = $entry['author'] . ': ' . $entry['title'];
             }
 
             // Embed a link to extended entry, if existing
-            if ($fullFeed) {
+            if ($options['fullFeed']) {
                 $entry['body'] .= ' ' . $entry['extended'];
                 $ext = '';
             } elseif ($entry['exflag']) {
@@ -41,7 +41,7 @@ function serendipity_printEntries_rss($entries, $version, $comments = false, $fu
             $entry['body'] = xhtml_cleanup($entry['body']);
 
             // extract author information
-            if ((isset($entry['no_email']) && $entry['no_email']) || !$showMail) {
+            if ((isset($entry['no_email']) && $entry['no_email']) || $options['showMail'] === FALSE) {
                 $entry['email'] = 'nospam@example.com'; // RSS Feeds need an E-Mail address!
             } elseif (empty($entry['email'])) {
                 $query = "select email FROM {$serendipity['dbPrefix']}authors WHERE authorid = '". serendipity_db_escape_string($entry['authorid']) ."'";
@@ -53,7 +53,7 @@ function serendipity_printEntries_rss($entries, $version, $comments = false, $fu
                 $entry['categories'] = array(0 => array('category_name' => $entry['category_name']));
             }
 
-            if ($version == 'atom0.3') {
+            if ($options['version'] == 'atom0.3') {
                 /*********** ATOM 0.3 FEED *************/
 ?>
 <entry>
@@ -69,10 +69,10 @@ function serendipity_printEntries_rss($entries, $version, $comments = false, $fu
     <wfw:comment><?php echo $serendipity['baseURL']; ?>wfwcomment.php?cid=<?php echo $id; ?></wfw:comment>
 
 <?php
-                    if ($comments === false) {
+                    if ($options['comments'] === false) {
 ?>
     <slash:comments><?php echo $entry['comments']; ?></slash:comments>
-    <wfw:commentRss><?php echo $serendipity['baseURL']; ?>rss.php?version=<?php echo $version; ?>&amp;type=comments&amp;cid=<?php echo $id; ?></wfw:commentRss>
+    <wfw:commentRss><?php echo $serendipity['baseURL']; ?>rss.php?version=<?php echo $options['version']; ?>&amp;type=comments&amp;cid=<?php echo $id; ?></wfw:commentRss>
 <?php
                     }
 ?>
@@ -95,7 +95,7 @@ function serendipity_printEntries_rss($entries, $version, $comments = false, $fu
 ?>
 </entry>
 <?php
-            } elseif ($version == 'atom1.0') {
+            } elseif ($options['version'] == 'atom1.0') {
                 /*********** ATOM 1.0 FEED *************/
 ?>
 <entry>
@@ -110,10 +110,10 @@ function serendipity_printEntries_rss($entries, $version, $comments = false, $fu
     <wfw:comment><?php echo $serendipity['baseURL']; ?>wfwcomment.php?cid=<?php echo $id; ?></wfw:comment>
 
 <?php
-                    if ($comments === false) {
+                    if ($options['comments'] === false) {
 ?>
     <slash:comments><?php echo $entry['comments']; ?></slash:comments>
-    <wfw:commentRss><?php echo $serendipity['baseURL']; ?>rss.php?version=<?php echo $version; ?>&amp;type=comments&amp;cid=<?php echo $id; ?></wfw:commentRss>
+    <wfw:commentRss><?php echo $serendipity['baseURL']; ?>rss.php?version=<?php echo $options['version']; ?>&amp;type=comments&amp;cid=<?php echo $id; ?></wfw:commentRss>
 <?php
                     }
 
@@ -142,7 +142,7 @@ function serendipity_printEntries_rss($entries, $version, $comments = false, $fu
 </entry>
 <?php
 
-            } elseif ($version == '0.91' || $version == '2.0') {
+            } elseif ($options['version'] == '0.91' || $options['version'] == '2.0') {
                 /*********** BEGIN RSS 0.91/2.0 FEED *************/
 ?>
 <item>
@@ -151,7 +151,7 @@ function serendipity_printEntries_rss($entries, $version, $comments = false, $fu
 <?php
                 /*********** END RSS 0.91/2.0 FEED *************/
 
-                if ($version == '2.0') {
+                if ($options['version'] == '2.0') {
                     /*********** RSS 2.0 FEED EXTRAS *************/
                     foreach ($entry['categories'] AS $idx => $cat) {
                         ?><category><?php echo serendipity_utf8_encode(htmlspecialchars($cat['category_name'])); ?></category><?php
@@ -160,10 +160,10 @@ function serendipity_printEntries_rss($entries, $version, $comments = false, $fu
     <comments><?php echo $entryLink; ?>#comments</comments>
     <wfw:comment><?php echo $serendipity['baseURL']; ?>wfwcomment.php?cid=<?php echo $id; ?></wfw:comment>
 <?php
-                    if ($comments === false) {
+                    if ($options['comments'] === false) {
 ?>
     <slash:comments><?php echo $entry['comments']; ?></slash:comments>
-    <wfw:commentRss><?php echo $serendipity['baseURL']; ?>rss.php?version=<?php echo $version; ?>&amp;type=comments&amp;cid=<?php echo $id; ?></wfw:commentRss>
+    <wfw:commentRss><?php echo $serendipity['baseURL']; ?>rss.php?version=<?php echo $options['version']; ?>&amp;type=comments&amp;cid=<?php echo $id; ?></wfw:commentRss>
 <?php
                     }
 ?>
@@ -201,7 +201,7 @@ function serendipity_printEntries_rss($entries, $version, $comments = false, $fu
 <?php
                     /*********** END RSS 0.91 FEED EXTRAS *************/
                 }
-            } else if ($version == '1.0') {
+            } else if ($options['version'] == '1.0') {
                 $categories = array();
                 foreach ($entry['categories'] AS $idx => $cat) {
                     $categories[] = $cat['category_name'];
@@ -230,16 +230,16 @@ function serendipity_printEntries_rss($entries, $version, $comments = false, $fu
     <dc:date><?php echo date('Y-m-d\TH:i:s\Z', serendipity_serverOffsetHour($entry['timestamp'])); ?></dc:date>
     <wfw:comment><?php echo $serendipity['baseURL']; ?>wfwcomment.php?cid=<?php echo $id; ?></wfw:comment>
 <?php
-                    if ($comments === false) {
+                    if ($options['comments'] === false) {
 ?>
     <slash:comments><?php echo $entry['comments']; ?></slash:comments>
-    <wfw:commentRss><?php echo $serendipity['baseURL']; ?>rss.php?version=<?php echo $version; ?>&amp;type=comments&amp;cid=<?php echo $id; ?></wfw:commentRss>
+    <wfw:commentRss><?php echo $serendipity['baseURL']; ?>rss.php?version=<?php echo $options['version']; ?>&amp;type=comments&amp;cid=<?php echo $id; ?></wfw:commentRss>
 <?php
                     }
 ?>
 </item>
 <?php
-            } elseif ($version == 'opml1.0') {
+            } elseif ($options['version'] == 'opml1.0') {
 ?>
     <outline text="<?php echo serendipity_utf8_encode(htmlspecialchars($entry['title'])); ?>" type="url" htmlUrl="<?php echo $entryLink; ?>" urlHTTP="<?php echo $entryLink; ?>" />
 <?php
index 96ee859d666d3ff3344217a5d3cceea89c71e89e..5fd483c92d6350c39f5a7905b94ddf1716f4bcc3 100644 (file)
@@ -674,7 +674,7 @@ class serendipity_syndication_plugin extends serendipity_plugin {
                 $propbag->add('type',        'boolean');
                 $propbag->add('name',        SYNDICATION_PLUGIN_SHOW_MAIL);
                 $propbag->add('description', '');
-                $propbag->add('default',     'true');
+                $propbag->add('default',     false);
                 break;
 
             case 'field_managingEditor':
diff --git a/rss.php b/rss.php
index fe2a4ef6b63d1a3a108a649f9069b4e9850c0af5..165f78bccff1e0c0757c60b2a04f6856581e3b1b 100644 (file)
--- a/rss.php
+++ b/rss.php
@@ -107,7 +107,7 @@ $metadata = array(
     'link'              => $serendipity['baseURL'],
     'email'             => $serendipity['email'],
     'fullFeed'          => false,
-    'showMail'          => showMail,
+    'showMail'          => false,
     'version'           => $version
 );
 
@@ -165,7 +165,7 @@ case '1.0':
         $entries = array();
     }
     
-    if ($showMail) {
+    if ($metadata['showMail']) {
         $head_mail = "<admin:errorReportsTo rdf:resource=\"mailto:{$metadata['email']}\" />";
     } else {
         $head_mail = '';
@@ -207,7 +207,7 @@ case '2.0':
         $entries = array();
     }
 
-    if ($showMail) {
+    if ($metadata['showMail']) {
         $head_mail = "<admin:errorReportsTo rdf:resource=\"mailto:{$metadata['email']}\" />";
     } else {
         $head_mail = '';
@@ -242,7 +242,7 @@ case 'atom0.3':
         $modified = gmdate('Y-m-d\TH:i:s\Z', serendipity_serverOffsetHour());
     }
 
-    if ($showMail) {
+    if ($metadata['showMail']) {
         $head_mail = "<admin:errorReportsTo rdf:resource=\"mailto:{$metadata['email']}\" />";
     } else {
         $head_mail = '';
@@ -280,7 +280,7 @@ case 'atom1.0':
         $modified = gmdate('Y-m-d\TH:i:s\Z', serendipity_serverOffsetHour());
     }
 
-    if ($showMail) {
+    if ($metadata['showMail']) {
         $head_mail = "<admin:errorReportsTo rdf:resource=\"mailto:{$metadata['email']}\" />";
     } else {
         $head_mail = '';