UPLOAD_TYPES_DOCS, 'dir' => dirname(__DIR__) . '/uploads/', 'prefix' => 'fortbildung', 'required' => false, ]); if (!$up['ok']) { redirect_error($back, $up['error']); } $filename = $up['filename'] ?? ''; $original_name = $up['original_name'] ?? ''; $mime = $up['mime'] ?? null; $user_id = current_user()['id']; $now = date('c'); db()->prepare( 'INSERT INTO requests_fortbildungsantrag (user_id, status, admin_note, anliegen, thema, nachricht, filename, original_name, created_at, updated_at) VALUES (?, \'pending\', \'\', ?, ?, ?, ?, ?, ?, ?)' )->execute([$user_id, $anliegen, $thema, $nachricht, $filename, $original_name, $now, $now]); $anliegen_labels = [ 'wbl_pdl' => 'WBL / PDL', 'fortbildung' => 'Fortbildung', 'pflichtschulung' => 'Pflichtschulung', ]; $config = require __DIR__ . '/../lib/config.php'; $attach = ($filename !== '') ? ['path' => dirname(__DIR__) . '/uploads/' . $filename, 'name' => $original_name, 'mime' => $mime] : []; smtp_send( $config, $config['mail_info'], 'Neuer Fortbildungsantrag: ' . current_name(), "Ein Fortbildungsantrag wurde eingereicht.\n\n" . 'Mitarbeiter: ' . current_name() . "\n" . 'Anliegen: ' . ($anliegen_labels[$anliegen] ?? $anliegen) . "\n" . 'Thema: ' . $thema . "\n" . 'Nachricht: ' . ($nachricht ?: '—') . "\n\n" . "---\nGesendet über OMSORG Connect", $attach ); redirect_ok($back);