1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 21:57:51 +02:00

Reflect 1.x bug #5376 - handle servers not in UTC timezone

This commit is contained in:
SteveD
2013-02-17 10:43:21 +00:00
parent a4ce03f454
commit c000634335
3 changed files with 42 additions and 39 deletions

View File

@@ -33,22 +33,22 @@ if (!$e107->isInstalled('calendar_menu')) header('Location: '.e_BASE.'index.php'
if (isset($_POST['viewallevents'])) if (isset($_POST['viewallevents']))
{ {
Header('Location: '.e_PLUGIN.'calendar_menu/event.php?'.intval($_POST['enter_new_val'])); Header('Location: '.e_PLUGIN_ABS.'calendar_menu/event.php?' . $_POST['enter_new_val']);
exit; exit();
} }
if (isset($_POST['doit'])) if (isset($_POST['doit']))
{ {
Header('Location: '.e_PLUGIN.'calendar_menu/event.php?ne.'.intval($_POST['enter_new_val'])); Header('Location: '.e_PLUGIN_ABS.'calendar_menu/event.php?ne.' . $_POST['enter_new_val']);
exit; exit();
} }
if (isset($_POST['subs'])) if (isset($_POST['subs']))
{ {
Header('Location: '.e_PLUGIN.'calendar_menu/subscribe.php'); Header('Location: '.e_PLUGIN_ABS.'calendar_menu/subscribe.php');
exit; exit();
} }
if (isset($_POST['printlists'])) if (isset($_POST['printlists']))
{ {
Header('Location: '.e_PLUGIN.'calendar_menu/ec_pf_page.php'); Header('Location: '.e_PLUGIN_ABS.'calendar_menu/ec_pf_page.php');
exit(); exit();
} }
@@ -83,7 +83,7 @@ unset($dateArray);
if (e_QUERY) if (e_QUERY)
{ {
$qs = explode('.', e_QUERY); // Get date from query $qs = explode('.', e_QUERY); // Get date from query
$dateArray = getdate($qs[0]); $dateArray = $ecal_class->gmgetdate($qs[0]);
} }
if (!isset($dateArray)) if (!isset($dateArray))
{ // Show current month { // Show current month
@@ -99,8 +99,8 @@ $nowday = $ecal_class->cal_date['mday'];
// Set date window for display // Set date window for display
$monthstart = mktime(0, 0, 0, $month, 1, $year); // Start of month to be shown $monthstart = gmmktime(0, 0, 0, $month, 1, $year); // Start of month to be shown
$monthend = mktime(0, 0, 0, $month + 1, 1, $year) - 1; // End of month to be shown $monthend = gmmktime(0, 0, 0, $month + 1, 1, $year) - 1; // End of month to be shown
$calSc->ecalClass = &$ecal_class; $calSc->ecalClass = &$ecal_class;
@@ -137,19 +137,19 @@ foreach ($ev_list as $row)
{ {
// Need to save event, copy marker for date // Need to save event, copy marker for date
$row['event_start'] = $ev_start; $row['event_start'] = $ev_start;
$events[date('j',$ev_start)][] = $row; $events[gmdate('j',$ev_start)][] = $row;
} }
} }
else else
{ // Its a 'normal' event { // Its a 'normal' event
$tmp = date('j',$row['event_start']); // Day of month for start $tmp = gmdate('j',$row['event_start']); // Day of month for start
if ($row['event_allday']) if ($row['event_allday'])
{ {
$tmp2 = $tmp; // Same day for start and end $tmp2 = $tmp; // Same day for start and end
} }
else else
{ {
$tmp2 = date('j',$row['event_end']-1); // Day of month for end - knock off a second to allow for BST and suchlike $tmp2 = gmdate('j',$row['event_end']-1); // Day of month for end - knock off a second to allow for BST and suchlike
} }
if(($row['event_start']>=$monthstart) && ($row['event_start']<=$monthend)) if(($row['event_start']>=$monthstart) && ($row['event_start']<=$monthend))
{ // Start within month { // Start within month
@@ -157,7 +157,7 @@ foreach ($ev_list as $row)
$tmp++; $tmp++;
if ($row['event_end']>$monthend) if ($row['event_end']>$monthend)
{ // End outside month { // End outside month
$tmp2 = date("t", $monthstart); // number of days in this month $tmp2 = gmdate("t", $monthstart); // number of days in this month
} }
} }
else else
@@ -165,7 +165,7 @@ foreach ($ev_list as $row)
$tmp = 1; $tmp = 1;
if ($row['event_end']>$monthend) if ($row['event_end']>$monthend)
{ // End outside month { // End outside month
$tmp2 = date("t", $monthstart); // number of days in this month $tmp2 = gmdate("t", $monthstart); // number of days in this month
} }
} }
// Now put in markers for all 'non-start' days within current month // Now put in markers for all 'non-start' days within current month
@@ -182,7 +182,7 @@ foreach ($ev_list as $row)
// ****** CAUTION - the category dropdown also used $sql object - take care to avoid interference! // ****** CAUTION - the category dropdown also used $sql object - take care to avoid interference!
$start = $monthstart; $start = $monthstart;
$numberdays = date('t', $start); // number of days in this month $numberdays = gmdate("t", $start); // number of days in this month
$text = ""; $text = "";
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_START, FALSE, $calSc); $text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_START, FALSE, $calSc);
@@ -198,7 +198,7 @@ $text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_HEADER_END, FALSE, $calSc);
// Calculate number of days to skip before 'real' days on first line of calendar // Calculate number of days to skip before 'real' days on first line of calendar
$firstdayoffset = date('w',$start) - $ecal_class->ec_first_day_of_week; $firstdayoffset = gmdate('w',$start) - $ecal_class->ec_first_day_of_week;
if ($firstdayoffset < 0) $firstdayoffset+= 7; if ($firstdayoffset < 0) $firstdayoffset+= 7;
for ($i=0; $i<$firstdayoffset; $i++) for ($i=0; $i<$firstdayoffset; $i++)

