3 namespace Friendica\Module\Admin;
5 use Friendica\Core\Config;
6 use Friendica\Core\L10n;
7 use Friendica\Core\Renderer;
9 use Friendica\Module\BaseAdminModule;
11 class Tos extends BaseAdminModule
13 public static function post(array $parameters = [])
15 parent::post($parameters);
17 parent::checkFormSecurityTokenRedirectOnError('/admin/tos', 'admin_tos');
19 if (empty($_POST['page_tos'])) {
23 $displaytos = !empty($_POST['displaytos']);
24 $displayprivstatement = !empty($_POST['displayprivstatement']);
25 $tostext = (!empty($_POST['tostext']) ? strip_tags(trim($_POST['tostext'])) : '');
27 Config::set('system', 'tosdisplay', $displaytos);
28 Config::set('system', 'tosprivstatement', $displayprivstatement);
29 Config::set('system', 'tostext', $tostext);
31 info(DI::l10n()->t('The Terms of Service settings have been updated.'));
33 DI::baseUrl()->redirect('admin/tos');
36 public static function content(array $parameters = [])
38 parent::content($parameters);
40 $tos = new \Friendica\Module\Tos();
41 $t = Renderer::getMarkupTemplate('admin/tos.tpl');
42 return Renderer::replaceMacros($t, [
43 '$title' => DI::l10n()->t('Administration'),
44 '$page' => DI::l10n()->t('Terms of Service'),
45 '$displaytos' => ['displaytos', DI::l10n()->t('Display Terms of Service'), 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.')],
46 '$displayprivstatement' => ['displayprivstatement', DI::l10n()->t('Display Privacy Statement'), 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')],
47 '$preview' => DI::l10n()->t('Privacy Statement Preview'),
48 '$privtext' => $tos->privacy_complete,
49 '$tostext' => ['tostext', DI::l10n()->t('The Terms of Service'), 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.')],
50 '$form_security_token' => parent::getFormSecurityToken('admin_tos'),
51 '$submit' => DI::l10n()->t('Save Settings'),