This blob has been accessed 374 times via Git panel.
- <?php
- // 201001110322 - Valid RSS 0.91, 1.0, 2.0
- error_reporting(E_ERROR);
- require("core.php");
- if (file_exists("data/offset.txt")) {
- $offset = file_get_contents("data/offset.txt");
- }
- else {
- $offset = 0;
- }
- if (isset($_REQUEST['ver']) and !empty($_REQUEST['ver'])) {
- $title = file_get_contents("data/title.txt");
- $title = strip_tags($title);
- $title = htmlspecialchars($title,ENT_QUOTES);
- $description = file_get_contents("data/profile.php");
- $description = strip_tags($description);
- $description = htmlspecialchars($description,ENT_QUOTES);
- if (file_exists("data/increase.txt")) {
- $increase = file_get_contents("data/increase.txt");
- }
- else {
- $increase = 5;
- }
- $link = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/";
- $link = str_replace('//', '/', $link);
- $link = "http://" . $link;
- $fix_link = array('//index.php', '///index.php');
- $feeds = $increase;
- if ($dh_rss_items = opendir("data/items")) {
- while (($entry_rss_items = readdir($dh_rss_items)) !== false) {
- if (($entry_rss_items > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
- continue;
- }
- $private = "0";
- if (file_exists("data/items/$entry_rss_items/categories")) {
- if ($dh_cat_rss = opendir("data/items/$entry_rss_items/categories")) {
- while (($entry_cat_rss = readdir($dh_cat_rss)) !== false) {
- if ($entry_cat_rss != "." && $entry_cat_rss != "..") {
- if (file_exists("data/categories/$entry_cat_rss/private.txt")) {
- $private = $private + 1;
- }
- }
- }
- closedir($dh_cat_rss);
- }
- }
- if (($private > 0) and !file_exists("data/items/$entry_rss_items/cat.txt")) {
- continue;
- }
- if (file_exists("data/items/$entry_rss_items/passwd.txt")) {
- continue;
- }
- if (file_exists("data/items/$entry_rss_items/member.txt")) {
- continue;
- }
- if (isset($_REQUEST['cat']) and !empty($_REQUEST['cat']) and file_exists("data/categories/{$_REQUEST['cat']}") and !file_exists("data/items/$entry_rss_items/categories/{$_REQUEST['cat']}")) {
- continue;
- }
- if (isset($_REQUEST['cat']) and !empty($_REQUEST['cat']) and !file_exists("data/categories/{$_REQUEST['cat']}")) {
- continue;
- }
- if ($entry_rss_items != "." && $entry_rss_items != ".." && fnmatch("*", $entry_rss_items) && !file_exists("data/items/$entry_rss_items/private.txt") && !file_exists("data/items/$entry_rss_items/members")) {
- $show_rss_items[] = $entry_rss_items;
- }
- }
- closedir($dh_rss_items);
- }
- rsort($show_rss_items);
- $count_rss_items = count($show_rss_items);
- if ($count_rss_items < $feeds) {
- $feeds = $count_rss_items;
- }
- if ($count_rss_items > 0) {
- header('Content-type: application/xml');
- echo "<?xml version=\"1.0\"?>\n";
- if ($_REQUEST['ver'] == "2.0") {
- $rss20_count = $rss20_count + 1;
- echo "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n";
- echo "<channel>\n";
- echo "<title>$title</title>\n";
- echo "<link>$link</link>\n";
- echo "<description>$description</description>\n";
- echo "<atom:link href=\"{$link}rss.php?ver={$_REQUEST['ver']}\" rel=\"self\" type=\"application/rss+xml\" />\n";
- }
- if ($_REQUEST['ver'] == "1.0") {
- $rss10_count = file_get_contents("data/rss-1.0.txt");
- $rss10_count = $rss10_count + 1;
- echo "<rdf:RDF\n";
- echo "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n";
- echo "xmlns=\"http://purl.org/rss/1.0/\"\n";
- echo "xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n";
- echo ">\n";
- echo "<channel rdf:about=\"$link\">\n";
- echo "<title>$title</title>\n";
- echo "<link>$link</link>\n";
- echo "<description>$description</description>\n";
- echo "<items>\n";
- echo "<rdf:Seq>\n";
- $increment_rss_entries = 0;
- $show_rss_entries = $feeds - 1;
- while ($increment_rss_entries <= $show_rss_entries) {
- $link = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/index.php?entry=$show_rss_items[$increment_rss_entries]";
- $link = str_replace($fix_link, '/index.php', $link);
- echo "<rdf:li rdf:resource=\"$link\"/>\n";
- $increment_rss_entries = $increment_rss_entries + 1;
- }
- echo "</rdf:Seq>\n";
- echo "</items>\n";
- echo "</channel>\n";
- }
- if ($_REQUEST['ver'] == "0.91") {
- $rss091_count = file_get_contents("data/rss-0.91.txt");
- $rss091_count = $rss091_count + 1;
- echo "<rss version=\"0.91\">\n";
- echo "<channel>\n";
- echo "<title>$title</title>\n";
- echo "<link>$link</link>\n";
- echo "<description>$description</description>\n";
- }
- $increment_rss_entries = 0;
- $show_rss_entries = $feeds - 1;
- while ($increment_rss_entries <= $show_rss_entries) {
- $title = file_get_contents("data/items/$show_rss_items[$increment_rss_entries]/title.txt");
- $title = strip_tags($title);
- $title = htmlspecialchars($title,ENT_QUOTES);
- $link = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/index.php?entry=$show_rss_items[$increment_rss_entries]";
- $link = str_replace($fix_link, '/index.php', $link);
- $description = file_get_contents("data/items/$show_rss_items[$increment_rss_entries]/body.txt");
- $description = strip_tags($description);
- $description = htmlspecialchars($description,ENT_QUOTES);
- if (file_exists("data/pf.txt") and file_exists("data/pf-badwords.txt")) {
- $badwords = file_get_contents("data/pf-badwords.txt");
- if (file_exists("data/pf-censor.txt")) {
- $censor = file_get_contents("data/pf-censor.txt");
- }
- else {
- $censor = "[expletive]";
- }
- $description = preg_replace("/\b($badwords)\b/i",$censor,$description);
- }
- if ($_REQUEST['ver'] == "1.0") {
- echo "<item rdf:about=\"$link\">\n";
- }
- else {
- echo "<item>\n";
- }
- echo "<title>$title</title>\n";
- echo "<link>$link</link>\n";
- if ($_REQUEST['ver'] != "1.0") {
- echo "<guid>$link</guid>\n";
- }
- echo "<description>$description</description>\n";
- echo "</item>\n";
- $increment_rss_entries = $increment_rss_entries + 1;
- }
- if ($_REQUEST['ver'] != "1.0") {
- echo "</channel>\n";
- echo "</rss>";
- }
- else {
- echo "</rdf:RDF>";
- }
- }
- }
- ?>