]> git.mxchange.org Git - friendica.git/blob - src/Module/Admin/Tos.php
Remove deprecated App::query_string - replace with DI::args()->getQueryString()
[friendica.git] / src / Module / Admin / Tos.php
1 <?php
2
3 namespace Friendica\Module\Admin;
4
5 use Friendica\Core\Config;
6 use Friendica\Core\L10n;
7 use Friendica\Core\Renderer;
8 use Friendica\DI;
9 use Friendica\Module\BaseAdminModule;
10
11 class Tos extends BaseAdminModule
12 {
13         public static function post(array $parameters = [])
14         {
15                 parent::post($parameters);
16
17                 parent::checkFormSecurityTokenRedirectOnError('/admin/tos', 'admin_tos');
18
19                 if (empty($_POST['page_tos'])) {
20                         return;
21                 }
22
23                 $displaytos = !empty($_POST['displaytos']);
24                 $displayprivstatement = !empty($_POST['displayprivstatement']);
25                 $tostext = (!empty($_POST['tostext']) ? strip_tags(trim($_POST['tostext'])) : '');
26
27                 Config::set('system', 'tosdisplay', $displaytos);
28                 Config::set('system', 'tosprivstatement', $displayprivstatement);
29                 Config::set('system', 'tostext', $tostext);
30
31                 info(L10n::t('The Terms of Service settings have been updated.'));
32
33                 DI::baseUrl()->redirect('admin/tos');
34         }
35
36         public static function content(array $parameters = [])
37         {
38                 parent::content($parameters);
39
40                 $tos = new \Friendica\Module\Tos();
41                 $t = Renderer::getMarkupTemplate('admin/tos.tpl');
42                 return Renderer::replaceMacros($t, [
43                         '$title' => L10n::t('Administration'),
44                         '$page' => L10n::t('Terms of Service'),
45                         '$displaytos' => ['displaytos', L10n::t('Display Terms of Service'), Config::get('system', 'tosdisplay'), L10n::t('Enable the Terms of Service page. If this is enabled a link to the terms will be added to the registration form and the general information page.')],
46                         '$displayprivstatement' => ['displayprivstatement', L10n::t('Display Privacy Statement'), Config::get('system', 'tosprivstatement'), L10n::t('Show some informations regarding the needed information to operate the node according e.g. to <a href="%s" target="_blank">EU-GDPR</a>.', 'https://en.wikipedia.org/wiki/General_Data_Protection_Regulation')],
47                         '$preview' => L10n::t('Privacy Statement Preview'),
48                         '$privtext' => $tos->privacy_complete,
49                         '$tostext' => ['tostext', L10n::t('The Terms of Service'), Config::get('system', 'tostext'), L10n::t('Enter the Terms of Service for your node here. You can use BBCode. Headers of sections should be [h2] and below.')],
50                         '$form_security_token' => parent::getFormSecurityToken('admin_tos'),
51                         '$submit' => L10n::t('Save Settings'),
52                 ]);
53         }
54 }