Initial upload to Gitea

This commit is contained in:
antonn committed 2026-11-30 16:32:37 +00:00
1 parent 78193254ad
commit 8478998cae
1485 files changed
+461025 -42348

No files matched your search

@@ -0,0 +1,72 @@
<?php
/*
* SPDX-FileCopyrightText: Copyright 2020 - 2026 grommunio GmbH
* SPDX-FileCopyrightText: Copyright 2016 Kopano and its licensors
* SPDX-FileCopyrightText: Copyright 2005 - 2016 Zarafa B.V. and its licensors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
// required to handle php errors
require_once __DIR__ . '/exceptions/class.GrommunioErrorException.php';
require_once __DIR__ . '/download_base.php';
/**
* DownloadAppointment.
*
* A class to manage downloading of appointment as a file,
* it will generate the appointment as RFC2445-formatted ics stream.
* It extends the DownloadBase class.
*/
class DownloadAppointment extends DownloadBase {
/**
* Function get appointment using respective mapi function.
* It also sends the ics file to the client.
*/
public function downloadAppointmentAsFile() {
if ($this->message && $this->store) {
// Get addressbook for current session
$addrBook = $GLOBALS['mapisession']->getAddressbook();
// get message properties.
$messageProps = mapi_getprops($this->message, [PR_SUBJECT]);
// Read the appointment as RFC2445-formatted ics stream.
$appointmentStream = mapi_mapitoical($GLOBALS['mapisession']->getSession(), $addrBook, $this->message, []);
if ($appointmentStream === false) {
throw new RuntimeException('Unable to convert appointment');
}
$filename = (!empty($messageProps[PR_SUBJECT])) ? $messageProps[PR_SUBJECT] : _('Untitled');
$filename .= '.ics';
$this->setNecessaryHeaders($filename, strlen($appointmentStream));
$split = str_split($appointmentStream, BLOCK_SIZE);
foreach ($split as $s) {
echo $s;
}
}
}
/**
* Generic function to check received data and download ics file.
*/
public function download() {
$this->downloadAppointmentAsFile();
}
}
// create instance of class to download message as file
$messageInstance = new DownloadAppointment();
try {
// initialize variables
$messageInstance->init($_GET);
// download message
$messageInstance->download();
}
catch (Exception $e) {
$messageInstance->handleSaveMessageException($e);
}