dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
dbxContent_cms_image_alignment_test.php
Go to the documentation of this file.
1<?php
2
3class dbxObj {}
4
5require_once dirname(__DIR__) . '/include/dbxContent_cms.class.php';
6
7$class = new ReflectionClass('dbx\\dbxContent_admin\\dbxContent_cms');
8$cms = $class->newInstanceWithoutConstructor();
9$sanitize = $class->getMethod('sanitize_content_html');
10$sanitize->setAccessible(true);
11
12$html = '<p class="dbx-cms-inline-media" style="float: left; margin-right: 1.5rem; position: fixed; color: red;">'
13 . '<img data-cms-media-id="108" src="index.php?dbx_modul=dbxContent&amp;dbx_run1=media&amp;dbx_mid=108">'
14 . '</p><p>Text rechts neben dem Bild.</p>';
16
17if (strpos($out, 'float: left;') === false || strpos($out, 'margin-right: 1.5rem;') === false) {
18 fwrite(STDERR, "FAIL: Linke Bildausrichtung wurde beim Sanitizing entfernt.\n$out\n");
19 exit(1);
20}
21if (strpos($out, 'position:') !== false || strpos($out, 'color:') !== false) {
22 fwrite(STDERR, "FAIL: Nicht freigegebene CSS-Eigenschaften wurden gespeichert.\n$out\n");
23 exit(2);
24}
25
27 $cms,
28 '<img data-cms-media-id="108" class="dbxki-visual" src="index.php?dbx_modul=dbxContent&amp;dbx_run1=media&amp;dbx_mid=108" style="float: left; margin-right: 1.5rem; width: 400px; height: auto; max-width: 100%; max-height: 480px; width: expression(alert(1));">'
29 . '<p>Text rechts neben dem zweiten Bild.</p>'
30);
31if (strpos($bareImage, 'float: left;') === false
32 || strpos($bareImage, 'margin-right: 1.5rem;') === false
33 || strpos($bareImage, 'width: 400px;') === false
34 || strpos($bareImage, 'height: auto;') === false
35 || strpos($bareImage, 'max-width: 100%;') === false
36 || strpos($bareImage, 'max-height: 480px;') === false
37 || strpos($bareImage, 'expression(') !== false) {
38 fwrite(STDERR, "FAIL: Ausrichtung oder Groesse eines Bildes ohne Medien-Wrapper wurde entfernt.\n$bareImage\n");
39 exit(3);
40}
41
43 $cms,
44 '<img src="bild.webp" style="display: block; margin-left: auto; margin-right: auto; transform: rotate(5deg);">'
45);
46if (strpos($centered, 'display: block;') === false
47 || strpos($centered, 'margin-left: auto;') === false
48 || strpos($centered, 'margin-right: auto;') === false
49 || strpos($centered, 'transform:') !== false) {
50 fwrite(STDERR, "FAIL: Zentrierte Bildausrichtung ist ungueltig.\n$centered\n");
51 exit(4);
52}
53
54$ordinary = $sanitize->invoke($cms, '<div style="float: right; text-align: center;">Text</div>');
55if (strpos($ordinary, 'float:') !== false || strpos($ordinary, 'text-align: center;') === false) {
56 fwrite(STDERR, "FAIL: CSS-Whitelist fuer normalen Content ist ungueltig.\n$ordinary\n");
57 exit(5);
58}
59
60echo "OK dbxContent CMS image alignment\n";
Gemeinsame Basisklasse fuer dbXapp-System-, Modul- und Include-Objekte.
Definition dbxKernel.php:63
if(strpos( $out, 'float:left;')===false||strpos( $out, 'margin-right:1.5rem;')===false) if(strpos($out, 'position:') !==false||strpos($out, 'color:') !==false) $bareImage
if(strpos($bareImage, 'float:left;')===false||strpos($bareImage, 'margin-right:1.5rem;')===false||strpos($bareImage, 'width:400px;')===false||strpos($bareImage, 'height:auto;')===false||strpos($bareImage, 'max-width:100%;')===false||strpos($bareImage, 'max-height:480px;')===false||strpos($bareImage, 'expression(') !==false) $centered
if(strpos($centered, 'display:block;')===false||strpos($centered, 'margin-left:auto;')===false||strpos($centered, 'margin-right:auto;')===false||strpos($centered, 'transform:') !==false) $ordinary
exit
Definition index.php:146