$title = $event["SUMMARY"]; if (isset($event['LOCATION']) && !empty($event['LOCATION'])) { $title .= ' (' . $event['LOCATION'] . ')'; } } elseif (isset($event["DESCRIPTION"]) && strpos(strtolower($event['DESCRIPTION']), strtolower("#location")) !== false) { if (isset($event['LOCATION']) && !empty($event['LOCATION'])) { $title .= ' (' . $event['LOCATION'] . ')'; } } elseif (isset($event["DESCRIPTION"]) && strpos(strtolower($event['DESCRIPTION']), strtolower("#privat")) !== false) { $privat = true; } if (!$privat) { $eventlist[] = ["start" => $start, "ende" => $ende, "title" => $title]; } } $v = createVCard($eventlist); echo $v; }); }); function dateToCal($timestamp) { return date('Ymd\\THis\\Z', $timestamp); } // Escapes a string of characters function escapeString($string) { #$string = str_replace('\\', '\\\\', $string); return preg_replace('/([\\,;])/', '\\\\$1', $string); } function createVCard($events) {
<?php include $pluginManager->getController('vcard'); $id = $pluginManager->getCommand(0); if (!empty($id) && is_numeric($id)) { $contact = $pluginManager->databaseManager->getValues(array('id' => array('value' => $id)), 1); if (!empty($contact) && is_array($contact)) { $filename = uniqid() . '.vcf'; if (!empty($contact['firstname']) && !empty($contact['lastname'])) { $filename = $contact['firstname'] . '_' . $contact['lastname'] . '.vcf'; } header("Content-Type: application/download"); header('Content-Disposition: attachment; filename="' . $filename . '"'); echo createVCard($contact); } }