Elgg  Version master
security_txt.php
Go to the documentation of this file.
1 <?php
9  'contact' => 'https://www.rfc-editor.org/rfc/rfc9116#section-2.5.3',
10  'expires' => 'https://www.rfc-editor.org/rfc/rfc9116#section-2.5.5',
11  'encryption' => 'https://www.rfc-editor.org/rfc/rfc9116#section-2.5.4',
12  'acknowledgments' => 'https://www.rfc-editor.org/rfc/rfc9116#section-2.5.1',
13  'language' => 'https://www.rfc-editor.org/rfc/rfc9116#section-2.5.8',
14  'canonical' => 'https://www.rfc-editor.org/rfc/rfc9116#section-2.5.2',
15  'policy' => 'https://www.rfc-editor.org/rfc/rfc9116#section-2.5.7',
16  'hiring' => 'https://www.rfc-editor.org/rfc/rfc9116#section-2.5.6',
17  'csaf' => 'https://docs.oasis-open.org/csaf/csaf/v2.0/os/csaf-v2.0-os.html#718-requirement-8-securitytxt',
18 ];
19 
20 echo elgg_view_field([
21  '#type' => 'url',
22  '#label' => elgg_echo('admin:security:security_txt:contact'),
23  '#help' => elgg_echo('admin:security:security_txt:contact:help', [elgg_view_url($help_urls['contact'])]),
24  'name' => 'contact',
25  'value' => elgg_extract('contact', $vars),
26  'required' => true,
27  'placeholder' => 'mailto:security@' . elgg_get_site_entity()->getDomain(),
28 ]);
29 
30 echo elgg_view_field([
31  '#type' => 'date',
32  '#label' => elgg_echo('admin:security:security_txt:expires'),
33  '#help' => elgg_echo('admin:security:security_txt:expires:help', [elgg_view_url($help_urls['expires'])]),
34  'name' => 'expires',
35  'value' => elgg_extract('expires', $vars),
36  'required' => true,
37  'timestamp' => true,
38 ]);
39 
40 echo elgg_view_field([
41  '#type' => 'url',
42  '#label' => elgg_echo('admin:security:security_txt:encryption'),
43  '#help' => elgg_echo('admin:security:security_txt:encryption:help', [elgg_view_url($help_urls['encryption'])]),
44  'name' => 'encryption',
45  'value' => elgg_extract('encryption', $vars),
46  'placeholder' => elgg_get_site_url() . 'pgp-key.txt',
47 ]);
48 
49 echo elgg_view_field([
50  '#type' => 'url',
51  '#label' => elgg_echo('admin:security:security_txt:acknowledgments'),
52  '#help' => elgg_echo('admin:security:security_txt:acknowledgments:help', [elgg_view_url($help_urls['acknowledgments'])]),
53  'name' => 'acknowledgments',
54  'value' => elgg_extract('acknowledgments', $vars),
55  'placeholder' => elgg_get_site_url() . 'hall-of-fame.html',
56 ]);
57 
59  'en',
60  elgg_get_config('language'),
62 ];
63 $languages = array_unique($languages);
64 
65 echo elgg_view_field([
66  '#type' => 'text',
67  '#label' => elgg_echo('admin:security:security_txt:language'),
68  '#help' => elgg_echo('admin:security:security_txt:language:help', [elgg_view_url($help_urls['language'])]),
69  'name' => 'language',
70  'value' => elgg_extract('language', $vars),
71  'placeholder' => implode(', ', $languages),
72 ]);
73 
74 echo elgg_view_field([
75  '#type' => 'url',
76  '#label' => elgg_echo('admin:security:security_txt:canonical'),
77  '#help' => elgg_echo('admin:security:security_txt:canonical:help', [elgg_view_url($help_urls['canonical'])]),
78  'name' => 'canonical',
79  'value' => elgg_extract('canonical', $vars),
80  'placeholder' => elgg_generate_url('security.txt'),
81 ]);
82 
83 echo elgg_view_field([
84  '#type' => 'url',
85  '#label' => elgg_echo('admin:security:security_txt:policy'),
86  '#help' => elgg_echo('admin:security:security_txt:policy:help', [elgg_view_url($help_urls['policy'])]),
87  'name' => 'policy',
88  'value' => elgg_extract('policy', $vars),
89  'placeholder' => elgg_get_site_url() . 'security-policy.html',
90 ]);
91 
92 echo elgg_view_field([
93  '#type' => 'url',
94  '#label' => elgg_echo('admin:security:security_txt:hiring'),
95  '#help' => elgg_echo('admin:security:security_txt:hiring:help', [elgg_view_url($help_urls['hiring'])]),
96  'name' => 'hiring',
97  'value' => elgg_extract('hiring', $vars),
98  'placeholder' => elgg_get_site_url() . 'jobs.html',
99 ]);
100 
101 echo elgg_view_field([
102  '#type' => 'url',
103  '#label' => elgg_echo('admin:security:security_txt:csaf'),
104  '#help' => elgg_echo('admin:security:security_txt:csaf:help', [elgg_view_url($help_urls['csaf'])]),
105  'name' => 'csaf',
106  'value' => elgg_extract('csaf', $vars),
107  'placeholder' => elgg_get_site_url() . '.well-known/csaf/provider-metadata.json',
108 ]);
109 
111  '#type' => 'submit',
112  'text' => elgg_echo('save'),
113 ]);
elgg_get_current_language()
Get the current system/user language or &#39;en&#39;.
Definition: languages.php:27
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1112
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
$footer
getDomain()
Get site domain.
Definition: Seeding.php:63
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:254
elgg_set_form_footer(string $footer= '')
Sets form footer and defers its rendering until the form view and extensions have been rendered...
Definition: views.php:1046
$help_urls
Form to configure the contents of the security.txt endpoint.
Definition: security_txt.php:8
elgg_get_site_url()
Get the URL for the current (or specified) site, ending with "/".
elgg_get_site_entity()
Get the current site entity.
Definition: entities.php:99
$vars
Definition: theme.php:5
elgg_view_url(string $href, string $text=null, array $options=[])
Helper function for outputting urls.
Definition: views.php:1427
elgg_generate_url(string $name, array $parameters=[])
Generate a URL for named route.
$languages