Compare commits
10 Commits
53c2defd44
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b31147c49 | |||
| 3042f6f5ec | |||
| 0abf367497 | |||
| f2af02c2d1 | |||
| a2f51b2fc1 | |||
| 37e81ae825 | |||
| baef24772b | |||
| 9fa40a1d1f | |||
| 00d3a8ab19 | |||
| c2cd4734e7 |
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
// Template-Mapping (Staging)
|
||||
$emailtemplates = [
|
||||
'registration_confirm' => 'neues-template-neue-logik',
|
||||
'registration_welcome' => 'template-1',
|
||||
'registration_resend_code' => 'template-mit-block',
|
||||
'password_reset' => 'template-mit-block',
|
||||
'registration_confirm' => 'confirm-email',
|
||||
'registration_welcome' => 'welcome-email',
|
||||
'registration_resend_code' => 'confirm-email-resend',
|
||||
'password_reset' => 'password-reset',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
BIN
public/assets/bilder/404.jpg
Executable file → Normal file
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 144 KiB |
|
Before Width: | Height: | Size: 22 KiB |
BIN
public/assets/bilder/404portrait.jpg
Normal file
|
After Width: | Height: | Size: 69 KiB |
|
Before Width: | Height: | Size: 89 KiB |
BIN
public/assets/bilder/email/banner_emailconfirm.jpg
Normal file
|
After Width: | Height: | Size: 62 KiB |
BIN
public/assets/bilder/email/banner_passwordreset.jpg
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
public/assets/bilder/email/banner_welcome.jpg
Normal file
|
After Width: | Height: | Size: 58 KiB |
BIN
public/assets/bilder/email/logo_mail.png
Normal file
|
After Width: | Height: | Size: 94 KiB |
BIN
public/assets/bilder/logo_female.png
Executable file → Normal file
|
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 94 KiB |
BIN
public/assets/bilder/logo_male.png
Executable file → Normal file
|
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 92 KiB |
BIN
public/assets/bilder/welcome.jpg
Normal file
|
After Width: | Height: | Size: 85 KiB |
@@ -5,10 +5,8 @@
|
||||
.page_404 img{ width:100%;}
|
||||
|
||||
.four_zero_four_bg{
|
||||
|
||||
background-image: url(//bilder.kusche.berlin/404image.gif);
|
||||
height: 400px;
|
||||
background-position: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,4 +24,11 @@
|
||||
background: #39ac31;
|
||||
margin: 20px 0;
|
||||
display: inline-block;}
|
||||
.contant_box_404{ margin-top:-50px;}
|
||||
.contant_box_404{ margin-top:24px;}
|
||||
|
||||
.page_404_image{
|
||||
width: 100%;
|
||||
max-width: 720px;
|
||||
height: auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
BIN
public/assets/fonts/KidsHandwriting-Regular.ttf
Normal file
BIN
public/assets/fonts/KidsHandwriting-Regular.woff
Normal file
BIN
public/assets/fonts/KidsHandwriting-Regular.woff2
Normal file
@@ -7,17 +7,13 @@
|
||||
<div class="col-sm-10 col-sm-offset-1 text-center"
|
||||
>
|
||||
<div class="four_zero_four_bg">
|
||||
<h1 class="text-center "></h1>
|
||||
<picture>
|
||||
<source media="(max-width: 400px)" srcset="/assets/bilder/404portrait.jpg">
|
||||
<img src="/assets/bilder/404.jpg" alt="404" class="page_404_image rounded-lg">
|
||||
</picture>
|
||||
</div>
|
||||
|
||||
<div class="contant_box_404">
|
||||
<h3 class="h2">
|
||||
Hier fehlt irgendwas
|
||||
</h3>
|
||||
|
||||
<p>die aufgerufene Seite existiert (noch) nicht!</p>
|
||||
|
||||
<a href="https://kusche.berlin" class="link_404">Zur Startseite</a>
|
||||
<a href="https://kusche.berlin" class="btn">Zur Startseite</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,176 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* EmailTemplate Bridge – Schema-API für Quellsysteme.
|
||||
*
|
||||
* Diese Datei kann auf einer geschützten Quelle (z.B. Kundenserver) installiert werden.
|
||||
* Sie liefert dem EmailTemplate-System Informationen über verfügbare Tabellen/Spalten,
|
||||
* ohne direkten DB-Zugriff von außen zu erlauben.
|
||||
*
|
||||
* Sicherheit:
|
||||
* - Authentifizierung per statischem Token (per Header oder Query-Parameter).
|
||||
* - Optional können Host/IP-Checks ergänzt werden.
|
||||
*
|
||||
* Aktionen:
|
||||
* - action=schema (Default) → Gibt Tabellen inkl. Spaltendefinition zurück.
|
||||
* - action=ping → Kleiner Health-Check.
|
||||
*
|
||||
* Hinweise:
|
||||
* - DB-Daten können direkt unten eingetragen oder aus einer separaten Datei geladen werden.
|
||||
* - Der Token sollte für jede Installation eindeutig sein.
|
||||
*/
|
||||
|
||||
$bridgeConfig = [
|
||||
'token' => getenv('EMAILTEMPLATE_BRIDGE_TOKEN') ?: 'kgIqdL9aNWsFWy6mhSRpnuLc1EbZ62sGCcJAwjjlqqznEGE13szhksWUan0cEdjE',
|
||||
'db' => [
|
||||
'dsn' => getenv('EMAILTEMPLATE_BRIDGE_DSN') ?: 'mysql:host=127.0.0.1;dbname=example;charset=utf8mb4',
|
||||
'user' => getenv('EMAILTEMPLATE_BRIDGE_DB_USER') ?: 'root',
|
||||
'pass' => getenv('EMAILTEMPLATE_BRIDGE_DB_PASS') ?: '',
|
||||
'options' => [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
],
|
||||
],
|
||||
//'tables_allow' => ['event', 'mail_accounts', 'users', 'verification_codes'], // optional whitelist: ['customers', 'orders']
|
||||
];
|
||||
|
||||
$localOverride = __DIR__ . '/emailtemplate.bridge.conf.php';
|
||||
if (is_file($localOverride)) {
|
||||
$override = include $localOverride;
|
||||
if (is_array($override)) {
|
||||
$bridgeConfig = array_replace_recursive($bridgeConfig, $override);
|
||||
}
|
||||
}
|
||||
|
||||
function bridgeRespond($payload, int $status = 200): void
|
||||
{
|
||||
http_response_code($status);
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
header('Cache-Control: no-store, max-age=0');
|
||||
echo json_encode($payload, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
exit;
|
||||
}
|
||||
|
||||
function bridgeRequireToken(array $config): void
|
||||
{
|
||||
$expected = (string)($config['token'] ?? '');
|
||||
if ($expected === '') {
|
||||
bridgeRespond(['ok' => false, 'error' => 'Bridge token not configured'], 500);
|
||||
}
|
||||
|
||||
$provided = null;
|
||||
if (!empty($_SERVER['HTTP_AUTHORIZATION']) && stripos($_SERVER['HTTP_AUTHORIZATION'], 'Bearer ') === 0) {
|
||||
$provided = trim(substr($_SERVER['HTTP_AUTHORIZATION'], 7));
|
||||
} elseif (!empty($_SERVER['HTTP_X_EMAILTEMPLATE_TOKEN'])) {
|
||||
$provided = trim($_SERVER['HTTP_X_EMAILTEMPLATE_TOKEN']);
|
||||
} elseif (isset($_GET['token'])) {
|
||||
$provided = (string)$_GET['token'];
|
||||
} elseif (isset($_POST['token'])) {
|
||||
$provided = (string)$_POST['token'];
|
||||
}
|
||||
|
||||
if (!$provided || !hash_equals($expected, $provided)) {
|
||||
bridgeRespond(['ok' => false, 'error' => 'Unauthorized'], 403);
|
||||
}
|
||||
}
|
||||
|
||||
function bridgeDb(array $config): PDO
|
||||
{
|
||||
static $pdo = null;
|
||||
if ($pdo instanceof PDO) {
|
||||
return $pdo;
|
||||
}
|
||||
|
||||
try {
|
||||
$pdo = new PDO(
|
||||
$config['db']['dsn'],
|
||||
$config['db']['user'],
|
||||
$config['db']['pass'],
|
||||
$config['db']['options']
|
||||
);
|
||||
} catch (Throwable $e) {
|
||||
bridgeRespond(['ok' => false, 'error' => 'DB connection failed', 'detail' => $e->getMessage()], 500);
|
||||
}
|
||||
|
||||
return $pdo;
|
||||
}
|
||||
|
||||
bridgeRequireToken($bridgeConfig);
|
||||
|
||||
$action = strtolower((string)($_GET['action'] ?? $_POST['action'] ?? 'schema'));
|
||||
|
||||
if ($action === 'ping') {
|
||||
bridgeRespond(['ok' => true, 'time' => date(DATE_ATOM)]);
|
||||
}
|
||||
|
||||
if ($action !== 'schema') {
|
||||
bridgeRespond(['ok' => false, 'error' => 'Unknown action'], 404);
|
||||
}
|
||||
|
||||
$pdo = bridgeDb($bridgeConfig);
|
||||
|
||||
try {
|
||||
$dbName = '';
|
||||
if (preg_match('/dbname=([^;]+)/i', $bridgeConfig['db']['dsn'], $m)) {
|
||||
$dbName = $m[1];
|
||||
}
|
||||
|
||||
$tablesStmt = $pdo->query('SHOW FULL TABLES');
|
||||
$tables = [];
|
||||
$whitelist = [];
|
||||
if (!empty($bridgeConfig['tables_allow']) && is_array($bridgeConfig['tables_allow'])) {
|
||||
foreach ($bridgeConfig['tables_allow'] as $tbl) {
|
||||
if (is_string($tbl) && $tbl !== '') {
|
||||
$whitelist[strtolower($tbl)] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
while ($row = $tablesStmt->fetch(PDO::FETCH_NUM)) {
|
||||
$tableName = $row[0];
|
||||
if ($tableName === null) {
|
||||
continue;
|
||||
}
|
||||
if ($whitelist && empty($whitelist[strtolower($tableName)])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$columnsStmt = $pdo->prepare(
|
||||
'SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_DEFAULT, COLUMN_KEY, EXTRA
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = :schema AND TABLE_NAME = :table
|
||||
ORDER BY ORDINAL_POSITION'
|
||||
);
|
||||
$columnsStmt->execute([
|
||||
':schema' => $dbName ?: $pdo->query('SELECT DATABASE()')->fetchColumn(),
|
||||
':table' => $tableName,
|
||||
]);
|
||||
|
||||
$columns = [];
|
||||
foreach ($columnsStmt as $col) {
|
||||
$columns[] = [
|
||||
'name' => $col['COLUMN_NAME'],
|
||||
'type' => $col['DATA_TYPE'],
|
||||
'nullable' => ($col['IS_NULLABLE'] === 'YES'),
|
||||
'default' => $col['COLUMN_DEFAULT'],
|
||||
'key' => $col['COLUMN_KEY'],
|
||||
'extra' => $col['EXTRA'],
|
||||
'placeholder'=> strtoupper($tableName) . '__' . strtoupper($col['COLUMN_NAME']),
|
||||
];
|
||||
}
|
||||
|
||||
$tables[] = [
|
||||
'name' => $tableName,
|
||||
'columns' => $columns,
|
||||
];
|
||||
}
|
||||
|
||||
bridgeRespond([
|
||||
'ok' => true,
|
||||
'tables' => $tables,
|
||||
'fetched' => date(DATE_ATOM),
|
||||
]);
|
||||
} catch (Throwable $e) {
|
||||
bridgeRespond(['ok' => false, 'error' => 'Schema fetch failed', 'detail' => $e->getMessage()], 500);
|
||||
}
|
||||
// Bridge DB Setup: direkte Angaben aus dem EmailTemplate-Backend.
|
||||
@@ -96,7 +96,7 @@ $bridgeConfig = [
|
||||
],
|
||||
|
||||
// Optional: Tabellen-Whitelist
|
||||
'tables_allow' => ['event', 'mail_accounts', 'users', 'verification_codes'], // z.B. ['customers', 'orders']
|
||||
// 'tables_allow' => ['event', 'mail_accounts', 'users', 'verification_codes'], // z.B. ['customers', 'orders']
|
||||
];
|
||||
|
||||
|
||||
|
||||