Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d6694d97a3 | |||
| 797afb4b17 | |||
| 29e836822f | |||
| 8f7be04301 | |||
| e62c61e255 | |||
| 143fe3d488 | |||
| 615866d215 | |||
| acc50dbb5d |
@@ -0,0 +1,45 @@
|
||||
# Application
|
||||
APP_NAME="GetYourBand"
|
||||
APP_ENV=local
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
# Database
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=getyourband
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
# Mail (SMTP)
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=smtp.mailtrap.io
|
||||
MAIL_PORT=2525
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=tls
|
||||
MAIL_FROM_ADDRESS=noreply@getyourband.ch
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
# Payment
|
||||
PAYPAL_MODE=sandbox
|
||||
PAYPAL_CLIENT_ID=
|
||||
PAYPAL_SECRET=
|
||||
PAYMENT_ENABLED=false
|
||||
COMMISSION_RATE=0.10
|
||||
|
||||
# Upload Settings
|
||||
MAX_UPLOAD_SIZE=5242880
|
||||
ALLOWED_IMAGE_TYPES=jpg,jpeg,png,webp
|
||||
ALLOWED_VIDEO_TYPES=mp4,webm
|
||||
|
||||
# Security
|
||||
SESSION_LIFETIME=120
|
||||
SESSION_DRIVER=file
|
||||
HASH_ALGO=bcrypt
|
||||
|
||||
# Features
|
||||
REQUIRE_EMAIL_VERIFICATION=true
|
||||
REQUIRE_BAND_APPROVAL=true
|
||||
ENABLE_REVIEWS=true
|
||||
+39
@@ -1,2 +1,41 @@
|
||||
# Environment
|
||||
.env
|
||||
.env.local
|
||||
|
||||
# Dependencies
|
||||
/vendor/
|
||||
/node_modules/
|
||||
|
||||
# Build assets
|
||||
/public/dist/
|
||||
/public/hot
|
||||
|
||||
# Storage
|
||||
storage/*
|
||||
!storage/.gitkeep
|
||||
storage/cache/*
|
||||
storage/logs/*
|
||||
storage/sessions/*
|
||||
storage/uploads/*
|
||||
|
||||
# IDE
|
||||
.vscode/
|
||||
.idea/
|
||||
*.sublime-*
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Composer
|
||||
composer.lock
|
||||
|
||||
# NPM
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
|
||||
# Testing
|
||||
.phpunit.result.cache
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
Options -Indexes
|
||||
AddDefaultCharset UTF-8
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
|
||||
# Redirect to public directory
|
||||
RewriteCond %{REQUEST_URI} !^/public/
|
||||
RewriteRule ^(.*)$ /public/$1 [L,QSA]
|
||||
</IfModule>
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
# Email & Buchungssystem Updates
|
||||
|
||||
## Änderungen vom 2. Dezember 2025
|
||||
|
||||
### ✅ Implementierte Features:
|
||||
|
||||
#### 1. **Echte Email-Funktionalität** (`includes/email.php`)
|
||||
- ✨ PHP `mail()` Funktion implementiert statt nur Logging
|
||||
- ✅ HTML-Email-Support mit professionellen Templates
|
||||
- 📧 Automatische Headers (From, Reply-To, Content-Type)
|
||||
- 📝 Logging bleibt erhalten für Debugging
|
||||
|
||||
#### 2. **Email-Template-System**
|
||||
- 🎨 Professionelle HTML-Email-Templates mit Styling
|
||||
- 🎸 "booking_request" - Email an die Band
|
||||
- ✅ "booking_confirmation" - Bestätigung an den Kunden
|
||||
- 🎨 Gelbes Branding (#f4b807) passend zur Plattform
|
||||
|
||||
#### 3. **Verbesserte Buchungsanfragen** (`anfrage.php`)
|
||||
- 📧 Automatische Email an Band bei neuer Anfrage
|
||||
- ✅ Bestätigungs-Email an Kunden
|
||||
- 👥 **Gäste-Buchungen** ohne Login möglich
|
||||
- ✔️ Bessere Formular-Validierung
|
||||
- 📅 Datum-Mindestauswahl (nur zukünftige Daten)
|
||||
|
||||
#### 4. **Band-Email-Verwaltung** (`profil.php`)
|
||||
- 📧 Bands können eigene Email-Adresse hinterlegen
|
||||
- 📝 Klare Beschriftung: "Email für Buchungsanfragen"
|
||||
- 💾 Email wird in der Datenbank gespeichert
|
||||
|
||||
#### 5. **Datenbank-Updates** (`database.sql`)
|
||||
- 🗄️ Neue Spalte `email` in `bands` Tabelle
|
||||
- 📜 Migration-Script: `migrate_add_band_email.php`
|
||||
|
||||
---
|
||||
|
||||
## 📋 Installations-Anleitung
|
||||
|
||||
### Schritt 1: Migration ausführen
|
||||
```bash
|
||||
php migrate_add_band_email.php
|
||||
```
|
||||
|
||||
### Schritt 2: Mail-Server konfigurieren
|
||||
Stelle sicher, dass PHP's `mail()` Funktion auf dem Server konfiguriert ist:
|
||||
- Ubuntu/Debian: `sudo apt-get install sendmail`
|
||||
- Oder verwende einen SMTP-Relay wie Postfix
|
||||
|
||||
### Schritt 3: Testen
|
||||
1. Als Band einloggen
|
||||
2. Profil bearbeiten und Email-Adresse hinzufügen
|
||||
3. Als Gast oder Kunde eine Buchungsanfrage senden
|
||||
4. Prüfe die Emails (und `storage/logs/mail.log`)
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Neue Funktionen im Detail
|
||||
|
||||
### Email an Band (booking_request)
|
||||
```
|
||||
Enthält:
|
||||
- Event-Datum, Ort, Typ
|
||||
- Budget
|
||||
- Nachricht des Kunden
|
||||
- Kontaktdaten (Name, Email)
|
||||
- Professionelles Layout
|
||||
```
|
||||
|
||||
### Email an Kunde (booking_confirmation)
|
||||
```
|
||||
Enthält:
|
||||
- Bestätigung der Anfrage
|
||||
- Event-Details
|
||||
- Hinweis auf Rückmeldung der Band
|
||||
- Support-Kontakt
|
||||
```
|
||||
|
||||
### Gäste-Buchungen
|
||||
```
|
||||
- Keine Registrierung nötig
|
||||
- Name + Email Pflichtfelder
|
||||
- Email-Validierung
|
||||
- Gleiche Funktionalität wie eingeloggte User
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Konfiguration
|
||||
|
||||
### Email-Absender
|
||||
In `includes/config.php`:
|
||||
```php
|
||||
const SITE_NAME = 'GetYourBand';
|
||||
const SUPPORT_EMAIL = 'support@getyourband.ch';
|
||||
```
|
||||
|
||||
### Band-Email Fallback
|
||||
Falls Band keine Email hinterlegt hat:
|
||||
```php
|
||||
info@[bandname].ch
|
||||
```
|
||||
(Leerzeichen werden entfernt, lowercase)
|
||||
|
||||
---
|
||||
|
||||
## 📝 Nächste Schritte (Optional)
|
||||
|
||||
### Empfohlene Erweiterungen:
|
||||
1. **PHPMailer Integration** für SMTP-Support
|
||||
2. **Email-Queue** für große Mengen
|
||||
3. **Email-Templates per Datenbank** konfigurierbar
|
||||
4. **Email-Benachrichtigungen** für:
|
||||
- Status-Änderungen von Anfragen
|
||||
- Neue Bewertungen
|
||||
- Profil-Freigaben
|
||||
|
||||
### SMTP mit PHPMailer (Beispiel):
|
||||
```bash
|
||||
composer require phpmailer/phpmailer
|
||||
```
|
||||
|
||||
Dann in `includes/email.php` ersetzen:
|
||||
```php
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
// ... SMTP Konfiguration
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🐛 Debugging
|
||||
|
||||
### Email kommt nicht an?
|
||||
1. Prüfe `storage/logs/mail.log` - werden Emails geloggt?
|
||||
2. Prüfe Server Mail-Logs: `tail -f /var/log/mail.log`
|
||||
3. Teste PHP mail(): `php -r "mail('test@example.com', 'Test', 'Test');"`
|
||||
4. Prüfe Spam-Ordner
|
||||
|
||||
### Häufige Probleme:
|
||||
- **sendmail nicht installiert**: `sudo apt-get install sendmail`
|
||||
- **Port 25 blockiert**: Verwende SMTP-Relay
|
||||
- **SPF/DKIM fehlt**: Emails landen im Spam
|
||||
|
||||
---
|
||||
|
||||
## ✨ Zusammenfassung
|
||||
|
||||
**Vorher:**
|
||||
- ❌ Emails wurden nur geloggt
|
||||
- ❌ Keine echten Email-Benachrichtigungen
|
||||
- ❌ Gäste konnten nicht buchen
|
||||
- ❌ Bands hatten keine Email-Verwaltung
|
||||
|
||||
**Nachher:**
|
||||
- ✅ Echte Email-Versand mit HTML-Templates
|
||||
- ✅ Automatische Benachrichtigungen an Band & Kunde
|
||||
- ✅ Gäste-Buchungen möglich
|
||||
- ✅ Bands verwalten ihre Email-Adresse
|
||||
- ✅ Professionelles Design
|
||||
- ✅ Bessere Validierung
|
||||
|
||||
---
|
||||
|
||||
**Viel Erfolg! 🎸🎵**
|
||||
@@ -0,0 +1,180 @@
|
||||
# Neue Features: PayPal-Integration & Bild-Upload
|
||||
|
||||
Dieses Dokument beschreibt die neu hinzugefügten Features für die GetYourBand-Plattform.
|
||||
|
||||
## 🖼️ Bild-Upload für Bands
|
||||
|
||||
### Features
|
||||
- **Upload-Funktionalität**: Bands können eigene Bilder hochladen
|
||||
- **Galerie-Verwaltung**: Anzeige und Verwaltung aller hochgeladenen Bilder
|
||||
- **Löschen**: Bilder können jederzeit gelöscht werden
|
||||
- **Validierung**:
|
||||
- Erlaubte Formate: JPG, PNG, GIF, WEBP
|
||||
- Maximale Dateigröße: 5MB
|
||||
- Automatische Dateinamens-Generierung
|
||||
|
||||
### Technische Details
|
||||
- **Upload-Verzeichnis**: `/storage/uploads/bands/`
|
||||
- **Handler**: `upload-handler.php`
|
||||
- **Frontend**: AJAX-basierter Upload mit Fetch API
|
||||
- **Dateinamensschema**: `band_{band_id}_{unique_id}.{extension}`
|
||||
|
||||
### Verwendung
|
||||
1. Als Band-User einloggen
|
||||
2. Zum Profil navigieren (`profil.php`)
|
||||
3. Sektion "Band-Galerie" finden
|
||||
4. Auf "+ Bild hochladen" klicken
|
||||
5. Bild auswählen (wird automatisch hochgeladen)
|
||||
|
||||
### Sicherheit
|
||||
- Nur authentifizierte Band-User können uploaden
|
||||
- Strenge Dateitypprüfung (MIME-Type + Extension)
|
||||
- Größenlimit verhindert DoS
|
||||
- Sichere Dateinamen ohne User-Input
|
||||
|
||||
---
|
||||
|
||||
## 💳 PayPal-Integration
|
||||
|
||||
### Features
|
||||
- **Zahlungsabwicklung**: Kunden können Buchungen direkt mit PayPal bezahlen
|
||||
- **Service Fee**: Konfigurierbare Servicegebühr (in Admin-Settings)
|
||||
- **Zahlungs-Tracking**: Alle Zahlungen werden in der Datenbank gespeichert
|
||||
- **Status-Updates**: Anfragen werden automatisch auf "bestätigt" gesetzt
|
||||
- **Email-Benachrichtigungen**: Kunde und Band erhalten Bestätigungen
|
||||
|
||||
### Komponenten
|
||||
|
||||
#### 1. Datenbank
|
||||
Neue Tabelle `payments`:
|
||||
```sql
|
||||
CREATE TABLE payments (
|
||||
id INTEGER PRIMARY KEY,
|
||||
request_id INTEGER NOT NULL,
|
||||
amount REAL NOT NULL,
|
||||
service_fee REAL NOT NULL,
|
||||
total_amount REAL NOT NULL,
|
||||
paypal_order_id TEXT,
|
||||
paypal_payer_id TEXT,
|
||||
status TEXT DEFAULT 'pending',
|
||||
created_at TEXT,
|
||||
completed_at TEXT
|
||||
);
|
||||
```
|
||||
|
||||
#### 2. Checkout-Seite
|
||||
**Datei**: `paypal-checkout.php`
|
||||
- Zeigt Buchungsdetails und Zahlungsübersicht
|
||||
- Integriert PayPal JavaScript SDK
|
||||
- Berechnet Gesamtbetrag (Band-Gage + Service Fee)
|
||||
|
||||
#### 3. Payment Processing
|
||||
**Datei**: `paypal-process.php`
|
||||
- Speichert erfolgreiche Zahlungen
|
||||
- Aktualisiert Request-Status
|
||||
- Sendet Bestätigungs-Emails
|
||||
|
||||
#### 4. Integration in Buchungsflow
|
||||
**Änderungen in `anfrage.php`**:
|
||||
- Nach erfolgreicher Anfrage wird PayPal-Button angezeigt (wenn aktiviert)
|
||||
- Direkter Link zum Checkout
|
||||
|
||||
**Änderungen in `profil.php`**:
|
||||
- Zahlungsstatus für jede Anfrage angezeigt
|
||||
- "Jetzt bezahlen"-Button für ausstehende Zahlungen
|
||||
|
||||
### PayPal-Konfiguration
|
||||
|
||||
#### Admin-Einstellungen
|
||||
Im Admin-Panel (`admin/settings.php`):
|
||||
- `paypal_enabled`: 0/1 (aktiviert/deaktiviert)
|
||||
- `service_fee`: Prozentsatz (z.B. 8 für 8%)
|
||||
|
||||
#### PayPal API Credentials
|
||||
In `paypal-checkout.php` Zeile 80:
|
||||
```javascript
|
||||
<script src="https://www.paypal.com/sdk/js?client-id=YOUR_PAYPAL_CLIENT_ID¤cy=CHF"></script>
|
||||
```
|
||||
|
||||
**Wichtig**: `YOUR_PAYPAL_CLIENT_ID` durch echte Client-ID ersetzen!
|
||||
|
||||
#### PayPal Developer Setup
|
||||
1. Gehen Sie zu https://developer.paypal.com
|
||||
2. Erstellen Sie eine App in "My Apps & Credentials"
|
||||
3. Kopieren Sie die Client-ID
|
||||
4. Für Produktion: Aktivieren Sie Live-Modus und verwenden Sie Live-Credentials
|
||||
|
||||
### Zahlungsablauf
|
||||
|
||||
1. **Kunde erstellt Anfrage** → Request wird in DB gespeichert
|
||||
2. **PayPal-Link erscheint** → Kunde klickt auf "Mit PayPal bezahlen"
|
||||
3. **Checkout-Seite** → Übersicht und PayPal-Button
|
||||
4. **PayPal-Zahlung** → Kunde loggt sich in PayPal ein und zahlt
|
||||
5. **Payment Processing** → Zahlung wird in DB gespeichert
|
||||
6. **Status-Update** → Request → "bestätigt", Emails versandt
|
||||
7. **Rückkehr zum Profil** → Erfolgsmeldung
|
||||
|
||||
### Testmodus
|
||||
|
||||
Die aktuelle Implementation läuft im **Sandbox-Modus**:
|
||||
- Verwenden Sie PayPal Sandbox-Accounts zum Testen
|
||||
- Keine echten Transaktionen werden durchgeführt
|
||||
- Für Produktion: Client-ID auf Live-Credentials umstellen
|
||||
|
||||
### Sicherheit
|
||||
- Zahlung nur für eigene Requests möglich
|
||||
- Doppelzahlungen werden verhindert
|
||||
- Transaktions-IDs werden gespeichert
|
||||
- Server-seitige Validierung aller Zahlungsdaten
|
||||
|
||||
---
|
||||
|
||||
## 📂 Neue Dateien
|
||||
|
||||
| Datei | Beschreibung |
|
||||
|-------|--------------|
|
||||
| `upload-handler.php` | REST-API für Bild-Uploads (POST/DELETE) |
|
||||
| `paypal-checkout.php` | PayPal Checkout-Seite |
|
||||
| `paypal-process.php` | PayPal Payment Processing Backend |
|
||||
| `storage/uploads/bands/` | Upload-Verzeichnis für Band-Bilder |
|
||||
| `PAYPAL_UPLOAD_FEATURES.md` | Diese Dokumentation |
|
||||
|
||||
## 🔄 Geänderte Dateien
|
||||
|
||||
| Datei | Änderungen |
|
||||
|-------|------------|
|
||||
| `database.sql` | + `payments` Tabelle |
|
||||
| `profil.php` | + Galerie-Sektion, + Zahlungsstatus in Anfragen |
|
||||
| `anfrage.php` | + PayPal-Button nach erfolgreicher Anfrage |
|
||||
|
||||
## 🚀 Deployment-Checklist
|
||||
|
||||
- [ ] `storage/uploads/` Verzeichnis erstellen mit Schreibrechten
|
||||
- [ ] PayPal Developer Account erstellen
|
||||
- [ ] Client-ID in `paypal-checkout.php` eintragen
|
||||
- [ ] Admin-Panel: PayPal aktivieren und Service Fee setzen
|
||||
- [ ] Für Produktion: Auf Live-Credentials umstellen
|
||||
- [ ] SSL-Zertifikat für HTTPS (PayPal requirement)
|
||||
|
||||
## 🐛 Bekannte Einschränkungen
|
||||
|
||||
1. **PayPal Client-ID**: Muss manuell konfiguriert werden
|
||||
2. **Keine Rückerstattungen**: Keine Admin-UI für Refunds
|
||||
3. **Email-System**: Aktuell nur Logging, kein echtes SMTP
|
||||
4. **Sandbox-Modus**: Standardmäßig aktiviert
|
||||
|
||||
## 📝 Nächste Schritte (Optional)
|
||||
|
||||
- Webhook-Integration für PayPal IPN (Instant Payment Notification)
|
||||
- Admin-Dashboard für Zahlungsübersicht
|
||||
- Automatische Rechnungserstellung (PDF)
|
||||
- Stripe als alternative Zahlungsmethode
|
||||
- Bulk-Upload für mehrere Bilder
|
||||
- Bildkompression/Optimierung
|
||||
- Thumbnail-Generierung
|
||||
|
||||
---
|
||||
|
||||
**Entwickelt für**: GetYourBand Platform
|
||||
**Datum**: 2025-12-02
|
||||
**Version**: 1.0
|
||||
@@ -0,0 +1,356 @@
|
||||
# 🎸 GetYourBand - Bandvermittlungsplattform
|
||||
|
||||
Eine moderne, professionelle Plattform für die Vermittlung von Live-Bands in der Schweiz.
|
||||
|
||||
## 🚀 Features
|
||||
|
||||
- ✨ **Moderne MVC-Architektur** - Saubere Trennung von Logik, Daten und Präsentation
|
||||
- 🎨 **Tailwind CSS** - Modernes, responsives Design mit gelben Farbtönen
|
||||
- ⚡ **Alpine.js** - Leichtgewichtige JavaScript-Interaktivität
|
||||
- 🔐 **Authentifizierung** - Login, Registrierung, E-Mail-Verifizierung
|
||||
- 👥 **Mehrere Rollen** - Admin, Band, Kunde
|
||||
- 🔍 **Erweiterte Suche** - Nach Genre, Ort, Preis filtern
|
||||
- ⭐ **Bewertungssystem** - Nur nach Buchung möglich
|
||||
- 📅 **Verfügbarkeitskalender** - Bands können Verfügbarkeit verwalten
|
||||
- 💳 **PayPal-Integration** - Optional aktivierbare Zahlungen
|
||||
- 📧 **E-Mail-Benachrichtigungen** - Automatische Updates
|
||||
- 🛡️ **DSGVO-konform** - Cookie-Banner, Datenschutz
|
||||
- 📱 **Mobile-First** - Optimiert für alle Geräte
|
||||
|
||||
## 📋 Voraussetzungen
|
||||
|
||||
- PHP 8.3 oder höher
|
||||
- MySQL 5.7+ oder MariaDB 10.3+
|
||||
- Apache mit mod_rewrite
|
||||
- Composer
|
||||
- Node.js & npm (für Frontend-Build)
|
||||
|
||||
## 🔧 Installation
|
||||
|
||||
### 1. Repository klonen
|
||||
|
||||
```bash
|
||||
git clone <repository-url>
|
||||
cd ai_playgroud
|
||||
```
|
||||
|
||||
### 2. PHP-Abhängigkeiten installieren
|
||||
|
||||
```bash
|
||||
composer install
|
||||
```
|
||||
|
||||
### 3. Frontend-Abhängigkeiten installieren
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
### 4. Umgebungskonfiguration
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
Passe die `.env`-Datei an:
|
||||
|
||||
```env
|
||||
# Datenbank
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=getyourband
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=dein_passwort
|
||||
|
||||
# Mail (SMTP)
|
||||
MAIL_HOST=smtp.gmail.com
|
||||
MAIL_PORT=587
|
||||
MAIL_USERNAME=deine@email.ch
|
||||
MAIL_PASSWORD=dein_passwort
|
||||
|
||||
# Optional: PayPal
|
||||
PAYPAL_CLIENT_ID=deine_client_id
|
||||
PAYPAL_SECRET=dein_secret
|
||||
PAYMENT_ENABLED=true
|
||||
```
|
||||
|
||||
### 5. Datenbank erstellen
|
||||
|
||||
```bash
|
||||
mysql -u root -p -e "CREATE DATABASE getyourband CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
|
||||
```
|
||||
|
||||
### 6. Migrationen ausführen
|
||||
|
||||
```bash
|
||||
php migrate.php
|
||||
```
|
||||
|
||||
### 7. Frontend-Assets kompilieren
|
||||
|
||||
**Entwicklung:**
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
**Produktion:**
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
### 8. Berechtigungen setzen
|
||||
|
||||
```bash
|
||||
chmod -R 755 storage
|
||||
chmod -R 755 public/uploads
|
||||
```
|
||||
|
||||
## 🌐 Entwicklungsserver
|
||||
|
||||
### Option 1: PHP Built-in Server
|
||||
|
||||
```bash
|
||||
cd public
|
||||
php -S localhost:8000
|
||||
```
|
||||
|
||||
Öffne: http://localhost:8000
|
||||
|
||||
### Option 2: Apache/XAMPP
|
||||
|
||||
1. Erstelle einen Virtual Host oder nutze htdocs
|
||||
2. Stelle sicher, dass `mod_rewrite` aktiviert ist
|
||||
3. DocumentRoot sollte auf das Hauptverzeichnis zeigen (nicht /public!)
|
||||
|
||||
## 📁 Projektstruktur
|
||||
|
||||
```
|
||||
.
|
||||
├── app/
|
||||
│ ├── Controllers/ # Controller-Klassen
|
||||
│ ├── Models/ # Datenmodelle
|
||||
│ ├── Views/ # View-Templates
|
||||
│ ├── Middleware/ # Middleware (Auth, etc.)
|
||||
│ ├── Core/ # Kern-Framework (Router, Controller, Model)
|
||||
│ └── helpers.php # Helper-Funktionen
|
||||
├── config/ # Konfigurationsdateien
|
||||
├── database/
|
||||
│ ├── migrations/ # SQL-Migrationen
|
||||
│ └── Database.php # Datenbankverbindung
|
||||
├── public/ # Öffentliches Verzeichnis (DocumentRoot)
|
||||
│ ├── index.php # Entry Point
|
||||
│ ├── .htaccess # Apache-Konfiguration
|
||||
│ ├── css/ # Kompilierte CSS
|
||||
│ ├── js/ # Kompilierte JS
|
||||
│ └── uploads/ # User-Uploads
|
||||
├── resources/
|
||||
│ ├── css/ # Quell-CSS (Tailwind)
|
||||
│ └── js/ # Quell-JavaScript
|
||||
├── routes/
|
||||
│ └── web.php # Route-Definitionen
|
||||
├── storage/ # Temporäre Dateien, Logs, Cache
|
||||
├── .env # Umgebungsvariablen (nicht committen!)
|
||||
├── composer.json # PHP-Abhängigkeiten
|
||||
├── package.json # Frontend-Abhängigkeiten
|
||||
├── tailwind.config.js # Tailwind-Konfiguration
|
||||
└── vite.config.js # Vite-Build-Konfiguration
|
||||
```
|
||||
|
||||
## 🎨 Design & Farben
|
||||
|
||||
Das Projekt nutzt ein modernes gelbes Farbschema:
|
||||
|
||||
- **Primary**: Gelb-Orange-Töne (#fbbf24 - #f59e0b)
|
||||
- **Accent**: Helles Gelb (#eab308 - #facc15)
|
||||
- **Schrift**: Inter (Body), Poppins (Headlines)
|
||||
|
||||
## 🔐 Standard-Admin erstellen
|
||||
|
||||
Nach der Migration kannst du einen Admin-Account manuell in der Datenbank erstellen:
|
||||
|
||||
```sql
|
||||
INSERT INTO users (email, password, name, role, email_verified_at, is_active)
|
||||
VALUES (
|
||||
'admin@getyourband.ch',
|
||||
'$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', -- "password"
|
||||
'Admin',
|
||||
'admin',
|
||||
NOW(),
|
||||
1
|
||||
);
|
||||
```
|
||||
|
||||
**Login:** admin@getyourband.ch
|
||||
**Passwort:** password
|
||||
|
||||
⚠️ **Wichtig:** Ändere das Passwort nach dem ersten Login!
|
||||
|
||||
## 📝 Routen-Übersicht
|
||||
|
||||
### Öffentlich
|
||||
- `GET /` - Homepage
|
||||
- `GET /bands` - Band-Liste
|
||||
- `GET /bands/{slug}` - Band-Detail
|
||||
- `GET /login` - Login-Formular
|
||||
- `POST /login` - Login-Verarbeitung
|
||||
- `GET /register` - Registrierungs-Formular
|
||||
- `POST /register` - Registrierung
|
||||
|
||||
### Geschützt (Authentifiziert)
|
||||
- `GET /profile` - User-Profil
|
||||
- `POST /profile/update` - Profil aktualisieren
|
||||
- `POST /bookings/create` - Buchung erstellen
|
||||
- `GET /my-bookings` - Meine Buchungen
|
||||
|
||||
### Band-Bereich
|
||||
- `GET /band/manage` - Band-Verwaltung
|
||||
- `POST /band/update` - Band aktualisieren
|
||||
- `GET /band/bookings` - Eingehende Buchungsanfragen
|
||||
|
||||
### Admin-Bereich
|
||||
- `GET /admin` - Admin-Dashboard
|
||||
- `GET /admin/bands` - Band-Verwaltung
|
||||
- `POST /admin/bands/{id}/approve` - Band freischalten
|
||||
- `GET /admin/reviews` - Bewertungen moderieren
|
||||
|
||||
## 🧪 Entwicklung
|
||||
|
||||
### Tailwind-Klassen neu kompilieren
|
||||
|
||||
```bash
|
||||
npm run watch
|
||||
```
|
||||
|
||||
Dies startet einen Watch-Modus, der bei Änderungen automatisch neu kompiliert.
|
||||
|
||||
### Neue Migration erstellen
|
||||
|
||||
Erstelle eine neue SQL-Datei in `database/migrations/`:
|
||||
|
||||
```bash
|
||||
touch database/migrations/007_create_new_table.sql
|
||||
```
|
||||
|
||||
Führe sie aus:
|
||||
|
||||
```bash
|
||||
php migrate.php
|
||||
```
|
||||
|
||||
### Neuen Controller erstellen
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Core\Controller;
|
||||
|
||||
class MyController extends Controller
|
||||
{
|
||||
public function index(): void
|
||||
{
|
||||
$this->view('my-view', [
|
||||
'data' => 'value'
|
||||
]);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Neues Model erstellen
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Core\Model;
|
||||
|
||||
class MyModel extends Model
|
||||
{
|
||||
protected string $table = 'my_table';
|
||||
|
||||
protected array $fillable = [
|
||||
'column1',
|
||||
'column2',
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
## 🐛 Debugging
|
||||
|
||||
Debug-Modus aktivieren in `.env`:
|
||||
|
||||
```env
|
||||
APP_DEBUG=true
|
||||
```
|
||||
|
||||
Im Debug-Modus werden ausführliche Fehler angezeigt.
|
||||
|
||||
### Nützliche Helper-Funktionen
|
||||
|
||||
```php
|
||||
dd($variable); // Dump & Die
|
||||
config('app.name'); // Konfiguration abrufen
|
||||
env('DB_HOST'); // Umgebungsvariable
|
||||
old('field_name'); // Vorheriger Formular-Wert
|
||||
error('field_name'); // Validierungsfehler
|
||||
```
|
||||
|
||||
## 📦 Deployment
|
||||
|
||||
### Produktion vorbereiten
|
||||
|
||||
1. **Assets kompilieren:**
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
2. **Composer optimieren:**
|
||||
```bash
|
||||
composer install --optimize-autoloader --no-dev
|
||||
```
|
||||
|
||||
3. **Environment:**
|
||||
```env
|
||||
APP_ENV=production
|
||||
APP_DEBUG=false
|
||||
```
|
||||
|
||||
4. **Berechtigungen:**
|
||||
```bash
|
||||
chmod -R 755 storage
|
||||
chmod -R 755 public/uploads
|
||||
```
|
||||
|
||||
5. **Apache-Konfiguration:**
|
||||
- DocumentRoot auf Hauptverzeichnis setzen (nicht /public!)
|
||||
- `mod_rewrite` aktivieren
|
||||
- `.htaccess` ermöglichen
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
1. Fork das Projekt
|
||||
2. Feature-Branch erstellen (`git checkout -b feature/AmazingFeature`)
|
||||
3. Änderungen committen (`git commit -m 'Add some AmazingFeature'`)
|
||||
4. Branch pushen (`git push origin feature/AmazingFeature`)
|
||||
5. Pull Request öffnen
|
||||
|
||||
## 📄 Lizenz
|
||||
|
||||
Proprietary - Alle Rechte vorbehalten
|
||||
|
||||
## 👤 Kontakt
|
||||
|
||||
GetYourBand - info@getyourband.ch
|
||||
|
||||
## 🙏 Credits
|
||||
|
||||
- **Tailwind CSS** - https://tailwindcss.com
|
||||
- **Alpine.js** - https://alpinejs.dev
|
||||
- **Vite** - https://vitejs.dev
|
||||
- **PHP** - https://php.net
|
||||
|
||||
---
|
||||
|
||||
Made with ❤️ and 🎸 in Switzerland
|
||||
+46
-8
@@ -15,6 +15,8 @@ $user = currentUser();
|
||||
$message = '';
|
||||
$error = '';
|
||||
|
||||
$requestId = null;
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$data = [
|
||||
'band_id' => $bandId,
|
||||
@@ -26,10 +28,18 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
'message' => trim((string) $_POST['message'] ?? ''),
|
||||
];
|
||||
|
||||
$guestName = trim($_POST['guest_name'] ?? '');
|
||||
$guestEmail = trim($_POST['guest_email'] ?? '');
|
||||
|
||||
if (!$data['event_date'] || !$data['location']) {
|
||||
$error = 'Bitte Datum und Ort ausfüllen.';
|
||||
} elseif (!$user && (!$guestName || !$guestEmail)) {
|
||||
$error = 'Bitte geben Sie Ihren Namen und Email-Adresse an.';
|
||||
} elseif (!$user && !filter_var($guestEmail, FILTER_VALIDATE_EMAIL)) {
|
||||
$error = 'Bitte geben Sie eine gültige Email-Adresse an.';
|
||||
} else {
|
||||
createRequest($data);
|
||||
$requestId = (int) db()->lastInsertId();
|
||||
$message = 'Anfrage gespeichert und an die Band gemeldet.';
|
||||
sendEmail('info@' . preg_replace('/\s+/', '', strtolower($band['name'])) . '.ch', 'Neue Anfrage', 'Neue Anfrage für ' . $band['name']);
|
||||
}
|
||||
@@ -52,26 +62,54 @@ $settings = settings();
|
||||
<p>PayPal Zahlungsabwicklung ist <?= $settings['paypal_enabled'] === '1' ? 'aktiviert' : 'optional' ?>, Service Fee: <?= htmlspecialchars($settings['service_fee']) ?>%.</p>
|
||||
</header>
|
||||
<main>
|
||||
<?php if ($message): ?><div class="alert alert-success"><?= htmlspecialchars($message) ?></div><?php endif; ?>
|
||||
<?php if ($message): ?>
|
||||
<div class="alert alert-success">
|
||||
<?= htmlspecialchars($message) ?>
|
||||
<?php if ($requestId && $settings['paypal_enabled'] === '1'): ?>
|
||||
<div style="margin-top: 1rem;">
|
||||
<a href="paypal-checkout.php?request_id=<?= $requestId ?>" class="btn-primary" style="display: inline-block; padding: 0.75rem 1.5rem; text-decoration: none;">
|
||||
Jetzt mit PayPal bezahlen
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($error): ?><div class="alert alert-error"><?= htmlspecialchars($error) ?></div><?php endif; ?>
|
||||
|
||||
<?php if (!$message): ?>
|
||||
<form method="post">
|
||||
<label>Event-Datum
|
||||
<input type="date" class="form-control" name="event_date" required>
|
||||
<?php if (!$user): ?>
|
||||
<div style="background: #fff3cd; padding: 15px; margin-bottom: 20px; border-radius: 4px;">
|
||||
<strong>Gast-Buchung</strong>
|
||||
<p style="margin: 5px 0 0 0; font-size: 14px;">Sie sind nicht eingeloggt. Bitte geben Sie Ihre Kontaktdaten an.</p>
|
||||
</div>
|
||||
<label>Ihr Name *
|
||||
<input type="text" class="form-control" name="guest_name" required>
|
||||
</label>
|
||||
<label>Ihre Email *
|
||||
<input type="email" class="form-control" name="guest_email" required>
|
||||
</label>
|
||||
<hr style="margin: 20px 0;">
|
||||
<?php endif; ?>
|
||||
|
||||
<label>Event-Datum *
|
||||
<input type="date" class="form-control" name="event_date" min="<?= date('Y-m-d') ?>" required>
|
||||
</label>
|
||||
<label>Ort / Location
|
||||
<label>Ort / Location *
|
||||
<input type="text" class="form-control" name="location" placeholder="Zürich, Kaufleuten" required>
|
||||
</label>
|
||||
<label>Event-Typ
|
||||
<input type="text" class="form-control" name="event_type" placeholder="Hochzeit, Firmenfeier">
|
||||
<input type="text" class="form-control" name="event_type" placeholder="Hochzeit, Firmenfeier, Geburtstag">
|
||||
</label>
|
||||
<label>Budget (CHF)
|
||||
<input type="number" class="form-control" name="budget" placeholder="4500">
|
||||
<input type="number" class="form-control" name="budget" placeholder="4500" min="0">
|
||||
</label>
|
||||
<label>Nachricht
|
||||
<textarea class="form-control" name="message" rows="4"></textarea>
|
||||
<label>Nachricht / Besondere Wünsche
|
||||
<textarea class="form-control" name="message" rows="4" placeholder="Erzählen Sie uns mehr über Ihr Event..."></textarea>
|
||||
</label>
|
||||
<button class="btn-primary">Anfrage senden</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Core\Controller;
|
||||
use App\Models\Band;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function index(): void
|
||||
{
|
||||
$bandModel = new Band();
|
||||
|
||||
// Get top-rated bands
|
||||
$featuredBands = $bandModel->query(
|
||||
"SELECT * FROM bands
|
||||
WHERE is_approved = 1 AND is_active = 1
|
||||
ORDER BY average_rating DESC, total_reviews DESC
|
||||
LIMIT 6"
|
||||
);
|
||||
|
||||
$this->view('home', [
|
||||
'featuredBands' => $featuredBands,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core;
|
||||
|
||||
class Controller
|
||||
{
|
||||
protected function view(string $view, array $data = []): void
|
||||
{
|
||||
extract($data);
|
||||
|
||||
$viewPath = __DIR__ . '/../Views/' . str_replace('.', '/', $view) . '.php';
|
||||
|
||||
if (!file_exists($viewPath)) {
|
||||
throw new \RuntimeException("View not found: {$view}");
|
||||
}
|
||||
|
||||
require_once $viewPath;
|
||||
}
|
||||
|
||||
protected function json($data, int $status = 200): void
|
||||
{
|
||||
http_response_code($status);
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($data);
|
||||
exit;
|
||||
}
|
||||
|
||||
protected function redirect(string $path): void
|
||||
{
|
||||
header("Location: {$path}");
|
||||
exit;
|
||||
}
|
||||
|
||||
protected function back(): void
|
||||
{
|
||||
$referer = $_SERVER['HTTP_REFERER'] ?? '/';
|
||||
$this->redirect($referer);
|
||||
}
|
||||
|
||||
protected function input(string $key, $default = null)
|
||||
{
|
||||
return $_POST[$key] ?? $_GET[$key] ?? $default;
|
||||
}
|
||||
|
||||
protected function validate(array $rules): array
|
||||
{
|
||||
$errors = [];
|
||||
$data = [];
|
||||
|
||||
foreach ($rules as $field => $fieldRules) {
|
||||
$value = $this->input($field);
|
||||
$fieldRules = explode('|', $fieldRules);
|
||||
|
||||
foreach ($fieldRules as $rule) {
|
||||
if ($rule === 'required' && empty($value)) {
|
||||
$errors[$field][] = ucfirst($field) . ' is required';
|
||||
}
|
||||
|
||||
if (str_starts_with($rule, 'min:')) {
|
||||
$min = (int) substr($rule, 4);
|
||||
if (strlen($value) < $min) {
|
||||
$errors[$field][] = ucfirst($field) . " must be at least {$min} characters";
|
||||
}
|
||||
}
|
||||
|
||||
if (str_starts_with($rule, 'max:')) {
|
||||
$max = (int) substr($rule, 4);
|
||||
if (strlen($value) > $max) {
|
||||
$errors[$field][] = ucfirst($field) . " must not exceed {$max} characters";
|
||||
}
|
||||
}
|
||||
|
||||
if ($rule === 'email' && !filter_var($value, FILTER_VALIDATE_EMAIL)) {
|
||||
$errors[$field][] = ucfirst($field) . ' must be a valid email';
|
||||
}
|
||||
}
|
||||
|
||||
$data[$field] = $value;
|
||||
}
|
||||
|
||||
if (!empty($errors)) {
|
||||
$_SESSION['errors'] = $errors;
|
||||
$_SESSION['old'] = $data;
|
||||
$this->back();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function auth()
|
||||
{
|
||||
return $_SESSION['user'] ?? null;
|
||||
}
|
||||
|
||||
protected function isAuthenticated(): bool
|
||||
{
|
||||
return isset($_SESSION['user']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core;
|
||||
|
||||
use Database\Database;
|
||||
use PDO;
|
||||
|
||||
abstract class Model
|
||||
{
|
||||
protected PDO $db;
|
||||
protected string $table;
|
||||
protected string $primaryKey = 'id';
|
||||
protected array $fillable = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->db = Database::connect();
|
||||
}
|
||||
|
||||
public function all(): array
|
||||
{
|
||||
$stmt = $this->db->query("SELECT * FROM {$this->table}");
|
||||
return $stmt->fetchAll();
|
||||
}
|
||||
|
||||
public function find(int $id): ?array
|
||||
{
|
||||
$stmt = $this->db->prepare("SELECT * FROM {$this->table} WHERE {$this->primaryKey} = ? LIMIT 1");
|
||||
$stmt->execute([$id]);
|
||||
$result = $stmt->fetch();
|
||||
return $result ?: null;
|
||||
}
|
||||
|
||||
public function where(string $column, $value): array
|
||||
{
|
||||
$stmt = $this->db->prepare("SELECT * FROM {$this->table} WHERE {$column} = ?");
|
||||
$stmt->execute([$value]);
|
||||
return $stmt->fetchAll();
|
||||
}
|
||||
|
||||
public function first(string $column, $value): ?array
|
||||
{
|
||||
$stmt = $this->db->prepare("SELECT * FROM {$this->table} WHERE {$column} = ? LIMIT 1");
|
||||
$stmt->execute([$value]);
|
||||
$result = $stmt->fetch();
|
||||
return $result ?: null;
|
||||
}
|
||||
|
||||
public function create(array $data): int
|
||||
{
|
||||
$data = $this->filterFillable($data);
|
||||
$columns = implode(', ', array_keys($data));
|
||||
$placeholders = implode(', ', array_fill(0, count($data), '?'));
|
||||
|
||||
$sql = "INSERT INTO {$this->table} ({$columns}) VALUES ({$placeholders})";
|
||||
$stmt = $this->db->prepare($sql);
|
||||
$stmt->execute(array_values($data));
|
||||
|
||||
return (int) $this->db->lastInsertId();
|
||||
}
|
||||
|
||||
public function update(int $id, array $data): bool
|
||||
{
|
||||
$data = $this->filterFillable($data);
|
||||
$set = implode(' = ?, ', array_keys($data)) . ' = ?';
|
||||
|
||||
$sql = "UPDATE {$this->table} SET {$set} WHERE {$this->primaryKey} = ?";
|
||||
$stmt = $this->db->prepare($sql);
|
||||
|
||||
return $stmt->execute([...array_values($data), $id]);
|
||||
}
|
||||
|
||||
public function delete(int $id): bool
|
||||
{
|
||||
$stmt = $this->db->prepare("DELETE FROM {$this->table} WHERE {$this->primaryKey} = ?");
|
||||
return $stmt->execute([$id]);
|
||||
}
|
||||
|
||||
public function query(string $sql, array $params = []): array
|
||||
{
|
||||
$stmt = $this->db->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
return $stmt->fetchAll();
|
||||
}
|
||||
|
||||
public function execute(string $sql, array $params = []): bool
|
||||
{
|
||||
$stmt = $this->db->prepare($sql);
|
||||
return $stmt->execute($params);
|
||||
}
|
||||
|
||||
protected function filterFillable(array $data): array
|
||||
{
|
||||
if (empty($this->fillable)) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
return array_intersect_key($data, array_flip($this->fillable));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core;
|
||||
|
||||
class Router
|
||||
{
|
||||
private array $routes = [];
|
||||
private array $middlewareStack = [];
|
||||
|
||||
public function get(string $path, $handler): void
|
||||
{
|
||||
$this->addRoute('GET', $path, $handler);
|
||||
}
|
||||
|
||||
public function post(string $path, $handler): void
|
||||
{
|
||||
$this->addRoute('POST', $path, $handler);
|
||||
}
|
||||
|
||||
public function put(string $path, $handler): void
|
||||
{
|
||||
$this->addRoute('PUT', $path, $handler);
|
||||
}
|
||||
|
||||
public function delete(string $path, $handler): void
|
||||
{
|
||||
$this->addRoute('DELETE', $path, $handler);
|
||||
}
|
||||
|
||||
public function group(array $attributes, callable $callback): void
|
||||
{
|
||||
$previousMiddleware = $this->middlewareStack;
|
||||
|
||||
if (isset($attributes['middleware'])) {
|
||||
$this->middlewareStack = array_merge(
|
||||
$this->middlewareStack,
|
||||
(array) $attributes['middleware']
|
||||
);
|
||||
}
|
||||
|
||||
$callback($this);
|
||||
|
||||
$this->middlewareStack = $previousMiddleware;
|
||||
}
|
||||
|
||||
private function addRoute(string $method, string $path, $handler): void
|
||||
{
|
||||
$this->routes[] = [
|
||||
'method' => $method,
|
||||
'path' => $path,
|
||||
'handler' => $handler,
|
||||
'middleware' => $this->middlewareStack,
|
||||
];
|
||||
}
|
||||
|
||||
public function dispatch(string $requestMethod, string $requestUri): void
|
||||
{
|
||||
$requestUri = parse_url($requestUri, PHP_URL_PATH);
|
||||
|
||||
foreach ($this->routes as $route) {
|
||||
if ($route['method'] !== $requestMethod) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$pattern = $this->convertToPattern($route['path']);
|
||||
|
||||
if (preg_match($pattern, $requestUri, $matches)) {
|
||||
array_shift($matches); // Remove full match
|
||||
|
||||
// Execute middleware
|
||||
foreach ($route['middleware'] as $middleware) {
|
||||
$this->executeMiddleware($middleware);
|
||||
}
|
||||
|
||||
// Execute handler
|
||||
$this->executeHandler($route['handler'], $matches);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 404 Not Found
|
||||
http_response_code(404);
|
||||
echo "404 - Page Not Found";
|
||||
}
|
||||
|
||||
private function convertToPattern(string $path): string
|
||||
{
|
||||
$pattern = preg_replace('/\{([a-zA-Z0-9_]+)\}/', '([^/]+)', $path);
|
||||
return '#^' . $pattern . '$#';
|
||||
}
|
||||
|
||||
private function executeMiddleware(string $middleware): void
|
||||
{
|
||||
$parts = explode(':', $middleware);
|
||||
$name = $parts[0];
|
||||
$params = $parts[1] ?? null;
|
||||
|
||||
$middlewareClass = "App\\Middleware\\" . ucfirst($name) . "Middleware";
|
||||
|
||||
if (!class_exists($middlewareClass)) {
|
||||
throw new \RuntimeException("Middleware not found: {$middlewareClass}");
|
||||
}
|
||||
|
||||
$instance = new $middlewareClass();
|
||||
$instance->handle($params);
|
||||
}
|
||||
|
||||
private function executeHandler($handler, array $params): void
|
||||
{
|
||||
if (is_array($handler)) {
|
||||
[$class, $method] = $handler;
|
||||
$controller = new $class();
|
||||
call_user_func_array([$controller, $method], $params);
|
||||
} elseif (is_callable($handler)) {
|
||||
call_user_func_array($handler, $params);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Middleware;
|
||||
|
||||
class AuthMiddleware
|
||||
{
|
||||
public function handle($params = null): void
|
||||
{
|
||||
if (!isset($_SESSION['user'])) {
|
||||
header('Location: /login');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Middleware;
|
||||
|
||||
class RoleMiddleware
|
||||
{
|
||||
public function handle($role = null): void
|
||||
{
|
||||
if (!isset($_SESSION['user'])) {
|
||||
header('Location: /login');
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($role && $_SESSION['user']['role'] !== $role) {
|
||||
http_response_code(403);
|
||||
die('403 - Forbidden');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Core\Model;
|
||||
|
||||
class Band extends Model
|
||||
{
|
||||
protected string $table = 'bands';
|
||||
|
||||
protected array $fillable = [
|
||||
'user_id',
|
||||
'name',
|
||||
'slug',
|
||||
'description',
|
||||
'genre',
|
||||
'location',
|
||||
'postal_code',
|
||||
'price_min',
|
||||
'price_max',
|
||||
'member_count',
|
||||
'phone',
|
||||
'website',
|
||||
'facebook',
|
||||
'instagram',
|
||||
'youtube',
|
||||
'profile_image',
|
||||
'cover_image',
|
||||
'is_approved',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
public function findBySlug(string $slug): ?array
|
||||
{
|
||||
return $this->first('slug', $slug);
|
||||
}
|
||||
|
||||
public function search(array $filters): array
|
||||
{
|
||||
$sql = "SELECT * FROM {$this->table} WHERE is_approved = 1 AND is_active = 1";
|
||||
$params = [];
|
||||
|
||||
if (!empty($filters['genre'])) {
|
||||
$sql .= " AND genre = ?";
|
||||
$params[] = $filters['genre'];
|
||||
}
|
||||
|
||||
if (!empty($filters['location'])) {
|
||||
$sql .= " AND (location LIKE ? OR postal_code LIKE ?)";
|
||||
$params[] = "%{$filters['location']}%";
|
||||
$params[] = "%{$filters['location']}%";
|
||||
}
|
||||
|
||||
if (!empty($filters['price_max'])) {
|
||||
$sql .= " AND price_min <= ?";
|
||||
$params[] = $filters['price_max'];
|
||||
}
|
||||
|
||||
if (!empty($filters['q'])) {
|
||||
$sql .= " AND MATCH(name, description, genre) AGAINST (? IN NATURAL LANGUAGE MODE)";
|
||||
$params[] = $filters['q'];
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY average_rating DESC, total_reviews DESC";
|
||||
|
||||
return $this->query($sql, $params);
|
||||
}
|
||||
|
||||
public function incrementViews(int $id): bool
|
||||
{
|
||||
return $this->execute(
|
||||
"UPDATE {$this->table} SET view_count = view_count + 1 WHERE id = ?",
|
||||
[$id]
|
||||
);
|
||||
}
|
||||
|
||||
public function updateRating(int $bandId): void
|
||||
{
|
||||
$sql = "
|
||||
UPDATE bands
|
||||
SET average_rating = (
|
||||
SELECT AVG(rating)
|
||||
FROM reviews
|
||||
WHERE band_id = ? AND is_approved = 1
|
||||
),
|
||||
total_reviews = (
|
||||
SELECT COUNT(*)
|
||||
FROM reviews
|
||||
WHERE band_id = ? AND is_approved = 1
|
||||
)
|
||||
WHERE id = ?
|
||||
";
|
||||
|
||||
$this->execute($sql, [$bandId, $bandId, $bandId]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Core\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected string $table = 'users';
|
||||
|
||||
protected array $fillable = [
|
||||
'email',
|
||||
'password',
|
||||
'name',
|
||||
'role',
|
||||
'verification_token',
|
||||
'email_verified_at',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
public function findByEmail(string $email): ?array
|
||||
{
|
||||
return $this->first('email', $email);
|
||||
}
|
||||
|
||||
public function verifyEmail(string $token): bool
|
||||
{
|
||||
$user = $this->first('verification_token', $token);
|
||||
|
||||
if (!$user) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->update($user['id'], [
|
||||
'email_verified_at' => date('Y-m-d H:i:s'),
|
||||
'verification_token' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
public static function hashPassword(string $password): string
|
||||
{
|
||||
return password_hash($password, PASSWORD_BCRYPT);
|
||||
}
|
||||
|
||||
public static function verifyPassword(string $password, string $hash): bool
|
||||
{
|
||||
return password_verify($password, $hash);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php ob_start(); ?>
|
||||
|
||||
<!-- Hero Section -->
|
||||
<section class="bg-gradient-to-br from-primary-500 via-accent-500 to-primary-600 text-white py-20">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-center">
|
||||
<h1 class="text-5xl md:text-6xl font-display font-bold mb-6 text-balance">
|
||||
Finde die perfekte Band für dein Event
|
||||
</h1>
|
||||
<p class="text-xl md:text-2xl mb-8 text-primary-50 max-w-3xl mx-auto text-balance">
|
||||
Professionelle Live-Bands in der ganzen Schweiz. Einfach buchen, perfekt performen.
|
||||
</p>
|
||||
<div class="flex flex-col sm:flex-row gap-4 justify-center">
|
||||
<a href="/bands" class="btn bg-white text-primary-600 hover:bg-gray-100 text-lg px-8 py-3">
|
||||
Bands entdecken
|
||||
</a>
|
||||
<a href="/register" class="btn bg-primary-700 text-white hover:bg-primary-800 text-lg px-8 py-3">
|
||||
Als Band registrieren
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Search Section -->
|
||||
<section class="py-16 bg-white">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div class="bg-gray-50 rounded-2xl shadow-lg p-8" x-data="searchBands">
|
||||
<h2 class="text-3xl font-display font-bold text-center mb-8">Suche deine Band</h2>
|
||||
|
||||
<form @submit.prevent="search" class="grid grid-cols-1 md:grid-cols-4 gap-4">
|
||||
<input
|
||||
type="text"
|
||||
x-model="query"
|
||||
placeholder="Band, Genre, Stil..."
|
||||
class="input-field"
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
x-model="filters.location"
|
||||
placeholder="Ort oder PLZ"
|
||||
class="input-field"
|
||||
>
|
||||
<select x-model="filters.genre" class="input-field">
|
||||
<option value="">Alle Genres</option>
|
||||
<option value="Rock">Rock</option>
|
||||
<option value="Pop">Pop</option>
|
||||
<option value="Jazz">Jazz</option>
|
||||
<option value="Blues">Blues</option>
|
||||
<option value="Funk">Funk</option>
|
||||
<option value="Cover">Cover</option>
|
||||
</select>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
Suchen
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Featured Bands -->
|
||||
<section class="py-16 bg-gray-50">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<h2 class="text-4xl font-display font-bold text-center mb-12">Top bewertete Bands</h2>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
|
||||
<?php foreach ($featuredBands ?? [] as $band): ?>
|
||||
<div class="card group hover:scale-105 transition-transform">
|
||||
<div class="aspect-video bg-gray-200 rounded-lg mb-4 overflow-hidden">
|
||||
<?php if ($band['cover_image']): ?>
|
||||
<img src="<?= $band['cover_image'] ?>" alt="<?= $band['name'] ?>" class="w-full h-full object-cover">
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="flex items-start justify-between mb-2">
|
||||
<h3 class="text-xl font-bold text-gray-900"><?= htmlspecialchars($band['name']) ?></h3>
|
||||
<span class="badge badge-yellow"><?= htmlspecialchars($band['genre']) ?></span>
|
||||
</div>
|
||||
<p class="text-gray-600 mb-4 line-clamp-2"><?= htmlspecialchars($band['description']) ?></p>
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center">
|
||||
<span class="text-yellow-500 mr-1">⭐</span>
|
||||
<span class="font-semibold"><?= number_format($band['average_rating'], 1) ?></span>
|
||||
<span class="text-gray-500 text-sm ml-1">(<?= $band['total_reviews'] ?>)</span>
|
||||
</div>
|
||||
<a href="/bands/<?= $band['slug'] ?>" class="text-primary-600 hover:text-primary-700 font-medium">
|
||||
Details →
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- How it Works -->
|
||||
<section class="py-16 bg-white">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<h2 class="text-4xl font-display font-bold text-center mb-12">So funktioniert's</h2>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-12">
|
||||
<div class="text-center">
|
||||
<div class="w-16 h-16 bg-primary-100 rounded-full flex items-center justify-center mx-auto mb-4">
|
||||
<span class="text-3xl">🔍</span>
|
||||
</div>
|
||||
<h3 class="text-xl font-bold mb-2">1. Suchen</h3>
|
||||
<p class="text-gray-600">Finde die perfekte Band für dein Event mit unseren Suchfiltern.</p>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<div class="w-16 h-16 bg-primary-100 rounded-full flex items-center justify-center mx-auto mb-4">
|
||||
<span class="text-3xl">📧</span>
|
||||
</div>
|
||||
<h3 class="text-xl font-bold mb-2">2. Anfragen</h3>
|
||||
<p class="text-gray-600">Sende eine unverbindliche Anfrage mit deinen Event-Details.</p>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<div class="w-16 h-16 bg-primary-100 rounded-full flex items-center justify-center mx-auto mb-4">
|
||||
<span class="text-3xl">🎉</span>
|
||||
</div>
|
||||
<h3 class="text-xl font-bold mb-2">3. Buchen</h3>
|
||||
<p class="text-gray-600">Bestätige die Buchung und freue dich auf ein unvergessliches Event!</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php $content = ob_get_clean(); ?>
|
||||
<?php $title = 'Home'; ?>
|
||||
<?php include __DIR__ . '/layouts/app.php'; ?>
|
||||
@@ -0,0 +1,104 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de" class="h-full">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title><?= $title ?? 'GetYourBand' ?> - Bandvermittlung Schweiz</title>
|
||||
|
||||
<!-- Fonts -->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@600;700;800&display=swap" rel="stylesheet">
|
||||
|
||||
<!-- Styles -->
|
||||
<link rel="stylesheet" href="/dist/css/app.css">
|
||||
|
||||
<!-- Alpine.js -->
|
||||
<script defer src="/dist/js/app.js"></script>
|
||||
</head>
|
||||
<body class="h-full">
|
||||
<!-- Navigation -->
|
||||
<nav class="bg-white shadow-sm sticky top-0 z-50">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div class="flex justify-between h-16">
|
||||
<div class="flex items-center">
|
||||
<a href="/" class="text-2xl font-display font-bold text-primary-600">
|
||||
🎸 GetYourBand
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="hidden md:flex items-center space-x-8">
|
||||
<a href="/" class="text-gray-700 hover:text-primary-600 transition">Home</a>
|
||||
<a href="/bands" class="text-gray-700 hover:text-primary-600 transition">Bands</a>
|
||||
|
||||
<?php if (isset($_SESSION['user'])): ?>
|
||||
<a href="/profile" class="text-gray-700 hover:text-primary-600 transition">Profil</a>
|
||||
<form action="/logout" method="POST" class="inline">
|
||||
<?= csrf_field() ?>
|
||||
<button type="submit" class="btn btn-secondary">Logout</button>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<a href="/login" class="text-gray-700 hover:text-primary-600 transition">Login</a>
|
||||
<a href="/register" class="btn btn-primary">Registrieren</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- Main Content -->
|
||||
<main>
|
||||
<?php if (isset($_SESSION['success'])): ?>
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mt-4">
|
||||
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded">
|
||||
<?= $_SESSION['success'] ?>
|
||||
<?php unset($_SESSION['success']); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($_SESSION['error'])): ?>
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mt-4">
|
||||
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded">
|
||||
<?= $_SESSION['error'] ?>
|
||||
<?php unset($_SESSION['error']); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?= $content ?? '' ?>
|
||||
</main>
|
||||
|
||||
<!-- Footer -->
|
||||
<footer class="bg-gray-900 text-white mt-20">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
|
||||
<div>
|
||||
<h3 class="text-xl font-display font-bold text-primary-400 mb-4">GetYourBand</h3>
|
||||
<p class="text-gray-400">Die Plattform für professionelle Bandvermittlung in der Schweiz.</p>
|
||||
</div>
|
||||
<div>
|
||||
<h4 class="font-semibold mb-4">Links</h4>
|
||||
<ul class="space-y-2">
|
||||
<li><a href="/" class="text-gray-400 hover:text-white transition">Home</a></li>
|
||||
<li><a href="/bands" class="text-gray-400 hover:text-white transition">Bands</a></li>
|
||||
<li><a href="/register" class="text-gray-400 hover:text-white transition">Als Band registrieren</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
<h4 class="font-semibold mb-4">Rechtliches</h4>
|
||||
<ul class="space-y-2">
|
||||
<li><a href="/impressum" class="text-gray-400 hover:text-white transition">Impressum</a></li>
|
||||
<li><a href="/datenschutz" class="text-gray-400 hover:text-white transition">Datenschutz</a></li>
|
||||
<li><a href="/agb" class="text-gray-400 hover:text-white transition">AGB</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-400">
|
||||
<p>© <?= date('Y') ?> GetYourBand. Alle Rechte vorbehalten.</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Helper functions available globally
|
||||
*/
|
||||
|
||||
if (!function_exists('env')) {
|
||||
function env(string $key, $default = null)
|
||||
{
|
||||
return $_ENV[$key] ?? $default;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('asset')) {
|
||||
function asset(string $path): string
|
||||
{
|
||||
return '/' . ltrim($path, '/');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('url')) {
|
||||
function url(string $path = ''): string
|
||||
{
|
||||
$baseUrl = env('APP_URL', 'http://localhost');
|
||||
return rtrim($baseUrl, '/') . '/' . ltrim($path, '/');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('redirect')) {
|
||||
function redirect(string $path): void
|
||||
{
|
||||
header("Location: {$path}");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('old')) {
|
||||
function old(string $key, $default = '')
|
||||
{
|
||||
return $_SESSION['old'][$key] ?? $default;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('error')) {
|
||||
function error(string $key): ?string
|
||||
{
|
||||
return $_SESSION['errors'][$key][0] ?? null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('csrf_token')) {
|
||||
function csrf_token(): string
|
||||
{
|
||||
if (!isset($_SESSION['csrf_token'])) {
|
||||
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
|
||||
}
|
||||
return $_SESSION['csrf_token'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('csrf_field')) {
|
||||
function csrf_field(): string
|
||||
{
|
||||
return '<input type="hidden" name="csrf_token" value="' . csrf_token() . '">';
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('dd')) {
|
||||
function dd(...$vars): void
|
||||
{
|
||||
foreach ($vars as $var) {
|
||||
var_dump($var);
|
||||
}
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('formatPrice')) {
|
||||
function formatPrice($price): string
|
||||
{
|
||||
return 'CHF ' . number_format($price, 2, '.', '\'');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('formatDate')) {
|
||||
function formatDate($date): string
|
||||
{
|
||||
return date('d.m.Y', strtotime($date));
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('generateSlug')) {
|
||||
function generateSlug(string $text): string
|
||||
{
|
||||
$text = mb_strtolower($text, 'UTF-8');
|
||||
$text = preg_replace('/[^a-z0-9\s-]/', '', $text);
|
||||
$text = preg_replace('/[\s-]+/', '-', $text);
|
||||
return trim($text, '-');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
// Start session
|
||||
session_start();
|
||||
|
||||
// Load Composer autoloader
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
// Load environment variables
|
||||
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
|
||||
$dotenv->load();
|
||||
|
||||
// Set timezone
|
||||
date_default_timezone_set('Europe/Zurich');
|
||||
|
||||
// Error reporting based on environment
|
||||
if (env('APP_DEBUG', false)) {
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
} else {
|
||||
error_reporting(0);
|
||||
ini_set('display_errors', 0);
|
||||
}
|
||||
|
||||
// Load configuration
|
||||
$config = [];
|
||||
$configFiles = glob(__DIR__ . '/config/*.php');
|
||||
foreach ($configFiles as $file) {
|
||||
$key = basename($file, '.php');
|
||||
$config[$key] = require $file;
|
||||
}
|
||||
|
||||
// Make config globally accessible
|
||||
define('CONFIG', $config);
|
||||
|
||||
// Helper function to access config
|
||||
function config(string $key, $default = null)
|
||||
{
|
||||
$keys = explode('.', $key);
|
||||
$value = CONFIG;
|
||||
|
||||
foreach ($keys as $k) {
|
||||
if (!isset($value[$k])) {
|
||||
return $default;
|
||||
}
|
||||
$value = $value[$k];
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "getyourband/platform",
|
||||
"description": "Modern band booking platform",
|
||||
"type": "project",
|
||||
"license": "proprietary",
|
||||
"require": {
|
||||
"php": ">=8.3",
|
||||
"ext-pdo": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-json": "*",
|
||||
"vlucas/phpdotenv": "^5.6",
|
||||
"twig/twig": "^3.8",
|
||||
"phpmailer/phpmailer": "^6.9",
|
||||
"respect/validation": "^2.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^10.5"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\": "database/"
|
||||
},
|
||||
"files": [
|
||||
"app/helpers.php"
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true,
|
||||
"scripts": {
|
||||
"post-autoload-dump": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => env('APP_NAME', 'GetYourBand'),
|
||||
'env' => env('APP_ENV', 'production'),
|
||||
'debug' => env('APP_DEBUG', false),
|
||||
'url' => env('APP_URL', 'http://localhost'),
|
||||
|
||||
'timezone' => 'Europe/Zurich',
|
||||
'locale' => 'de_CH',
|
||||
|
||||
'features' => [
|
||||
'email_verification' => env('REQUIRE_EMAIL_VERIFICATION', true),
|
||||
'band_approval' => env('REQUIRE_BAND_APPROVAL', true),
|
||||
'reviews' => env('ENABLE_REVIEWS', true),
|
||||
'payment' => env('PAYMENT_ENABLED', false),
|
||||
],
|
||||
|
||||
'upload' => [
|
||||
'max_size' => env('MAX_UPLOAD_SIZE', 5242880), // 5MB
|
||||
'allowed_images' => explode(',', env('ALLOWED_IMAGE_TYPES', 'jpg,jpeg,png,webp')),
|
||||
'allowed_videos' => explode(',', env('ALLOWED_VIDEO_TYPES', 'mp4,webm')),
|
||||
],
|
||||
|
||||
'pagination' => [
|
||||
'per_page' => 12,
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'connection' => env('DB_CONNECTION', 'mysql'),
|
||||
|
||||
'connections' => [
|
||||
'mysql' => [
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'getyourband'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_unicode_ci',
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -16,6 +16,7 @@ CREATE TABLE IF NOT EXISTS bands (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
user_id INTEGER,
|
||||
name TEXT NOT NULL,
|
||||
email TEXT,
|
||||
city TEXT,
|
||||
genre TEXT,
|
||||
price INTEGER DEFAULT 0,
|
||||
@@ -74,3 +75,17 @@ CREATE TABLE IF NOT EXISTS settings (
|
||||
key TEXT PRIMARY KEY,
|
||||
value TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS payments (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
request_id INTEGER NOT NULL,
|
||||
amount REAL NOT NULL,
|
||||
service_fee REAL NOT NULL,
|
||||
total_amount REAL NOT NULL,
|
||||
paypal_order_id TEXT,
|
||||
paypal_payer_id TEXT,
|
||||
status TEXT NOT NULL DEFAULT 'pending',
|
||||
created_at TEXT DEFAULT CURRENT_TIMESTAMP,
|
||||
completed_at TEXT,
|
||||
FOREIGN KEY(request_id) REFERENCES requests(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Database;
|
||||
|
||||
use PDO;
|
||||
use PDOException;
|
||||
|
||||
class Database
|
||||
{
|
||||
private static ?PDO $instance = null;
|
||||
|
||||
public static function connect(): PDO
|
||||
{
|
||||
if (self::$instance === null) {
|
||||
try {
|
||||
$host = $_ENV['DB_HOST'] ?? '127.0.0.1';
|
||||
$port = $_ENV['DB_PORT'] ?? '3306';
|
||||
$dbname = $_ENV['DB_DATABASE'] ?? 'getyourband';
|
||||
$username = $_ENV['DB_USERNAME'] ?? 'root';
|
||||
$password = $_ENV['DB_PASSWORD'] ?? '';
|
||||
|
||||
$dsn = "mysql:host={$host};port={$port};dbname={$dbname};charset=utf8mb4";
|
||||
|
||||
self::$instance = new PDO($dsn, $username, $password, [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
PDO::ATTR_EMULATE_PREPARES => false,
|
||||
]);
|
||||
} catch (PDOException $e) {
|
||||
throw new \RuntimeException("Database connection failed: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
public static function disconnect(): void
|
||||
{
|
||||
self::$instance = null;
|
||||
}
|
||||
|
||||
public static function runMigrations(string $migrationsPath): void
|
||||
{
|
||||
$db = self::connect();
|
||||
$files = glob($migrationsPath . '/*.sql');
|
||||
sort($files);
|
||||
|
||||
foreach ($files as $file) {
|
||||
echo "Running migration: " . basename($file) . "\n";
|
||||
$sql = file_get_contents($file);
|
||||
|
||||
try {
|
||||
$db->exec($sql);
|
||||
echo "✓ Migration completed successfully\n";
|
||||
} catch (PDOException $e) {
|
||||
echo "✗ Migration failed: " . $e->getMessage() . "\n";
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
echo "\nAll migrations completed!\n";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
-- Migration: Create users table
|
||||
-- Created: 2025-12-02
|
||||
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
email VARCHAR(255) NOT NULL UNIQUE,
|
||||
password VARCHAR(255) NOT NULL,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
role ENUM('admin', 'band', 'customer') NOT NULL DEFAULT 'customer',
|
||||
email_verified_at TIMESTAMP NULL,
|
||||
verification_token VARCHAR(64) NULL,
|
||||
reset_token VARCHAR(64) NULL,
|
||||
reset_token_expires TIMESTAMP NULL,
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
INDEX idx_email (email),
|
||||
INDEX idx_role (role),
|
||||
INDEX idx_verification_token (verification_token),
|
||||
INDEX idx_reset_token (reset_token)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
@@ -0,0 +1,38 @@
|
||||
-- Migration: Create bands table
|
||||
-- Created: 2025-12-02
|
||||
|
||||
CREATE TABLE IF NOT EXISTS bands (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
user_id INT NOT NULL,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
slug VARCHAR(255) NOT NULL UNIQUE,
|
||||
description TEXT,
|
||||
genre VARCHAR(100),
|
||||
location VARCHAR(255),
|
||||
postal_code VARCHAR(10),
|
||||
price_min DECIMAL(10, 2),
|
||||
price_max DECIMAL(10, 2),
|
||||
member_count INT,
|
||||
phone VARCHAR(50),
|
||||
website VARCHAR(255),
|
||||
facebook VARCHAR(255),
|
||||
instagram VARCHAR(255),
|
||||
youtube VARCHAR(255),
|
||||
profile_image VARCHAR(255),
|
||||
cover_image VARCHAR(255),
|
||||
is_approved BOOLEAN DEFAULT FALSE,
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
view_count INT DEFAULT 0,
|
||||
average_rating DECIMAL(3, 2) DEFAULT 0.00,
|
||||
total_reviews INT DEFAULT 0,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
|
||||
INDEX idx_slug (slug),
|
||||
INDEX idx_genre (genre),
|
||||
INDEX idx_location (location),
|
||||
INDEX idx_postal_code (postal_code),
|
||||
INDEX idx_is_approved (is_approved),
|
||||
INDEX idx_average_rating (average_rating),
|
||||
FULLTEXT idx_search (name, description, genre)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
@@ -0,0 +1,17 @@
|
||||
-- Migration: Create band_media table
|
||||
-- Created: 2025-12-02
|
||||
|
||||
CREATE TABLE IF NOT EXISTS band_media (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
band_id INT NOT NULL,
|
||||
type ENUM('image', 'video') NOT NULL,
|
||||
url VARCHAR(500) NOT NULL,
|
||||
title VARCHAR(255),
|
||||
is_featured BOOLEAN DEFAULT FALSE,
|
||||
sort_order INT DEFAULT 0,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (band_id) REFERENCES bands(id) ON DELETE CASCADE,
|
||||
INDEX idx_band_id (band_id),
|
||||
INDEX idx_type (type),
|
||||
INDEX idx_sort_order (sort_order)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
@@ -0,0 +1,26 @@
|
||||
-- Migration: Create bookings table
|
||||
-- Created: 2025-12-02
|
||||
|
||||
CREATE TABLE IF NOT EXISTS bookings (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
band_id INT NOT NULL,
|
||||
customer_id INT NOT NULL,
|
||||
event_date DATE NOT NULL,
|
||||
event_time TIME,
|
||||
event_location VARCHAR(255) NOT NULL,
|
||||
event_type VARCHAR(100),
|
||||
budget DECIMAL(10, 2),
|
||||
guest_count INT,
|
||||
message TEXT,
|
||||
status ENUM('pending', 'accepted', 'rejected', 'completed', 'cancelled') DEFAULT 'pending',
|
||||
band_response TEXT,
|
||||
responded_at TIMESTAMP NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (band_id) REFERENCES bands(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (customer_id) REFERENCES users(id) ON DELETE CASCADE,
|
||||
INDEX idx_band_id (band_id),
|
||||
INDEX idx_customer_id (customer_id),
|
||||
INDEX idx_status (status),
|
||||
INDEX idx_event_date (event_date)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
@@ -0,0 +1,23 @@
|
||||
-- Migration: Create reviews table
|
||||
-- Created: 2025-12-02
|
||||
|
||||
CREATE TABLE IF NOT EXISTS reviews (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
band_id INT NOT NULL,
|
||||
booking_id INT NOT NULL,
|
||||
customer_id INT NOT NULL,
|
||||
rating INT NOT NULL CHECK (rating BETWEEN 1 AND 5),
|
||||
comment TEXT,
|
||||
is_approved BOOLEAN DEFAULT FALSE,
|
||||
is_visible BOOLEAN DEFAULT TRUE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (band_id) REFERENCES bands(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (booking_id) REFERENCES bookings(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (customer_id) REFERENCES users(id) ON DELETE CASCADE,
|
||||
UNIQUE KEY unique_booking_review (booking_id),
|
||||
INDEX idx_band_id (band_id),
|
||||
INDEX idx_customer_id (customer_id),
|
||||
INDEX idx_rating (rating),
|
||||
INDEX idx_is_approved (is_approved)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- Migration: Create band_availability table
|
||||
-- Created: 2025-12-02
|
||||
|
||||
CREATE TABLE IF NOT EXISTS band_availability (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
band_id INT NOT NULL,
|
||||
date DATE NOT NULL,
|
||||
is_available BOOLEAN DEFAULT TRUE,
|
||||
notes VARCHAR(255),
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (band_id) REFERENCES bands(id) ON DELETE CASCADE,
|
||||
UNIQUE KEY unique_band_date (band_id, date),
|
||||
INDEX idx_band_id (band_id),
|
||||
INDEX idx_date (date)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
+172
-1
@@ -1,10 +1,181 @@
|
||||
<?php
|
||||
function sendEmail(string $to, string $subject, string $message): void
|
||||
require_once __DIR__ . '/config.php';
|
||||
|
||||
function sendEmail(string $to, string $subject, string $message, bool $isHtml = true): bool
|
||||
{
|
||||
$logDir = __DIR__ . '/../storage/logs';
|
||||
if (!is_dir($logDir)) {
|
||||
mkdir($logDir, 0775, true);
|
||||
}
|
||||
|
||||
$entry = sprintf("%s\nTo: %s\nSubject: %s\n%s\n---\n", date('c'), $to, $subject, $message);
|
||||
file_put_contents($logDir . '/mail.log', $entry, FILE_APPEND);
|
||||
|
||||
$headers = [
|
||||
'From: ' . SITE_NAME . ' <' . SUPPORT_EMAIL . '>',
|
||||
'Reply-To: ' . SUPPORT_EMAIL,
|
||||
'X-Mailer: PHP/' . phpversion(),
|
||||
'MIME-Version: 1.0'
|
||||
];
|
||||
|
||||
if ($isHtml) {
|
||||
$headers[] = 'Content-Type: text/html; charset=UTF-8';
|
||||
} else {
|
||||
$headers[] = 'Content-Type: text/plain; charset=UTF-8';
|
||||
}
|
||||
|
||||
return mail($to, $subject, $message, implode("\r\n", $headers));
|
||||
}
|
||||
|
||||
function sendBookingRequestEmail(array $band, array $requestData, ?array $customer = null): bool
|
||||
{
|
||||
$bandEmail = $band['email'] ?? 'info@' . preg_replace('/\s+/', '', strtolower($band['name'])) . '.ch';
|
||||
|
||||
$subject = 'Neue Buchungsanfrage für ' . $band['name'];
|
||||
|
||||
$message = emailTemplate('booking_request', [
|
||||
'band_name' => $band['name'],
|
||||
'event_date' => date('d.m.Y', strtotime($requestData['event_date'])),
|
||||
'location' => $requestData['location'],
|
||||
'event_type' => $requestData['event_type'] ?: 'Nicht angegeben',
|
||||
'budget' => $requestData['budget'] ? formatPrice($requestData['budget']) : 'Nicht angegeben',
|
||||
'message' => $requestData['message'] ?: 'Keine Nachricht',
|
||||
'customer_name' => $customer['name'] ?? 'Gast',
|
||||
'customer_email' => $customer['email'] ?? 'Keine Email angegeben',
|
||||
]);
|
||||
|
||||
return sendEmail($bandEmail, $subject, $message);
|
||||
}
|
||||
|
||||
function sendBookingConfirmationEmail(string $customerEmail, array $band, array $requestData): bool
|
||||
{
|
||||
$subject = 'Ihre Anfrage an ' . $band['name'] . ' wurde gesendet';
|
||||
|
||||
$message = emailTemplate('booking_confirmation', [
|
||||
'band_name' => $band['name'],
|
||||
'event_date' => date('d.m.Y', strtotime($requestData['event_date'])),
|
||||
'location' => $requestData['location'],
|
||||
'site_name' => SITE_NAME,
|
||||
]);
|
||||
|
||||
return sendEmail($customerEmail, $subject, $message);
|
||||
}
|
||||
|
||||
function emailTemplate(string $templateName, array $data): string
|
||||
{
|
||||
$templates = [
|
||||
'booking_request' => '
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }
|
||||
.container { max-width: 600px; margin: 0 auto; padding: 20px; }
|
||||
.header { background: #f4b807; padding: 20px; text-align: center; }
|
||||
.content { background: #fff; padding: 20px; border: 1px solid #ddd; }
|
||||
.info-row { margin: 10px 0; padding: 10px; background: #f9f9f9; }
|
||||
.label { font-weight: bold; color: #666; }
|
||||
.footer { text-align: center; padding: 20px; color: #666; font-size: 12px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h1 style="margin:0; color: #fff;">🎸 Neue Buchungsanfrage</h1>
|
||||
</div>
|
||||
<div class="content">
|
||||
<p>Hallo <strong>' . htmlspecialchars($data['band_name']) . '</strong>,</p>
|
||||
<p>Sie haben eine neue Buchungsanfrage erhalten:</p>
|
||||
|
||||
<div class="info-row">
|
||||
<span class="label">Event-Datum:</span> ' . htmlspecialchars($data['event_date']) . '
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="label">Ort:</span> ' . htmlspecialchars($data['location']) . '
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="label">Event-Typ:</span> ' . htmlspecialchars($data['event_type']) . '
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="label">Budget:</span> ' . htmlspecialchars($data['budget']) . '
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="label">Nachricht:</span><br>' . nl2br(htmlspecialchars($data['message'])) . '
|
||||
</div>
|
||||
|
||||
<h3>Kontaktdaten:</h3>
|
||||
<div class="info-row">
|
||||
<span class="label">Name:</span> ' . htmlspecialchars($data['customer_name']) . '
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="label">Email:</span> <a href="mailto:' . htmlspecialchars($data['customer_email']) . '">' . htmlspecialchars($data['customer_email']) . '</a>
|
||||
</div>
|
||||
|
||||
<p style="margin-top: 20px;">
|
||||
Bitte kontaktieren Sie den Kunden direkt, um die Details zu besprechen.
|
||||
</p>
|
||||
</div>
|
||||
<div class="footer">
|
||||
Gesendet von ' . SITE_NAME . ' - Ihre Band-Vermittlungsplattform
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
',
|
||||
|
||||
'booking_confirmation' => '
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }
|
||||
.container { max-width: 600px; margin: 0 auto; padding: 20px; }
|
||||
.header { background: #f4b807; padding: 20px; text-align: center; }
|
||||
.content { background: #fff; padding: 20px; border: 1px solid #ddd; }
|
||||
.info-row { margin: 10px 0; padding: 10px; background: #f9f9f9; }
|
||||
.label { font-weight: bold; color: #666; }
|
||||
.footer { text-align: center; padding: 20px; color: #666; font-size: 12px; }
|
||||
.success { background: #d4edda; border: 1px solid #c3e6cb; padding: 15px; margin: 15px 0; border-radius: 4px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h1 style="margin:0; color: #fff;">✅ Anfrage gesendet</h1>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="success">
|
||||
<strong>Ihre Anfrage wurde erfolgreich gesendet!</strong>
|
||||
</div>
|
||||
|
||||
<p>Vielen Dank für Ihre Anfrage an <strong>' . htmlspecialchars($data['band_name']) . '</strong>.</p>
|
||||
|
||||
<h3>Details Ihrer Anfrage:</h3>
|
||||
<div class="info-row">
|
||||
<span class="label">Event-Datum:</span> ' . htmlspecialchars($data['event_date']) . '
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="label">Ort:</span> ' . htmlspecialchars($data['location']) . '
|
||||
</div>
|
||||
|
||||
<p style="margin-top: 20px;">
|
||||
Die Band wird sich in Kürze bei Ihnen melden. Bitte überprüfen Sie auch Ihren Spam-Ordner.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Bei Fragen können Sie uns jederzeit unter <a href="mailto:' . SUPPORT_EMAIL . '">' . SUPPORT_EMAIL . '</a> erreichen.
|
||||
</p>
|
||||
</div>
|
||||
<div class="footer">
|
||||
Vielen Dank, dass Sie ' . htmlspecialchars($data['site_name']) . ' nutzen!
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
',
|
||||
];
|
||||
|
||||
return $templates[$templateName] ?? '';
|
||||
}
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use Database\Database;
|
||||
use Dotenv\Dotenv;
|
||||
|
||||
// Load environment variables
|
||||
$dotenv = Dotenv::createImmutable(__DIR__);
|
||||
$dotenv->load();
|
||||
|
||||
try {
|
||||
echo "Starting database migrations...\n\n";
|
||||
Database::runMigrations(__DIR__ . '/database/migrations');
|
||||
echo "\n✓ All migrations completed successfully!\n";
|
||||
} catch (Exception $e) {
|
||||
echo "\n✗ Migration failed: " . $e->getMessage() . "\n";
|
||||
exit(1);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Migration: Add email column to bands table
|
||||
* Run this once to update existing databases
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/includes/database.php';
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
|
||||
$columns = $pdo->query("PRAGMA table_info(bands)")->fetchAll(PDO::FETCH_ASSOC);
|
||||
$hasEmail = false;
|
||||
|
||||
foreach ($columns as $column) {
|
||||
if ($column['name'] === 'email') {
|
||||
$hasEmail = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$hasEmail) {
|
||||
echo "Adding email column to bands table...\n";
|
||||
$pdo->exec("ALTER TABLE bands ADD COLUMN email TEXT");
|
||||
echo "✓ Email column added successfully!\n";
|
||||
} else {
|
||||
echo "✓ Email column already exists.\n";
|
||||
}
|
||||
|
||||
echo "\nMigration completed successfully!\n";
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "Error: " . $e->getMessage() . "\n";
|
||||
exit(1);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "getyourband-platform",
|
||||
"version": "1.0.0",
|
||||
"description": "Modern band booking platform",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"watch": "vite build --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vite": "^5.0.0",
|
||||
"tailwindcss": "^3.4.0",
|
||||
"postcss": "^8.4.32",
|
||||
"autoprefixer": "^10.4.16",
|
||||
"@tailwindcss/forms": "^0.5.7",
|
||||
"@tailwindcss/typography": "^0.5.10"
|
||||
},
|
||||
"dependencies": {
|
||||
"alpinejs": "^3.13.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
require_once __DIR__ . '/includes/auth.php';
|
||||
|
||||
$requestId = isset($_GET['request_id']) ? (int) $_GET['request_id'] : 0;
|
||||
if (!$requestId) {
|
||||
http_response_code(400);
|
||||
echo 'Keine Anfrage-ID angegeben';
|
||||
exit;
|
||||
}
|
||||
|
||||
$user = currentUser();
|
||||
|
||||
// Get request details
|
||||
$stmt = db()->prepare('SELECT r.*, b.name as band_name, b.price as band_price
|
||||
FROM requests r
|
||||
JOIN bands b ON b.id = r.band_id
|
||||
WHERE r.id = :id AND r.user_id = :user_id');
|
||||
$stmt->execute([':id' => $requestId, ':user_id' => $user['id']]);
|
||||
$request = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!$request) {
|
||||
http_response_code(404);
|
||||
echo 'Anfrage nicht gefunden';
|
||||
exit;
|
||||
}
|
||||
|
||||
$settings = settings();
|
||||
if ($settings['paypal_enabled'] !== '1') {
|
||||
http_response_code(403);
|
||||
echo 'PayPal-Zahlungen sind derzeit nicht aktiviert';
|
||||
exit;
|
||||
}
|
||||
|
||||
// Calculate amounts
|
||||
$bandPrice = (int) $request['band_price'];
|
||||
$serviceFeePercent = (float) $settings['service_fee'];
|
||||
$serviceFee = $bandPrice * ($serviceFeePercent / 100);
|
||||
$totalAmount = $bandPrice + $serviceFee;
|
||||
|
||||
// Check if already paid
|
||||
$stmt = db()->prepare('SELECT * FROM payments WHERE request_id = :id AND status = "completed"');
|
||||
$stmt->execute([':id' => $requestId]);
|
||||
$existingPayment = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($existingPayment) {
|
||||
$message = 'Diese Buchung wurde bereits bezahlt.';
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>PayPal Zahlung – <?= SITE_NAME ?></title>
|
||||
<link rel="stylesheet" href="assets/css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<a class="badge" href="profil.php">← Zurück zum Profil</a>
|
||||
<h1>Zahlung für Buchung</h1>
|
||||
</header>
|
||||
<main style="max-width: 600px; margin: 0 auto;">
|
||||
<?php if (isset($message)): ?>
|
||||
<div class="alert alert-success"><?= htmlspecialchars($message) ?></div>
|
||||
<?php else: ?>
|
||||
<h2>Buchungsdetails</h2>
|
||||
<table class="table" style="margin-bottom: 2rem;">
|
||||
<tr><td><strong>Band:</strong></td><td><?= htmlspecialchars($request['band_name']) ?></td></tr>
|
||||
<tr><td><strong>Event-Datum:</strong></td><td><?= htmlspecialchars($request['event_date']) ?></td></tr>
|
||||
<tr><td><strong>Location:</strong></td><td><?= htmlspecialchars($request['location']) ?></td></tr>
|
||||
<tr><td><strong>Event-Typ:</strong></td><td><?= htmlspecialchars($request['event_type']) ?></td></tr>
|
||||
</table>
|
||||
|
||||
<h2>Zahlungsübersicht</h2>
|
||||
<table class="table" style="margin-bottom: 2rem;">
|
||||
<tr><td><strong>Band-Gage:</strong></td><td><?= formatPrice($bandPrice) ?></td></tr>
|
||||
<tr><td><strong>Service Fee (<?= htmlspecialchars($serviceFeePercent) ?>%):</strong></td><td><?= formatPrice((int) $serviceFee) ?></td></tr>
|
||||
<tr style="border-top: 2px solid #ffb703;"><td><strong>Gesamtbetrag:</strong></td><td><strong><?= formatPrice((int) $totalAmount) ?></strong></td></tr>
|
||||
</table>
|
||||
|
||||
<div id="payment-status" style="display:none; padding: 1rem; margin-bottom: 1rem; border-radius: 4px;"></div>
|
||||
|
||||
<!-- PayPal Button Container -->
|
||||
<div id="paypal-button-container" style="margin: 2rem 0;"></div>
|
||||
|
||||
<p style="color: #666; font-size: 0.875rem; margin-top: 2rem;">
|
||||
<strong>Hinweis:</strong> Dies ist eine Demo-Integration. Für die Produktivumgebung benötigen Sie echte PayPal API-Credentials.
|
||||
Aktuell wird im Sandbox-Modus gearbeitet.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</main>
|
||||
|
||||
<?php if (!isset($message)): ?>
|
||||
<!-- PayPal SDK -->
|
||||
<script src="https://www.paypal.com/sdk/js?client-id=YOUR_PAYPAL_CLIENT_ID¤cy=CHF"></script>
|
||||
|
||||
<script>
|
||||
paypal.Buttons({
|
||||
createOrder: function(data, actions) {
|
||||
return actions.order.create({
|
||||
purchase_units: [{
|
||||
amount: {
|
||||
value: '<?= number_format($totalAmount, 2, '.', '') ?>',
|
||||
currency_code: 'CHF',
|
||||
breakdown: {
|
||||
item_total: {
|
||||
value: '<?= number_format($bandPrice, 2, '.', '') ?>',
|
||||
currency_code: 'CHF'
|
||||
},
|
||||
tax_total: {
|
||||
value: '<?= number_format($serviceFee, 2, '.', '') ?>',
|
||||
currency_code: 'CHF'
|
||||
}
|
||||
}
|
||||
},
|
||||
description: 'Buchung: <?= htmlspecialchars($request['band_name']) ?> - <?= htmlspecialchars($request['event_date']) ?>'
|
||||
}]
|
||||
});
|
||||
},
|
||||
onApprove: function(data, actions) {
|
||||
return actions.order.capture().then(function(details) {
|
||||
// Save payment to database
|
||||
const statusDiv = document.getElementById('payment-status');
|
||||
statusDiv.style.display = 'block';
|
||||
statusDiv.style.background = '#28a745';
|
||||
statusDiv.style.color = 'white';
|
||||
statusDiv.textContent = 'Zahlung erfolgreich! Verarbeite Transaktion...';
|
||||
|
||||
fetch('paypal-process.php', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
request_id: <?= $requestId ?>,
|
||||
amount: <?= $bandPrice ?>,
|
||||
service_fee: <?= number_format($serviceFee, 2, '.', '') ?>,
|
||||
total_amount: <?= number_format($totalAmount, 2, '.', '') ?>,
|
||||
paypal_order_id: data.orderID,
|
||||
paypal_payer_id: details.payer.payer_id
|
||||
})
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(result => {
|
||||
if (result.success) {
|
||||
statusDiv.textContent = 'Zahlung erfolgreich abgeschlossen! Sie werden weitergeleitet...';
|
||||
setTimeout(() => {
|
||||
window.location.href = 'profil.php?payment_success=1';
|
||||
}, 2000);
|
||||
} else {
|
||||
statusDiv.style.background = '#dc3545';
|
||||
statusDiv.textContent = 'Fehler beim Speichern der Zahlung: ' + result.error;
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
onError: function(err) {
|
||||
const statusDiv = document.getElementById('payment-status');
|
||||
statusDiv.style.display = 'block';
|
||||
statusDiv.style.background = '#dc3545';
|
||||
statusDiv.style.color = 'white';
|
||||
statusDiv.textContent = 'Fehler bei der Zahlung: ' + err;
|
||||
}
|
||||
}).render('#paypal-button-container');
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
require_once __DIR__ . '/includes/auth.php';
|
||||
require_once __DIR__ . '/includes/email.php';
|
||||
requireLogin();
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$user = currentUser();
|
||||
|
||||
// Get JSON input
|
||||
$input = json_decode(file_get_contents('php://input'), true);
|
||||
|
||||
if (!$input || !isset($input['request_id'])) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => 'Ungültige Anfrage']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$requestId = (int) $input['request_id'];
|
||||
$amount = (float) $input['amount'];
|
||||
$serviceFee = (float) $input['service_fee'];
|
||||
$totalAmount = (float) $input['total_amount'];
|
||||
$paypalOrderId = $input['paypal_order_id'] ?? '';
|
||||
$paypalPayerId = $input['paypal_payer_id'] ?? '';
|
||||
|
||||
// Verify request belongs to user
|
||||
$stmt = db()->prepare('SELECT r.*, b.name as band_name, b.user_id as band_user_id
|
||||
FROM requests r
|
||||
JOIN bands b ON b.id = r.band_id
|
||||
WHERE r.id = :id AND r.user_id = :user_id');
|
||||
$stmt->execute([':id' => $requestId, ':user_id' => $user['id']]);
|
||||
$request = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!$request) {
|
||||
http_response_code(404);
|
||||
echo json_encode(['error' => 'Anfrage nicht gefunden']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check if already paid
|
||||
$stmt = db()->prepare('SELECT * FROM payments WHERE request_id = :id AND status = "completed"');
|
||||
$stmt->execute([':id' => $requestId]);
|
||||
if ($stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => 'Diese Buchung wurde bereits bezahlt']);
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
// Save payment
|
||||
$stmt = db()->prepare('INSERT INTO payments (request_id, amount, service_fee, total_amount, paypal_order_id, paypal_payer_id, status, completed_at)
|
||||
VALUES (:request_id, :amount, :service_fee, :total_amount, :paypal_order_id, :paypal_payer_id, :status, :completed_at)');
|
||||
|
||||
$stmt->execute([
|
||||
':request_id' => $requestId,
|
||||
':amount' => $amount,
|
||||
':service_fee' => $serviceFee,
|
||||
':total_amount' => $totalAmount,
|
||||
':paypal_order_id' => $paypalOrderId,
|
||||
':paypal_payer_id' => $paypalPayerId,
|
||||
':status' => 'completed',
|
||||
':completed_at' => (new DateTimeImmutable())->format('c')
|
||||
]);
|
||||
|
||||
// Update request status to confirmed
|
||||
$stmt = db()->prepare('UPDATE requests SET status = :status WHERE id = :id');
|
||||
$stmt->execute([':status' => 'bestätigt', ':id' => $requestId]);
|
||||
|
||||
// Send confirmation emails
|
||||
sendEmail($user['email'], 'Zahlungsbestätigung',
|
||||
'Ihre Zahlung für die Buchung von ' . $request['band_name'] . ' wurde erfolgreich verarbeitet.');
|
||||
|
||||
// Notify band
|
||||
if ($request['band_user_id']) {
|
||||
$bandUserStmt = db()->prepare('SELECT email FROM users WHERE id = :id');
|
||||
$bandUserStmt->execute([':id' => $request['band_user_id']]);
|
||||
$bandUser = $bandUserStmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($bandUser) {
|
||||
sendEmail($bandUser['email'], 'Neue bezahlte Buchung',
|
||||
'Sie haben eine neue bezahlte Buchung für ' . $request['event_date'] . ' erhalten.');
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'message' => 'Zahlung erfolgreich verarbeitet',
|
||||
'payment_id' => (int) db()->lastInsertId()
|
||||
]);
|
||||
|
||||
} catch (Exception $e) {
|
||||
http_response_code(500);
|
||||
echo json_encode(['error' => 'Fehler beim Speichern der Zahlung: ' . $e->getMessage()]);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export default {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
}
|
||||
+127
-4
@@ -13,9 +13,10 @@ if ($user['role'] === 'band') {
|
||||
$band = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$stmt = db()->prepare('UPDATE bands SET name = :name, city = :city, genre = :genre, price = :price, description = :description, style_tags = :tags WHERE id = :id');
|
||||
$stmt = db()->prepare('UPDATE bands SET name = :name, email = :email, city = :city, genre = :genre, price = :price, description = :description, style_tags = :tags WHERE id = :id');
|
||||
$stmt->execute([
|
||||
':name' => $_POST['name'],
|
||||
':email' => $_POST['email'] ?? null,
|
||||
':city' => $_POST['city'],
|
||||
':genre' => $_POST['genre'],
|
||||
':price' => (int) $_POST['price'],
|
||||
@@ -47,7 +48,11 @@ if ($user['role'] === 'band') {
|
||||
<h2>Bandprofil</h2>
|
||||
<form method="post">
|
||||
<label>Bandname
|
||||
<input class="form-control" name="name" value="<?= htmlspecialchars($band['name']) ?>">
|
||||
<input class="form-control" name="name" value="<?= htmlspecialchars($band['name']) ?>" required>
|
||||
</label>
|
||||
<label>Email für Buchungsanfragen
|
||||
<input class="form-control" type="email" name="email" value="<?= htmlspecialchars($band['email'] ?? '') ?>" placeholder="band@example.ch">
|
||||
<small>An diese Adresse werden Buchungsanfragen gesendet</small>
|
||||
</label>
|
||||
<label>Ort
|
||||
<input class="form-control" name="city" value="<?= htmlspecialchars($band['city']) ?>">
|
||||
@@ -66,20 +71,138 @@ if ($user['role'] === 'band') {
|
||||
</label>
|
||||
<button class="btn-primary">Speichern</button>
|
||||
</form>
|
||||
|
||||
<h2 style="margin-top: 2rem;">Band-Galerie</h2>
|
||||
<div id="upload-status" style="display:none; padding: 1rem; margin-bottom: 1rem; background: #28a745; color: white; border-radius: 4px;"></div>
|
||||
<div style="margin-bottom: 1rem;">
|
||||
<label class="btn-primary" style="display: inline-block; cursor: pointer;">
|
||||
<input type="file" id="image-upload" accept="image/*" style="display: none;">
|
||||
+ Bild hochladen
|
||||
</label>
|
||||
<small style="display: block; margin-top: 0.5rem; color: #666;">Max 5MB (JPG, PNG, GIF, WEBP)</small>
|
||||
</div>
|
||||
<div id="gallery" style="display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem;">
|
||||
<?php foreach (bandMedia((int) $band['id']) as $media): ?>
|
||||
<div class="gallery-item" data-media-id="<?= $media['id'] ?>">
|
||||
<img src="<?= htmlspecialchars($media['url']) ?>" alt="Band Foto" style="width: 100%; height: 200px; object-fit: cover; border-radius: 4px;">
|
||||
<button class="delete-image" data-id="<?= $media['id'] ?>" style="margin-top: 0.5rem; background: #dc3545; color: white; border: none; padding: 0.5rem 1rem; border-radius: 4px; cursor: pointer; width: 100%;">Löschen</button>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.getElementById('image-upload').addEventListener('change', function(e) {
|
||||
const file = e.target.files[0];
|
||||
if (!file) return;
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('image', file);
|
||||
|
||||
const statusDiv = document.getElementById('upload-status');
|
||||
statusDiv.style.display = 'block';
|
||||
statusDiv.style.background = '#ffc107';
|
||||
statusDiv.textContent = 'Uploading...';
|
||||
|
||||
fetch('upload-handler.php', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
statusDiv.style.background = '#28a745';
|
||||
statusDiv.textContent = data.message;
|
||||
|
||||
// Add to gallery
|
||||
const gallery = document.getElementById('gallery');
|
||||
const div = document.createElement('div');
|
||||
div.className = 'gallery-item';
|
||||
div.setAttribute('data-media-id', data.id);
|
||||
div.innerHTML = `
|
||||
<img src="${data.url}" alt="Band Foto" style="width: 100%; height: 200px; object-fit: cover; border-radius: 4px;">
|
||||
<button class="delete-image" data-id="${data.id}" style="margin-top: 0.5rem; background: #dc3545; color: white; border: none; padding: 0.5rem 1rem; border-radius: 4px; cursor: pointer; width: 100%;">Löschen</button>
|
||||
`;
|
||||
gallery.appendChild(div);
|
||||
|
||||
setTimeout(() => { statusDiv.style.display = 'none'; }, 3000);
|
||||
} else {
|
||||
statusDiv.style.background = '#dc3545';
|
||||
statusDiv.textContent = data.error;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
statusDiv.style.background = '#dc3545';
|
||||
statusDiv.textContent = 'Upload fehlgeschlagen: ' + error.message;
|
||||
});
|
||||
|
||||
e.target.value = '';
|
||||
});
|
||||
|
||||
document.addEventListener('click', function(e) {
|
||||
if (e.target.classList.contains('delete-image')) {
|
||||
if (!confirm('Bild wirklich löschen?')) return;
|
||||
|
||||
const mediaId = e.target.getAttribute('data-id');
|
||||
const galleryItem = e.target.closest('.gallery-item');
|
||||
|
||||
fetch('upload-handler.php', {
|
||||
method: 'DELETE',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: 'media_id=' + mediaId
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
galleryItem.remove();
|
||||
} else {
|
||||
alert(data.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php else: ?>
|
||||
<p>Du hast noch kein Bandprofil angelegt.</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($user['role'] === 'kunde'): ?>
|
||||
<?php if (isset($_GET['payment_success'])): ?>
|
||||
<div class="alert alert-success">Zahlung erfolgreich abgeschlossen! Vielen Dank für Ihre Buchung.</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<h2>Meine Anfragen</h2>
|
||||
<table class="table">
|
||||
<thead><tr><th>Band</th><th>Datum</th><th>Status</th></tr></thead>
|
||||
<thead><tr><th>Band</th><th>Datum</th><th>Status</th><th>Zahlung</th><th>Aktion</th></tr></thead>
|
||||
<tbody>
|
||||
<?php foreach (userRequests((int) $user['id']) as $request): $bandName = findBand((int) $request['band_id']); ?>
|
||||
<?php
|
||||
$settings = settings();
|
||||
foreach (userRequests((int) $user['id']) as $request):
|
||||
$bandName = findBand((int) $request['band_id']);
|
||||
|
||||
// Check payment status
|
||||
$stmt = db()->prepare('SELECT * FROM payments WHERE request_id = :id AND status = "completed"');
|
||||
$stmt->execute([':id' => $request['id']]);
|
||||
$payment = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($bandName['name'] ?? 'Band #' . $request['band_id']) ?></td>
|
||||
<td><?= htmlspecialchars($request['event_date']) ?></td>
|
||||
<td><?= htmlspecialchars($request['status']) ?></td>
|
||||
<td>
|
||||
<?php if ($payment): ?>
|
||||
<span style="color: #28a745;">✓ Bezahlt</span><br>
|
||||
<small style="color: #666;"><?= formatPrice((int) $payment['total_amount']) ?></small>
|
||||
<?php else: ?>
|
||||
<span style="color: #dc3545;">Ausstehend</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if (!$payment && $settings['paypal_enabled'] === '1'): ?>
|
||||
<a href="paypal-checkout.php?request_id=<?= $request['id'] ?>" class="badge" style="background: #0070ba; color: white; text-decoration: none;">
|
||||
PayPal bezahlen
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
RewriteEngine On
|
||||
|
||||
# Redirect all requests to index.php
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ index.php [L,QSA]
|
||||
|
||||
# Security headers
|
||||
<IfModule mod_headers.c>
|
||||
Header set X-Content-Type-Options "nosniff"
|
||||
Header set X-Frame-Options "SAMEORIGIN"
|
||||
Header set X-XSS-Protection "1; mode=block"
|
||||
</IfModule>
|
||||
|
||||
# Disable directory browsing
|
||||
Options -Indexes
|
||||
|
||||
# Compress assets
|
||||
<IfModule mod_deflate.c>
|
||||
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json
|
||||
</IfModule>
|
||||
|
||||
# Browser caching
|
||||
<IfModule mod_expires.c>
|
||||
ExpiresActive On
|
||||
ExpiresByType image/jpeg "access plus 1 year"
|
||||
ExpiresByType image/png "access plus 1 year"
|
||||
ExpiresByType image/webp "access plus 1 year"
|
||||
ExpiresByType text/css "access plus 1 month"
|
||||
ExpiresByType application/javascript "access plus 1 month"
|
||||
</IfModule>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../bootstrap.php';
|
||||
|
||||
use App\Core\Router;
|
||||
|
||||
// Initialize router
|
||||
$router = new Router();
|
||||
|
||||
// Load routes
|
||||
require_once __DIR__ . '/../routes/web.php';
|
||||
|
||||
// Dispatch request
|
||||
$requestMethod = $_SERVER['REQUEST_METHOD'];
|
||||
$requestUri = $_SERVER['REQUEST_URI'];
|
||||
|
||||
try {
|
||||
$router->dispatch($requestMethod, $requestUri);
|
||||
} catch (Exception $e) {
|
||||
if (config('app.debug')) {
|
||||
echo "<h1>Error</h1>";
|
||||
echo "<p>{$e->getMessage()}</p>";
|
||||
echo "<pre>{$e->getTraceAsString()}</pre>";
|
||||
} else {
|
||||
http_response_code(500);
|
||||
echo "500 - Internal Server Error";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
@layer base {
|
||||
html {
|
||||
@apply scroll-smooth;
|
||||
}
|
||||
|
||||
body {
|
||||
@apply bg-gray-50 text-gray-900 antialiased;
|
||||
}
|
||||
}
|
||||
|
||||
@layer components {
|
||||
.btn {
|
||||
@apply px-4 py-2 rounded-lg font-medium transition-all duration-200 inline-flex items-center justify-center;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
@apply bg-primary-500 text-white hover:bg-primary-600 active:bg-primary-700;
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
@apply bg-gray-200 text-gray-800 hover:bg-gray-300 active:bg-gray-400;
|
||||
}
|
||||
|
||||
.card {
|
||||
@apply bg-white rounded-xl shadow-md p-6 transition-shadow hover:shadow-lg;
|
||||
}
|
||||
|
||||
.input-field {
|
||||
@apply w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent;
|
||||
}
|
||||
|
||||
.badge {
|
||||
@apply inline-flex items-center px-3 py-1 rounded-full text-sm font-medium;
|
||||
}
|
||||
|
||||
.badge-yellow {
|
||||
@apply bg-accent-100 text-accent-800;
|
||||
}
|
||||
}
|
||||
|
||||
@layer utilities {
|
||||
.text-balance {
|
||||
text-wrap: balance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
import Alpine from 'alpinejs';
|
||||
|
||||
// Make Alpine available globally
|
||||
window.Alpine = Alpine;
|
||||
|
||||
// Alpine Components
|
||||
Alpine.data('searchBands', () => ({
|
||||
query: '',
|
||||
filters: {
|
||||
genre: '',
|
||||
location: '',
|
||||
priceMin: '',
|
||||
priceMax: '',
|
||||
},
|
||||
results: [],
|
||||
loading: false,
|
||||
|
||||
init() {
|
||||
console.log('Search component initialized');
|
||||
},
|
||||
|
||||
async search() {
|
||||
this.loading = true;
|
||||
try {
|
||||
const params = new URLSearchParams({
|
||||
q: this.query,
|
||||
...this.filters
|
||||
});
|
||||
const response = await fetch(`/api/bands/search?${params}`);
|
||||
this.results = await response.json();
|
||||
} catch (error) {
|
||||
console.error('Search error:', error);
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
Alpine.data('bookingForm', () => ({
|
||||
formData: {
|
||||
bandId: '',
|
||||
eventDate: '',
|
||||
location: '',
|
||||
budget: '',
|
||||
eventType: '',
|
||||
message: ''
|
||||
},
|
||||
submitting: false,
|
||||
|
||||
async submit() {
|
||||
this.submitting = true;
|
||||
try {
|
||||
const response = await fetch('/api/bookings', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(this.formData)
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
alert('Buchungsanfrage erfolgreich gesendet!');
|
||||
this.reset();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Booking error:', error);
|
||||
alert('Es gab einen Fehler. Bitte versuchen Sie es erneut.');
|
||||
} finally {
|
||||
this.submitting = false;
|
||||
}
|
||||
},
|
||||
|
||||
reset() {
|
||||
this.formData = {
|
||||
bandId: '',
|
||||
eventDate: '',
|
||||
location: '',
|
||||
budget: '',
|
||||
eventType: '',
|
||||
message: ''
|
||||
};
|
||||
}
|
||||
}));
|
||||
|
||||
// Initialize Alpine
|
||||
Alpine.start();
|
||||
|
||||
// Smooth scroll for anchor links
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
||||
anchor.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
const target = document.querySelector(this.getAttribute('href'));
|
||||
if (target) {
|
||||
target.scrollIntoView({ behavior: 'smooth' });
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use App\Controllers\HomeController;
|
||||
use App\Controllers\BandController;
|
||||
use App\Controllers\BookingController;
|
||||
use App\Controllers\AuthController;
|
||||
use App\Controllers\ProfileController;
|
||||
use App\Controllers\Admin\AdminController;
|
||||
|
||||
// Public routes
|
||||
$router->get('/', [HomeController::class, 'index']);
|
||||
$router->get('/bands', [BandController::class, 'index']);
|
||||
$router->get('/bands/{slug}', [BandController::class, 'show']);
|
||||
|
||||
// Authentication routes
|
||||
$router->get('/login', [AuthController::class, 'showLogin']);
|
||||
$router->post('/login', [AuthController::class, 'login']);
|
||||
$router->get('/register', [AuthController::class, 'showRegister']);
|
||||
$router->post('/register', [AuthController::class, 'register']);
|
||||
$router->post('/logout', [AuthController::class, 'logout']);
|
||||
$router->get('/verify-email/{token}', [AuthController::class, 'verifyEmail']);
|
||||
|
||||
// Protected routes (require authentication)
|
||||
$router->group(['middleware' => 'auth'], function($router) {
|
||||
// Profile
|
||||
$router->get('/profile', [ProfileController::class, 'show']);
|
||||
$router->post('/profile/update', [ProfileController::class, 'update']);
|
||||
|
||||
// Booking routes
|
||||
$router->post('/bookings/create', [BookingController::class, 'create']);
|
||||
$router->get('/my-bookings', [BookingController::class, 'myBookings']);
|
||||
|
||||
// Band management (for band users)
|
||||
$router->group(['middleware' => 'role:band'], function($router) {
|
||||
$router->get('/band/manage', [BandController::class, 'manage']);
|
||||
$router->post('/band/update', [BandController::class, 'update']);
|
||||
$router->get('/band/bookings', [BookingController::class, 'bandBookings']);
|
||||
$router->post('/band/bookings/{id}/respond', [BookingController::class, 'respond']);
|
||||
});
|
||||
|
||||
// Admin routes
|
||||
$router->group(['middleware' => 'role:admin'], function($router) {
|
||||
$router->get('/admin', [AdminController::class, 'dashboard']);
|
||||
$router->get('/admin/bands', [AdminController::class, 'bands']);
|
||||
$router->post('/admin/bands/{id}/approve', [AdminController::class, 'approveBand']);
|
||||
$router->get('/admin/reviews', [AdminController::class, 'reviews']);
|
||||
$router->post('/admin/reviews/{id}/moderate', [AdminController::class, 'moderateReview']);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,45 @@
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
export default {
|
||||
content: [
|
||||
"./app/Views/**/*.php",
|
||||
"./public/**/*.js",
|
||||
],
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
primary: {
|
||||
50: '#fffbeb',
|
||||
100: '#fef3c7',
|
||||
200: '#fde68a',
|
||||
300: '#fcd34d',
|
||||
400: '#fbbf24',
|
||||
500: '#f59e0b',
|
||||
600: '#d97706',
|
||||
700: '#b45309',
|
||||
800: '#92400e',
|
||||
900: '#78350f',
|
||||
},
|
||||
accent: {
|
||||
50: '#fefce8',
|
||||
100: '#fef9c3',
|
||||
200: '#fef08a',
|
||||
300: '#fde047',
|
||||
400: '#facc15',
|
||||
500: '#eab308',
|
||||
600: '#ca8a04',
|
||||
700: '#a16207',
|
||||
800: '#854d0e',
|
||||
900: '#713f12',
|
||||
}
|
||||
},
|
||||
fontFamily: {
|
||||
sans: ['Inter', 'system-ui', 'sans-serif'],
|
||||
display: ['Poppins', 'system-ui', 'sans-serif'],
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
require('@tailwindcss/forms'),
|
||||
require('@tailwindcss/typography'),
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
require_once __DIR__ . '/includes/auth.php';
|
||||
requireLogin();
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$user = currentUser();
|
||||
if ($user['role'] !== 'band') {
|
||||
http_response_code(403);
|
||||
echo json_encode(['error' => 'Nur Bands können Bilder hochladen']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get band
|
||||
$stmt = db()->prepare('SELECT * FROM bands WHERE user_id = :id');
|
||||
$stmt->execute([':id' => $user['id']]);
|
||||
$band = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!$band) {
|
||||
http_response_code(404);
|
||||
echo json_encode(['error' => 'Kein Bandprofil gefunden']);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['image'])) {
|
||||
$file = $_FILES['image'];
|
||||
|
||||
// Validate file
|
||||
$allowedTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'];
|
||||
$maxSize = 5 * 1024 * 1024; // 5MB
|
||||
|
||||
if (!in_array($file['type'], $allowedTypes)) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => 'Ungültiger Dateityp. Erlaubt sind: JPG, PNG, GIF, WEBP']);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($file['size'] > $maxSize) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => 'Datei zu groß (max 5MB)']);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($file['error'] !== UPLOAD_ERR_OK) {
|
||||
http_response_code(500);
|
||||
echo json_encode(['error' => 'Upload-Fehler']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Generate unique filename
|
||||
$extension = pathinfo($file['name'], PATHINFO_EXTENSION);
|
||||
$filename = 'band_' . $band['id'] . '_' . uniqid() . '.' . $extension;
|
||||
$uploadPath = __DIR__ . '/storage/uploads/bands/' . $filename;
|
||||
|
||||
// Move file
|
||||
if (!move_uploaded_file($file['tmp_name'], $uploadPath)) {
|
||||
http_response_code(500);
|
||||
echo json_encode(['error' => 'Datei konnte nicht gespeichert werden']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Save to database
|
||||
$url = 'storage/uploads/bands/' . $filename;
|
||||
$stmt = db()->prepare('INSERT INTO band_media (band_id, type, url) VALUES (:band_id, :type, :url)');
|
||||
$stmt->execute([
|
||||
':band_id' => $band['id'],
|
||||
':type' => 'image',
|
||||
':url' => $url
|
||||
]);
|
||||
|
||||
$mediaId = (int) db()->lastInsertId();
|
||||
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'id' => $mediaId,
|
||||
'url' => $url,
|
||||
'message' => 'Bild erfolgreich hochgeladen'
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Delete image
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'DELETE') {
|
||||
parse_str(file_get_contents('php://input'), $deleteData);
|
||||
$mediaId = (int) ($deleteData['media_id'] ?? 0);
|
||||
|
||||
if (!$mediaId) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => 'Keine Media-ID angegeben']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check ownership
|
||||
$stmt = db()->prepare('SELECT * FROM band_media WHERE id = :id AND band_id = :band_id');
|
||||
$stmt->execute([':id' => $mediaId, ':band_id' => $band['id']]);
|
||||
$media = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!$media) {
|
||||
http_response_code(404);
|
||||
echo json_encode(['error' => 'Bild nicht gefunden']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Delete file
|
||||
$filePath = __DIR__ . '/' . $media['url'];
|
||||
if (file_exists($filePath) && strpos($media['url'], 'storage/uploads/') === 0) {
|
||||
unlink($filePath);
|
||||
}
|
||||
|
||||
// Delete from database
|
||||
$stmt = db()->prepare('DELETE FROM band_media WHERE id = :id');
|
||||
$stmt->execute([':id' => $mediaId]);
|
||||
|
||||
echo json_encode(['success' => true, 'message' => 'Bild gelöscht']);
|
||||
exit;
|
||||
}
|
||||
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => 'Ungültige Anfrage']);
|
||||
@@ -0,0 +1,31 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import path from 'path';
|
||||
|
||||
export default defineConfig({
|
||||
root: '.',
|
||||
build: {
|
||||
outDir: 'public/dist',
|
||||
emptyOutDir: true,
|
||||
manifest: true,
|
||||
rollupOptions: {
|
||||
input: {
|
||||
main: path.resolve(__dirname, 'resources/js/app.js'),
|
||||
css: path.resolve(__dirname, 'resources/css/app.css'),
|
||||
},
|
||||
output: {
|
||||
entryFileNames: 'js/[name].[hash].js',
|
||||
chunkFileNames: 'js/[name].[hash].js',
|
||||
assetFileNames: (assetInfo) => {
|
||||
if (assetInfo.name.endsWith('.css')) {
|
||||
return 'css/[name].[hash][extname]';
|
||||
}
|
||||
return 'assets/[name].[hash][extname]';
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
server: {
|
||||
port: 3000,
|
||||
strictPort: false,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user