= 2) return strtoupper(mb_substr($parts[0], 0, 1) . mb_substr($parts[1], 0, 1));
return strtoupper(mb_substr($name, 0, 2));
}
function avatarHtml(array $user, string $size = '32px'): string {
$initials = userInitials($user['name']);
$farbe = htmlspecialchars($user['farbe'] ?? '#2563eb');
$name = htmlspecialchars($user['name']);
if (!empty($user['avatar_url'])) {
return "";
}
return "{$initials}";
}
// ββ XSS-Schutz ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
function h(string $s): string {
return htmlspecialchars($s, ENT_QUOTES, 'UTF-8');
}
// ββ Packliste-Kategorien ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
$PACKEN_KATEGORIEN = [
'kleidung' => ['label' => 'Kleidung', 'icon' => 'π'],
'dokumente' => ['label' => 'Dokumente', 'icon' => 'π'],
'elektronik' => ['label' => 'Elektronik', 'icon' => 'π'],
'medizin' => ['label' => 'Medizin', 'icon' => 'π'],
'toilette' => ['label' => 'Toilette', 'icon' => 'π§΄'],
'essen' => ['label' => 'Essen & Trinken', 'icon' => 'πΏ'],
'strand' => ['label' => 'Strand', 'icon' => 'π'],
'sport' => ['label' => 'Sport', 'icon' => 'β½'],
'sonstiges' => ['label' => 'Sonstiges', 'icon' => 'π¦'],
];
$UPLOAD_TYPEN = [
'application/pdf' => 'PDF',
'image/jpeg' => 'JPG',
'image/png' => 'PNG',
'image/gif' => 'GIF',
'image/webp' => 'WEBP',
'application/msword' => 'Word',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'Word',
];
// ββ E-Mail-Versand ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
function sendMail(string $to, string $subject, string $htmlBody): bool {
$fromName = '=?UTF-8?B?' . base64_encode(MAIL_FROM_NAME) . '?=';
$subjectEncoded = '=?UTF-8?B?' . base64_encode($subject) . '?=';
$boundary = md5(uniqid());
$headers = "From: {$fromName} <" . MAIL_FROM . ">\r\n";
$headers .= "Reply-To: " . MAIL_FROM . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/alternative; boundary=\"{$boundary}\"\r\n";
$headers .= "X-Mailer: PHP/" . phpversion();
$plain = strip_tags(str_replace(['
', '
', '
', '
Hallo!
' . htmlspecialchars($inviterName) . ' hat dich zur Reise β' . htmlspecialchars($tripName) . '" eingeladen.
Oder kopiere diesen Link in deinen Browser:
' . htmlspecialchars($inviteLink) . '
LΓΌtte Planer Β· Reisen planen & teilen
Hallo ' . htmlspecialchars($toName) . '!
' . htmlspecialchars($inviterName) . ' hat dich zur Reise β' . htmlspecialchars($tripName) . '" hinzugefΓΌgt.
LΓΌtte Planer Β· Reisen planen & teilen