Skip to content

Commit

Permalink
Merge pull request #17 from bwein-net/feature/icalcreator-update
Browse files Browse the repository at this point in the history
Support kigkonsult/icalcreator 2.28
  • Loading branch information
iCodr8 authored May 19, 2020
2 parents fd16e30 + 506801b commit 9786bda
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"require": {
"php": ">=5.6.0",
"contao/core-bundle": ">=4.2,<5.0",
"kigkonsult/icalcreator": "2.27.*"
"kigkonsult/icalcreator": "2.28.*"
},
"require-dev": {
"contao/manager-plugin": "^2.0"
Expand Down
15 changes: 13 additions & 2 deletions src/Resources/contao/classes/CalendarImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace Contao;

use Exception;
use Kigkonsult\Icalcreator\Vcalendar;

/**
Expand Down Expand Up @@ -127,7 +128,12 @@ public function importFromWebICS($pid, $url, $startDate, $endDate, $timezone, $p
}
$this->cal->setConfig('directory', TL_ROOT . '/' . dirname($filename));
$this->cal->setConfig('filename', basename($filename));
$this->cal->parse();
try {
$this->cal->parse();
} catch (Exception $e) {
\System::log($e->getMessage(), __METHOD__, TL_ERROR);
return;
}
$tz = $this->cal->getProperty('X-WR-TIMEZONE');

if (!is_array($tz) || strlen($tz[1]) == 0) {
Expand Down Expand Up @@ -676,7 +682,12 @@ protected function importFromICSFile(
/* start parse of local file */
$this->cal->setConfig('directory', TL_ROOT . '/' . dirname($filename));
$this->cal->setConfig('filename', basename($filename));
$this->cal->parse();
try {
$this->cal->parse();
} catch (Exception $e) {
\Message::addError($e->getMessage());
$this->redirect(str_replace('&key=import', '', \Environment::get('request')));
}
$tz = $this->cal->getProperty('X-WR-TIMEZONE');

if ($timeshift == 0) {
Expand Down

0 comments on commit 9786bda

Please sign in to comment.