Vergleich inc/class_feedgeneration.php - 1.2.5 - 1.2.11

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 3Zeile 3
 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html

 *

 *

 * $Id: class_feedgeneration.php 2724 2007-02-07 20:03:56Z CraKteR $

 * $Id: class_feedgeneration.php 3199 2007-07-10 19:27:32Z CraKteR $

 */

class FeedGenerator

 */

class FeedGenerator

Zeile 83Zeile 83
	 */
function generate_feed()
{

	 */
function generate_feed()
{

 
		global $lang;

		// First, add the feed metadata.
switch($this->feed_format)
{
// Ouput an Atom 1.0 formatted feed.
case "atom1.0":

		// First, add the feed metadata.
switch($this->feed_format)
{
// Ouput an Atom 1.0 formatted feed.
case "atom1.0":

				$this->channel['date'] = date("Y-m-d\TH:i:s\Z", $this->channel['date']);
$this->xml .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";

				$this->channel['date'] = gmdate("Y-m-d\TH:i:s\Z", $this->channel['date']);
$this->xml .= "<?xml version=\"1.0\" encoding=\"{$lang->settings['charset']}\"?>\n";

				$this->xml .= "<feed xmlns=\"http://www.w3.org/2005/Atom\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";

				$this->xml .= "<feed xmlns=\"http://www.w3.org/2005/Atom\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";

				$this->xml .= "\t<title type=\"html\">".htmlspecialchars_uni($this->channel['title'])."</title>\n";
$this->xml .= "\t<subtitle type=\"html\">".htmlspecialchars_uni($this->channel['description'])."</subtitle>\n";

				$this->xml .= "\t<title type=\"html\"><![CDATA[".$this->sanitize_content($this->channel['title'])."]]></title>\n";
$this->xml .= "\t<subtitle type=\"html\"><![CDATA[".$this->sanitize_content($this->channel['description'])."]]></subtitle>\n";

				$this->xml .= "\t<link rel=\"self\" href=\"{$this->channel['link']}syndication.php\"/>\n";
$this->xml .= "\t<id>{$this->channel['link']}</id>\n";
$this->xml .= "\t<link rel=\"alternate\" type=\"text/html\" href=\"{$this->channel['link']}\"/>\n";
$this->xml .= "\t<updated>{$this->channel['date']}</updated>\n";

				$this->xml .= "\t<link rel=\"self\" href=\"{$this->channel['link']}syndication.php\"/>\n";
$this->xml .= "\t<id>{$this->channel['link']}</id>\n";
$this->xml .= "\t<link rel=\"alternate\" type=\"text/html\" href=\"{$this->channel['link']}\"/>\n";
$this->xml .= "\t<updated>{$this->channel['date']}</updated>\n";

				$this->xml .= "\t<generator uri=\"http://mybboard.com\">MyBB</generator>\n";

				$this->xml .= "\t<generator uri=\"http://mybboard.net\">MyBB</generator>\n";

				break;
// The default is the RSS 2.0 format.
default:
$this->channel['date'] = date("D, d M Y H:i:s O", $this->channel['date']);

				break;
// The default is the RSS 2.0 format.
default:
$this->channel['date'] = date("D, d M Y H:i:s O", $this->channel['date']);

				$this->xml .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";

				$this->xml .= "<?xml version=\"1.0\" encoding=\"{$lang->settings['charset']}\"?>\n";

				$this->xml .= "<rss version=\"2.0\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";
$this->xml .= "\t<channel>\n";

				$this->xml .= "<rss version=\"2.0\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";
$this->xml .= "\t<channel>\n";

				$this->xml .= "\t\t<title>".htmlspecialchars_uni($this->channel['title'])."</title>\n";

				$this->xml .= "\t\t<title><![CDATA[".$this->sanitize_content($this->channel['title'])."]]></title>\n";

				$this->xml .= "\t\t<link>".$this->channel['link']."</link>\n";

				$this->xml .= "\t\t<link>".$this->channel['link']."</link>\n";

				$this->xml .= "\t\t<description>".htmlspecialchars_uni($this->channel['description'])."</description>\n";

				$this->xml .= "\t\t<description><![CDATA[".$this->sanitize_content($this->channel['description'])."]]></description>\n";

				$this->xml .= "\t\t<pubDate>".$this->channel['date']."</pubDate>\n";
$this->xml .= "\t\t<generator>MyBB</generator>\n";
}

				$this->xml .= "\t\t<pubDate>".$this->channel['date']."</pubDate>\n";
$this->xml .= "\t\t<generator>MyBB</generator>\n";
}

Zeile 128Zeile 129
					if(!empty($item['author']))
{
$this->xml .= "\t\t<author>\n";

					if(!empty($item['author']))
{
$this->xml .= "\t\t<author>\n";

						$this->xml .= "\t\t\t<name>".htmlspecialchars_uni($item['author'])."</name>\n";

						$this->xml .= "\t\t\t<name>".$this->sanitize_content($item['author'])."</name>\n";

						$this->xml .= "\t\t</author>\n";
}
$this->xml .= "\t\t<published>{$item['date']}</published>\n";

						$this->xml .= "\t\t</author>\n";
}
$this->xml .= "\t\t<published>{$item['date']}</published>\n";

Zeile 143Zeile 144
					$this->xml .= "\t\t<updated>{$item['updated']}</updated>\n";
$this->xml .= "\t\t<link rel=\"alternate\" type=\"text/html\" href=\"{$item['link']}\" />\n";
$this->xml .= "\t\t<id>{$item['link']}</id>\n";

					$this->xml .= "\t\t<updated>{$item['updated']}</updated>\n";
$this->xml .= "\t\t<link rel=\"alternate\" type=\"text/html\" href=\"{$item['link']}\" />\n";
$this->xml .= "\t\t<id>{$item['link']}</id>\n";

					$this->xml .= "\t\t<title type=\"html\" xml:space=\"preserve\">".htmlspecialchars_uni($item['title'])."</title>\n";
$this->xml .= "\t\t<content type=\"html\" xml:space=\"preserve\" xml:base=\"{$item['link']}\"><![CDATA[".strip_tags($item['description'])."]]></content>\n";

					$this->xml .= "\t\t<title type=\"html\" xml:space=\"preserve\"><![CDATA[".$this->sanitize_content($item['title'])."]]></title>\n";
$this->xml .= "\t\t<content type=\"html\" xml:space=\"preserve\" xml:base=\"{$item['link']}\"><![CDATA[".strip_tags(str_replace("]]>", "]]&gt;", $item['description']))."]]></content>\n";

					$this->xml .= "\t\t<draft xmlns=\"http://purl.org/atom-blog/ns#\">false</draft>\n";
$this->xml .= "\t</entry>\n";
break;

					$this->xml .= "\t\t<draft xmlns=\"http://purl.org/atom-blog/ns#\">false</draft>\n";
$this->xml .= "\t</entry>\n";
break;

Zeile 153Zeile 154
				default:
$item['date'] = date("D, d M Y H:i:s O", $item['date']);
$this->xml .= "\t\t<item>\n";

				default:
$item['date'] = date("D, d M Y H:i:s O", $item['date']);
$this->xml .= "\t\t<item>\n";

					$this->xml .= "\t\t\t<title>".htmlspecialchars_uni($item['title'])."</title>\n";

					$this->xml .= "\t\t\t<title><![CDATA[".$this->sanitize_content($item['title'])."]]></title>\n";

					$this->xml .= "\t\t\t<link>".$item['link']."</link>\n";
$this->xml .= "\t\t\t<pubDate>".$item['date']."</pubDate>\n";
if($item['author'])
{

					$this->xml .= "\t\t\t<link>".$item['link']."</link>\n";
$this->xml .= "\t\t\t<pubDate>".$item['date']."</pubDate>\n";
if($item['author'])
{

						$this->xml .= "\t\t\t<dc:creator>".htmlspecialchars_uni($item['author'])."</dc:creator>\n";

						$this->xml .= "\t\t\t<dc:creator>".$this->sanitize_content($item['author'])."</dc:creator>\n";

					}
$this->xml .= "\t\t\t<guid isPermaLink=\"false\">".$item['link']."</guid>\n";

					}
$this->xml .= "\t\t\t<guid isPermaLink=\"false\">".$item['link']."</guid>\n";

					$this->xml .= "\t\t\t<description><![CDATA[".strip_tags($item['description'])."]]></description>\n";
$this->xml .= "\t\t\t<content:encoded><![CDATA[".$item['description']."]]></content:encoded>\n";

					$this->xml .= "\t\t\t<description><![CDATA[".nl2br(strip_tags(str_replace("]]>", "]]&gt;", $item['description'])))."]]></description>\n";
$this->xml .= "\t\t\t<content:encoded><![CDATA[".nl2br($item['description'])."]]></content:encoded>\n";

					$this->xml .= "\t\t</item>\n";
break;
}

					$this->xml .= "\t\t</item>\n";
break;
}

