]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
fix of rss headers problem 665/head
authorMaryana Rozhankivska <mariroz@mr.lviv.ua>
Thu, 24 Apr 2014 08:48:00 +0000 (11:48 +0300)
committerMaryana Rozhankivska <mariroz@mr.lviv.ua>
Thu, 24 Apr 2014 08:48:00 +0000 (11:48 +0300)
inc/3rdparty/libraries/feedwriter/FeedWriter.php
inc/3rdparty/makefulltextfeed.php

index 79639c0c2780113863fba63639934b5f4484e5e0..d708e99b0ec36e12dce2dcc6309410f3f8e598dc 100755 (executable)
@@ -87,12 +87,25 @@ define('JSONP', 3, true);
     * @access   public\r
     * @return   void\r
     */\r
-    public function genarateFeed()\r
+    public function genarateFeed($withHeaders = true)\r
     {\r
-        header('Content-type: text/xml; charset=UTF-8');\r
-        // this line prevents Chrome 20 from prompting download\r
-        // used by Google: https://news.google.com/news/feeds?ned=us&topic=b&output=rss\r
-        header('X-content-type-options: nosniff');\r
+        if ($withHeaders) {\r
+          if ($this->version == RSS2) {\r
+              header('Content-type: text/xml; charset=UTF-8');\r
+              // this line prevents Chrome 20 from prompting download\r
+              // used by Google: https://news.google.com/news/feeds?ned=us&topic=b&output=rss\r
+              header('X-content-type-options: nosniff');\r
+          } elseif ($this->version == JSON) {\r
+              header('Content-type: application/json; charset=UTF-8');\r
+          } elseif ($this->version == JSONP) {\r
+              header('Content-type: application/javascript; charset=UTF-8');\r
+          }\r
+        }\r
+      \r
+        if ($this->version == JSON || $this->version == JSONP) {\r
+          $this->json = new stdClass();\r
+        }\r
+      \r
 \r
         $this->printHead();\r
         $this->printChannels();\r
index 135964f18477d4ad9ffe2a0d678f033b6664b4c7..4faad6d941904c5526bd4436d1793c4a52bb7b53 100755 (executable)
@@ -749,7 +749,7 @@ foreach ($items as $key => $item) {
                // add effective URL (URL after redirects)\r
                if (isset($effective_url)) {\r
                        //TODO: ensure $effective_url is valid witout - sometimes it causes problems, e.g.\r
-                       //http://www.siasat.pk/forum/showthread.php?108883-Pakistan-Chowk-by-Rana-Mubashir-\96-25th-March-2012-Special-Program-from-Liari-(Karachi)\r
+                       //http://www.siasat.pk/forum/showthread.php?108883-Pakistan-Chowk-by-Rana-Mubashir--25th-March-2012-Special-Program-from-Liari-(Karachi)\r
                        //temporary measure: use utf8_encode()\r
                        $newitem->addElement('dc:identifier', remove_url_cruft(utf8_encode($effective_url)));\r
                } else {\r
@@ -831,7 +831,7 @@ if (!$debug_mode) {
        }\r
        if ($add_to_cache) {\r
                ob_start();\r
-               $output->genarateFeed();\r
+               $output->genarateFeed(false);\r
                $output = ob_get_contents();\r
                ob_end_clean();\r
                if ($html_only && $item_count == 0) {\r
@@ -842,7 +842,7 @@ if (!$debug_mode) {
                }\r
                echo $output;\r
        } else {\r
-               $output->genarateFeed();\r
+               $output->genarateFeed(false);\r
        }\r
        if ($callback) echo ');';\r
 }\r