3 * @copyright Copyright (C) 2020, Friendica
5 * @license GNU AGPL version 3 or any later version
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 namespace Friendica\Module\Admin;
24 use Friendica\Core\Renderer;
26 use Friendica\Module\BaseAdmin;
28 class Tos extends BaseAdmin
30 public static function post(array $parameters = [])
32 parent::post($parameters);
34 parent::checkFormSecurityTokenRedirectOnError('/admin/tos', 'admin_tos');
36 if (empty($_POST['page_tos'])) {
40 $displaytos = !empty($_POST['displaytos']);
41 $displayprivstatement = !empty($_POST['displayprivstatement']);
42 $tostext = (!empty($_POST['tostext']) ? strip_tags(trim($_POST['tostext'])) : '');
44 DI::config()->set('system', 'tosdisplay', $displaytos);
45 DI::config()->set('system', 'tosprivstatement', $displayprivstatement);
46 DI::config()->set('system', 'tostext', $tostext);
48 info(DI::l10n()->t('The Terms of Service settings have been updated.'));
50 DI::baseUrl()->redirect('admin/tos');
53 public static function content(array $parameters = [])
55 parent::content($parameters);
57 $tos = new \Friendica\Module\Tos();
58 $t = Renderer::getMarkupTemplate('admin/tos.tpl');
59 return Renderer::replaceMacros($t, [
60 '$title' => DI::l10n()->t('Administration'),
61 '$page' => DI::l10n()->t('Terms of Service'),
62 '$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.')],
63 '$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" rel="noopener noreferrer">EU-GDPR</a>.', 'https://en.wikipedia.org/wiki/General_Data_Protection_Regulation')],
64 '$preview' => DI::l10n()->t('Privacy Statement Preview'),
65 '$privtext' => $tos->privacy_complete,
66 '$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.')],
67 '$form_security_token' => parent::getFormSecurityToken('admin_tos'),
68 '$submit' => DI::l10n()->t('Save Settings'),