dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
dbxForm_help_audit_test.php
Go to the documentation of this file.
1<?php
2
3$root = dirname(__DIR__, 2);
4$modules = $root . DIRECTORY_SEPARATOR . 'modules';
5$errors = array();
7
8$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($modules, FilesystemIterator::SKIP_DOTS));
9foreach ($it as $file) {
10 if (!$file->isFile() || strtolower($file->getExtension()) !== 'htm') {
11 continue;
12 }
13 $html = (string)file_get_contents($file->getPathname());
14 if (!preg_match('/<form\b/i', $html)) {
15 continue;
16 }
17
18 $hasBar = preg_match('/\‍[tpl=dbx\|(module-bar|form-shell-head|frame-head)\‍]/i', $html)
19 || preg_match('/class="[^"]*(dbx-bar|dbx-auth-panel-head)[^"]*"/i', $html);
20 if (!$hasBar) {
21 continue;
22 }
23 $checked++;
24
25 $usesStandardBar = preg_match('/\‍[tpl=dbx\|(module-bar|form-shell-head|frame-head)\‍]/i', $html);
26 $hasHelpSlot = strpos($html, '{bar_extra}') !== false
27 || strpos($html, '{help_button}') !== false
28 || strpos($html, '{obj:help_button}') !== false;
29 if (!$usesStandardBar && !$hasHelpSlot) {
30 $errors[] = str_replace('\\', '/', substr($file->getPathname(), strlen($root) + 1));
31 }
32}
33
34if ($checked === 0) {
35 fwrite(STDERR, "Keine Formularleisten gefunden.\n");
36 exit(1);
37}
38
39$formClass = (string)file_get_contents($root . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'dbxForm.class.php');
40$reportClass = (string)file_get_contents($root . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'dbxReport.class.php');
41$fallbackTemplate = $modules . DIRECTORY_SEPARATOR . 'dbx' . DIRECTORY_SEPARATOR . 'tpl' . DIRECTORY_SEPARATOR . 'htm' . DIRECTORY_SEPARATOR . 'form-help-bar.htm';
42if (strpos($formClass, 'ensureFormHelpBar($content)') === false
43 || strpos($reportClass, 'ensureFormHelpBar($report_tpl)') === false
44 || strpos($formClass, 'set_form_help_enabled(bool $enabled = true)') === false
45 || !is_file($fallbackTemplate)) {
46 fwrite(STDERR, "Zentrale Help-Leiste fuer dbxForm/dbxReport-Templates ohne eigenen Bar-Slot fehlt.\n");
47 exit(1);
48}
49if ($errors) {
50 fwrite(STDERR, "Formularleisten ohne Help-Slot:\n - " . implode("\n - ", $errors) . "\n");
51 exit(1);
52}
53
54$helpButtonTemplate = (string)file_get_contents($modules . DIRECTORY_SEPARATOR . 'dbxAdmin' . DIRECTORY_SEPARATOR . 'tpl' . DIRECTORY_SEPARATOR . 'htm' . DIRECTORY_SEPARATOR . 'admin-help-button.htm');
55$dbxappTheme = (string)file_get_contents($root . DIRECTORY_SEPARATOR . 'design' . DIRECTORY_SEPARATOR . 'dbxapp' . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . 'theme.css');
56$flowersTheme = (string)file_get_contents($root . DIRECTORY_SEPARATOR . 'design' . DIRECTORY_SEPARATOR . 'flowers' . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . 'theme.css');
57$flowersForm = (string)file_get_contents($root . DIRECTORY_SEPARATOR . 'design' . DIRECTORY_SEPARATOR . 'flowers' . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . 'c-form.css');
58$shopChannelTemplate = (string)file_get_contents($modules . DIRECTORY_SEPARATOR . 'dbxShop_admin' . DIRECTORY_SEPARATOR . 'tpl' . DIRECTORY_SEPARATOR . 'htm' . DIRECTORY_SEPARATOR . 'shop-channel-form.htm');
59$dashboardClass = (string)file_get_contents($modules . DIRECTORY_SEPARATOR . 'dbxAdmin' . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'dbxDashboard.class.php');
60$dashboardCacheActions = (string)file_get_contents($modules . DIRECTORY_SEPARATOR . 'dbxAdmin' . DIRECTORY_SEPARATOR . 'tpl' . DIRECTORY_SEPARATOR . 'htm' . DIRECTORY_SEPARATOR . 'admin-dashboard-content-cache-actions.htm');
61$contextHelpClass = (string)file_get_contents($modules . DIRECTORY_SEPARATOR . 'dbxContent' . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'dbxContentContextHelp.class.php');
62$contentClass = (string)file_get_contents($modules . DIRECTORY_SEPARATOR . 'dbxContent' . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'dbxContent_content.class.php');
63if (strpos($helpButtonTemplate, 'dbx-help-action') === false
64 || strpos($dbxappTheme, '.dbx-help-action') === false
65 || strpos($flowersTheme, '.dbx-help-action') === false
66 || strpos($flowersForm, '.dbx-auth-panel-actions') === false
67 || strpos($shopChannelTemplate, '{channel_edit_button}{channel_help_button}') === false
68 || strpos($dashboardClass, "add_rep('bar_extra', \$this->help_action('cache'))") === false
69 || substr_count($dashboardClass, 'set_form_help_enabled(false)') < 7
70 || strpos($dashboardCacheActions, "</form>\n{bar_extra}") === false) {
71 fwrite(STDERR, "Help-Buttons sind nicht in allen Designs und Sonderleisten als letzte rechte Aktion abgesichert.\n");
72 exit(1);
73}
74
75if (strpos($contextHelpClass, "'template' => 'c-content-help'") === false
76 || strpos($contextHelpClass, "'wrap' => false") === false
77 || strpos($contentClass, "\$renderOptions['template'] = \$forcedTemplate") === false) {
78 fwrite(STDERR, "Kontext-Hilfe wird nicht mit dem medienfreien Hilfe-Template gerendert.\n");
79 exit(1);
80}
81
82echo "OK: {$checked} Formular-Templates mit Leiste besitzen einen zentralen oder eigenen Help-Slot.\n";
foreach( $it as $file) if($checked===0) $formClass
if(strpos( $formClass, 'ensureFormHelpBar( $content)')===false||strpos( $reportClass, 'ensureFormHelpBar( $report_tpl)')===false||strpos( $formClass, 'set_form_help_enabled(bool $enabled=true)')===false||!is_file( $fallbackTemplate)) if($errors) $helpButtonTemplate
exit
Definition index.php:146