aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojciech Polak <polak@gnu.org>2010-04-19 18:46:47 +0200
committerWojciech Polak <polak@gnu.org>2010-04-19 18:46:47 +0200
commit9e0a7fd01fe083f1d8b47c528cb599fd49fd138d (patch)
tree5139e052fddf6d20f514d25a2905a9394f45f983
parent9a2ce594f9ad8f40d77f8228856d673efc426b17 (diff)
downloadblogright-master.tar.gz
blogright-master.tar.bz2
version 2.5HEADmaster
-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,10 +1,10 @@
<?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
// Free Software Foundation; either version 3 of the License, or (at your
// option) any later version.
//
@@ -68,12 +68,16 @@ if (isset ($CONF['path.data']) && $CONF['path.data'] != '')
else
{
$CONF['path.data'] = '';
$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']))
{
$lines = file ($CONF['path.data'].$CONF['orderfile']);
foreach ($lines as $line)
$searchdirs[] = chop ($line);
@@ -263,28 +267,30 @@ if (isset ($RSS))
}
else {
$fmtime = filemtime ($inc);
}
$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";
echo " <title>$itemTitle</title>\n";
echo " <link>".$CONF['url.site']."/".
$CONF['qpattern'].$permaLink."</link>\n";
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";
}
echo " <guid isPermaLink=\"true\">".
$CONF['url.site']."/".$CONF['qpattern'].
$permaLink."</guid>\n";
@@ -355,37 +361,39 @@ else if (isset ($ATOM))
}
else {
$fmtime = filemtime ($inc);
}
$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";
echo " <id>".$CONF['feed.tagUri']."/$permaLink</id>\n";
echo " <updated>$pubDate</updated>\n";
echo " <title>$itemTitle</title>\n";
echo " <link rel=\"alternate\" type=\"text/html\" href=\"".
$CONF['url.site']."/".$CONF['qpattern'].$permaLink."\"/>\n";
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";
}
echo " </entry>\n";
}
}
@@ -414,21 +422,21 @@ else // HTML
// the query engine...
if (isset ($search_m))
{
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.
$copyrightYear = '';
if (count ($year_array))
{
@@ -601,15 +609,15 @@ function printer ($data, $string)
echo $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
$local_fn = 0;
if (is_numeric ($cdd))
{
@@ -656,17 +664,40 @@ function include_file ($file)
}
process_footnotes ('printer', 0);
echo '</div>'."\n";
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";
}
}
function printer_html ($level, $string)
@@ -736,13 +767,13 @@ function printCalendar ()
continue;
$dir = basename ($dir);
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 ();
while ($name = readdir ($dp))
{
if (ereg ("^(.*)-(.*)\.html\$", $name, $res))

Return to:

Send suggestions and report system problems to the System administrator.