Zeile 178Zeile 179
				$this->xml .= "\t</channel>\n";
$this->xml .= "</rss>";
}

				$this->xml .= "\t</channel>\n";
$this->xml .= "</rss>";
}

 
	}

/**
* Sanitize content suitable for RSS feeds.
*
* @param string The string we wish to sanitize.
* @return string The cleaned string.
*/
function sanitize_content($content)
{
$content = preg_replace("#&([^\#])(?![a-z1-4]{1,10};)#i", "&#x26;$1", $content);
$content = str_replace("]]>", "]]&gt;", $content);
return htmlspecialchars_uni($content);

	}

/**

	}

/**

Zeile 185Zeile 199
	*/
function output_feed()
{

	*/
function output_feed()
{

 
		global $lang;

		// Send an appropriate header to the browser.
switch($this->feed_format)
{
case "atom1.0":

		// Send an appropriate header to the browser.
switch($this->feed_format)
{
case "atom1.0":

				header("Content-Type: application/atom+xml; charset=utf-8");

				header("Content-Type: application/atom+xml; charset={$lang->settings['charset']}");

				break;
default:

				break;
default:

				header("Content-Type: text/xml; charset=utf-8");

				header("Content-Type: text/xml; charset={$lang->settings['charset']}");

		}

// Output the feed XML. If the feed hasn't been generated, do so.

		}

// Output the feed XML. If the feed hasn't been generated, do so.