52 lines
2.1 KiB
PHP
52 lines
2.1 KiB
PHP
<?php
|
|
/**
|
|
* Standalone-Bootstrap fuer Endpunkte OHNE Shop-Router und OHNE Session:
|
|
* payment_webhook.php (Docroot) und core/payments/cli.php.
|
|
*
|
|
* Bindet den Shop-Kern (DB + Config, Konstanten ROOT_DIR/MAIN_URL) ein und stellt
|
|
* $base_object bereit. Session wird bewusst nicht gestartet.
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
\ini_set('display_errors', '0');
|
|
\error_reporting(E_ALL);
|
|
|
|
$docroot = $_SERVER['DOCUMENT_ROOT'] ?? '';
|
|
if ($docroot === '' || !\is_dir($docroot . '/core')) {
|
|
$docroot = \dirname(__DIR__, 2);
|
|
$_SERVER['DOCUMENT_ROOT'] = $docroot;
|
|
}
|
|
\chdir($docroot);
|
|
|
|
// base.class.php nutzt relative Includes und liest config.inc.php
|
|
require_once $docroot . '/core/base.class.php';
|
|
require_once $docroot . '/core/registry.class.php';
|
|
require_once $docroot . '/core/order.class.php';
|
|
if (\is_file($docroot . '/core/postgres/shop_events.php')) {
|
|
require_once $docroot . '/core/postgres/shop_events.php';
|
|
}
|
|
require_once __DIR__ . '/Registry.php';
|
|
\Payments\Registry::requireCore();
|
|
|
|
$base_object = new base();
|
|
Registry::set('base', $base_object);
|
|
|
|
// 27.09.2026 -- Layout-Objekt (Smarty) auch hier: die Bestellbestaetigung rendert die
|
|
// Positionen ueber DeliveryItemsHTML, das Registry::get('layout_object') holt. Ohne das
|
|
// scheiterte die Mail, wenn der WEBHOOK (nicht die Rueckkehr) die Zahlung abschloss
|
|
// ("Call to a member function assign() on null", Mollie-Test 290616). Der Kunde
|
|
// bekam dann keine Bestaetigung. start() braucht SERVER_NAME (CLI: aus MAIN_URL).
|
|
if (empty($_SERVER['SERVER_NAME']) && \defined('MAIN_URL')) {
|
|
$_SERVER['SERVER_NAME'] = (string) \parse_url((string) MAIN_URL, PHP_URL_HOST);
|
|
}
|
|
$_SERVER['REQUEST_URI'] = $_SERVER['REQUEST_URI'] ?? '/'; // layout.class.php liest sie beim Start
|
|
try {
|
|
require_once $docroot . '/libs/smarty/libs/Smarty.class.php';
|
|
require_once $docroot . '/core/layout.class.php';
|
|
$layout_object = new layout();
|
|
$layout_object->start($base_object);
|
|
Registry::set('layout_object', $layout_object);
|
|
} catch (\Throwable $e) {
|
|
\error_log('payments bootstrap: Layout nicht initialisiert -- ' . $e->getMessage());
|
|
}
|