View File

@@ -229,8 +229,8 @@ class event_calendar_shortcodes
$this->day = varset($curDate['mday'], 0); // Day number being shown - rarely relevant $this->day = varset($curDate['mday'], 0); // Day number being shown - rarely relevant
$this->month = $curDate['mon']; // Number of month being shown $this->month = $curDate['mon']; // Number of month being shown
$this->year = $curDate['year']; // Number of year being shown $this->year = $curDate['year']; // Number of year being shown
$this->monthStart = mktime(0, 0, 0, $curDate['mon'], 1, $curDate['year']); // Start of month to be shown $this->monthStart = gmmktime(0, 0, 0, $curDate['mon'], 1, $curDate['year']); // Start of month to be shown
$this->monthEnd = mktime(0, 0, 0, $curDate['mon'] + 1, 1, $curDate['year']) - 1; // End of month to be shown $this->monthEnd = gmmktime(0, 0, 0, $curDate['mon'] + 1, 1, $curDate['year']) - 1; // End of month to be shown
// Calculate date code for previous month // Calculate date code for previous month
@@ -241,7 +241,7 @@ class event_calendar_shortcodes
$this->prevMonth = 12; $this->prevMonth = 12;
$prevYear--; $prevYear--;
} }
$this->previous = mktime(0, 0, 0, $this->prevMonth, 1, $prevYear); // Previous month - Used by nav $this->previous = gmmktime(0, 0, 0, $this->prevMonth, 1, $prevYear); // Previous month - Used by nav
// Calculate date code for next month // Calculate date code for next month
$this->nextMonth = $curDate['mon'] + 1; $this->nextMonth = $curDate['mon'] + 1;
@@ -251,13 +251,13 @@ class event_calendar_shortcodes
$this->nextMonth = 1; $this->nextMonth = 1;
$nextYear++; $nextYear++;
} }
$this->next = mktime(0, 0, 0, $this->nextMonth, 1, $nextYear); // Next month - used by nav $this->next = gmmktime(0, 0, 0, $this->nextMonth, 1, $nextYear); // Next month - used by nav
$this->py = $curDate['year']-1; // Number of previous year for nav $this->py = $curDate['year']-1; // Number of previous year for nav
$this->prevLink = mktime(0, 0, 0, $curDate['mon'], 1, $this->py); $this->prevLink = gmmktime(0, 0, 0, $curDate['mon'], 1, $this->py);
$this->ny = $curDate['year'] + 1; // Number of next year for nav $this->ny = $curDate['year'] + 1; // Number of next year for nav
$this->nextLink = mktime(0, 0, 0, $curDate['mon'], 1, $this->ny); $this->nextLink = gmmktime(0, 0, 0, $curDate['mon'], 1, $this->ny);
$this->prop = gmmktime(0, 0, 0, $curDate['mon'], $curDate['mday'], $curDate['year']); // Sets start date for new event entry $this->prop = gmmktime(0, 0, 0, $curDate['mon'], $curDate['mday'], $curDate['year']); // Sets start date for new event entry
@@ -305,7 +305,7 @@ class event_calendar_shortcodes
$ret = ''; $ret = '';
for ($ii = 0; $ii < 12; $ii++) for ($ii = 0; $ii < 12; $ii++)
{ {
$monthJump = mktime(0, 0, 0, $ii+1, 1, $this->year); $monthJump = gmmktime(0, 0, 0, $ii+1, 1, $this->year);
$ret .= "<a href='".e_SELF."?".$monthJump."'>".$this->monthabb[$ii]."</a> &nbsp;"; $ret .= "<a href='".e_SELF."?".$monthJump."'>".$this->monthabb[$ii]."</a> &nbsp;";
} }
return $ret; return $ret;
@@ -360,8 +360,11 @@ class event_calendar_shortcodes
return "<input class='button' type='submit' style='width:140px;' name='printlists' value='".EC_LAN_164."' title='".EC_LAN_183."' />"; return "<input class='button' type='submit' style='width:140px;' name='printlists' value='".EC_LAN_164."' title='".EC_LAN_183."' />";
} }
else else
{
return '';
return 'Cant print lists'; return 'Cant print lists';
} }
}
// Categories listing // Categories listing
public function sc_ec_nav_categories($parm = '') public function sc_ec_nav_categories($parm = '')
@@ -539,7 +542,7 @@ class event_calendar_shortcodes
public function sc_ec_mail_link($parm = '') public function sc_ec_mail_link($parm = '')
{ {
$cal_dayarray = getdate($this->event['event_start']); $cal_dayarray = getdate($this->event['event_start']);
$cal_linkut = mktime(0 , 0 , 0 , $cal_dayarray['mon'], $cal_dayarray['mday'], $cal_dayarray['year']).".one"; // ALways need "one" $cal_linkut = gmmktime(0 , 0 , 0 , $cal_dayarray['mon'], $cal_dayarray['mday'], $cal_dayarray['year']).".one"; // ALways need "one"
return ' '.SITEURLBASE.e_PLUGIN_ABS.'calendar_menu/event.php?'.$cal_linkut.' '; return ' '.SITEURLBASE.e_PLUGIN_ABS.'calendar_menu/event.php?'.$cal_linkut.' ';
} }

View File

@@ -135,7 +135,7 @@ if ((isset($_POST['ne_insert']) || isset($_POST['ne_update'])) && ($cal_super |
$ev_event = $e107->tp->toDB($_POST['ne_event']); $ev_event = $e107->tp->toDB($_POST['ne_event']);
$ev_email = $e107->tp -> toDB($_POST['ne_email']); $ev_email = $e107->tp -> toDB($_POST['ne_email']);
$ev_thread = $e107->tp->toDB($_POST['ne_thread']); $ev_thread = $e107->tp->toDB($_POST['ne_thread']);
$temp_date = getdate($ecal_class->make_date(0,0,$_POST['start_date'])); $temp_date = $ecal_class->gmgetdate($ecal_class->make_date(0,0,$_POST['start_date']));
$ev_allday = intval($_POST['allday']); $ev_allday = intval($_POST['allday']);
$recurring = intval($_POST['ec_recur_type']); $recurring = intval($_POST['ec_recur_type']);
if ($recurring >= 100) $recurring += intval($_POST['ec_recur_week']) - 100; if ($recurring >= 100) $recurring += intval($_POST['ec_recur_week']) - 100;