3 namespace Friendica\Module\Admin;
5 use Friendica\Core\Renderer;
7 use Friendica\Module\BaseAdminModule;
9 class Tos extends BaseAdminModule
11 public static function post(array $parameters = [])
13 parent::post($parameters);
15 parent::checkFormSecurityTokenRedirectOnError('/admin/tos', 'admin_tos');
17 if (empty($_POST['page_tos'])) {
21 $displaytos = !empty($_POST['displaytos']);
22 $displayprivstatement = !empty($_POST['displayprivstatement']);
23 $tostext = (!empty($_POST['tostext']) ? strip_tags(trim($_POST['tostext'])) : '');
25 DI::config()->set('system', 'tosdisplay', $displaytos);
26 DI::config()->set('system', 'tosprivstatement', $displayprivstatement);
27 DI::config()->set('system', 'tostext', $tostext);
29 info(DI::l10n()->t('The Terms of Service settings have been updated.'));
31 DI::baseUrl()->redirect('admin/tos');
34 public static function content(array $parameters = [])
36 parent::content($parameters);
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'),