} else { return $t; } } // today adjusted for user's timezone if (empty($date_arr)) { global $timedate; $gmt_today = $timedate->get_gmt_db_datetime(); $user_today = $timedate->handle_offset($gmt_today, $GLOBALS['timedate']->get_db_date_time_format()); preg_match('/(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})/', $user_today, $matches); $date_arr = array('year' => $matches[1], 'month' => $matches[2], 'day' => $matches[3], 'hour' => $matches[4], 'min' => $matches[5]); } else { $gmt_today = $date_arr['year'] . "-" . add_zero($date_arr['month']) . "-" . add_zero($date_arr['day']); $user_today = $timedate->handle_offset($gmt_today, $GLOBALS['timedate']->get_db_date_time_format()); } $real_today_unix = to_timestamp($timedate->get_gmt_db_date()); $args['calendar'] = new ECalendar($_REQUEST['view'], $date_arr); $show_tasks = $current_user->getPreference('show_tasks'); $rec_enabled = $current_user->getPreference('rec_enabled'); $args['calendar']->show_tasks = $show_tasks; if ($_REQUEST['view'] == 'day' || $_REQUEST['view'] == 'week' || $_REQUEST['view'] == 'month') { global $current_user; $args['calendar']->add_activities($current_user); } if ($_REQUEST['view'] == 'shared') { global $ids; global $current_user; global $mod_strings; global $app_list_strings, $current_language, $currentModule, $action, $app_strings; $current_module_strings = return_module_language($current_language, 'ECalendar'); $ids = array();
function to_timestamp_from_uf($d) { $db_d = $GLOBALS['timedate']->swap_formats($d, $GLOBALS['timedate']->get_date_time_format(), 'Y-m-d H:i:s'); $ts_d = to_timestamp($db_d); return $ts_d; }
if (empty($d_end_time)) { $d_end_time = "19:00"; } $tarr = explode(":", $d_start_time); $d_start_hour = $tarr[0]; $d_start_min = $tarr[1]; $tarr = explode(":", $d_end_time); $d_end_hour = $tarr[0]; $d_end_min = $tarr[1]; $hour_start = $d_start_hour; $minute_start = $d_start_min; $hour_end = $d_end_hour; $minute_end = $d_end_min; $r_start = $hour_start * 60 + $minute_start; $r_end = $hour_end * 60 + $minute_end; $today_unix = to_timestamp($gmt_today); //if(date('I',$today_unix)) // $hour_start = $hour_start - 1; $day_duration_hours = $hour_end - $hour_start; if ($minute_end < $minute_start) { $day_duration_hours--; $day_duration_minutes = $minute_start - $minute_end; } else { $day_duration_minutes = $minute_end - $minute_start; } $weekday_names = array(); $of = 0; $startday = $first_day_of_a_week; if ($startday != "Monday") { $of = 1; }
<?php $rtype = $_REQUEST['repeat_type_c']; $repeat_days = $_REQUEST['repeat_days_c']; $interval = $_REQUEST['repeat_interval_c']; $timezone = $GLOBALS['timedate']->getUserTimeZone(); global $timedate; $start_unix = to_timestamp_from_uf($_REQUEST['date_start']); $end_unix = to_timestamp($GLOBALS['timedate']->swap_formats($_REQUEST['repeat_end_date_c'], $GLOBALS['timedate']->get_date_format(), 'Y-m-d H:i:s')); $end_unix = $end_unix + 60 * 60 * 24 - 1; $start_day = date("w", $start_unix - date('Z', $start_unix)) + 1; $start_dayM = date("j", $start_unix - date('Z', $start_unix)); if ($rtype == 'Weekly' || $rtype == 'Monthly (day)') { $start_unix = $start_unix - 60 * 60 * 24 * ($start_day - 1); } remove_recurence($bean, $table_name, $jn, $bean->id); $ft = true; if (!empty($_REQUEST['repeat_type_c']) && !empty($_REQUEST['repeat_end_date_c'])) { if (empty($interval) && $interval == 0) { $interval = 1; } $cur_date = $start_unix; $i = 0; if ($rtype == 'Weekly' || $rtype == 'Monthly (day)') { $i--; } while ($cur_date <= $end_unix) { $i++; if ($rtype == 'Daily') { $step = 60 * 60 * 24; } else {