]> git.mxchange.org Git - friendica.git/blob - src/Module/Admin/Tos.php
Remove join profile table
[friendica.git] / src / Module / Admin / Tos.php
1 <?php
2
3 namespace Friendica\Module\Admin;
4
5 use Friendica\Core\Renderer;
6 use Friendica\DI;
7 use Friendica\Module\BaseAdmin;
8
9 class Tos extends BaseAdmin
10 {
11         public static function post(array $parameters = [])
12         {
13                 parent::post($parameters);
14
15                 parent::checkFormSecurityTokenRedirectOnError('/admin/tos', 'admin_tos');
16
17                 if (empty($_POST['page_tos'])) {
18                         return;
19                 }
20
21                 $displaytos = !empty($_POST['displaytos']);
22                 $displayprivstatement = !empty($_POST['displayprivstatement']);
23                 $tostext = (!empty($_POST['tostext']) ? strip_tags(trim($_POST['tostext'])) : '');
24
25                 DI::config()->set('system', 'tosdisplay', $displaytos);
26                 DI::config()->set('system', 'tosprivstatement', $displayprivstatement);
27                 DI::config()->set('system', 'tostext', $tostext);
28
29                 info(DI::l10n()->t('The Terms of Service settings have been updated.'));
30
31                 DI::baseUrl()->redirect('admin/tos');
32         }
33
34         public static function content(array $parameters = [])
35         {
36                 parent::content($parameters);
37
38                 $tos = new \Friendica\Module\Tos();
39                 $t = Renderer::getMarkupTemplate('admin/tos.tpl');
40                 return Renderer::replaceMacros($t, [
41                         '$title' => DI::l10n()->t('Administration'),
42                         '$page' => DI::l10n()->t('Terms of Service'),
43                         '$displaytos' => ['displaytos', DI::l10n()->t('Display Terms of Service'), DI::config()->get('system', 'tosdisplay'), DI::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.')],
44                         '$displayprivstatement' => ['displayprivstatement', DI::l10n()->t('Display Privacy Statement'), DI::config()->get('system', 'tosprivstatement'), DI::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')],
45                         '$preview' => DI::l10n()->t('Privacy Statement Preview'),
46                         '$privtext' => $tos->privacy_complete,
47                         '$tostext' => ['tostext', DI::l10n()->t('The Terms of Service'), DI::config()->get('system', 'tostext'), DI::l10n()->t('Enter the Terms of Service for your node here. You can use BBCode. Headers of sections should be [h2] and below.')],
48                         '$form_security_token' => parent::getFormSecurityToken('admin_tos'),
49                         '$submit' => DI::l10n()->t('Save Settings'),
50                 ]);
51         }
52 }