2008-08-18, 08:38 PM
Hi,
on our installation of 1.4.1 the birthday for users born before 1970 was displayed wrongly. Day and month were wrong. The reason seems to be an error in member.php. There are two parallel attempts to correct the 1970-problem, one is not good. The original code is:
This bit here causes the trouble, the year is passed to mktime. After that the year is reinserted by the $bdayformat-hack. But then the $membday-timestamp already has the wrong month and day.
I took out the whole discrimnation between before and after 1970 because the functions called from function.php already deal with the issue and it works fine here. This is the fixed code:
Can someone please check, confirm or correct me? Thanks.
Zakkinen
on our installation of 1.4.1 the birthday for users born before 1970 was displayed wrongly. Day and month were wrong. The reason seems to be an error in member.php. There are two parallel attempts to correct the 1970-problem, one is not good. The original code is:
if($memprofile['birthday'])
{
$membday = explode("-", $memprofile['birthday']);
if($memprofile['birthdayprivacy'] != 'none')
{
if($membday[2])
{
$lang->membdayage = $lang->sprintf($lang->membdayage, get_age($memprofile['birthday']));
if($membday[2] >= 1970)
{
$w_day = get_weekday($membday[1], $membday[0], $membday[2]);
$membday = format_bdays($mybb->settings['dateformat'], $membday[1], $membday[0], $membday[2], $w_day);
}
else
{
$bdayformat = fix_mktime($mybb->settings['dateformat'], $membday[2]);
$membday = mktime(0, 0, 0, $membday[1], $membday[0], $membday[2]);
$membday = date($bdayformat, $membday);
}
$membdayage = $lang->membdayage;
}
else
{
$membday = mktime(0, 0, 0, $membday[1], $membday[0], 0);
$membday = date("F j", $membday);
$membdayage = '';
}
}
if($memprofile['birthdayprivacy'] == 'age')
{
$membday = $lang->birthdayhidden;
}
else if($memprofile['birthdayprivacy'] == 'none')
{
$membday = $lang->birthdayhidden;
$membdayage = '';
}
}
else
{
$membday = $lang->not_specified;
$membdayage = '';
}
This bit here causes the trouble, the year is passed to mktime. After that the year is reinserted by the $bdayformat-hack. But then the $membday-timestamp already has the wrong month and day.
else
{
$bdayformat = fix_mktime($mybb->settings['dateformat'], $membday[2]);
$membday = mktime(0, 0, 0, $membday[1], $membday[0], $membday[2]);
$membday = date($bdayformat, $membday);
}
I took out the whole discrimnation between before and after 1970 because the functions called from function.php already deal with the issue and it works fine here. This is the fixed code:
if($memprofile['birthday'])
{
$membday = explode("-", $memprofile['birthday']);
if($memprofile['birthdayprivacy'] != 'none')
{
if($membday[2])
{
$lang->membdayage = $lang->sprintf($lang->membdayage, get_age($memprofile['birthday']));
$w_day = get_weekday($membday[1], $membday[0], $membday[2]);
$membday = format_bdays($mybb->settings['dateformat'], $membday[1], $membday[0], $membday[2], $w_day);
$membdayage = $lang->membdayage;
}
else
{
$membday = mktime(0, 0, 0, $membday[1], $membday[0], 0);
$membday = date("F j", $membday);
$membdayage = '';
}
}
if($memprofile['birthdayprivacy'] == 'age')
{
$membday = $lang->birthdayhidden;
}
else if($memprofile['birthdayprivacy'] == 'none')
{
$membday = $lang->birthdayhidden;
$membdayage = '';
}
}
else
{
$membday = $lang->not_specified;
$membdayage = '';
}
Can someone please check, confirm or correct me? Thanks.
Zakkinen