dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
public_config_defaults_test.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
10function read_public_config(string $file): array
11{
12 $config = array();
13 require $file;
14 return is_array($config) ? $config : array();
15}
16
17function value_at(array $config, array $path)
18{
20 foreach ($path as $part) {
21 if (!is_array($value) || !array_key_exists($part, $value)) {
22 return null;
23 }
24 $value = $value[$part];
25 }
26 return $value;
27}
28
29$modules = dirname(__DIR__, 2) . '/modules';
30$core = read_public_config($modules . '/dbx/cfg/config.php');
31$login = read_public_config($modules . '/dbxLogin/cfg/config.php');
32$contact = read_public_config($modules . '/dbxContact/cfg/config.php');
33$download = read_public_config($modules . '/dbxDownLoad/cfg/config.php');
34
36 array('core', $core, array('ftp', 'web', 'sftp_host')),
37 array('core', $core, array('ftp', 'web', 'sftp_user')),
38 array('core', $core, array('ftp', 'web', 'sftp_pass')),
39 array('core', $core, array('mail', 'dbxApp', 'host')),
40 array('core', $core, array('mail', 'dbxApp', 'user')),
41 array('core', $core, array('mail', 'dbxApp', 'pass')),
42 array('core', $core, array('mail', 'dbxApp', 'from_email')),
43 array('core', $core, array('mail', 'dbxApp', 'sender')),
44 array('login', $login, array('activity_mail_to')),
45 array('login', $login, array('mail_from')),
46 array('contact', $contact, array('mail_to')),
47 array('contact', $contact, array('mail_from')),
48 array('download', $download, array('mail_from')),
49 array('download', $download, array('token_secret')),
50);
51
52foreach ($mustBeEmpty as [$module, $config, $path]) {
53 if (trim((string)value_at($config, $path)) !== '') {
54 fwrite(STDERR, $module . ': öffentlicher Wert muss leer sein: ' . implode('.', $path) . PHP_EOL);
55 exit(1);
56 }
57}
58
60 array('core', $core, array('db', 'dbxRoundtrip', 'activ')),
61 array('core', $core, array('mail', 'dbxApp', 'auth')),
62 array('login', $login, array('login_mail')),
63 array('login', $login, array('logout_mail')),
64 array('contact', $contact, array('mail_admin_on_request')),
65 array('contact', $contact, array('mail_confirm_requester')),
66 array('contact', $contact, array('mail_on_reply')),
67);
68
69foreach ($disabledFlags as [$module, $config, $path]) {
70 $value = strtolower(trim((string)value_at($config, $path)));
71 if (!in_array($value, array('', '0', 'false', 'off', 'no'), true)) {
72 fwrite(STDERR, $module . ': öffentlicher Schalter muss deaktiviert sein: ' . implode('.', $path) . PHP_EOL);
73 exit(1);
74 }
75}
76
77if (($core['mail_delivery_mode'] ?? '') !== 'internal') {
78 fwrite(STDERR, 'core: öffentlicher Mailstandard muss internal sein.' . PHP_EOL);
79 exit(1);
80}
81
82echo "Public config defaults: OK\n";
if($resolved !==$expectedBase . 'files/test/') $config
exit
Definition index.php:146
read_public_config(string $file)
Öffentliche Defaults dürfen keine installationsbezogenen Ziele oder Geheimnisse enthalten.
foreach($mustBeEmpty as[$module, $config, $path]) $disabledFlags
value_at(array $config, array $path)