list($cYear, $cMonth, $cDay) = explode('-', XenForo_Locale::getFormattedDate(XenForo_Application::$time, 'Y-m-d'));
$leapYear = 0;
$cYear = intval($cYear); // convert string to int
if ($cYear / 4 == intval($cYear / 4))
{
$leapYear++;
}
$cMonth = intval($cMonth);
switch ($cMonth)
{
case 2:
$numberofDays = 28 + $leapYear;
break;
case 4:
case 5:
case 9:
case 11:
$numberofDays = 30;
break;
default:
$numberofDays = 31;
break;
}
$overlapDays = 0;
$nextmonthsDays = array();
$thismonthsDays = array();
$x = 0;
$nDay = intval($cDay);
$nDay++; // start at next day
if ($nDay > $numberofDays)
{
$nDay = 1;
}
else if ($nDay + 9 > $numberofDays)
{ // 9 + position 0 = 10 days
$nMonth = $cMonth;
$nMonth++;
if ($nMonth > 12)
{
$nMonth = 1;
}
$overlapDays = ($nDay + 9) - $numberofDays;
for ($x = 0; $x < $overlapDays; $x++)
{
$nextmonthsDays[] = $x + 1;
}
}
if ($x < 10)
{
$x = 10 - $x;
for ($y = 0; $y < $x; $y++)
{
$thismonthsDays[] = $nDay + $y;
}
}
$db = XenForo_Application::get('db');
if (!empty($thismonthsdays))
{
$thismonthsDays = implode(',', $thismonthsDays);
$test = $db->fetchAll('
SELECT user_id
FROM xf_user_profile
WHERE dob_day IN (' . $thismonthsDays . ')
AND dob_month = ' . $cMonth . '
ORDER BY user_id
');
}
if (!empty($nextmonthsdays))
{
$nextmonthsDays = implode(',', $nextmonthsDays);
$nexttest = $db->fetchAll('
SELECT user_id
FROM xf_user_profile
WHERE dob_day IN (' . $nextmonthsDays . ')
AND dob_month = ' . $nMonth . '
ORDER BY user_id
');
}