Update of /cvsroot/php-blog/serendipity/include
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25986/include
Modified Files:
Tag: branch-smarty
functions.inc.php functions_comments.inc.php
functions_entries.inc.php functions_smarty.inc.php
plugin_internal.inc.php
Log Message:
* Support for adding timezone offsets in configuration
* Fixed XHTML compliance of calendar
* Adjusted coding style in some places
* Fixed entry preview to not show comments/trackbacks
* Fixed draft display in frontend entry overview
* New variable "is_preview" for smarty template
* Removed some hard-coded language strings in smarty templates
Index: plugin_internal.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/Attic/plugin_internal.inc.php,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -d -r1.1.2.2 -r1.1.2.3
--- plugin_internal.inc.php 8 Nov 2004 09:25:31 -0000 1.1.2.2
+++ plugin_internal.inc.php 12 Nov 2004 15:43:23 -0000 1.1.2.3
@@ -39,40 +39,46 @@
$title = CALENDAR;
- if (!isset($serendipity['GET']['calendarZoom'])) {
+ // Usage of serendipity_serverOffsetHour is as follow:
+ // * Whenever a date to display needs to be set, apply the timezone offset
+ // * Whenever we USE the date anywhere in the database, subtract the timezone offset
+ // * Whenever we DISPLAY the date, we do not apply additional timezone addition to it.
+
+ if (!isset($serendipity['GET']['calendarZoom'])) {
if (!isset($serendipity['range'])) {
- $serendipity['GET']['calendarZoom'] = time();
- } else {
- $serendipity['GET']['calendarZoom'] = $serendipity['range'][0];
- }
- }
+ $serendipity['GET']['calendarZoom'] = serendipity_serverOffsetHour(time());
+ } else {
+ $serendipity['GET']['calendarZoom'] = serendipity_serverOffsetHour($serendipity['range'][0]);
+ }
+ }
- $month = date('m', $serendipity['GET']['calendarZoom']);
- $year = date('Y', $serendipity['GET']['calendarZoom']);
+ $month = date('m', serendipity_serverOffsetHour($serendipity['GET']['calendarZoom'], true));
+ $year = date('Y', serendipity_serverOffsetHour($serendipity['GET']['calendarZoom'], true));
$bow = (int)$this->get_config('beginningOfWeek', 1);
// Check for faulty input, is so - run the default
- if ($bow>6) {
+ if ($bow > 6) {
$bow = 1;
}
// Catch faulty month
$month = (int)$month;
- if ($month<1) {
+ if ($month < 1) {
$month = 1;
}
// How many days does the month have?
$ts = strtotime($year . '-' . sprintf('%02d', $month) . '-01');
+ $now = serendipity_serverOffsetHour(time(), true);
$nrOfDays = date('t', $ts);
$firstDayWeekDay = date('w', $ts);
// Calculate the first day of the week, based on the beginning of the week ($bow)
- if ( $bow > $firstDayWeekDay ) {
- $firstDayWeekDay = $firstDayWeekDay+7-$bow;
+ if ($bow > $firstDayWeekDay) {
+ $firstDayWeekDay = $firstDayWeekDay + 7 - $bow;
} elseif ( $bow < $firstDayWeekDay ) {
- $firstDayWeekDay = $firstDayWeekDay-$bow;
+ $firstDayWeekDay = $firstDayWeekDay - $bow;
} else {
$firstDayWeekDay = 0;
}
@@ -86,7 +92,7 @@
$previousYear = $year-1;
}
- if ($month <12) {
+ if ($month < 12) {
$nextMonth = $month+1;
$nextYear = $year;
} else {
@@ -102,8 +108,8 @@
// If no entry is available yet, allow scrolling a year back and forth
$minmax = array(
'0' => array(
- 'min' => mktime(0, 0, 0, 1, 1, date('Y')-1),
- 'max' => mktime(0, 0, 0, 1, 1, date('Y')+1)
+ 'min' => mktime(0, 0, 0, 1, 1, date('Y', $now) - 1),
+ 'max' => mktime(0, 0, 0, 1, 1, date('Y', $now) + 1)
)
);
}
@@ -121,9 +127,9 @@
FROM {$serendipity['dbPrefix']}entries e,
{$serendipity['dbPrefix']}category c,
{$serendipity['dbPrefix']}entrycat ec
- WHERE e.timestamp >= $ts
- AND e.timestamp <= $endts
- AND e.timestamp <= " . time() . "
+ WHERE e.timestamp >= " . serendipity_serverOffsetHour($ts, true) . "
+ AND e.timestamp <= " . serendipity_serverOffsetHour($endts, true) . "
+ AND e.timestamp <= $now
AND e.isdraft = 'false'
AND e.id = ec.entryid
AND c.categoryid = ec.categoryid
@@ -132,15 +138,20 @@
}
if (!isset($querystring)) {
- $querystring = "SELECT timestamp
+ $querystring = "SELECT id, timestamp
FROM {$serendipity['dbPrefix']}entries e
- WHERE e.timestamp >= $ts and e.timestamp <= $endts AND e.timestamp <= " . time() . " AND e.isdraft = 'false'";
+ WHERE e.timestamp >= " . serendipity_serverOffsetHour($ts, true) . "
+ AND e.timestamp <= " . serendipity_serverOffsetHour($endts, true) . "
+ AND e.timestamp <= $now
+ AND e.isdraft = 'false'";
}
$rows = serendipity_db_query($querystring);
+
$activeDays = array();
if (is_array($rows)) {
foreach ($rows as $row) {
+ $row['timestamp'] = serendipity_serverOffsetHour($row['timestamp']);
$activeDays[date('j', $row['timestamp'])] = $row['timestamp'];
}
}
@@ -148,9 +159,9 @@
// Print the calendar
$currDay = 1;
$nrOfRows = ceil(($nrOfDays+$firstDayWeekDay)/7);
- $today_day = date('j');
- $today_month = date('m');
- $today_year = date('Y');
+ $today_day = date('j', $now);
+ $today_month = date('m', $now);
+ $today_year = date('Y', $now);
for ($x = 0; $x < 6; $x++) {
// Break out if we are out of days
if ($currDay > $nrOfDays) {
@@ -197,11 +208,10 @@
$dow = array();
for ($i = 1; $i <= 7; $i++) {
- $dow[] = array('date' => mktime(0,0,0,3,$bow+$i-1,2004));
+ $dow[] = array('date' => mktime(0, 0, 0, 3, $bow + $i - 1, $year));
}
$serendipity['smarty']->assign('plugin_calendar_dow', $dow);
-
$serendipity['smarty']->assign('plugin_calendar_head', array('month_date' => $ts,
'uri_previous' => serendipity_archiveDateUrl(sprintf('%04d/%02d', $previousYear, $previousMonth). $add_query),
'uri_month' => serendipity_archiveDateUrl(sprintf('%04d/%02d', $year, $month)),
@@ -297,7 +307,7 @@
break;
case 'days' :
$linkStamp = date('Y/m/d', $ts);
- $ts_title = serendipity_formatTime("%B %e. %Y", $ts);
+ $ts_title = serendipity_formatTime("%B %e. %Y", $ts, false);
$ts = mktime(0, 0, 0, date('m', $ts), date('d', $ts)-1, date('Y', $ts)); // Must be last in 'case' statement
break;
}
@@ -681,7 +691,7 @@
switch($match[1]) {
case 'pubDate':
if ($bag_content != 'false') {
- $bag_content = gmdate('D, d M Y H:i:s \G\M\T', $entries[0]['last_modified']);
+ $bag_content = gmdate('D, d M Y H:i:s \G\M\T', serendipity_serverOffsetHour($entries[0]['last_modified']));
} else {
$bag_content = '';
}
Index: functions_smarty.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/Attic/functions_smarty.inc.php,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -d -r1.1.2.3 -r1.1.2.4
--- functions_smarty.inc.php 11 Nov 2004 12:45:21 -0000 1.1.2.3
+++ functions_smarty.inc.php 12 Nov 2004 15:43:23 -0000 1.1.2.4
@@ -58,11 +58,11 @@
}
-function serendipity_smarty_formatTime($timestamp, $format) {
+function serendipity_smarty_formatTime($timestamp, $format, $useOffset = true) {
if (defined($format)) {
- return serendipity_formatTime(constant($format), $timestamp);
+ return serendipity_formatTime(constant($format), $timestamp, $useOffset);
} else {
- return serendipity_formatTime($format, $timestamp);
+ return serendipity_formatTime($format, $timestamp, $useOffset);
}
}
@@ -104,7 +104,7 @@
return serendipity_printTrackbacks(serendipity_fetchTrackbacks($params['entry']));
}
-function serendipity_smarty_assignDefaults() {
+function serendipity_smarty_assignDefaults($smartyvars = null) {
global $serendipity;
$serendipity['smarty']->assign(
array(
@@ -131,6 +131,10 @@
)
);
+ if (is_array($smartyvars)) {
+ $serendipity['smarty']->assign($smartyvars);
+ }
+
return true;
}
Index: functions_entries.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/Attic/functions_entries.inc.php,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -d -r1.1.2.5 -r1.1.2.6
--- functions_entries.inc.php 11 Nov 2004 13:42:58 -0000 1.1.2.5
+++ functions_entries.inc.php 12 Nov 2004 15:43:23 -0000 1.1.2.6
@@ -98,16 +98,16 @@
}
/* Attempt to grab range from $serendipity, if $range is not an array or null */
- if ( !is_array($range) && !is_null($range) && isset($serendipity['range']) ) {
+ if (!is_array($range) && !is_null($range) && isset($serendipity['range'])) {
$range = $serendipity['range'];
}
if (is_numeric($range)) {
- $year = (int)substr($range, 0, 4);
+ $year = (int)substr($range, 0, 4);
$month = (int)substr($range, 4, 2);
- $day = (int)substr($range, 6, 2);
+ $day = (int)substr($range, 6, 2);
- $startts = mktime(0, 0, 0, $month, ($day == 0 ? 1 : $day), $year);
+ $startts = serendipity_serverOffsetHour(mktime(0, 0, 0, $month, ($day == 0 ? 1 : $day), $year), true);
if ($day == 0) {
$month++;
@@ -115,15 +115,12 @@
$day++;
}
- $endts = mktime(0, 0, 0, $month, ($day == 0 ? 1 : $day), $year);
+ $endts = serendipity_serverOffsetHour(mktime(0, 0, 0, $month, ($day == 0 ? 1 : $day), $year), true);
$cond['and'] = " WHERE timestamp >= $startts AND timestamp <= $endts";
- if ($drafts) {
- $cond['and'] .= " AND $drafts";
- }
} elseif (is_array($range) && count($range)==2) {
- $startts = (int)$range[0];
- $endts = (int)$range[1];
+ $startts = serendipity_serverOffsetHour((int)$range[0], true);
+ $endts = serendipity_serverOffsetHour((int)$range[1], true);
$cond['and'] = " WHERE timestamp >= $startts AND timestamp <= $endts";
} else {
if ($modified_since) {
@@ -136,13 +133,13 @@
$cond['orderby'] = 'last_modified DESC';
}
}
+ }
- if (!empty($drafts)) {
- if (!empty($cond['and'])) {
- $cond['and'] .= " AND $drafts";
- } else {
- $cond['and'] = "WHERE $drafts";
- }
+ if (!empty($drafts)) {
+ if (!empty($cond['and'])) {
+ $cond['and'] .= " AND $drafts";
+ } else {
+ $cond['and'] = "WHERE $drafts";
}
}
@@ -177,9 +174,9 @@
if (!isset($serendipity['GET']['adminModule'])) {
if (!empty($cond['and'])) {
- $cond['and'] .= " AND e.timestamp <= '" . time() . "'";
+ $cond['and'] .= " AND e.timestamp <= '" . serendipity_serverOffsetHour(time(), true) . "'";
} else {
- $cond['and'] = "WHERE e.timestamp <= '" . time() . "'";
+ $cond['and'] = "WHERE e.timestamp <= '" . serendipity_serverOffsetHour(time(), true) . "'";
}
}
@@ -237,6 +234,7 @@
$group
ORDER BY {$cond['orderby']}
$limit";
+
$ret = serendipity_db_query($query);
if (is_string($ret)) {
@@ -293,9 +291,10 @@
global $serendipity;
$cond = array();
- $cond['and'] = '';
+ $cond['and'] = " "; // intentional dummy string to attach dummy AND parts to the WHERE clauses
+
if ($fetchDrafts == 'false') {
- $cond['and'] = " AND e.isdraft = 'false' AND e.timestamp <= " . time();
+ $cond['and'] = " AND e.isdraft = 'false' AND e.timestamp <= " . serendipity_serverOffsetHour(time(), true);
}
if (isset($serendipity['GET']['adminModule']) && $serendipity['GET']['adminModule'] == 'entries' && $serendipity['serendipityUserlevel'] < USERLEVEL_CHIEF) {
@@ -319,8 +318,11 @@
LIMIT 1";
$ret = serendipity_db_query($querystring, true);
- $ret['categories'] = serendipity_fetchEntryCategories($ret['id']);
- $ret['properties'] = serendipity_fetchEntryProperties($ret['id']);
+ if (is_array($ret)) {
+ $ret['categories'] = serendipity_fetchEntryCategories($ret['id']);
+ $ret['properties'] = serendipity_fetchEntryProperties($ret['id']);
+ }
+
return $ret;
}
@@ -415,7 +417,7 @@
}
$cond = array();
- $cond['and'] = " AND isdraft = 'false' AND timestamp <= " . time();
+ $cond['and'] = " AND isdraft = 'false' AND timestamp <= " . serendipity_serverOffsetHour(time(), true);
serendipity_plugin_api::hook_event('frontend_fetchentries', $cond);
$querystring = "SELECT $distinct
e.id,
@@ -539,7 +541,7 @@
$entries[$x]['is_sticky'] = true;
$key = 'sticky';
} else {
- $key = date('Ymd', $entries[$x]['timestamp']);
+ $key = date('Ymd', serendipity_serverOffsetHour($entries[$x]['timestamp']));
}
if (!empty($entries[$x]['properties']['ep_cache_body'])) {
@@ -568,9 +570,7 @@
$entry['commURL'] = serendipity_archiveURL($entry['id'], $entry['title'], 'baseURL', false);
$entry['link_allow_comments'] = $serendipity['baseURL'] . 'comment.php?serendipity[switch]=enable&serendipity[entry]=' . $entry['id'];
$entry['link_deny_comments'] = $serendipity['baseURL'] . 'comment.php?serendipity[switch]=disable&serendipity[entry]=' . $entry['id'];
-
-
- $entry['allow_comments'] = serendipity_db_bool($entry['allow_comments']);
+ $entry['allow_comments'] = serendipity_db_bool($entry['allow_comments']);
if (strlen($entry['extended'])) {
$entry['has_extended'] = true;
@@ -697,9 +697,9 @@
<email><?php echo serendipity_utf8_encode(htmlspecialchars($entry['email'])); ?></email>
</author>
- <issued><?php echo gmdate('Y-m-d\TH:i:s\Z', $entry['timestamp']); ?></issued>
- <created><?php echo gmdate('Y-m-d\TH:i:s\Z', $entry['timestamp']); ?></created>
- <modified><?php echo gmdate('Y-m-d\TH:i:s\Z', $entry['last_modified']); ?></modified>
+ <issued><?php echo gmdate('Y-m-d\TH:i:s\Z', serendipity_serverOffsetHour($entry['timestamp'])); ?></issued>
+ <created><?php echo gmdate('Y-m-d\TH:i:s\Z', serendipity_serverOffsetHour($entry['timestamp'])); ?></created>
+ <modified><?php echo gmdate('Y-m-d\TH:i:s\Z', serendipity_serverOffsetHour($entry['last_modified'])); ?></modified>
<wfw:comment><?php echo $serendipity['baseURL']; ?>wfwcomment.php?cid=<?php echo $id; ?></wfw:comment>
<?php
@@ -753,7 +753,7 @@
echo serendipity_utf8_encode(htmlspecialchars($entry['body'].$ext));
?>
</content:encoded>
- <pubDate><?php echo date('r', $entry['timestamp']); ?></pubDate>
+ <pubDate><?php echo date('r', serendipity_serverOffsetHour($entry['timestamp'])); ?></pubDate>
<guid><?php echo $guid; ?></guid>
<?php
$eventData = array_merge(array('display_dat' => ''), $entry);
@@ -796,7 +796,7 @@
<dc:publisher><?php echo serendipity_utf8_encode(htmlspecialchars($serendipity['blogTitle'])); ?></dc:publisher>
<dc:creator><?php echo serendipity_utf8_encode(htmlspecialchars($entry['email'])) . ' (' . serendipity_utf8_encode(htmlspecialchars($entry['username'])) . ')'; ?></dc:creator>
<dc:subject><?php echo serendipity_utf8_encode(htmlspecialchars(implode(', ', $categories))); ?></dc:subject>
- <dc:date><?php echo date('Y-m-d\TH:i:s\Z', $entry['timestamp']); ?></dc:date>
+ <dc:date><?php echo date('Y-m-d\TH:i:s\Z', serendipity_serverOffsetHour($entry['timestamp'])); ?></dc:date>
<wfw:comment><?php echo $serendipity['baseURL']; ?>wfwcomment.php?cid=<?php echo $id; ?></wfw:comment>
<?php
if ($comments === false) {
@@ -832,8 +832,8 @@
}
if (isset($timestamp)) {
- $dated = date('Ymd', $timestamp);
- $datem = date('Ym', $timestamp);
+ $dated = date('Ymd', serendipity_serverOffsetHour($timestamp));
+ $datem = date('Ym', serendipity_serverOffsetHour($timestamp));
@unlink("{$serendipity['serendipityPath']}/".PATH_ARCHIVES."/{$dated}.html");
@unlink("{$serendipity['serendipityPath']}/".PATH_ARCHIVES."/{$datem}.html");
@@ -1137,7 +1137,7 @@
$hidden .= ' <input type="hidden" name="' . $key . '" value="' . $value . '" />' . $n;
}
$hidden .= ' <input type="hidden" name="serendipity[id]" value="' . (isset($entry['id']) ? $entry['id'] : '') . '" />' . $n;
- $hidden .= ' <input type="hidden" name="serendipity[timestamp]" value="' . (isset($entry['timestamp']) ? $entry['timestamp'] : '') . '" />' . $n;
+ $hidden .= ' <input type="hidden" name="serendipity[timestamp]" value="' . (isset($entry['timestamp']) ? serendipity_serverOffsetHour($entry['timestamp']) : '') . '" />' . $n;
$hidden .= ' <input type="hidden" name="serendipity[preview]" value="false" />';
$hidden .= ' <input type="hidden" name="serendipity[quicksave]" value="false" />';
@@ -1175,8 +1175,8 @@
<b><?php echo DATE; ?>:</b>
</td>
<td>
- <input type="hidden" name="serendipity[chk_timestamp]" value="<?php echo (isset($entry['timestamp']) && $entry['timestamp'] > 0 ? $entry['timestamp'] : time()); ?>" />
- <input type="text" name="serendipity[new_timestamp]" value="<?php echo date(DATE_FORMAT_2, (isset($entry['timestamp']) && $entry['timestamp'] > 0 ? $entry['timestamp'] : time())); ?>" />
+ <input type="hidden" name="serendipity[chk_timestamp]" value="<?php echo serendipity_serverOffsetHour(isset($entry['timestamp']) && $entry['timestamp'] > 0 ? $entry['timestamp'] : time()); ?>" />
+ <input type="text" name="serendipity[new_timestamp]" value="<?php echo date(DATE_FORMAT_2, serendipity_serverOffsetHour(isset($entry['timestamp']) && $entry['timestamp'] > 0 ? $entry['timestamp'] : time())); ?>" />
</td>
<td align="right">
<?php
@@ -1525,38 +1525,38 @@
global $serendipity;
$f = serendipity_db_query("SELECT timestamp FROM {$serendipity['dbPrefix']}entries ORDER BY timestamp ASC LIMIT 1");
- $lastYear = date('Y', $f[0][0]);
- $lastMonth = date('m', $f[0][0]);
- $thisYear = date('Y');
- $thisMonth = date('m');
+ $lastYear = date('Y', serendipity_serverOffsetHour($f[0][0]));
+ $lastMonth = date('m', serendipity_serverOffsetHour($f[0][0]));
+ $thisYear = date('Y', serendipity_serverOffsetHour());
+ $thisMonth = date('m', serendipity_serverOffsetHour());
$max = 0;
$output = array();
- for ( $y = $thisYear; $y >= $lastYear; $y--) {
+ for ($y = $thisYear; $y >= $lastYear; $y--) {
$output[$y]['year'] = $y;
- for( $m=12; $m>=1; $m-- ) {
+ for ($m = 12; $m >= 1; $m--) {
/* If the month we are checking are in the future, we drop it */
- if ( $m > $thisMonth && $y == $thisYear ) {
+ if ($m > $thisMonth && $y == $thisYear) {
continue;
}
/* If the month is lower than the lowest month containing entries, we're done */
- if ( $m < $lastMonth && $y <= $lastYear ) {
+ if ($m < $lastMonth && $y <= $lastYear) {
break;
}
- $s = mktime(0, 0, 0, $m, 1, $y);
- $e = mktime(23, 59, 59, $m, date('t', $s), $y);
+ $s = serendipity_serverOffsetHour(mktime(0, 0, 0, $m, 1, $y), true);
+ $e = serendipity_serverOffsetHour(mktime(23, 59, 59, $m, date('t', $s), $y), true);
$entries = serendipity_db_query("SELECT count(id) FROM {$serendipity['dbPrefix']}entries
WHERE isdraft = 'false'
AND timestamp >= $s
AND timestamp <= $e
- AND timestamp <= " . time());
+ AND timestamp <= " . serendipity_serverOffsetHour(time(), true));
$entry_count = $entries[0][0];
/* A silly hack to get the maximum amount of entries per month */
- if ( $entry_count > $max ) {
+ if ($entry_count > $max) {
$max = $entry_count;
}
Index: functions_comments.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/Attic/functions_comments.inc.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- functions_comments.inc.php 6 Nov 2004 11:22:49 -0000 1.1.2.1
+++ functions_comments.inc.php 12 Nov 2004 15:43:23 -0000 1.1.2.2
@@ -134,7 +134,7 @@
foreach ($comments as $comment) {
if ($comment['parent_id'] == $parent) {
$i++;
- $retval .= '<option value="' . $comment['id'] . '"'. ($selected == $comment['id'] || (isset($serendipity['POST']['replyTo']) && $comment['id'] == $serendipity['POST']['replyTo']) ? ' selected="selected"' : '') .'>' . str_repeat(' ', $level * 2) . '#' . $indent . $i . ': ' . (empty($comment['username']) ? ANONYMOUS : htmlspecialchars($comment['username'])) . ' ' . ON . ' ' . ucfirst(strftime(DATE_FORMAT_SHORT, $comment['timestamp'])) . "</option>\n";
+ $retval .= '<option value="' . $comment['id'] . '"'. ($selected == $comment['id'] || (isset($serendipity['POST']['replyTo']) && $comment['id'] == $serendipity['POST']['replyTo']) ? ' selected="selected"' : '') .'>' . str_repeat(' ', $level * 2) . '#' . $indent . $i . ': ' . (empty($comment['username']) ? ANONYMOUS : htmlspecialchars($comment['username'])) . ' ' . ON . ' ' . ucfirst(serendipity_strftime(DATE_FORMAT_SHORT, $comment['timestamp'])) . "</option>\n";
$retval .= serendipity_generateCommentList($id, $comments, $selected, $comment['id'], $level + 1, $indent . $i . '.');
}
}
@@ -315,7 +315,7 @@
$email = serendipity_db_escape_string($commentInfo['email']);
$parentid = (isset($commentInfo['parent_id']) && is_numeric($commentInfo['parent_id'])) ? $commentInfo['parent_id'] : 0;
$status = isset($commentInfo['status']) ? $commentInfo['status'] : (serendipity_db_bool($ca['moderate_comments']) ? 'pending' : 'approved');
- $t = isset($commentInfo['time']) ? $commentInfo['time'] : time();
+ $t = isset($commentInfo['time']) ? $commentInfo['time'] : time();
if (isset($commentInfo['subscribe'])) {
$subscribe = 'true';
Index: functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/Attic/functions.inc.php,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -d -r1.1.2.2 -r1.1.2.3
--- functions.inc.php 11 Nov 2004 11:15:55 -0000 1.1.2.2
+++ functions.inc.php 12 Nov 2004 15:43:23 -0000 1.1.2.3
@@ -22,7 +22,31 @@
return $s;
}
-function serendipity_formatTime($format, $time) {
+function serendipity_serverOffsetHour($timestamp = null, $negative = false) {
+ global $serendipity;
+
+ if ($timestamp == null) {
+ $timestamp = time();
+ }
+
+ if (empty($serendipity['serverOffsetHours']) || !is_numeric($serendipity['serverOffsetHours']) || $serendipity['serverOffsetHours'] == 0) {
+ return $timestamp;
+ } else {
+ return $timestamp + (($negative ? -$serendipity['serverOffsetHours'] : $serendipity['serverOffsetHours']) * 60 * 60);
+ }
+}
+
+function serendipity_strftime($format, $timestamp = null, $useOffset = true) {
+ if ($timestamp == null) {
+ $timestamp = serendipity_serverOffsetHour();
+ } elseif ($useOffset) {
+ $timestamp = serendipity_serverOffsetHour($timestamp);
+ }
+
+ return strftime($format, $timestamp);
+}
+
+function serendipity_formatTime($format, $time, $useOffset = true) {
static $cache;
if (!isset($cache)) {
$cache = array();
@@ -34,7 +58,7 @@
$cache[$format] = str_replace('%e', '%d', $cache[$format]);
}
}
- return ucfirst(strftime($cache[$format], (int)$time));
+ return ucfirst(serendipity_strftime($cache[$format], (int)$time, $useOffset));
}
|