diff options
author | Mario Vavti <mario@mariovavti.com> | 2019-05-10 12:18:37 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2019-05-10 12:18:37 +0200 |
commit | 274f69526fcfa0858a04a8f745650c6daad22a02 (patch) | |
tree | ed0b4713800b22b7a8707daba388f822f9ad4aa3 /Zotlabs/Module/Cdav.php | |
parent | b9b65d7dfbf0d5532c93bd7395b5dbbcb8c1b68f (diff) | |
download | volse-hubzilla-274f69526fcfa0858a04a8f745650c6daad22a02.tar.gz volse-hubzilla-274f69526fcfa0858a04a8f745650c6daad22a02.tar.bz2 volse-hubzilla-274f69526fcfa0858a04a8f745650c6daad22a02.zip |
calendar merge: implement channel calendar import in cdav/calendar
Diffstat (limited to 'Zotlabs/Module/Cdav.php')
-rw-r--r-- | Zotlabs/Module/Cdav.php | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php index ed8a641b8..6b4f57ea5 100644 --- a/Zotlabs/Module/Cdav.php +++ b/Zotlabs/Module/Cdav.php @@ -754,16 +754,27 @@ class Cdav extends Controller { //Import calendar or addressbook if(($_FILES) && array_key_exists('userfile',$_FILES) && intval($_FILES['userfile']['size']) && $_REQUEST['target']) { - $src = @file_get_contents($_FILES['userfile']['tmp_name']); + $src = $_FILES['userfile']['tmp_name']; if($src) { if($_REQUEST['c_upload']) { + if($_REQUEST['target'] == 'channel_calendar') { + $result = parse_ical_file($src,local_channel()); + if($result) + info( t('Calendar entries imported.') . EOL); + else + notice( t('No calendar entries found.') . EOL); + + @unlink($src); + return; + } + $id = explode(':', $_REQUEST['target']); $ext = 'ics'; $table = 'calendarobjects'; $column = 'calendarid'; - $objects = new \Sabre\VObject\Splitter\ICalendar($src); + $objects = new \Sabre\VObject\Splitter\ICalendar(@file_get_contents($src)); $profile = \Sabre\VObject\Node::PROFILE_CALDAV; $backend = new \Sabre\CalDAV\Backend\PDO($pdo); } @@ -773,7 +784,7 @@ class Cdav extends Controller { $ext = 'vcf'; $table = 'cards'; $column = 'addressbookid'; - $objects = new \Sabre\VObject\Splitter\VCard($src); + $objects = new \Sabre\VObject\Splitter\VCard(@file_get_contents($src)); $profile = \Sabre\VObject\Node::PROFILE_CARDDAV; $backend = new \Sabre\CardDAV\Backend\PDO($pdo); } |