drink-it-cold/app/legal.php

93 lines
3.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
declare(strict_types=1);
/**
* Rechtliche Pflichtangaben für Impressum und Datenschutzerklärung.
*
* Die Werte lassen sich in app/config.local.php unter dem Schlüssel `legal`
* überschreiben. Fehlende Angaben fallen auf die hier hinterlegten Werte
* zurück. Die Standardwerte stammen von der bisherigen Website
* (drinkitcold.wixsite.com/drinkitcold).
*/
function legal_data(): array
{
static $data = null;
if (is_array($data)) {
return $data;
}
$defaults = [
'business_name' => 'Drink it cold',
'owner' => 'Michael Schmitz',
'street' => 'Rosellener Schulstr. 2',
'postal_code' => '41470',
'city' => 'Neuss',
'country' => 'Deutschland',
'phone' => '+49 172 6384350',
'email' => 'drinkitcold@web.de',
'vat_id' => 'DE408374900',
// Wird bewusst nicht im Impressum veröffentlicht: § 5 DDG verlangt
// die USt-IdNr., nicht die Steuernummer.
'tax_number' => '122/5553/5322',
'register_court' => '',
'register_number' => '',
'hosting_provider' => 'ALL-INKL.COM – Neue Medien Münnich',
'hosting_address' => 'Hauptstraße 68, 02742 Friedersdorf',
'hosting_country' => 'Deutschland',
'dpo_name' => '',
'dpo_email' => '',
'supervisory_authority' => 'Landesbeauftragte für Datenschutz und Informationsfreiheit Nordrhein-Westfalen',
'supervisory_address' => 'Kavalleriestraße 2–4, 40213 Düsseldorf',
'supervisory_phone' => '0211 38424-0',
'supervisory_email' => 'poststelle@ldi.nrw.de',
'supervisory_url' => 'https://www.ldi.nrw.de',
// Bei inhaltlichen Änderungen der Datenschutzerklärung anpassen.
'privacy_version' => '13.11.2026',
'log_retention_days' => 30,
'log_max_mb' => 5,
'invoice_retention_years' => 10,
'limitation_years' => 3,
];
$configured = config('legal', []);
if (is_array($configured)) {
foreach ($configured as $key => $value) {
if (is_string($key) && (is_string($value) || is_int($value)) && $value !== '') {
$defaults[$key] = $value;
}
}
}
$defaults['phone_href'] = legal_phone_href((string) $defaults['phone']);
$defaults['address_line'] = trim(
(string) $defaults['street'] . ', ' . (string) $defaults['postal_code'] . ' ' . (string) $defaults['city']
);
$defaults['session_days'] = max(1, (int) round(((int) config('app.session_absolute_seconds', 7776000)) / 86400));
$defaults['remember_days'] = max(1, (int) round(((int) config('app.remember_seconds', 7776000)) / 86400));
$data = $defaults;
return $data;
}
function legal_phone_href(string $phone): string
{
$digits = preg_replace('/[^0-9+]/', '', $phone) ?? '';
return $digits !== '' ? 'tel:' . $digits : '';
}
/** Öffentliche Rechtsseiten, die ohne Anmeldung und ohne Session erreichbar sind. */
function legal_is_public_path(string $path): bool
{
return in_array($path, ['/impressum', '/datenschutz'], true);
}
function legal_page(string $page): void
{
if (!in_array($page, ['impressum', 'datenschutz'], true)) {
abort_page(404, 'Diese Seite gibt es nicht.');
}
render_standalone('legal', [
'page' => $page,
'info' => legal_data(),
], $page === 'impressum' ? 'Impressum' : 'Datenschutz');
}