| Server IP : 193.86.120.172 / Your IP : 216.73.216.67 Web Server : Apache/2.4.63 (Unix) System : Linux JServices 3.10.108 #86003 SMP Wed Oct 22 13:20:46 CST 2025 x86_64 User : kubec ( 1026) PHP Version : 8.2.28 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /volume1/web/hotellesnizatisi_cz/new/includes/ |
Upload File : |
<?php
// ============================================================
// HTML šablony pro e-maily z kontaktního formuláře — sdílený
// branding (tmavé záhlaví/patička, pískovcový akcent), tabulkové
// rozložení a inline styly kvůli kompatibilitě s e-mailovými klienty.
// ============================================================
function email_wrap(string $innerHtml): string
{
return '<!DOCTYPE html><html lang="cs"><head><meta charset="UTF-8">'
. '<meta name="viewport" content="width=device-width, initial-scale=1.0">'
. '<title>Hotel Lesní zátiší</title></head>'
. '<body style="margin:0;padding:0;background-color:#EDE8DD;">'
. '<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background-color:#EDE8DD;">'
. '<tr><td align="center" style="padding:24px 12px;">'
. '<table role="presentation" width="600" cellpadding="0" cellspacing="0" style="max-width:600px;width:100%;background-color:#EDE8DD;border-radius:10px;overflow:hidden;">'
. '<tr><td style="background-color:#1F2620;padding:32px 36px 28px;text-align:center;">'
. '<div style="font-family:Arial,Helvetica,sans-serif;font-weight:bold;font-size:22px;letter-spacing:1px;text-transform:uppercase;color:#EDE8DD;">Lesní zátiší</div>'
. '<div style="font-family:Arial,Helvetica,sans-serif;font-size:11px;letter-spacing:2px;text-transform:uppercase;color:#C2884F;margin-top:6px;">Hotel · Adršpach</div>'
. '</td></tr>'
. '<tr><td style="padding:36px 36px 8px;">' . $innerHtml . '</td></tr>'
. '<tr><td style="background-color:#2B3527;padding:22px 36px;text-align:center;">'
. '<div style="font-family:Arial,Helvetica,sans-serif;font-size:12px;color:#A9B49C;line-height:1.7;">'
. 'Dolní Adršpach 121 · 549 51 Adršpach<br>'
. '+420 777 172 786 · lesni.zatisi@email.cz'
. '</div></td></tr>'
. '</table></td></tr></table>'
. '</body></html>';
}
function email_quote_box(string $label, string $title, string $body): string
{
$html = '<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="margin:0 0 26px;background-color:#FFFFFF;border-left:3px solid #C2884F;border-radius:0 6px 6px 0;">'
. '<tr><td style="padding:18px 22px;">'
. '<div style="font-family:Arial,Helvetica,sans-serif;font-size:10px;letter-spacing:1px;text-transform:uppercase;color:#9C6E3F;margin-bottom:10px;">' . htmlspecialchars($label) . '</div>';
if ($title !== '') {
$html .= '<div style="font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:bold;color:#232A1F;margin-bottom:8px;">' . htmlspecialchars($title) . '</div>';
}
$html .= '<div style="font-family:Arial,Helvetica,sans-serif;font-size:13px;line-height:1.6;color:#5b5f55;">' . nl2br(htmlspecialchars($body)) . '</div>'
. '</td></tr></table>';
return $html;
}
/**
* Potvrzovací e-mail zákazníkovi — v jeho jazyce, s opisem zprávy.
* Vrací ['subject' => ..., 'text' => ..., 'html' => ...].
*/
function build_customer_confirm_email(string $lang, string $jmeno, string $predmet, string $zprava): array
{
$texts = [
'cs' => [
'subject' => 'Potvrzení přijetí zprávy — Hotel Lesní zátiší',
'greeting' => 'Dobrý den ' . $jmeno . ',',
'intro' => 'děkujeme za vaši zprávu — byla úspěšně doručena. Ozveme se vám co nejdříve.',
'box_label' => 'Vaše zpráva',
'sig_html' => 'S pozdravem,<br>Hotel Lesní zátiší',
'sig_text' => "S pozdravem,\nHotel Lesní zátiší",
],
'en' => [
'subject' => 'Message received — Hotel Lesní zátiší',
'greeting' => 'Hello ' . $jmeno . ',',
'intro' => 'thank you for your message — it has been delivered successfully. We will get back to you as soon as possible.',
'box_label' => 'Your message',
'sig_html' => 'Best regards,<br>Hotel Lesní zátiší',
'sig_text' => "Best regards,\nHotel Lesní zátiší",
],
'de' => [
'subject' => 'Nachricht erhalten — Hotel Lesní zátiší',
'greeting' => 'Hallo ' . $jmeno . ',',
'intro' => 'vielen Dank für Ihre Nachricht — sie wurde erfolgreich übermittelt. Wir melden uns so schnell wie möglich bei Ihnen.',
'box_label' => 'Ihre Nachricht',
'sig_html' => 'Mit freundlichen Grüßen,<br>Hotel Lesní zátiší',
'sig_text' => "Mit freundlichen Grüßen,\nHotel Lesní zátiší",
],
];
$t = $texts[$lang] ?? $texts['cs'];
$inner = '<p style="font-family:Arial,Helvetica,sans-serif;font-size:15px;color:#232A1F;margin:0 0 18px;">' . htmlspecialchars($t['greeting']) . '</p>';
$inner .= '<p style="font-family:Arial,Helvetica,sans-serif;font-size:14px;line-height:1.6;color:#232A1F;margin:0 0 26px;">' . htmlspecialchars($t['intro']) . '</p>';
$inner .= email_quote_box($t['box_label'], $predmet, $zprava !== '' ? $zprava : '—');
$inner .= '<p style="font-family:Arial,Helvetica,sans-serif;font-size:14px;color:#232A1F;margin:0;">' . $t['sig_html'] . '</p>';
$text = $t['greeting'] . "\n\n" . $t['intro'] . "\n\n" . $t['box_label'] . ":\n—\n";
$text .= ($predmet !== '' ? $predmet . "\n\n" : '');
$text .= ($zprava !== '' ? $zprava . "\n" : '');
$text .= "—\n\n" . $t['sig_text'];
return ['subject' => $t['subject'], 'text' => $text, 'html' => email_wrap($inner)];
}
/**
* Notifikační e-mail hotelu o nové zprávě z webu.
* Vrací ['subject' => ..., 'text' => ..., 'html' => ...].
*/
function build_hotel_notify_email(string $jmeno, string $email, string $telefon, string $predmet, string $zprava): array
{
$subject = $predmet !== '' ? $predmet : 'Zpráva z webu hotelu';
$rows = [
'Jméno a příjmení' => $jmeno,
'E-mail' => $email,
'Telefon' => $telefon !== '' ? $telefon : '—',
'Předmět' => $predmet !== '' ? $predmet : '—',
];
$detailsRows = '';
foreach ($rows as $label => $value) {
$detailsRows .= '<tr>'
. '<td style="font-family:Arial,Helvetica,sans-serif;font-size:12px;color:#9C6E3F;padding:6px 14px 6px 0;white-space:nowrap;vertical-align:top;">' . htmlspecialchars($label) . '</td>'
. '<td style="font-family:Arial,Helvetica,sans-serif;font-size:13px;color:#232A1F;padding:6px 0;">' . htmlspecialchars($value) . '</td>'
. '</tr>';
}
$inner = '<p style="font-family:Arial,Helvetica,sans-serif;font-size:15px;color:#232A1F;margin:0 0 22px;">Nová zpráva z kontaktního formuláře na webu.</p>';
$inner .= '<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="margin:0 0 24px;"><tbody>' . $detailsRows . '</tbody></table>';
$inner .= email_quote_box('Zpráva', '', $zprava !== '' ? $zprava : '—');
$text = "Nová zpráva z kontaktního formuláře na webu hotellesnizatisi.cz\n\n";
$text .= "Jméno a příjmení: {$jmeno}\n";
$text .= "E-mail: {$email}\n";
$text .= "Telefon: " . ($telefon !== '' ? $telefon : '—') . "\n";
$text .= "Předmět: " . ($predmet !== '' ? $predmet : '—') . "\n\n";
$text .= "Zpráva:\n" . ($zprava !== '' ? $zprava : '—') . "\n";
return ['subject' => $subject, 'text' => $text, 'html' => email_wrap($inner)];
}