Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24515
Modified Files:
NEWS serendipity_functions.inc.php
Log Message:
Fixed Bug item #941922 - strftime %e does not work on windows
Fixed by creating serendipity_formatTime() which wraps strftime() and replaces %e if the OS is Windows
Format is cached, to avoid multiple str_replace() per page
Also added id="" to emoticons, for better styling :)
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.260
retrieving revision 1.261
diff -u -d -r1.260 -r1.261
--- serendipity_functions.inc.php 5 May 2004 09:14:28 -0000 1.260
+++ serendipity_functions.inc.php 5 May 2004 16:40:09 -0000 1.261
@@ -11,6 +11,18 @@
include_once(S9Y_INCLUDE_PATH . "serendipity_functions_images.inc.php");
include_once(S9Y_INCLUDE_PATH . "serendipity_functions_installer.inc.php");
+function serendipity_formatTime($format, $time) {
+ static $cache;
+ if ( !isset($cache[$format]) ) {
+ $cache[$format] = $format;
+ if ( strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ) {
+ $cache[$format] = str_replace('%e', '%d', $format);
+ }
+ }
+ return ucfirst(strftime($cache[$format], (int)$time));
+}
+
+
function serendipity_logout() {
$_SESSION['serendipityAuthedUser'] = false;
session_destroy();
@@ -912,7 +924,7 @@
$lastDate = '';
for ($x = 0, $num_entries = count($entries); $x < $num_entries; $x++) {
- $d = ucfirst(strftime(DATE_FORMAT_ENTRY, $entries[$x]['timestamp']));
+ $d = serendipity_formatTime(DATE_FORMAT_ENTRY, $entries[$x]['timestamp']);
$bydate[$d][] = $entries[$x];
}
Index: NEWS
===================================================================
RCS file: /cvsroot/php-blog/serendipity/NEWS,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- NEWS 26 Apr 2004 11:01:51 -0000 1.115
+++ NEWS 5 May 2004 16:40:08 -0000 1.116
@@ -3,6 +3,9 @@
Version 0.7 ()
------------------------------------------------------------------------
+ * Fixed Bug #941922 - strftime %e does not work on windows platform
+ (tomsommer)
+
* Fix template chooser plugin to reflect new location of template
variable (tadpole9)
|