Subversion Repositories SvarDOS

Rev

Rev 1223 | Rev 1230 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1223 Rev 1229
Line 95... Line 95...
95
}
95
}
96
 
96
 
97
 
97
 
98
function mateuszbb_rss() {
98
function mateuszbb_rss() {
99
  global $DATADIR;
99
  global $DATADIR;
-
 
100
  global $RSS_TITLE;
-
 
101
 
100
  $db = new SQLite3($DATADIR . 'mateuszbb.sqlite3', SQLITE3_OPEN_READONLY);
102
  $db = new SQLite3($DATADIR . 'mateuszbb.sqlite3', SQLITE3_OPEN_READONLY);
101
  if (! $db) {
103
  if (! $db) {
102
    echo "SQL ERROR: ACCESS DENIED\n";
104
    echo "SQL ERROR: ACCESS DENIED\n";
103
    return false;
105
    return false;
104
  }
106
  }
Line 111... Line 113...
111
  header('content-type: application/rss+xml');
113
  header('content-type: application/rss+xml');
112
 
114
 
113
  echo '<?xml version="1.0" encoding="utf-8" ?>' . "\n";
115
  echo '<?xml version="1.0" encoding="utf-8" ?>' . "\n";
114
  echo '<rss version="2.0">' . "\n";
116
  echo '<rss version="2.0">' . "\n";
115
  echo "<channel>\n";
117
  echo "<channel>\n";
116
  echo "<title>Forum Ul Warré</title>\n";
118
  echo "<title>" . htmlspecialchars($RSS_TITLE, ENT_XML1) . "</title>\n";
117
  echo "<link>https://ulwarre.pl/forum/</link>\n";
119
  echo "<link>" . selfurl(). "</link>\n";
118
  echo "<description>Forum na temat ula ojca Warré</description>\n";
-
 
119
 
120
 
120
  while ($row = $sqlres->fetchArray()) {
121
  while ($row = $sqlres->fetchArray()) {
121
    $rawtitle = file_get_contents($DATADIR . 'threads/' . $row['thread'] . '/title.txt');
122
    $rawtitle = file_get_contents($DATADIR . 'threads/' . $row['thread'] . '/title.txt');
122
    if (empty($rawtitle)) continue;
123
    if (empty($rawtitle)) continue;
123
    $title = htmlspecialchars($rawtitle, ENT_XML1, 'UTF-8');
124
    $title = htmlspecialchars($rawtitle, ENT_XML1, 'UTF-8');
124
    $author = htmlspecialchars($row['author'], ENT_XML1, 'UTF-8');
125
    $author = htmlspecialchars($row['author'], ENT_XML1, 'UTF-8');
-
 
126
    if ($NICE_URLS) {
-
 
127
      $link = selfurl();
-
 
128
      if (substr($link, -1) !== '/') $link .= '/';
-
 
129
      $link .= "{$row['thread']}";
-
 
130
    } else {
125
    $link = "https://ulwarre.pl/forum/{$row['thread']}#{$row['msgid']}";
131
      $link = selfurl('thread=' . $row['thread']);
-
 
132
    }
-
 
133
    $link .= '#' . $row['msgid'];
126
    echo "<item>\n";
134
    echo "<item>\n";
127
    echo "<title>{$author} napisał(a) wiadomość w wątku '{$title}'</title>\n";
135
    echo "<title>{$author} @ '{$title}'</title>\n";
128
    echo "<link>{$link}</link>\n";
136
    echo "<link>" . htmlspecialchars($link, ENT_XML1) . "</link>\n";
129
    echo "<description>{$author} napisał(a) wiadomość w wątku '{$title}'</description>\n";
137
    echo "<description>{$author} @ '{$title}'</description>\n";
130
    echo "<pubDate>" . date('r', $row['msgid']) . "</pubDate>\n";
138
    echo "<pubDate>" . date('r', $row['msgid']) . "</pubDate>\n";
131
    echo "<guid>{$link}</guid>\n";
139
    echo "<guid>" . htmlspecialchars($link, ENT_XML1) . "</guid>\n";
132
    echo "</item>\n";
140
    echo "</item>\n";
133
  }
141
  }
134
  $db->close();
142
  $db->close();
135
 
143
 
136
  echo "</channel>\n";
144
  echo "</channel>\n";