diff options
author | Wojciech Polak <polak@gnu.org> | 2010-04-19 18:46:47 +0200 |
---|---|---|
committer | Wojciech Polak <polak@gnu.org> | 2010-04-19 18:46:47 +0200 |
commit | 9e0a7fd01fe083f1d8b47c528cb599fd49fd138d (patch) | |
tree | 5139e052fddf6d20f514d25a2905a9394f45f983 | |
parent | 9a2ce594f9ad8f40d77f8228856d673efc426b17 (diff) | |
download | blogright-9e0a7fd01fe083f1d8b47c528cb599fd49fd138d.tar.gz blogright-9e0a7fd01fe083f1d8b47c528cb599fd49fd138d.tar.bz2 |
-rw-r--r-- | blog.php | 69 |
1 files changed, 50 insertions, 19 deletions
@@ -1,7 +1,7 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | // blogRight! version 2.2 (2008-03-16) | 3 | // blogRight! version 2.5 (2010-04-19) |
4 | // Copyright (C) 2004, 2005, 2006, 2007, 2008 Wojciech Polak. | 4 | // Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Wojciech Polak. |
5 | // | 5 | // |
6 | // This program is free software; you can redistribute it and/or modify it | 6 | // This program is free software; you can redistribute it and/or modify it |
7 | // under the terms of the GNU General Public License as published by the | 7 | // under the terms of the GNU General Public License as published by the |
@@ -71,6 +71,10 @@ else | |||
71 | $cwd = getcwd (); | 71 | $cwd = getcwd (); |
72 | } | 72 | } |
73 | 73 | ||
74 | $feed_titles_idx = array (); | ||
75 | if (isset ($CONF['feed.titles.idx'])) | ||
76 | @include $CONF['path.data'].$CONF['feed.titles.idx']; | ||
77 | |||
74 | if (isset ($CONF['orderfile']) && | 78 | if (isset ($CONF['orderfile']) && |
75 | file_exists ($CONF['path.data'].$CONF['orderfile'])) | 79 | file_exists ($CONF['path.data'].$CONF['orderfile'])) |
76 | { | 80 | { |
@@ -266,7 +270,9 @@ if (isset ($RSS)) | |||
266 | } | 270 | } |
267 | 271 | ||
268 | $pubDate = date ("D, d M Y H:i:s O", $fmtime); | 272 | $pubDate = date ("D, d M Y H:i:s O", $fmtime); |
269 | $itemTitle = date ('d M Y', $fmtime); | 273 | $idx = substr ($inc, strlen ($cwd)); |
274 | $itemTitle = isset ($feed_titles_idx[$idx]) ? $feed_titles_idx[$idx] : | ||
275 | date ('d M Y', $fmtime); | ||
270 | $permaLink = date ($CONF['permalinkFmt'], $fmtime); | 276 | $permaLink = date ($CONF['permalinkFmt'], $fmtime); |
271 | 277 | ||
272 | echo " <item>\n"; | 278 | echo " <item>\n"; |
@@ -276,12 +282,12 @@ if (isset ($RSS)) | |||
276 | 282 | ||
277 | if ($CONF['feed.CDATA']) { | 283 | if ($CONF['feed.CDATA']) { |
278 | echo " <description><![CDATA[\n"; | 284 | echo " <description><![CDATA[\n"; |
279 | indent_include (9, $inc, $CONF['feed.CDATA']); | 285 | indent_include (0, $inc, $CONF['feed.CDATA']); |
280 | echo " ]]></description>\n"; | 286 | echo "]]></description>\n"; |
281 | } | 287 | } |
282 | else { | 288 | else { |
283 | echo " <description>\n"; | 289 | echo " <description>\n"; |
284 | indent_include (9, $inc, $CONF['feed.CDATA']); | 290 | indent_include (0, $inc, $CONF['feed.CDATA']); |
285 | echo " </description>\n"; | 291 | echo " </description>\n"; |
286 | } | 292 | } |
287 | 293 | ||
@@ -358,7 +364,9 @@ else if (isset ($ATOM)) | |||
358 | } | 364 | } |
359 | 365 | ||
360 | $pubDate = date ('Y-m-d\TH:i:s\Z', $fmtime); | 366 | $pubDate = date ('Y-m-d\TH:i:s\Z', $fmtime); |
361 | $itemTitle = date ('d M Y', $fmtime); | 367 | $idx = substr ($inc, strlen ($cwd)); |
368 | $itemTitle = isset ($feed_titles_idx[$idx]) ? $feed_titles_idx[$idx] : | ||
369 | date ('d M Y', $fmtime); | ||
362 | $permaLink = date ($CONF['permalinkFmt'], $fmtime); | 370 | $permaLink = date ($CONF['permalinkFmt'], $fmtime); |
363 | 371 | ||
364 | echo " <entry>\n"; | 372 | echo " <entry>\n"; |
@@ -371,18 +379,18 @@ else if (isset ($ATOM)) | |||
371 | if ($CONF['feed.XHTML']) { | 379 | if ($CONF['feed.XHTML']) { |
372 | echo " <content type=\"xhtml\" xml:space=\"preserve\">\n"; | 380 | echo " <content type=\"xhtml\" xml:space=\"preserve\">\n"; |
373 | echo " <div xmlns=\"http://www.w3.org/1999/xhtml\">\n"; | 381 | echo " <div xmlns=\"http://www.w3.org/1999/xhtml\">\n"; |
374 | indent_include (6, $inc, $CONF['feed.XHTML']); | 382 | indent_include (0, $inc, $CONF['feed.XHTML']); |
375 | echo " </div>\n"; | 383 | echo " </div>\n"; |
376 | echo " </content>\n"; | 384 | echo " </content>\n"; |
377 | } | 385 | } |
378 | else if ($CONF['feed.CDATA']) { | 386 | else if ($CONF['feed.CDATA']) { |
379 | echo " <content type=\"html\" xml:space=\"preserve\"><![CDATA[\n"; | 387 | echo " <content type=\"html\" xml:space=\"preserve\"><![CDATA[\n"; |
380 | indent_include (6, $inc, $CONF['feed.CDATA']); | 388 | indent_include (0, $inc, $CONF['feed.CDATA']); |
381 | echo " ]]></content>\n"; | 389 | echo "]]></content>\n"; |
382 | } | 390 | } |
383 | else { | 391 | else { |
384 | echo " <content type=\"html\" xml:space=\"preserve\">\n"; | 392 | echo " <content type=\"html\" xml:space=\"preserve\">\n"; |
385 | indent_include (6, $inc, $CONF['feed.CDATA']); | 393 | indent_include (0, $inc, $CONF['feed.CDATA']); |
386 | echo " </content>\n"; | 394 | echo " </content>\n"; |
387 | } | 395 | } |
388 | 396 | ||
@@ -417,15 +425,15 @@ else // HTML | |||
417 | if (isset ($search_d)) | 425 | if (isset ($search_d)) |
418 | { | 426 | { |
419 | if (ereg ("^$search_m-$search_d.*\.html\$", basename ($inc))) | 427 | if (ereg ("^$search_m-$search_d.*\.html\$", basename ($inc))) |
420 | include_file ($inc); | 428 | include_file ($inc, 'd'); |
421 | } | 429 | } |
422 | else | 430 | else |
423 | if (ereg ("^$search_m-.*\.html\$", basename ($inc))) | 431 | if (ereg ("^$search_m-.*\.html\$", basename ($inc))) |
424 | include_file ($inc); | 432 | include_file ($inc, 'm'); |
425 | } | 433 | } |
426 | else | 434 | else |
427 | if (ereg (".*\.html\$", basename ($inc))) | 435 | if (ereg (".*\.html\$", basename ($inc))) |
428 | include_file ($inc); | 436 | include_file ($inc, 'y'); |
429 | } | 437 | } |
430 | 438 | ||
431 | // Calculate a copyright footnote. | 439 | // Calculate a copyright footnote. |
@@ -604,9 +612,9 @@ function printer ($data, $string) | |||
604 | ///////////////////////////// | 612 | ///////////////////////////// |
605 | 613 | ||
606 | // HTML output | 614 | // HTML output |
607 | function include_file ($file) | 615 | function include_file ($file, $type) |
608 | { | 616 | { |
609 | global $CONF, $search_d, $local_fn, $year_array; | 617 | global $CONF, $search_y, $search_m, $local_fn, $year_array; |
610 | $res = array (); | 618 | $res = array (); |
611 | $cdd = basename (dirname ($file)); // current data dir | 619 | $cdd = basename (dirname ($file)); // current data dir |
612 | 620 | ||
@@ -659,11 +667,34 @@ function include_file ($file) | |||
659 | 667 | ||
660 | echo '<div class="entry-footer">'."\n"; | 668 | echo '<div class="entry-footer">'."\n"; |
661 | echo '<a href="./'.$CONF['qpattern']. | 669 | echo '<a href="./'.$CONF['qpattern']. |
662 | $permaLink.'" rel="bookmark" title="'.$entryDate. | 670 | $permaLink.'" class="bookmark" rel="bookmark" title="'. |
663 | '"><abbr class="published" title="'. | 671 | $entryDate.'"><abbr class="published" title="'. |
664 | $pubDate.'">'.$entryDate.'</abbr></a>'."\n"; | 672 | $pubDate.'">'.$entryDate.'</abbr></a>'."\n"; |
665 | echo '<address class="vcard"><span class="fn">'. | 673 | echo '<address class="vcard"><span class="fn">'. |
666 | $CONF['feed.authorName'].'</span></address>'; | 674 | $CONF['feed.authorName'].'</span></address>'; |
675 | |||
676 | /* disqus support */ | ||
677 | if (isset ($CONF['disqus.account']) && $CONF['disqus.account'] != '') { | ||
678 | if ($type == 'd') { | ||
679 | echo "\n"; | ||
680 | echo '<div id="disqus_thread"></div>'; | ||
681 | echo '<script type="text/javascript" src="http://disqus.com/forums/'. | ||
682 | $CONF['disqus.account'].'/embed.js"></script>'; | ||
683 | if (isset ($CONF['disqus.showNoScript'])) { | ||
684 | echo '<noscript><div><a href="http://'.$CONF['disqus.account']. | ||
685 | '.disqus.com/?url=ref">View the forum thread.</a></div></noscript>'; | ||
686 | } | ||
687 | echo '<a href="http://disqus.com" class="dsq-brlink">'. | ||
688 | 'comments powered by <span class="logo-disqus">Disqus</span>'. | ||
689 | '</a>'."\n"; | ||
690 | } | ||
691 | else if (isset ($CONF['recent']) && | ||
692 | (!isset ($search_y) || isset ($search_m))) { | ||
693 | echo '<a href="./'.$CONF['qpattern'].$permaLink. | ||
694 | '#disqus_thread" title="View comments">Comments</a>'."\n"; | ||
695 | } | ||
696 | } | ||
697 | |||
667 | echo '</div>'."\n"; | 698 | echo '</div>'."\n"; |
668 | echo '</div>'."\n\n"; | 699 | echo '</div>'."\n\n"; |
669 | } | 700 | } |
@@ -739,7 +770,7 @@ function printCalendar () | |||
739 | 770 | ||
740 | echo "\n <!-- $dir -->\n"; | 771 | echo "\n <!-- $dir -->\n"; |
741 | echo " <td><div class=\"calendar-year\"><a href=\"./". | 772 | echo " <td><div class=\"calendar-year\"><a href=\"./". |
742 | $CONF['qpattern'].$dir."/\">$dir</a></div>\n"; | 773 | $CONF['qpattern'].$dir."/\" rel=\"nofollow\">$dir</a></div>\n"; |
743 | echo " <table class=\"calendar-months\">\n\n"; | 774 | echo " <table class=\"calendar-months\">\n\n"; |
744 | 775 | ||
745 | $mtab = array (); | 776 | $mtab = array (); |