mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/8177] Display birthdays of 29th february on 28th in non-leap years.
PHPBB3-8177
This commit is contained in:
parent
1680b3a2a7
commit
3c7dfc7e19
1 changed files with 9 additions and 1 deletions
|
@ -84,12 +84,20 @@ $birthday_list = '';
|
||||||
if ($config['load_birthdays'] && $config['allow_birthdays'])
|
if ($config['load_birthdays'] && $config['allow_birthdays'])
|
||||||
{
|
{
|
||||||
$now = phpbb_gmgetdate(time() + $user->timezone + $user->dst);
|
$now = phpbb_gmgetdate(time() + $user->timezone + $user->dst);
|
||||||
|
|
||||||
|
// Display birthdays of 29th february on 28th february in non-leap-years
|
||||||
|
$leap_year_birthdays = '';
|
||||||
|
if ($now['mday'] == 28 && $now['mon'] == 2 && !$user->format_date(time(), 'L'))
|
||||||
|
{
|
||||||
|
$leap_year_birthdays = " OR user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', 29, 2)) . "%'";
|
||||||
|
}
|
||||||
|
|
||||||
$sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday
|
$sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday
|
||||||
FROM ' . USERS_TABLE . ' u
|
FROM ' . USERS_TABLE . ' u
|
||||||
LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)
|
LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)
|
||||||
WHERE (b.ban_id IS NULL
|
WHERE (b.ban_id IS NULL
|
||||||
OR b.ban_exclude = 1)
|
OR b.ban_exclude = 1)
|
||||||
AND u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
|
AND (u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' $leap_year_birthdays)
|
||||||
AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
|
AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue