Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions languages/de-DE.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources>
<!--Phrases only in installation-->
<string name="SYS_SUBSCRIBE">Abonnieren</string>
<string name="INS_ADDIDIONAL_DATA">Zusätzliche Daten</string>
<string name="INS_ADDRESS_LIST">Adressliste</string>
<string name="INS_ADMINISTRATOR_LOGIN_DESC">Ein Update der Datenbank darf nur von einer Administratorin oder einem Administrator durchgeführt werden. Geben Sie an dieser Stelle bitte die Zugangsdaten einer Administratorin oder eines Administrators ein.</string>
Expand Down
1 change: 1 addition & 0 deletions languages/de.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources>
<!--Phrases only in installation-->
<string name="SYS_SUBSCRIBE">Abonnieren</string>
<string name="INS_ADDIDIONAL_DATA">Zusätzliche Daten</string>
<string name="INS_ADDRESS_LIST">Adressliste</string>
<string name="INS_ADMINISTRATOR_LOGIN_DESC">Ein Update der Datenbank darf nur von einer Administratorin oder einem Administrator durchgeführt werden. Gib an dieser Stelle bitte die Zugangsdaten einer Administratorin oder eines Administrators ein.</string>
Expand Down
1 change: 1 addition & 0 deletions languages/en.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources>
<!--Phrases only in installation-->
Expand Down Expand Up @@ -1666,6 +1666,7 @@
<string name="SYS_SUBJECT">Subject</string>
<string name="SYS_SUBORDINATE_ORGANIZATIONS">Sub-organizations</string>
<string name="SYS_SUBORDINATE_ORGANIZATIONS_DESC">Sub-organizations can share profile data of contacts. In some modules (announcements, events) it is possible to display entries from the main organization in the sub-organizations. The administration of a sub-organization is completely independent and can be provided with its own rights concept. You can find more information in the #VAR1#Admidio Wiki#VAR2#.</string>
<string name="SYS_SUBSCRIBE">Subscribe</string>
<string name="SYS_SUNDAY">Sunday</string>
<string name="SYS_SWITCH_TO_CALENDAR_MANAGEMENT">Switch to calendar management</string>
<string name="SYS_SWITCH_TO_CATEGORIES_ADMINISTRATION">Switch to category administration</string>
Expand Down
16 changes: 12 additions & 4 deletions modules/events/events.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,16 @@ function(data) {
ChangelogService::displayHistoryButton($page, 'events', 'events');

if ($getEventUuid === '') {
// show print button
$page->addPageFunctionsMenuItem('menu_item_event_print_view', $gL10n->get('SYS_PRINT_PREVIEW'), 'javascript:void(0);', 'bi-printer-fill');

// iCal Download
// Download / Subscribe iCal
if ($gSettingsManager->getBool('events_ical_export_enabled')) {
$url = SecurityUtils::encodeUrl(ADMIDIO_URL . FOLDER_MODULES . '/events/events_function.php', array('mode' => 'subscribe'));
$page->addPageFunctionsMenuItem(
'menu_item_event_subscribe',
$gL10n->get('SYS_SUBSCRIBE'),
str_replace(["http://", "https://"], "webcal://", $url),
'bi-calendar-check'
);

$param = array('mode' => 'export');
($getCatUuid !== '' ? $param['cat_uuid'] = $getCatUuid : '');
($getDateFrom !== '' ? $param['date_from'] = $getDateFrom : '');
Expand All @@ -190,6 +195,9 @@ function(data) {
);
}

// show print button
$page->addPageFunctionsMenuItem('menu_item_event_print_view', $gL10n->get('SYS_PRINT_PREVIEW'), 'javascript:void(0);', 'bi-printer-fill');

if ($gCurrentUser->isAdministratorEvents()) {
// if no calendar select box is shown, then show a link to edit calendars
$page->addPageFunctionsMenuItem(
Expand Down
16 changes: 11 additions & 5 deletions modules/events/events_function.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* participate - User attends to the event
* participate_cancel - User cancel participation of the event
* participate_maybe - User may participate in the event
* subscribe - Subscribe to events in iCal format
* user_uuid : UUID of the user membership to an event should be edited
* copy : true - The event of the dat_id will be copied and the base for this new event
* cat_uuid : show all events of calendar with this UUID
Expand Down Expand Up @@ -43,7 +44,7 @@

// Initialize and check the parameters
$getEventUuid = admFuncVariableIsValid($_GET, 'dat_uuid', 'uuid');
$getMode = admFuncVariableIsValid($_GET, 'mode', 'string', array('requireValue' => true, 'validValues' => array('edit', 'delete', 'participate', 'participate_cancel', 'participate_maybe', 'export')));
$getMode = admFuncVariableIsValid($_GET, 'mode', 'string', array('requireValue' => true, 'validValues' => array('edit', 'delete', 'participate', 'participate_cancel', 'participate_maybe', 'export', 'subscribe')));
$getUserUuid = admFuncVariableIsValid($_GET, 'user_uuid', 'uuid', $gValidLogin ? array('defaultValue' => $gCurrentUser->getValue('usr_uuid')) : []);
$getCopy = admFuncVariableIsValid($_GET, 'copy', 'bool');
$getCatUuid = admFuncVariableIsValid($_GET, 'cat_uuid', 'uuid');
Expand All @@ -58,7 +59,7 @@
throw new Exception('SYS_MODULE_DISABLED');
}

if ($getMode !== 'export' || (int)$gSettingsManager->get('events_module_enabled') === 2) {
if (!in_array($getMode, array('export', 'subscribe'), true) || (int)$gSettingsManager->get('events_module_enabled') === 2) {
// All functions, except export, are only available for logged-in users.
require(__DIR__ . '/../../system/login_valid.php');
}
Expand Down Expand Up @@ -364,7 +365,7 @@

echo json_encode(array('status' => 'success'));
exit();
} elseif ($getMode === 'export') { // export event in iCal format
} elseif (in_array($getMode, array('export', 'subscribe'), true)) { // export event in iCal format
// If iCal enabled and module is public
if (!$gSettingsManager->getBool('events_ical_export_enabled')) {
throw new Exception('SYS_ICAL_DISABLED');
Expand All @@ -375,6 +376,12 @@
$getDateTo = DATE_MAX;
}

if ($getMode === 'subscribe') {
$contentDisposition = 'inline';
} else {
$contentDisposition = 'attachment';
}

$events = new ModuleEvents();
if ($getEventUuid !== '') {
$filename = FileSystemUtils::getSanitizedPathEntry($event->getValue('dat_headline', 'database')) . '.ics';
Expand All @@ -392,8 +399,7 @@
}

header('Content-Type: text/calendar; charset=utf-8');
header('Content-Disposition: attachment; filename="' . $filename . '"');

header('Content-Disposition: ' . $contentDisposition . '; filename="' . $filename . '"');
// necessary for IE, because without it the download with SSL has problems
header('Cache-Control: private');
header('Pragma: public');
Expand Down
15 changes: 8 additions & 7 deletions src/Menu/ValueObject/MenuNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Admidio\Infrastructure\Exception;
use Admidio\Infrastructure\Language;
use Admidio\Infrastructure\Service\RegistrationService;
use Admidio\Messages\Entity\Message;
use Admidio\Roles\Entity\RolesRights;

/**
Expand Down Expand Up @@ -79,7 +80,7 @@ public function count(): int
* @param string $description An optional description of the menu node that could be shown in some output cases
* @throws Exception
*/
public function addItem(string $id, string $name, string $url, string $icon, string $parentMenuItemId = '', int $badgeCount = 0, string $description = '')
public function addItem(string $id, string $name, string $url, string $icon, string $parentMenuItemId = '', int $badgeCount = 0, string $description = ''): void
{
$node['id'] = $id;

Expand All @@ -88,17 +89,17 @@ public function addItem(string $id, string $name, string $url, string $icon, str
$node['description'] = Language::translateIfTranslationStrId($description);

// add root path to link unless the full URL is given
if (preg_match('/^http(s?):\/\//', $url) === 0 && strpos($url, 'javascript:') !== 0) {
if (preg_match('/^http(s?):\/\//', $url) === 0 && !str_starts_with($url, 'javascript:') && !str_starts_with($url, 'webcal:')) {
$url = ADMIDIO_URL . $url;
}
$node['url'] = $url;

if ($icon === '') {
$icon = 'bi bi-trash invisible';
}
if (strpos($icon, 'bi-') !== false) {
if (str_contains($icon, 'bi-')) {
$node['icon'] = 'bi ' . $icon;
} elseif (strpos($icon, 'bi') !== false) {
} elseif (str_contains($icon, 'bi')) {
$node['icon'] = $icon;
} else {
$node['icon'] = 'bi bi-' . $icon;
Expand Down Expand Up @@ -137,7 +138,7 @@ public function getName(): string
* @param int $nodeId The database id of the node menu entry
* @throws Exception
*/
public function loadFromDatabase(int $nodeId)
public function loadFromDatabase(int $nodeId): void
{
global $gDb, $gValidLogin;

Expand All @@ -157,7 +158,7 @@ public function loadFromDatabase(int $nodeId)

if ($node['men_name_intern'] === 'messages' && $gValidLogin) {
// get number of unread messages for user
$message = new \Admidio\Messages\Entity\Message($gDb);
$message = new Message($gDb);
$badgeCount = $message->countUnreadMessageRecords($GLOBALS['gCurrentUserId']);
} elseif ($node['men_name_intern'] === 'registration') {
$registration = new RegistrationService($gDb);
Expand Down Expand Up @@ -205,7 +206,7 @@ public function menuItemIsVisible(int $menuId): bool
* Sets the translated name of this node.
* @param string $name Translated name of the node.
*/
public function setName(string $name)
public function setName(string $name): void
{
$this->name = $name;
}
Expand Down
Loading