diff options
-rwxr-xr-x | inc/3rdparty/libraries/feedwriter/FeedWriter.php | 23 | ||||
-rwxr-xr-x | inc/3rdparty/makefulltextfeed.php | 6 |
2 files changed, 21 insertions, 8 deletions
diff --git a/inc/3rdparty/libraries/feedwriter/FeedWriter.php b/inc/3rdparty/libraries/feedwriter/FeedWriter.php index 79639c0c..d708e99b 100755 --- a/inc/3rdparty/libraries/feedwriter/FeedWriter.php +++ b/inc/3rdparty/libraries/feedwriter/FeedWriter.php | |||
@@ -87,12 +87,25 @@ define('JSONP', 3, true); | |||
87 | * @access public | 87 | * @access public |
88 | * @return void | 88 | * @return void |
89 | */ | 89 | */ |
90 | public function genarateFeed() | 90 | public function genarateFeed($withHeaders = true) |
91 | { | 91 | { |
92 | header('Content-type: text/xml; charset=UTF-8'); | 92 | if ($withHeaders) { |
93 | // this line prevents Chrome 20 from prompting download | 93 | if ($this->version == RSS2) { |
94 | // used by Google: https://news.google.com/news/feeds?ned=us&topic=b&output=rss | 94 | header('Content-type: text/xml; charset=UTF-8'); |
95 | header('X-content-type-options: nosniff'); | 95 | // this line prevents Chrome 20 from prompting download |
96 | // used by Google: https://news.google.com/news/feeds?ned=us&topic=b&output=rss | ||
97 | header('X-content-type-options: nosniff'); | ||
98 | } elseif ($this->version == JSON) { | ||
99 | header('Content-type: application/json; charset=UTF-8'); | ||
100 | } elseif ($this->version == JSONP) { | ||
101 | header('Content-type: application/javascript; charset=UTF-8'); | ||
102 | } | ||
103 | } | ||
104 | |||
105 | if ($this->version == JSON || $this->version == JSONP) { | ||
106 | $this->json = new stdClass(); | ||
107 | } | ||
108 | |||
96 | 109 | ||
97 | $this->printHead(); | 110 | $this->printHead(); |
98 | $this->printChannels(); | 111 | $this->printChannels(); |
diff --git a/inc/3rdparty/makefulltextfeed.php b/inc/3rdparty/makefulltextfeed.php index 135964f1..4faad6d9 100755 --- a/inc/3rdparty/makefulltextfeed.php +++ b/inc/3rdparty/makefulltextfeed.php | |||
@@ -749,7 +749,7 @@ foreach ($items as $key => $item) { | |||
749 | // add effective URL (URL after redirects) | 749 | // add effective URL (URL after redirects) |
750 | if (isset($effective_url)) { | 750 | if (isset($effective_url)) { |
751 | //TODO: ensure $effective_url is valid witout - sometimes it causes problems, e.g. | 751 | //TODO: ensure $effective_url is valid witout - sometimes it causes problems, e.g. |
752 | //http://www.siasat.pk/forum/showthread.php?108883-Pakistan-Chowk-by-Rana-Mubashir-–-25th-March-2012-Special-Program-from-Liari-(Karachi) | 752 | //http://www.siasat.pk/forum/showthread.php?108883-Pakistan-Chowk-by-Rana-Mubashir-�-25th-March-2012-Special-Program-from-Liari-(Karachi) |
753 | //temporary measure: use utf8_encode() | 753 | //temporary measure: use utf8_encode() |
754 | $newitem->addElement('dc:identifier', remove_url_cruft(utf8_encode($effective_url))); | 754 | $newitem->addElement('dc:identifier', remove_url_cruft(utf8_encode($effective_url))); |
755 | } else { | 755 | } else { |
@@ -831,7 +831,7 @@ if (!$debug_mode) { | |||
831 | } | 831 | } |
832 | if ($add_to_cache) { | 832 | if ($add_to_cache) { |
833 | ob_start(); | 833 | ob_start(); |
834 | $output->genarateFeed(); | 834 | $output->genarateFeed(false); |
835 | $output = ob_get_contents(); | 835 | $output = ob_get_contents(); |
836 | ob_end_clean(); | 836 | ob_end_clean(); |
837 | if ($html_only && $item_count == 0) { | 837 | if ($html_only && $item_count == 0) { |
@@ -842,7 +842,7 @@ if (!$debug_mode) { | |||
842 | } | 842 | } |
843 | echo $output; | 843 | echo $output; |
844 | } else { | 844 | } else { |
845 | $output->genarateFeed(); | 845 | $output->genarateFeed(false); |
846 | } | 846 | } |
847 | if ($callback) echo ');'; | 847 | if ($callback) echo ');'; |
848 | } | 848 | } |