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,13 @@
<?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
*/
/**
* Class will be used for exceptions that are generated by class.bus.php.
*/
class BusException extends GrommunioException {}
@@ -0,0 +1,13 @@
<?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
*/
/**
* Class will be used for exceptions that are generated by class.dispatcher.php.
*/
class DispatcherException extends GrommunioException {}
@@ -0,0 +1,55 @@
<?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
*/
/**
* Defines an exception class for all php Errors.
* ErrorException properties and methods http://php.net/manual/en/class.errorexception.php
* Exception properties and methods http://www.php.net/manual/en/class.exception.php.
*/
class GrommunioErrorException extends BaseException {
/**
* Constructs the Exception.
*
* @param string $errorMessage The exception message
* @param int $code The Exception code
* @param string $filename the filename where the exception is thrown
* @param int $lineno the line number where the exception is thrown
* @param mixed $errorContext
* @param null|string $displayMessage the exception message to show at client side
*/
public function __construct($errorMessage, $code, $filename, $lineno, protected $errorContext = null, $displayMessage = null) {
if (!$displayMessage) {
$displayMessage = _('Action is not performed correctly.');
}
parent::__construct($errorMessage, $code, null, $displayMessage);
$this->setFile($filename);
$this->setLineNo($lineno);
}
/**
* Function sets the filename where the exception was thrown.
*
* @param string $filename name of the file where the exception was thrown
*/
protected function setFile($filename = '') {
$this->file = $filename;
}
/**
* Function sets the line where the exception was thrown.
*
* @param int $lineno line number where the exception was thrown
*/
protected function setLineNo($lineno = 0) {
$this->line = $lineno;
}
}
class_alias(GrommunioErrorException::class, 'ZarafaErrorException');
@@ -0,0 +1,16 @@
<?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
*/
/**
* Defines a base exception class for custom grommunio generated exceptions, these exceptions
* are generated and handled by our application only.
*/
class GrommunioException extends BaseException {}
class_alias(GrommunioException::class, 'ZarafaException');
@@ -0,0 +1,64 @@
<?php
/*
* SPDX-FileCopyrightText: Copyright 2020 - 2026 grommunio GmbH
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
require_once __DIR__ . '/class.GrommunioException.php';
/**
* Builds the user-facing exception for a file that could not be imported into a folder.
*/
class ImportError {
/**
* @param Exception $e conversion failure
* @param string $filename name of the imported file
* @param resource $folder destination folder
* @param callable $otherStore returns the delegate store owning the folder
* @param string $emptyText message for a file without importable items
*/
public static function fromException($e, $filename, $folder, callable $otherStore, $emptyText): GrommunioException {
$message = sprintf(_("Unable to import '%s' to '%s'. "), $filename, self::qualifiedFolderName($folder, $otherStore));
if ($e->getCode() === MAPI_E_TABLE_EMPTY) {
$message .= $emptyText;
}
elseif ($e->getCode() === MAPI_E_CORRUPT_DATA) {
$message .= _("The file is corrupt.");
}
elseif ($e->getCode() === MAPI_E_INVALID_PARAMETER) {
$message .= _("The file is invalid.");
}
else {
$message = sprintf(_("Unable to import '%s'. "), $filename) . $e->getMessage();
}
$error = new GrommunioException($message);
$error->setTitle(_("Import error"));
return $error;
}
/**
* Folder name followed by the public store name or the delegate store owner.
*
* @param resource $folder
*
* @return string
*/
private static function qualifiedFolderName($folder, callable $otherStore) {
$folderProps = mapi_getprops($folder, [PR_DISPLAY_NAME, PR_MDB_PROVIDER]);
$name = $folderProps[PR_DISPLAY_NAME];
if ($folderProps[PR_MDB_PROVIDER] === ZARAFA_STORE_PUBLIC_GUID) {
$publicStore = $GLOBALS["mapisession"]->getPublicMessageStore();
$publicStoreName = mapi_getprops($publicStore, [PR_DISPLAY_NAME]);
$name .= " - " . $publicStoreName[PR_DISPLAY_NAME];
}
elseif ($folderProps[PR_MDB_PROVIDER] === ZARAFA_STORE_DELEGATE_GUID) {
$ownerName = mapi_getprops($otherStore(), [PR_MAILBOX_OWNER_NAME]);
$name .= " - " . $ownerName[PR_MAILBOX_OWNER_NAME];
}
return $name;
}
}
@@ -0,0 +1,19 @@
<?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
*/
require_once __DIR__ . '/class.GrommunioException.php';
if (!class_exists('JSONException')) {
/**
* Class will be used for exceptions that are generated by json_decode_data
* in server/util.php
* getCode() method will return actual JSON error constant.
*/
class JSONException extends GrommunioException {}
}
@@ -0,0 +1,13 @@
<?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
*/
/**
* Class will be used for exceptions that are generated by search in list modules.
*/
class SearchException extends GrommunioException {}
@@ -0,0 +1,13 @@
<?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
*/
/**
* Class will be used for exceptions that are generated by class.setting.php.
*/
class SettingsException extends GrommunioException {}