[geeklog-hg] geeklog: The Content Syndication Editor now tests (and corrects ...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Tue Dec 31 18:03:47 EST 2013


changeset 9362:797565e21872
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/797565e21872
user: Tom <websitemaster at cogeco.net>
date: Tue Dec 31 18:01:03 2013 -0500
description:
The Content Syndication Editor now tests (and corrects if needed) the file extension of the feed when it is saved.

diffstat:

 public_html/admin/syndication.php |  35 ++++++++++++++++++++++++++++++++++-
 1 files changed, 34 insertions(+), 1 deletions(-)

diffs (51 lines):

diff -r fe13ab58829a -r 797565e21872 public_html/admin/syndication.php
--- a/public_html/admin/syndication.php	Mon Dec 30 06:52:37 2013 -0500
+++ b/public_html/admin/syndication.php	Tue Dec 31 18:01:03 2013 -0500
@@ -455,13 +455,46 @@
     } else {
         $A['is_enabled'] = 0;
     }
+
+    // Make sure correct format returned and correct file extenstion
+    $file_parts = pathinfo($A['filename']);
+    $A['filename'] = ''; // Clear out filename. If it doesn't get recreated then we know there is an error
+    if (!empty($file_parts['filename'])) {
+        $formats = find_feedFormats();
+        foreach ($formats as $f) {
+            if ($A['format'] == ($f['name'] . '-' . $f['version'])) {
+                switch($f['name'])
+                {
+                    case "Atom":
+                        if ($file_parts['extension'] != "atm" OR $file_parts['extension'] != "xml") {
+                            $A['filename'] = $file_parts['filename'] . '.atm'; 
+                        }
+                        break;
+                    
+                    case "RSS":
+                        if ($file_parts['extension'] != "rss" OR $file_parts['extension'] != "xml") {
+                            $A['filename'] = $file_parts['filename'] . '.rss';
+                        }
+                        break;
+                        
+                    case "RDF":
+                        if ($file_parts['extension'] != "rdf") {
+                            $A['filename'] = $file_parts['filename'] . '.rdf';
+                        }
+                        break;
+                        
+                }
+                
+            }
+        }
+    }
     if (empty ($A['title']) || empty ($A['description']) ||
             empty ($A['filename'])) {
         $retval = COM_showMessageText($LANG33[39], $LANG33[38])
                 . editfeed ($A['fid'], $A['type']);
         $retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG33[38]));
         return $retval;
-    }
+    }    
 
     $result = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['syndication']} WHERE filename = '{$A['filename']}' AND (fid <> '{$A['fid']}')");
     $C = DB_fetchArray($result);



More information about the geeklog-cvs mailing list