dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
update_homepage_20260728.php
Go to the documentation of this file.
1<?php
2declare(strict_types=1);
3
11
12$base = dirname(__DIR__, 4);
13chdir($base);
14$_SERVER['REQUEST_URI'] = '/dbxapp/';
15$_SERVER['HTTP_HOST'] = 'localhost';
16$_SERVER['HTTPS'] = 'on';
17$_SERVER['SCRIPT_NAME'] = '/dbxapp/index.php';
18
19define('dbxSystem', 'dbxWebApp');
20define('dbxRunAsAdmin', 1);
21
22require $base . '/dbx/vendor/autoload.php';
23require_once $base . '/dbx/include/dbxKernel.php';
24
25$db = dbx()->get_system_obj('dbxDB');
26$dd = dbx()->get_system_obj('dbxDD');
27$mediaDd = 'dbx|dbxMedia';
28$mediaUsageDd = 'dbx|dbxMediaUsage';
29$contentDd = 'dbx|content_de';
30
31$dd->sync_dd_to_db('dbx', 'content_de', 'reset');
32for ($step = 0; $step < 1000; $step++) {
33 $schema = $dd->sync_dd_to_db('dbx', 'content_de', 'apply');
34 if (in_array((string)($schema['status'] ?? ''), array('finished', 'error', 'cancelled'), true)) {
35 break;
36 }
37}
38if (($schema['status'] ?? '') !== 'finished') {
39 throw new RuntimeException(
40 'Die Content-DD konnte nicht synchronisiert werden: '
41 . (string)($schema['message'] ?? $schema['status'] ?? 'unbekannt')
42 );
43}
44
45$media = array(
46 166 => array(
47 'title' => 'dbxapp – eine Plattform für Inhalte, Shop und Anwendungen',
48 'alt' => 'Vernetzte dbxapp Plattform für CMS, Shop und Geschäftsanwendungen',
49 'file_name' => 'dbxapp-platform-hero-20260728.webp',
50 'file_path' => 'media/img/hero/dbxapp-platform-hero-20260728.webp',
51 'mime' => 'image/webp',
52 'width' => 2560,
53 'height' => 640,
54 'media_type' => 'image',
55 'media_folder' => 'hero',
56 'slot' => 'hero',
57 'usage' => 'hero',
58 ),
59 371 => array(
60 'title' => 'Bestehende Systeme neu denken und optimieren',
61 'alt' => 'Getrennte Altsysteme werden als klare modulare dbxapp Lösung neu aufgebaut',
62 'file_name' => 'dbxapp-systeme-neu-denken-20260728.webp',
63 'file_path' => 'media/img/images/dbxapp-systeme-neu-denken-20260728.webp',
64 'mime' => 'image/webp',
65 'width' => 1600,
66 'height' => 900,
67 'media_type' => 'image',
68 'media_folder' => 'images',
69 'slot' => 'inline',
70 'usage' => 'inline',
71 ),
72 432 => array(
73 'title' => 'Mit dbxapp modular und sicher wachsen',
74 'alt' => 'Modulare dbxapp Plattform mit CMS, Shop, Apps, Workflows und Sicherheit',
75 'file_name' => 'dbxapp-modular-wachsen-20260728.webp',
76 'file_path' => 'media/img/images/dbxapp-modular-wachsen-20260728.webp',
77 'mime' => 'image/webp',
78 'width' => 1600,
79 'height' => 900,
80 'media_type' => 'image',
81 'media_folder' => 'images',
82 'slot' => 'inline',
83 'usage' => 'inline',
84 ),
85);
86
87foreach ($media as $id => $record) {
88 $file = $base . '/files/' . $record['file_path'];
89 if (!is_file($file)) {
90 throw new RuntimeException('Homepage-Medium fehlt: ' . $file);
91 }
92 $record['active'] = 1;
93 $record['storage_type'] = 'local';
94 $record['size'] = filesize($file);
95 if ($db->update($mediaDd, $record, $id, 0, 1, 0, 1) !== 1) {
96 throw new RuntimeException('Medium #' . $id . ' konnte nicht aktualisiert werden.');
97 }
98}
99
100$upsertMedia = static function (array $record) use ($db, $mediaDd, $base): int {
101 $file = $base . '/files/' . $record['file_path'];
102 if (!is_file($file)) {
103 throw new RuntimeException('Homepage-Medium fehlt: ' . $file);
104 }
105 $record['active'] = 1;
106 $record['content_id'] = 0;
107 $record['folder_id'] = 0;
108 $record['storage_type'] = 'local';
109 $record['size'] = filesize($file);
110 $rows = $db->select(
111 $mediaDd,
112 array('file_path' => $record['file_path']),
113 'id',
114 'id',
115 'ASC',
116 '',
117 1,
118 0,
119 0
120 );
121 $id = is_array($rows) && isset($rows[0]['id']) ? (int)$rows[0]['id'] : 0;
122 if ($id > 0) {
123 if ($db->update($mediaDd, $record, $id, 0, 1, 0, 1) !== 1) {
124 throw new RuntimeException('Medium #' . $id . ' konnte nicht aktualisiert werden.');
125 }
126 return $id;
127 }
128 if ($db->insert($mediaDd, $record, 0, 1, 0, 1) !== 1) {
129 throw new RuntimeException('Homepage-Medium konnte nicht angelegt werden.');
130 }
131 return (int)$db->get_insert_id();
132};
133
135 'slot' => 'inline',
136 'usage' => 'inline',
137 'sorter' => '0000',
138 'template' => '',
139 'title' => 'dbxapp TV-Spot – bewegtere Fassung',
140 'alt' => 'Formatfüllendes dbxapp Original-Logo als Schlussbild des 30-Sekunden-Spots',
141 'file_name' => 'dbxapp-tvspot-poster-20260730-v3.webp',
142 'file_path' => 'media/img/images/dbxapp-tvspot-poster-20260730-v3.webp',
143 'mime' => 'image/webp',
144 'width' => 1024,
145 'height' => 576,
146 'media_type' => 'image',
147 'media_folder' => 'images',
148));
149
151 'slot' => 'inline',
152 'usage' => 'inline',
153 'sorter' => '0000',
154 'template' => '',
155 'title' => 'dbxapp TV-Spot – bewegtere Fassung',
156 'alt' => 'Dynamischer TV-Spot über Handy, Desktop, KI, CMS, Shop und Datenbanken mit dbxapp',
157 'file_name' => 'dbxapp-tvspot-20260730-v3.mp4',
158 'file_path' => 'media/video/dbxapp-tvspot-20260730-v3.mp4',
159 'thumb_file_path' => 'media/img/images/dbxapp-tvspot-poster-20260730-v3.webp',
160 'mime' => 'video/mp4',
161 'width' => 1024,
162 'height' => 576,
163 'media_type' => 'video',
164 'media_folder' => 'video',
165));
166
167$pages = $db->select(
169 array('permalink' => 'home'),
170 '*',
171 'id',
172 'ASC',
173 '',
174 1,
175 0,
176 0
177);
178$pageId = is_array($pages) && isset($pages[0]['id']) ? (int)$pages[0]['id'] : 0;
179if ($pageId <= 0) {
180 throw new RuntimeException('Die deutsche Startseite mit Permalink "home" wurde nicht gefunden.');
181}
182
183$content = <<<'HTML'
184<div class="dbx-home-hero-copy text-white">
185 <p class="text-uppercase fw-semibold mb-2">Eine Plattform. Klare Abläufe.</p>
186 <h2 class="display-5 fw-bold text-white mb-3">Website, Shop und Anwendungen aus einem Kern.</h2>
187 <p class="lead mb-4">dbxapp verbindet Inhalte, Verkauf, Daten und individuelle Prozesse – modular, sicher und passend zu Ihrem Unternehmen.</p>
188 <a class="btn btn-primary btn-lg me-2 mb-2" href="demo">Demo ansehen</a>
189 <a class="btn btn-outline-light btn-lg mb-2" href="kontakt">Projekt besprechen</a>
190</div>
191<hr class="dbx-cms-marker dbx-cms-marker-hero" contenteditable="false" data-dbx-marker="dbx:hero" data-label="Hero">
192
193<div class="row g-4 mb-5">
194 <div class="col-12">
195 <p class="text-uppercase fw-semibold text-primary mb-2">30 Sekunden dbxapp</p>
196 <h2>Eine Plattform in Bewegung.</h2>
197 <p>Handy, Desktop, KI, CMS, aktiver Shop und Datenbanken in einem noch schnelleren Schnitt – die Lösung: dbxapp. Ton kann direkt im Player aktiviert werden.</p>
198 <div class="d-flex flex-wrap gap-2">
199 <span class="badge text-bg-primary">Handy</span>
200 <span class="badge text-bg-primary">Desktop</span>
201 <span class="badge text-bg-primary">KI</span>
202 <span class="badge text-bg-primary">CMS</span>
203 <span class="badge text-bg-primary">Shop</span>
204 <span class="badge text-bg-primary">Datenbank</span>
205 </div>
206 </div>
207 <div class="col-12">
208 <div class="ratio ratio-16x9 rounded-4 overflow-hidden shadow">
209 <figure class="dbx-cms-inline-media dbx-cms-inline-video-block" data-cms-media-id="{VIDEO_ID}" data-cms-media-slot="inline" data-cms-video-url="index.php?dbx_modul=dbxContent&amp;dbx_run1=media&amp;dbx_mid={VIDEO_ID}" data-cms-video-type="video" data-cms-video-mime="video/mp4" data-cms-video-autoplay="0" data-cms-video-loop="0" data-cms-video-muted="0">
210 <img class="dbx-cms-inline-video-thumb" src="index.php?dbx_modul=dbxContent&amp;dbx_run1=media&amp;dbx_mid={POSTER_ID}" alt="dbxapp TV-Spot" title="dbxapp TV-Spot" data-cms-media-id="{VIDEO_ID}" data-cms-media-slot="inline">
211 <span class="dbx-cms-inline-video-play" aria-hidden="true"><i class="bi bi-play-fill"></i></span>
212 </figure>
213 </div>
214 </div>
215</div>
216
217<div class="row g-3 mb-5">
218 <div class="col-sm-6 col-xl-3"><a class="card h-100 text-decoration-none shadow-sm" href="cms-website"><div class="card-body"><i class="bi bi-file-earmark-richtext fs-2 text-primary"></i><h2 class="h5 mt-3">Website &amp; CMS</h2><p class="text-body-secondary mb-0">Seiten, Medien, Designs und Sprachen einfach pflegen.</p></div></a></div>
219 <div class="col-sm-6 col-xl-3"><a class="card h-100 text-decoration-none shadow-sm" href="shop-multichannel"><div class="card-body"><i class="bi bi-bag-check fs-2 text-primary"></i><h2 class="h5 mt-3">Shop &amp; Verkauf</h2><p class="text-body-secondary mb-0">Produkte, Bestellungen und Kanäle klar organisieren.</p></div></a></div>
220 <div class="col-sm-6 col-xl-3"><a class="card h-100 text-decoration-none shadow-sm" href="individuelle-anwendungen"><div class="card-body"><i class="bi bi-grid-1x2 fs-2 text-primary"></i><h2 class="h5 mt-3">Individuelle Apps</h2><p class="text-body-secondary mb-0">Formulare, Reports und Workflows passend zur Aufgabe.</p></div></a></div>
221 <div class="col-sm-6 col-xl-3"><a class="card h-100 text-decoration-none shadow-sm" href="intranet-portale"><div class="card-body"><i class="bi bi-people fs-2 text-primary"></i><h2 class="h5 mt-3">Portale &amp; Intranet</h2><p class="text-body-secondary mb-0">Geschützte Lösungen für Teams, Kunden und Partner.</p></div></a></div>
222</div>
223
224<div class="row g-4 mb-5">
225 <div class="col-lg-6">
226 <article class="card h-100 overflow-hidden shadow-sm">
227 <img class="card-img-top" src="index.php?dbx_modul=dbxContent&amp;dbx_run1=media&amp;dbx_mid=371" alt="Bestehende Systeme werden neu gedacht" loading="lazy">
228 <div class="card-body">
229 <h2 class="h4">Bestehende Systeme besser aufbauen.</h2>
230 <p class="mb-0"><strong>Bestehende Systeme lassen sich leicht nachbilden und optimieren.</strong> Bewährte Funktionen bleiben erhalten, während Datenmodelle, Bedienung und Abläufe klarer und einheitlicher werden.</p>
231 </div>
232 </article>
233 </div>
234 <div class="col-lg-6">
235 <article class="card h-100 overflow-hidden shadow-sm">
236 <img class="card-img-top" src="index.php?dbx_modul=dbxContent&amp;dbx_run1=media&amp;dbx_mid=432" alt="dbxapp wächst modular mit den Anforderungen" loading="lazy">
237 <div class="card-body">
238 <h2 class="h4">Klein starten. Sicher wachsen.</h2>
239 <p class="mb-0">Ein gemeinsamer Kern für Benutzer, Rechte, Daten, Formulare, Reports und Templates. Neue Module ergänzen die Lösung, ohne ein neues Inselsystem zu schaffen.</p>
240 </div>
241 </article>
242 </div>
243</div>
244
245<div class="alert alert-primary shadow-sm d-lg-flex align-items-center justify-content-between gap-4 mb-0">
246 <div><h2 class="h4 mb-1">Passt dbxapp zu Ihrem Vorhaben?</h2><p class="mb-lg-0">Als Full Service, selbst betrieben, im Intranet oder auf eigener Infrastruktur.</p></div>
247 <div class="text-nowrap mt-3 mt-lg-0"><a class="btn btn-primary me-2" href="demo">Demo anfordern</a><a class="btn btn-outline-primary" href="kontakt">Beratung</a></div>
248</div>
249HTML;
250
251$content = str_replace(
252 array('{POSTER_ID}', '{VIDEO_ID}'),
253 array((string)$posterId, (string)$videoId),
255);
256
257$updated = $db->update($contentDd, array(
258 'title' => 'dbxapp – CMS, Shop und Anwendungen',
259 'menu_title' => 'Home',
260 'seo_title' => 'dbxapp: CMS, Shop und individuelle Anwendungen',
261 'description' => 'dbxapp verbindet Website und CMS, Shop, Portale und individuelle Geschäftsanwendungen in einer modularen Plattform.',
262 'keywords' => 'dbxapp, CMS, Shop, Geschäftsanwendung, Portal, Workflow, Self-Hosting',
263 'template' => 'c-title-hero_header-body1-footer',
264 'content' => $content,
265 'hero_template' => 'image-hero',
266 'hero_image_id' => '166',
267 'hero_margin_top' => '0',
268 'hero_height' => '420px',
269 'hero_variant' => 'original',
270 'hero_sticky' => '0',
271 'hero_scroll_layer' => 'under',
272 'seo_image_id' => 166,
273 'lng_rev' => (int)($pages[0]['lng_rev'] ?? 0) + 1,
274), $pageId, 0, 1, 0, 1);
275
276if ($updated !== 1) {
277 throw new RuntimeException('Die deutsche Startseite konnte nicht aktualisiert werden (Rückgabe '
278 . var_export($updated, true) . ').');
279}
280
281// Die Medienzuordnung spiegelt verbindlich den gerenderten Seitenaufbau:
282// Hero getrennt vom HTML, Inline-Medien ausschließlich aus dem Content.
284 'hero' => array(166),
285 'inline' => array($videoId, 371, 432),
286);
289 'content_id = ' . $pageId . ' AND active = 1',
290 '*',
291 'sorter,id',
292 'ASC',
293 '',
294 0,
295 0,
296 0
297);
298$kept = array('hero' => array(), 'inline' => array());
299foreach (is_array($activeUsage) ? $activeUsage : array() as $usage) {
300 $slot = (string)($usage['slot'] ?? '');
301 if (!array_key_exists($slot, $wantedUsage)) {
302 continue;
303 }
304 $mediaId = (int)($usage['media_id'] ?? 0);
305 if (in_array($mediaId, $wantedUsage[$slot], true) && empty($kept[$slot][$mediaId])) {
306 $kept[$slot][$mediaId] = true;
307 continue;
308 }
309 $usageId = (int)($usage['id'] ?? 0);
310 if ($usageId > 0 && $db->update($mediaUsageDd, array('active' => 0), $usageId, 0, 1, 0, 1) !== 1) {
311 throw new RuntimeException('Veraltete Medienzuordnung #' . $usageId . ' konnte nicht deaktiviert werden.');
312 }
313}
314foreach ($wantedUsage as $slot => $mediaIds) {
315 foreach (array_values(array_unique(array_map('intval', $mediaIds))) as $position => $mediaId) {
316 if ($mediaId <= 0 || !empty($kept[$slot][$mediaId])) {
317 continue;
318 }
319 $usage = array(
320 'active' => 1,
321 'media_id' => $mediaId,
322 'content_id' => $pageId,
323 'folder_id' => 0,
324 'slot' => $slot,
325 'sorter' => str_pad((string)$position, 4, '0', STR_PAD_LEFT),
326 'template' => '',
327 'caption' => '',
328 'settings' => '',
329 );
330 if ($db->insert($mediaUsageDd, $usage, 0, 1, 0, 1) !== 1) {
331 throw new RuntimeException('Medienzuordnung für #' . $mediaId . ' (' . $slot . ') konnte nicht angelegt werden.');
332 }
333 }
334}
335
336dbx()->load_content_cache_classes();
339if (class_exists(\dbx\dbxContent\dbxContentSitemap::class)) {
341}
342
343echo json_encode(array(
344 'ok' => true,
345 'page_id' => $pageId,
346 'poster_id' => $posterId,
347 'video_id' => $videoId,
348 'media_replaced' => array_keys($media),
349), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . PHP_EOL;
if(!is_array( $before)||(int)( $before[ 'id'] ?? 0) !==$mediaId) if((string)($before['media_type'] ?? '') !=='video') $updated
$_SERVER['REQUEST_METHOD']
DBX schema administration.
for( $step=0;$step< 1000;$step++) if(($schema['status'] ?? '') !=='finished') $media
foreach($media as $id=> $record) $upsertMedia
if($updated !==1) $wantedUsage