summaryrefslogtreecommitdiffabout
authorWojciech Polak <polak@gnu.org>2010-04-19 16:46:47 (GMT)
committer Wojciech Polak <polak@gnu.org>2010-04-19 16:46:47 (GMT)
commit9e0a7fd01fe083f1d8b47c528cb599fd49fd138d (patch) (side-by-side diff)
tree5139e052fddf6d20f514d25a2905a9394f45f983
parent9a2ce594f9ad8f40d77f8228856d673efc426b17 (diff)
downloadblogright-master.tar.gz
blogright-master.tar.bz2
version 2.5HEADmaster
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--blog.php65
1 files changed, 48 insertions, 17 deletions
diff --git a/blog.php b/blog.php
index 367773b..823fbde 100644
--- a/blog.php
+++ b/blog.php
@@ -1,7 +1,7 @@
<?php
-// blogRight! version 2.2 (2008-03-16)
-// Copyright (C) 2004, 2005, 2006, 2007, 2008 Wojciech Polak.
+// blogRight! version 2.5 (2010-04-19)
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Wojciech Polak.
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
@@ -71,6 +71,10 @@ else
$cwd = getcwd ();
}
+$feed_titles_idx = array ();
+if (isset ($CONF['feed.titles.idx']))
+ @include $CONF['path.data'].$CONF['feed.titles.idx'];
+
if (isset ($CONF['orderfile']) &&
file_exists ($CONF['path.data'].$CONF['orderfile']))
{
@@ -266,7 +270,9 @@ if (isset ($RSS))
}
$pubDate = date ("D, d M Y H:i:s O", $fmtime);
- $itemTitle = date ('d M Y', $fmtime);
+ $idx = substr ($inc, strlen ($cwd));
+ $itemTitle = isset ($feed_titles_idx[$idx]) ? $feed_titles_idx[$idx] :
+ date ('d M Y', $fmtime);
$permaLink = date ($CONF['permalinkFmt'], $fmtime);
echo " <item>\n";
@@ -276,12 +282,12 @@ if (isset ($RSS))
if ($CONF['feed.CDATA']) {
echo " <description><![CDATA[\n";
- indent_include (9, $inc, $CONF['feed.CDATA']);
+ indent_include (0, $inc, $CONF['feed.CDATA']);
echo " ]]></description>\n";
}
else {
echo " <description>\n";
- indent_include (9, $inc, $CONF['feed.CDATA']);
+ indent_include (0, $inc, $CONF['feed.CDATA']);
echo " </description>\n";
}
@@ -358,7 +364,9 @@ else if (isset ($ATOM))
}
$pubDate = date ('Y-m-d\TH:i:s\Z', $fmtime);
- $itemTitle = date ('d M Y', $fmtime);
+ $idx = substr ($inc, strlen ($cwd));
+ $itemTitle = isset ($feed_titles_idx[$idx]) ? $feed_titles_idx[$idx] :
+ date ('d M Y', $fmtime);
$permaLink = date ($CONF['permalinkFmt'], $fmtime);
echo " <entry>\n";
@@ -371,18 +379,18 @@ else if (isset ($ATOM))
if ($CONF['feed.XHTML']) {
echo " <content type=\"xhtml\" xml:space=\"preserve\">\n";
echo " <div xmlns=\"http://www.w3.org/1999/xhtml\">\n";
- indent_include (6, $inc, $CONF['feed.XHTML']);
+ indent_include (0, $inc, $CONF['feed.XHTML']);
echo " </div>\n";
echo " </content>\n";
}
else if ($CONF['feed.CDATA']) {
echo " <content type=\"html\" xml:space=\"preserve\"><![CDATA[\n";
- indent_include (6, $inc, $CONF['feed.CDATA']);
+ indent_include (0, $inc, $CONF['feed.CDATA']);
echo " ]]></content>\n";
}
else {
echo " <content type=\"html\" xml:space=\"preserve\">\n";
- indent_include (6, $inc, $CONF['feed.CDATA']);
+ indent_include (0, $inc, $CONF['feed.CDATA']);
echo " </content>\n";
}
@@ -417,15 +425,15 @@ else // HTML
if (isset ($search_d))
{
if (ereg ("^$search_m-$search_d.*\.html\$", basename ($inc)))
- include_file ($inc);
+ include_file ($inc, 'd');
}
else
if (ereg ("^$search_m-.*\.html\$", basename ($inc)))
- include_file ($inc);
+ include_file ($inc, 'm');
}
else
if (ereg (".*\.html\$", basename ($inc)))
- include_file ($inc);
+ include_file ($inc, 'y');
}
// Calculate a copyright footnote.
@@ -604,9 +612,9 @@ function printer ($data, $string)
/////////////////////////////
// HTML output
-function include_file ($file)
+function include_file ($file, $type)
{
- global $CONF, $search_d, $local_fn, $year_array;
+ global $CONF, $search_y, $search_m, $local_fn, $year_array;
$res = array ();
$cdd = basename (dirname ($file)); // current data dir
@@ -659,11 +667,34 @@ function include_file ($file)
echo '<div class="entry-footer">'."\n";
echo '<a href="./'.$CONF['qpattern'].
- $permaLink.'" rel="bookmark" title="'.$entryDate.
- '"><abbr class="published" title="'.
+ $permaLink.'" class="bookmark" rel="bookmark" title="'.
+ $entryDate.'"><abbr class="published" title="'.
$pubDate.'">'.$entryDate.'</abbr></a>'."\n";
echo '<address class="vcard"><span class="fn">'.
$CONF['feed.authorName'].'</span></address>';
+
+ /* disqus support */
+ if (isset ($CONF['disqus.account']) && $CONF['disqus.account'] != '') {
+ if ($type == 'd') {
+ echo "\n";
+ echo '<div id="disqus_thread"></div>';
+ echo '<script type="text/javascript" src="http://disqus.com/forums/'.
+ $CONF['disqus.account'].'/embed.js"></script>';
+ if (isset ($CONF['disqus.showNoScript'])) {
+ echo '<noscript><div><a href="http://'.$CONF['disqus.account'].
+ '.disqus.com/?url=ref">View the forum thread.</a></div></noscript>';
+ }
+ echo '<a href="http://disqus.com" class="dsq-brlink">'.
+ 'comments powered by <span class="logo-disqus">Disqus</span>'.
+ '</a>'."\n";
+ }
+ else if (isset ($CONF['recent']) &&
+ (!isset ($search_y) || isset ($search_m))) {
+ echo '<a href="./'.$CONF['qpattern'].$permaLink.
+ '#disqus_thread" title="View comments">Comments</a>'."\n";
+ }
+ }
+
echo '</div>'."\n";
echo '</div>'."\n\n";
}
@@ -739,7 +770,7 @@ function printCalendar ()
echo "\n <!-- $dir -->\n";
echo " <td><div class=\"calendar-year\"><a href=\"./".
- $CONF['qpattern'].$dir."/\">$dir</a></div>\n";
+ $CONF['qpattern'].$dir."/\" rel=\"nofollow\">$dir</a></div>\n";
echo " <table class=\"calendar-months\">\n\n";
$mtab = array ();

Return to:

Send suggestions and report system problems to the System administrator.