- Kontaktformular mit Spam-Schutz (Honeypot, Mindestzeit, Rate-Limit), klarer Bestätigung, Paketpreis vom Server, WhatsApp mit vorbereitetem Text - Preis-Hinweis unter Paketpreisen, eigene 404-Seite, verständliche Fehler - Admin: Toasts, Speicherleiste, Warnung bei ungespeicherten Änderungen, Re-Login bei abgelaufener Sitzung, Sortieren per Drag & Drop - Neues Recht system.admin für DB, Mail, Google, Export/Import, Reset - Englische Texte für Leistungen/Pakete/Upgrades (content_translations) - Automatische Schema-Migration beim ersten Aufruf nach git pull - Build in hifi/ neu erzeugt Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Dgc8etkq7JkjyZgD2DEbv
86 lines
3.2 KiB
PHP
86 lines
3.2 KiB
PHP
<?php
|
|
|
|
require __DIR__ . '/../vendor/autoload.php';
|
|
|
|
use App\Config\Database;
|
|
use App\Controllers\DownloadController;
|
|
use App\Controllers\SiteSettingsController;
|
|
|
|
$config = require __DIR__ . '/../config/config.php';
|
|
$siteUrl = rtrim($config['app']['site_url'], '/');
|
|
|
|
$db = Database::connection();
|
|
$models = $db->query(
|
|
'SELECT b.slug AS brand_slug, m.slug AS model_slug, m.updated_at
|
|
FROM car_models m JOIN brands b ON b.id = m.brand_id'
|
|
)->fetchAll();
|
|
$brands = $db->query('SELECT slug, updated_at FROM brands')->fetchAll();
|
|
|
|
// Im Dashboard ausgeblendete Bereiche leiten auf die Startseite um - gehoeren nicht in die Sitemap.
|
|
$vehiclesHidden = SiteSettingsController::isHidden('page.vehicles');
|
|
if ($vehiclesHidden) {
|
|
$models = $brands = [];
|
|
}
|
|
|
|
$urls = [['loc' => '/', 'priority' => '1.0']];
|
|
if (!$vehiclesHidden) {
|
|
$urls[] = ['loc' => '/fahrzeuge', 'priority' => '0.9'];
|
|
}
|
|
$urls[] = ['loc' => '/kontakt', 'priority' => '0.5'];
|
|
// Passwortgeschuetzt zeigt die Seite nur ein Eingabefeld - nichts, was ein Suchmaschinen-
|
|
// Eintrag wert waere.
|
|
if (DownloadController::hasVisible() && !DownloadController::isProtected() && !SiteSettingsController::isHidden('page.downloads')) {
|
|
$urls[] = ['loc' => '/downloads', 'priority' => '0.4'];
|
|
}
|
|
|
|
foreach ($brands as $brand) {
|
|
$urls[] = ['loc' => "/fahrzeuge/{$brand['slug']}", 'priority' => '0.8', 'lastmod' => $brand['updated_at']];
|
|
}
|
|
foreach ($models as $model) {
|
|
$urls[] = [
|
|
'loc' => "/fahrzeuge/{$model['brand_slug']}/{$model['model_slug']}",
|
|
'priority' => '0.7',
|
|
'lastmod' => $model['updated_at'],
|
|
];
|
|
}
|
|
|
|
if (!SiteSettingsController::isHidden('page.services')) {
|
|
$urls[] = ['loc' => '/leistungen', 'priority' => '0.8'];
|
|
}
|
|
|
|
if (!SiteSettingsController::isHidden('page.gallery')) {
|
|
$urls[] = ['loc' => '/galerie', 'priority' => '0.6'];
|
|
$galleryBrands = $db->query('SELECT slug, updated_at FROM gallery_brands')->fetchAll();
|
|
foreach ($galleryBrands as $galleryBrand) {
|
|
$urls[] = ['loc' => "/galerie/{$galleryBrand['slug']}", 'priority' => '0.5', 'lastmod' => $galleryBrand['updated_at']];
|
|
}
|
|
$galleryProjects = $db->query(
|
|
'SELECT gb.slug AS brand_slug, gp.slug AS project_slug, gp.updated_at
|
|
FROM gallery_projects gp JOIN gallery_brands gb ON gb.id = gp.gallery_brand_id'
|
|
)->fetchAll();
|
|
foreach ($galleryProjects as $project) {
|
|
$urls[] = [
|
|
'loc' => "/galerie/{$project['brand_slug']}/{$project['project_slug']}",
|
|
'priority' => '0.5',
|
|
'lastmod' => $project['updated_at'],
|
|
];
|
|
}
|
|
}
|
|
|
|
foreach (['/impressum', '/datenschutz', '/agb'] as $legalPath) {
|
|
$urls[] = ['loc' => $legalPath, 'priority' => '0.2'];
|
|
}
|
|
|
|
header('Content-Type: application/xml; charset=utf-8');
|
|
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
|
|
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
|
|
foreach ($urls as $url) {
|
|
echo " <url>\n";
|
|
echo ' <loc>' . htmlspecialchars($siteUrl . $url['loc']) . "</loc>\n";
|
|
if (!empty($url['lastmod'])) {
|
|
echo ' <lastmod>' . date('Y-m-d', strtotime($url['lastmod'])) . "</lastmod>\n";
|
|
}
|
|
echo ' <priority>' . $url['priority'] . "</priority>\n";
|
|
echo " </url>\n";
|
|
}
|
|
echo '</urlset>';
|