Fixed what I believe was a bug involving timezones and timestamp parsing. It now works as I would expect it to.

master
Steven Oxley 2009-10-27 09:44:01 -04:00
rodzic b7ecdff2ab
commit c5b1402ab9
3 zmienionych plików z 17 dodań i 13 usunięć

Wyświetl plik

@ -84,6 +84,9 @@ class SG_iCal {
if( $tzid == null ) {
return $this->timezones;
} else {
if ( !isset($this->timezones)) {
return null;
}
foreach( $this->timezones AS $tz ) {
if( $tz->getTimeZoneId() == $tzid ) {
return $tz;

Wyświetl plik

@ -18,6 +18,7 @@ class SG_iCal_VEvent {
private $uid;
private $start;
private $end;
private $recurrence;
private $summary;
private $description;
private $location;
@ -34,12 +35,12 @@ class SG_iCal_VEvent {
unset($data['uid']);
if( isset($data['dtstart']) ) {
$this->start = $this->getTimestamp( $data['dtstart'] );
$this->start = $this->getTimestamp( $data['dtstart'], $ical );
unset($data['dtstart']);
}
if( isset($data['dtend']) ) {
$this->end = $this->getTimestamp($data['dtend']);
$this->end = $this->getTimestamp($data['dtend'], $ical);
unset($data['dtend']);
} elseif( isset($data['duration']) ) {
require_once dirname(__FILE__).'/../helpers/SG_iCal_Duration.php'; // BUILD: Remove line
@ -155,12 +156,12 @@ class SG_iCal_VEvent {
* @param $line SG_iCal_Line
* @return int
*/
private function getTimestamp( SG_iCal_Line $line ) {
private function getTimestamp( SG_iCal_Line $line, SG_iCal $ical ) {
$ts = strtotime($line->getData());
if( isset($ts['tzid']) ) {
if( isset($line['tzid']) ) {
$tz = $ical->getTimeZoneInfo($line['tzid']);
$offset = $tz->getOffset($ts);
$ts = strtotime(gmdate('D, d M Y H:i:s', $ts) . ' ' . $offset);
$ts = strtotime(date('D, d M Y H:i:s', $ts) . ' ' . $offset);
}
return $ts;
}

Wyświetl plik

@ -141,7 +141,7 @@ class SG_iCal_Recurrence {
}
/**
*
* Corresponds to BYHOUR in RFC 2445.
* @return mixed string if the member has been set, false otherwise
*/
public function getByHour() {
@ -149,7 +149,7 @@ class SG_iCal_Recurrence {
}
/**
*
*Corresponds to BYDAY in RFC 2445.
* @return mixed string if the member has been set, false otherwise
*/
public function getByDay() {
@ -157,7 +157,7 @@ class SG_iCal_Recurrence {
}
/**
*
* Corresponds to BYMONTHDAY in RFC 2445.
* @return mixed string if the member has been set, false otherwise
*/
public function getByMonthDay() {
@ -165,7 +165,7 @@ class SG_iCal_Recurrence {
}
/**
*
* Corresponds to BYYEARDAY in RFC 2445.
* @return mixed string if the member has been set, false otherwise
*/
public function getByYearDay() {
@ -173,7 +173,7 @@ class SG_iCal_Recurrence {
}
/**
*
* Corresponds to BYYEARNO in RFC 2445.
* @return mixed string if the member has been set, false otherwise
*/
public function getByYearNo() {
@ -181,7 +181,7 @@ class SG_iCal_Recurrence {
}
/**
*
* Corresponds to BYMONTH in RFC 2445.
* @return mixed string if the member has been set, false otherwise
*/
public function getByMonth() {
@ -189,7 +189,7 @@ class SG_iCal_Recurrence {
}
/**
*
* Corresponds to BYSETPOS in RFC 2445.
* @return mixed string if the member has been set, false otherwise
*/
public function getBySetPos() {
@ -197,7 +197,7 @@ class SG_iCal_Recurrence {
}
/**
*
* Corresponds to WKST in RFC 2445.
* @return mixed string if the member has been set, false otherwise
*/
public function getWkst() {