dbxapp
4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
dbxapp.de
Portal
Start
Anwender
Entwickler
KI-Bereiche
Loading...
Searching...
No Matches
dbxSearchTemplate_test.php
Go to the documentation of this file.
1
<?php
2
3
require_once dirname(__DIR__, 2) .
'/vendor/autoload.php'
;
4
require_once dirname(__DIR__) .
'/dbxKernel.php'
;
5
6
$form
=
dbx
()->get_system_obj(
'dbxForm'
);
7
$token
=
$form
->create_fld(array(
8
'name'
=>
'probe'
,
9
'tpl'
=>
'dbx|search'
,
10
'data'
=> array(
11
'name'
=>
'probe'
,
12
'label'
=>
'<strong>Suche</strong>'
,
13
),
14
'options'
=> array(),
15
'value'
=>
'"><script>alert(1)</script>'
,
16
'error'
=> 0,
17
'verify'
=> 1,
18
), 7);
19
20
$norepKey
= trim((
string
)
$token
,
'[]'
);
21
$html
= (string)(
$_SESSION
[
'dbx'
][
'norep'
][
$norepKey
] ??
''
);
22
if
(
$html
===
''
) {
23
fwrite(STDERR,
"FAIL: dbxForm hat das Suchfeld nicht gerendert.\n"
);
24
exit
(1);
25
}
26
if
(strpos(
$html
,
'<strong>Suche</strong>'
) ===
false
) {
27
fwrite(STDERR,
"FAIL: Vertrauenswuerdiges Template-HTML wurde escaped.\n"
);
28
exit
(2);
29
}
30
if
(strpos(
$html
,
'value=""><script>alert(1)</script>"'
) ===
false
) {
31
fwrite(STDERR,
"FAIL: Der Benutzerwert wurde nicht einmal korrekt escaped.\n"
);
32
exit
(3);
33
}
34
if
(strpos(
$html
,
'&quot;'
) !==
false
|| strpos(
$html
,
'&lt;'
) !==
false
) {
35
fwrite(STDERR,
"FAIL: Der Benutzerwert wurde doppelt escaped.\n"
);
36
exit
(4);
37
}
38
if
(strpos(
$html
,
'value=""><script>alert(1)</script>'
) !==
false
) {
39
fwrite(STDERR,
"FAIL: Der Benutzerwert wurde als HTML ausgegeben.\n"
);
40
exit
(5);
41
}
42
if
(strpos(
$html
,
'id="probe_7"'
) ===
false
|| strpos(
$html
,
'for="probe_7"'
) ===
false
) {
43
fwrite(STDERR,
"FAIL: Label und Eingabefeld verwenden keine gemeinsame Template-ID.\n"
);
44
exit
(6);
45
}
46
if
(strpos(
$html
,
'class="dbx-search-icon"'
) ===
false
|| strpos(
$html
,
'class="dbx-clear-btn"'
) ===
false
) {
47
fwrite(STDERR,
"FAIL: Lupe oder Reset-Schaltflaeche fehlt im Suchfeld-Template.\n"
);
48
exit
(7);
49
}
50
51
echo
"OK: Suchfeld nutzt dbxForm/dbxTPL; Template-HTML bleibt erhalten und Benutzerwerte werden einmal escaped.\n"
;
$form
$form
Definition
dbxActionTokenAutomation_test.php:260
$_SESSION
$_SESSION
Definition
dbxActionTokenAutomation_test.php:11
$token
$token
Definition
dbxSearchTemplate_test.php:7
$norepKey
$norepKey
Definition
dbxSearchTemplate_test.php:20
$html
$html
Definition
dbxSearchTemplate_test.php:21
exit
exit
Definition
index.php:146
dbx
DBX schema administration.
dbx
include
tests
dbxSearchTemplate_test.php
Generated by
1.17.0