-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathphplist-settings.php
More file actions
68 lines (59 loc) · 1.82 KB
/
Copy pathphplist-settings.php
File metadata and controls
68 lines (59 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
function simplesamlDefaultSettings(): array
{
return [
'simplesaml' => 'Saml',
'hide_default_login' => false,
'saml_idp' => 'https://sso.phplist.com:8443/realms/master',
'saml_entity_id' => 'phplisttest',
'saml_realm' => 'master',
'saml_trusted_url_domains' => 'localhost',
'saml_session_cookie_domain' => '.localhost',
'saml_session_save_path' => '/var/lib/php/sessions',
'saml_secret_salt' => 'defaultsecretsalt',
'saml_admin_password' => '123',
];
}
function simplesamlHasConfigValue($value): bool
{
return !($value === false || $value === null || $value === '');
}
function simplesamlBootstrapPhpList(): void
{
if (function_exists('getConfig')) {
return;
}
$documentRoot = rtrim((string) ($_SERVER['DOCUMENT_ROOT'] ?? ''), '/');
$candidates = [
$documentRoot . '/lists/admin/defaultconfig.php',
dirname(__DIR__, 4) . '/defaultconfig.php',
dirname(__DIR__, 5) . '/admin/defaultconfig.php',
dirname(__DIR__, 6) . '/lists/admin/defaultconfig.php',
];
foreach (array_unique($candidates) as $candidate) {
if ($candidate === '' || strpos($candidate, '//') !== false) {
continue;
}
if (is_file($candidate)) {
require_once $candidate;
}
if (function_exists('getConfig')) {
return;
}
}
}
function simplesamlLoadSettings(): array
{
$settings = simplesamlDefaultSettings();
simplesamlBootstrapPhpList();
if (!function_exists('getConfig')) {
return $settings;
}
foreach ($settings as $key => $defaultValue) {
$configured = getConfig($key);
if (simplesamlHasConfigValue($configured)) {
$settings[$key] = $configured;
}
}
return $settings;
}