/** * Get the birthdays list */ function get_birthdays_list_full() { global $db, $cache, $config; if (($birthdays_list = $cache->get('_birthdays_list_' . $config['board_timezone'])) === false) { $time_now = time(); $date_today = create_date('Ymd', $time_now, $config['board_timezone']); $date_forward = create_date('Ymd', $time_now + $config['birthday_check_day'] * 86400, $config['board_timezone']); $b_year = create_date('Y', $time_now, $config['board_timezone']); $b_month = create_date('n', $time_now, $config['board_timezone']); $b_day = create_date('j', $time_now, $config['board_timezone']); $b_day_end = create_date('j', $time_now + $config['birthday_check_day'] * 86400, $config['board_timezone']); $b_limit = 0; $show_inactive = empty($config['inactive_users_memberlists']) ? false : true; $birthdays_list['xdays'] = ''; $birthdays_list['today'] = ''; $birthdays_list_sql = get_birthdays_list($b_year, true, $b_month, $b_day, $b_day_end, $b_limit, $show_inactive); for ($i = 0; $i < sizeof($birthdays_list_sql); $i++) { $user_birthday2 = $b_year . ($user_birthday = realdate('md', $birthdays_list_sql[$i]['user_birthday'])); $birthdays_list_sql[$i]['username'] = stripslashes($birthdays_list_sql[$i]['username']); if ($user_birthday2 < $date_today) { // MG: Why??? $user_birthday2 += 10000; } $birthday_username_age = colorize_username($birthdays_list_sql[$i]['user_id'], $birthdays_list_sql[$i]['username'], $birthdays_list_sql[$i]['user_color'], $birthdays_list_sql[$i]['user_active']) . ' (' . (intval($b_year) - intval($birthdays_list_sql[$i]['user_birthday_y'])) . ')'; if ($user_birthday2 > $date_today && $user_birthday2 <= $date_forward) { // users having birthday within the next days $birthdays_list['xdays'] .= ($birthdays_list['xdays'] == '' ? ' ' : ', ') . $birthday_username_age; } elseif ($user_birthday2 == $date_today) { //users having birthday today $birthdays_list['today'] .= ($birthdays_list['today'] == '' ? ' ' : ', ') . $birthday_username_age; } } $current_time = time(); $cache_expiry = create_date_midnight($current_time, $config['board_timezone']) - $current_time + 86400; $cache->put('_birthdays_list_' . $config['board_timezone'], $birthdays_list, $cache_expiry); } return $birthdays_list; }
function create_date_ip($format, $gmepoch, $tz = 0, $day_only = false) { global $config, $lang; $tz = empty($tz) ? $config['board_timezone'] : $tz; $midnight = create_date_midnight($gmepoch, $tz); $output_date = ''; $time_sep = !empty($lang['NUMBER_FORMAT_TIME_SEP']) ? $lang['NUMBER_FORMAT_TIME_SEP'] : ':'; $format_hour = 'H' . $time_sep . 'i'; if ($gmepoch >= $midnight && $gmepoch < $midnight + 86400) { $format = $day_only ? $format : $format_hour; $output_date = $day_only ? $lang['TODAY'] : $lang['Today_at'] . ' '; } elseif ($gmepoch < $midnight && $gmepoch >= $midnight - 86400) { $format = $day_only ? $format : $format_hour; $output_date = $day_only ? $lang['YESTERDAY'] : $lang['Yesterday_at'] . ' '; } $output_date = $output_date . ($day_only && !empty($output_date) ? '' : create_date($format, $gmepoch, $tz)); return $output_date; }