Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15339
Modified Files:
serendipity_functions.inc.php
Log Message:
Add new format function for archieve URLs, thanks to zem
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.241
retrieving revision 1.242
diff -u -d -r1.241 -r1.242
--- serendipity_functions.inc.php 26 Mar 2004 13:21:55 -0000 1.241
+++ serendipity_functions.inc.php 27 Mar 2004 18:28:53 -0000 1.242
@@ -391,7 +391,7 @@
}
$monthName = ucfirst(strftime("%B", mktime(0,0,0,$month)));
// Prepare the table
- $link = $serendipity['serendipityHTTPPath'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . PATH_ARCHIVES . '/' . $year . sprintf('%02d', $month) . '.html' . $base_query;
+ $link = serendipity_archiveDateUrl($year . sprintf('%02d', $month)) . $base_query;
?>
<table width="100%" class="serendipity_calendar" cellspacing="1">
<tr>
@@ -468,7 +468,7 @@
}
// Print day
- $link = $serendipity['serendipityHTTPPath'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . PATH_ARCHIVES . '/' . date('Ymd', mktime(0,0,0, $month, $currDay, $year)) . '.html' . $base_query;
+ $link = serendipity_archiveDateUrl(date('Ymd', mktime(0,0,0, $month, $currDay, $year))) . $base_query;
if (date('m') == $month
&& date('Y') == $year
@@ -1771,6 +1771,15 @@
}
/**
+ * return URL for a date archive
+ */
+function serendipity_archiveDateUrl($range, $short=false, $key='baseURL') {
+ global $serendipity;
+
+ return $serendipity[$key]. ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . PATH_ARCHIVES . '/' . $range . ($short ? '_short' : '') . '.html';
+}
+
+/**
* search through link body, and automatically send a trackback ping.
*/
function serendipity_handle_references($id, $author, $title, $text)
@@ -2436,10 +2445,10 @@
for($x=1; $x<13; $x++) {
$entries = serendipity_postAmount($currYear, $x);
if ($entries > 0) {
- $a = "<a href='{$serendipity['serendipityHTTPPath']}" . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . PATH_ARCHIVES."/$currYear" . sprintf('%02s', $x) . '.html\'>';
+ $a = "<a href='". serendipity_archiveDateUrl($currYear . sprintf('%02s', $x)) . '\'>';
$b = '</a>';
- $c = "<a href='{$serendipity['serendipityHTTPPath']}" . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . PATH_ARCHIVES."/$currYear" . sprintf('%02s', $x) . '_short.html\'>';
- $d = "<a href='{$serendipity['serendipityHTTPPath']}" . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . PATH_ARCHIVES."/$currYear" . sprintf('%02s', $x) . '.html\'>';
+ $c = "<a href='". serendipity_archiveDateUrl($currYear . sprintf('%02s', $x), true) . '\'>';
+ $d = "<a href='". serendipity_archiveDateUrl($currYear . sprintf('%02s', $x)) . '\'>';
} else {
$a = $c = '<span style="color: #CDCDCD">';
$b = $d = '</span>';
|