Hey guys, another question for the PHP gurus. A while back Jeremie told me that the (likely) only thing keeping NS from running on PHP 5 was to do with the way date/timestamp was generated. I'm hoping to fix these if it ends up being a simple/easy fix, so I can get rid of PHP 4 on the server (tried setting 4 and 5 up concurrently with fastcgi, but no luck). I've got a local copy of NS running on PHP 5 now, and set error_reporting(E_STRICT); --- it was set to E_ALL by default.
Instead of crashing PHP like it did before, it gave a helpful error message:
Quote:File: /htdocs/sites/Nside/areas/portal/index.php
Line: 66
Errno: 2048 (UNKNOWN)
Error: date() [<a href='function.date'>function.date</a>]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for 'PDT/-7.0/DST' instead
Here are a few relevant bits of code from NS... this is from config.php:
PHP:<?php
// Time settings
'timezone' => -8,
'time_format' => 'h:i A',
'date_format' => 'F jS, Y',
'date_format_short' => 'M jS, Y',
?>
And this is line 66 from the Portal section's index.php, as referenced by the error message (this is only found in a few other files, a few times just referencing $today or mktime, and a few times in a bit different context, but the same mktime function):
PHP:<?php
$today = mktime(0, 0, 0, date('n'), date('j'), date('Y'));
?>
And lastly, one other file that came up in a search for $today was templates/ns/functions.php and included this code:
PHP:<?php
************************************************
* Formats a timestamp
* ---
* @param INTEGER : The timestamp to format
* @param BOOLEAN : If the format to should be short or not
* @return STRING : The formatted timestamp
***********************************************/
function format_date($time, $short = FALSE)
{
global $cfg, $user;
static $today;
// First call, get today's timestamp
if($today === NULL)
{
$today = mktime(0, 0, 0, date('n'), date('j'), date('Y')) + ($user['timezone'] - $cfg['timezone']) * 3600;
}
// Adjust the time according to the user's timezone
$time += ($user['timezone'] - $cfg['timezone']) * 3600;
// Today
if($time >= $today && $time <= $today + 86400)
{
return 'Today, <span class="time">' . date($cfg['time_format'], $time) . '</span>';
}
// Yesterday
if($time >= $today - 86400 && $time <= $today)
{
return 'Yesterday, <span class="time">' . date($cfg['time_format'], $time) . '</span>';
}
// Tomorrow
if($time >= $today + 86400 && $time <= $today + 172800)
{
return 'Tomorrow, <span class="time">' . date($cfg['time_format'], $time) . '</span>';
}
// Other dates
return date(($short ? $cfg['date_format_short'] : $cfg['date_format']) . ' <\sp\a\n c\l\a\s\s="\t\i\me">' . $cfg['time_format'] . '</\sp\a\n>', $time);
}
?>
As I'm still a newbie with PHP, I don't know what to do, but perhaps the solution is simple to you guys. If so I've love to get your suggestions. If some additional code or files from NS would help, please let me know and I will provide it.
Thanks!
___________________
-- Dave
Neverside Admin
absolutecross.com
Last edited by AbsoluteCross, June 13th, 2008 01:04 AM (Edited 2 times)

