diff options
author | Wojciech Polak <polak@gnu.org> | 2006-01-14 18:52:27 +0000 |
---|---|---|
committer | Wojciech Polak <polak@gnu.org> | 2006-01-14 18:52:27 +0000 |
commit | 34ae1ce7b55a0c106c604912db9bf94424fb9113 (patch) | |
tree | dfab56c86092927c055e16ac6624fa5d49b729b0 | |
parent | 44c5fc1252c3d3a671be89582472908d6f46f176 (diff) | |
download | blogright-34ae1ce7b55a0c106c604912db9bf94424fb9113.tar.gz blogright-34ae1ce7b55a0c106c604912db9bf94424fb9113.tar.bz2 |
version 2.1
-rw-r--r-- | blog.php | 100 | ||||
-rw-r--r-- | config.php | 17 |
2 files changed, 102 insertions, 15 deletions
@@ -1,6 +1,6 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | // blogRight! version 2.0.1 (2006-01-05) | 3 | // blogRight! version 2.1 (2006-01-14) |
4 | // Copyright (C) 2004, 2005, 2006 Wojciech Polak. | 4 | // Copyright (C) 2004, 2005, 2006 Wojciech Polak. |
5 | // | 5 | // |
6 | // This program is free software; you can redistribute it and/or modify | 6 | // This program is free software; you can redistribute it and/or modify |
@@ -213,17 +213,19 @@ if (isset ($RSS) || isset ($_REQUEST['rss'])) | |||
213 | header ("ETag: $ETag"); | 213 | header ("ETag: $ETag"); |
214 | 214 | ||
215 | echo '<?xml version="1.0" encoding="'.$charsetEncoding.'"?>'."\n"; | 215 | echo '<?xml version="1.0" encoding="'.$charsetEncoding.'"?>'."\n"; |
216 | if ($feedStylesheet) | ||
217 | echo "<?xml-stylesheet href=\"$site/$weblogdir/css/rss.css\" type=\"text/css\"?>\n"; | ||
216 | echo '<rss version="2.0">'."\n"; | 218 | echo '<rss version="2.0">'."\n"; |
217 | echo " <channel>\n"; | 219 | echo " <channel>\n"; |
218 | echo " <title>$rssTitle</title>\n"; | 220 | echo " <title>$feedTitle</title>\n"; |
219 | echo " <description>$rssDescription</description>\n"; | 221 | echo " <description>$feedDescription</description>\n"; |
220 | echo " <link>$site/$weblogdir/</link>\n"; | 222 | echo " <link>$site/$weblogdir/</link>\n"; |
221 | echo " <copyright>$rssCopyright</copyright>\n"; | 223 | echo " <copyright>$feedCopyright</copyright>\n"; |
222 | echo " <language>$rssLanguage</language>\n"; | 224 | echo " <language>$feedLanguage</language>\n"; |
223 | echo " <pubDate>$pubDate</pubDate>\n"; | 225 | echo " <pubDate>$pubDate</pubDate>\n"; |
224 | echo " <docs>http://blogs.law.harvard.edu/tech/rss</docs>\n"; | 226 | echo " <docs>http://blogs.law.harvard.edu/tech/rss</docs>\n"; |
225 | echo " <generator>blogRight!</generator>\n"; | 227 | echo " <generator>blogRight!</generator>\n"; |
226 | echo " <managingEditor>$rssEditor</managingEditor>\n"; | 228 | echo " <managingEditor>$feedEditor</managingEditor>\n"; |
227 | 229 | ||
228 | foreach ($include_files as $inc) | 230 | foreach ($include_files as $inc) |
229 | { | 231 | { |
@@ -266,7 +268,89 @@ if (isset ($RSS) || isset ($_REQUEST['rss'])) | |||
266 | } | 268 | } |
267 | 269 | ||
268 | echo " </channel>\n"; | 270 | echo " </channel>\n"; |
269 | echo '</rss>'."\n"; | 271 | echo "</rss>\n"; |
272 | } | ||
273 | else if (isset ($ATOM) || isset ($_REQUEST['atom'])) { | ||
274 | |||
275 | $pubDate = date ('Y-m-d\TH:i:s\Z', filemtime ($include_files[0])); | ||
276 | $lastModified = date ('Y-m-d\TH:i:s\Z', filemtime ($include_files[0])); | ||
277 | $ETag = '"'.md5 ($lastModified).'"'; | ||
278 | |||
279 | $headers = getallheaders (); | ||
280 | if (array_key_exists ('If-Modified-Since', $headers) && | ||
281 | array_key_exists ('If-None-Match', $headers)) | ||
282 | { | ||
283 | if ($headers['If-Modified-Since'] == $lastModified && | ||
284 | $headers['If-None-Match'] == $ETag) | ||
285 | { | ||
286 | header ('HTTP/1.1 304 Not Modified'); | ||
287 | exit (); | ||
288 | } | ||
289 | } | ||
290 | header ("Content-Type: text/xml; charset=$charsetEncoding"); | ||
291 | header ("Last-Modified: $lastModified"); | ||
292 | header ("ETag: $ETag"); | ||
293 | |||
294 | $tagUri = "tag:$feedAuthorEmail,2004:blog"; | ||
295 | |||
296 | echo '<?xml version="1.0" encoding="'.$charsetEncoding.'"?>'."\n"; | ||
297 | if ($feedStylesheet) | ||
298 | echo "<?xml-stylesheet href=\"$site/$weblogdir/css/atom.css\" type=\"text/css\"?>\n"; | ||
299 | echo '<feed xmlns="http://www.w3.org/2005/Atom">'."\n"; | ||
300 | echo " <title>$feedTitle</title>\n"; | ||
301 | echo " <subtitle>$feedDescription</subtitle>\n"; | ||
302 | echo " <updated>$pubDate</updated>\n"; | ||
303 | echo " <author>\n"; | ||
304 | echo " <name>$feedAuthorName</name>\n"; | ||
305 | echo " <email>$feedAuthorEmail</email>\n"; | ||
306 | echo " </author>\n"; | ||
307 | echo " <rights>$feedCopyright</rights>\n"; | ||
308 | echo " <generator>blogRight!</generator>\n"; | ||
309 | echo " <id>$tagUri</id>\n"; | ||
310 | echo " <link rel=\"self\" type=\"application/atom+xml\" href=\"$site/$weblogdir/atom/\"/>\n"; | ||
311 | echo " <link rel=\"alternate\" type=\"text/html\" href=\"$site/$weblogdir/\"/>\n"; | ||
312 | |||
313 | foreach ($include_files as $inc) | ||
314 | { | ||
315 | if (ereg (".*$suffix\$", basename ($inc))) | ||
316 | { | ||
317 | $cdd = basename (dirname ($inc)); // current data dir | ||
318 | if (is_numeric ($cdd)) | ||
319 | { | ||
320 | ereg ('^(.*)-(.*)\.', basename ($inc), $res); | ||
321 | $year = $cdd; | ||
322 | |||
323 | if (isset ($res[1]) && isset ($res[2])) | ||
324 | { | ||
325 | $month = $res[1]; | ||
326 | $day = $res[2]; | ||
327 | } | ||
328 | |||
329 | $fmtime = mktime (0, 0, 0, $month, $day, $year); | ||
330 | } | ||
331 | else { | ||
332 | $fmtime = filemtime ($inc); | ||
333 | } | ||
334 | |||
335 | $pubDate = date ('Y-m-d\TH:i:s\Z', $fmtime); | ||
336 | $itemTitle = date ('d M Y', $fmtime); | ||
337 | $permaLink = date ('Ymd', $fmtime); | ||
338 | |||
339 | echo " <entry>\n"; | ||
340 | echo " <id>$tagUri/$permaLink</id>\n"; | ||
341 | echo " <updated>$pubDate</updated>\n"; | ||
342 | echo " <title>$itemTitle</title>\n"; | ||
343 | echo " <link rel=\"alternate\" type=\"text/html\" href=\"$site/$weblogdir/?q=$permaLink\"/>\n"; | ||
344 | echo " <content type=\"html\" xml:space=\"preserve\">\n"; | ||
345 | |||
346 | indent_include (6, $inc); | ||
347 | |||
348 | echo " </content>\n"; | ||
349 | echo " </entry>\n"; | ||
350 | } | ||
351 | } | ||
352 | |||
353 | echo '</feed>'."\n"; | ||
270 | } | 354 | } |
271 | else // HTML | 355 | else // HTML |
272 | { | 356 | { |
@@ -514,7 +598,7 @@ function printer_html ($level, $string) | |||
514 | echo (htmlentities ($string) . "\n"); | 598 | echo (htmlentities ($string) . "\n"); |
515 | } | 599 | } |
516 | 600 | ||
517 | // RSS 2.0 output | 601 | // Atom/RSS 2.0 output |
518 | function indent_include ($level, $file) | 602 | function indent_include ($level, $file) |
519 | { | 603 | { |
520 | global $site, $imagedir, $photodir, $weblogdir, $local_fn; | 604 | global $site, $imagedir, $photodir, $weblogdir, $local_fn; |
@@ -1,6 +1,6 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | // blogRight! version 2.0 | 3 | // blogRight! version 2.1 |
4 | // BEGIN CONFIG | 4 | // BEGIN CONFIG |
5 | 5 | ||
6 | $site = 'http://your.site.name'; | 6 | $site = 'http://your.site.name'; |
@@ -25,12 +25,15 @@ $defaultGallery = 'photoblog'; | |||
25 | $thumbnailPrefix['default'] = 'small/small-'; | 25 | $thumbnailPrefix['default'] = 'small/small-'; |
26 | $thumbnailPrefix['photoblog'] = 'photoblog/small/small-'; | 26 | $thumbnailPrefix['photoblog'] = 'photoblog/small/small-'; |
27 | 27 | ||
28 | // RSS | 28 | // RSS/Atom |
29 | $rssTitle = "RSS Title"; | 29 | $feedStylesheet = true; // $site/$weblogdir/css/(atom|rss).css |
30 | $rssDescription = "Some descriptive title"; | 30 | $feedTitle = 'title'; |
31 | $rssCopyright = "Your Name"; | 31 | $feedDescription = "description"; |
32 | $rssEditor = "Editor Name"; | 32 | $feedCopyright = 'Copyright (C) Your Name'; |
33 | $rssLanguage = "qu"; // Two-letter language code as per ISO 639 | 33 | $feedAuthorName = 'Your Name'; |
34 | $feedAuthorEmail = 'Your e-mail address'; | ||
35 | $feedEditor = "$feedAuthorEmail ($feedAuthorName)"; | ||
36 | $feedLanguage = 'en'; // Two-letter language code as per ISO 639 | ||
34 | 37 | ||
35 | // Calendar | 38 | // Calendar |
36 | $calendarEmptyMonths = false; | 39 | $calendarEmptyMonths = false; |