Functions formatDate and formatTime in /lib/Theme.php do not work
properly on a Windows 2000 server running IIS. The day and hours
will not display with the s/w patch that was inserted. This
non-working code for W2000 IIS has carried thru to the latest
version on CVS.
Recommend changing from using php's strftime to the date function
which I believe works fine cross platform. This also eliminates
the need to use preg_replace to strip out leading zeros on a
date. Recommended changes:
Under the theme directory, modify these two lines in each
themeinfo.php file to the date and time string formats used by
php's date function
http://www.php.net/manual/en/function.date.php instead of those
used by the strftime function:
http://www.php.net/manual/en/function.strftime.php.
Example from MacOSX Theme:
[Old Code]
$Theme->setDateFormat("%A, %B %e, %Y"); // must not contain time
$Theme->setTimeFormat("%l:%M:%S %p");
[New Code]
$Theme->setDateFormat("l, F j Y"); // must not contain time
$Theme->setTimeFormat("g:i:s");
In /lib/Theme.php, modify the return statement in function
formatDate as follows:
[Old Code]
function formatDate ($time_t) {
global $request;
$offset_time = $time_t + 3600 *
$request->getPref('timeOffset');
// strip leading zeros from date elements (ie space
followed by zero)
return preg_replace('/ 0/', ' ',
strftime($this->_dateFormat,
$offset_time));
}
[New Code]
function formatDate ($time_t) {
global $request;
$offset_time = $time_t + 3600 *
$request->getPref('timeOffset');
return date($this->_dateFormat, $offset_time);
}
In /lib/Theme.php, modify the return statement in function
formatTime as follows:
[Old Code]
function formatTime ($time_t) {
//FIXME: make 24-hour mode configurable?
global $request;
$offset_time = $time_t + 3600 *
$request->getPref('timeOffset');
return preg_replace('/^0/', ' ',
strtolower(strftime($this->_timeFormat, $offset_time)));
}
[New Code]
function formatTime ($time_t) {
//FIXME: make 24-hour mode configurable?
global $request;
$offset_time = $time_t + 3600 *
$request->getPref('timeOffset');
return date($this->_timeFormat, $offset_time);
}
FYI, these appear to be unused variables located in
/lib/Theme.php:
var $_dateFormat = "%B %d, %Y";
var $_timeFormat = "%I:%M %p";
var $_showModTime = true;
|