Subversion Repositories SvarDOS

Rev

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

Rev 1998 Rev 1999
Line 1... Line 1...
1
<?php
1
<?php
2
//
2
//
3
// mateuszbb - minimalist bulletin board forum. MIT license.
3
// mateuszbb - minimalist bulletin board forum. MIT license.
4
//
4
//
5
// VERSION 20240429
5
// VERSION 20240906
6
//
6
//
7
// Copyright (C) 2021-2024 Mateusz Viste
7
// Copyright (C) 2021-2024 Mateusz Viste
8
//
8
//
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
10
// of this software and associated documentation files (the “Software”), to
10
// of this software and associated documentation files (the “Software”), to
Line 224... Line 224...
224
  echo "<title>" . htmlspecialchars($RSS_TITLE, ENT_XML1) . "</title>\n";
224
  echo "<title>" . htmlspecialchars($RSS_TITLE, ENT_XML1) . "</title>\n";
225
  echo "<link>" . selfurl(). "</link>\n";
225
  echo "<link>" . selfurl(). "</link>\n";
226
  echo "<description>" . htmlspecialchars($RSS_TITLE, ENT_XML1) . "</description>\n";
226
  echo "<description>" . htmlspecialchars($RSS_TITLE, ENT_XML1) . "</description>\n";
227
 
227
 
228
  while ($row = $sqlres->fetchArray()) {
228
  while ($row = $sqlres->fetchArray()) {
-
 
229
    // TITLE
229
    $rawtitle = file_get_contents($DATADIR . 'threads/' . $row['thread'] . '/title.txt');
230
    $rawtitle = file_get_contents($DATADIR . 'threads/' . $row['thread'] . '/title.txt');
230
    if (empty($rawtitle)) continue;
231
    if (empty($rawtitle)) continue;
231
    $title = htmlspecialchars($rawtitle, ENT_XML1, 'UTF-8');
232
    $title = htmlspecialchars($rawtitle, ENT_XML1, 'UTF-8');
-
 
233
 
-
 
234
    // AUTHOR
232
    $author = htmlspecialchars($row['author'], ENT_XML1, 'UTF-8');
235
    $author = htmlspecialchars($row['author'], ENT_XML1, 'UTF-8');
-
 
236
 
-
 
237
    // CONTENT
-
 
238
    $rawcontent = loadmsg($row['thread'], $row['msgid'])['msg'];
-
 
239
    $rawcontent_shorter =  mb_substr($rawcontent, 0, 256);
-
 
240
    if (strlen($rawcontent) > strlen($rawcontent_shorter)) $rawcontent_shorter .= " (...)";
-
 
241
    $content = htmlspecialchars($rawcontent_shorter, ENT_XHTML, 'UTF-8');
-
 
242
 
-
 
243
    // LINK
233
    if ($NICE_URLS) {
244
    if ($NICE_URLS) {
234
      $link = selfurl();
245
      $link = selfurl();
235
      if (substr($link, -1) !== '/') $link .= '/';
246
      if (substr($link, -1) !== '/') $link .= '/';
236
      $link .= "{$row['thread']}";
247
      $link .= "{$row['thread']}";
237
    } else {
248
    } else {
238
      $link = selfurl('thread=' . $row['thread']);
249
      $link = selfurl('thread=' . $row['thread']);
239
    }
250
    }
240
    $link .= '#' . $row['msgid'];
251
    $link .= '#' . $row['msgid'];
-
 
252
 
-
 
253
    // RSS
241
    echo "<item>\n";
254
    echo "<item>\n";
242
    echo "<title>{$author} @ '{$title}'</title>\n";
255
    echo "<title>{$author} @ '{$title}'</title>\n";
243
    echo "<link>" . htmlspecialchars($link, ENT_XML1) . "</link>\n";
256
    echo "<link>" . htmlspecialchars($link, ENT_XML1) . "</link>\n";
244
    echo "<description>{$author} @ '{$title}'</description>\n";
257
    echo "<description>{$content}</description>\n";
245
    echo "<pubDate>" . date('r', $row['msgid']) . "</pubDate>\n";
258
    echo "<pubDate>" . date('r', $row['msgid']) . "</pubDate>\n";
246
    echo "<guid>" . htmlspecialchars($link, ENT_XML1) . "</guid>\n";
259
    echo "<guid>" . htmlspecialchars($link, ENT_XML1) . "</guid>\n";
247
    echo "</item>\n";
260
    echo "</item>\n";
248
  }
261
  }
249
  $db->close();
262
  $db->close();