Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -303,15 +303,30 @@ class _ICSParser
|
||||
$_imported = 0;
|
||||
$_skipped = 0;
|
||||
$_newEvents = 0;
|
||||
|
||||
$maxImport = 500;
|
||||
|
||||
// Leave this here - useful for debugging
|
||||
// print_r($this->_parsedIcsData);exit;
|
||||
|
||||
if ( count( $this->_parsedIcsData ) and isset( $this->_parsedIcsData['events'] ) )
|
||||
{
|
||||
usort( $this->_parsedIcsData['events'], function( $a, $b ) {
|
||||
if ( $a['start']['raw_ts'] == $b['start']['raw_ts'] )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ( $a['start']['raw_ts'] > $b['start']['raw_ts'] ) ? -1 : 1;
|
||||
} );
|
||||
|
||||
/* Loop over the events */
|
||||
foreach( $this->_parsedIcsData['events'] as $event )
|
||||
{
|
||||
if ( $_imported > $maxImport )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
/* Quickly, if we don't support the recurrence data provided let's just skip this event */
|
||||
if( isset( $event['recurr'] ) )
|
||||
{
|
||||
@@ -413,7 +428,7 @@ class _ICSParser
|
||||
$_new = TRUE;
|
||||
|
||||
/* Basics */
|
||||
$newEvent->post_key = md5( uniqid() );
|
||||
$newEvent->post_key = md5( mt_rand() );
|
||||
$newEvent->member_id = $this->member->member_id;
|
||||
$newEvent->calendar_id = $this->calendar->id;
|
||||
|
||||
@@ -1312,7 +1327,20 @@ class _ICSParser
|
||||
/* Is a timezone specified? */
|
||||
if ( isset( $event[ $method ]['tzid'] ) AND $event[ $method ]['tzid'] )
|
||||
{
|
||||
$event[ $method ]['utc_time'] = new \IPS\DateTime( $event[ $method ]['raw'], new \DateTimeZone( $event[ $method ]['tzid'] ) );
|
||||
/* Let's test it first... */
|
||||
if( in_array( $event[ $method ]['tzid'], \IPS\DateTime::getTimezoneIdentifiers() ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$timezone = new \DateTimeZone( $event[ $method ]['tzid'] );
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
$timezone = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
$event[ $method ]['utc_time'] = new \IPS\DateTime( $event[ $method ]['raw'], $timezone );
|
||||
}
|
||||
elseif( isset( $event[ $method ]['raw'] ) )
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user