]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Admin/Tos.php
Merge pull request #12922 from annando/nomad-version
[friendica.git] / src / Module / Admin / Tos.php
index 0e019cc329c3333eb85863a45ff277336716ded9..82377ed66616fb3b3bad33c5669ab08ce4f81960 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
 
 namespace Friendica\Module\Admin;
 
-use Friendica\App\BaseURL;
+use Friendica\App;
 use Friendica\Core\Config\Capability\IManageConfigValues;
 use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
 use Friendica\Module\BaseAdmin;
+use Friendica\Module\Response;
+use Friendica\Util\Profiler;
+use Psr\Log\LoggerInterface;
 
 class Tos extends BaseAdmin
 {
@@ -33,19 +36,16 @@ class Tos extends BaseAdmin
        protected $tos;
        /** @var IManageConfigValues */
        protected $config;
-       /** @var BaseURL */
-       protected $baseUrl;
 
-       public function __construct(\Friendica\Module\Tos $tos, IManageConfigValues $config, BaseURL $baseUrl, L10n $l10n, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IManageConfigValues $config, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
-               $this->tos     = $tos;
+               $this->tos     = new \Friendica\Module\Tos($l10n, $baseUrl, $args, $logger, $profiler, $response, $config, $server, $parameters);
                $this->config  = $config;
-               $this->baseUrl = $baseUrl;
        }
 
-       public function post()
+       protected function post(array $request = [])
        {
                self::checkAdminAccess();
 
@@ -57,16 +57,18 @@ class Tos extends BaseAdmin
 
                $displaytos = !empty($_POST['displaytos']);
                $displayprivstatement = !empty($_POST['displayprivstatement']);
-               $tostext = (!empty($_POST['tostext']) ? strip_tags(trim($_POST['tostext'])) : '');
+               $tostext  = (!empty($_POST['tostext']) ? strip_tags(trim($_POST['tostext'])) : '');
+               $tosrules = (!empty($_POST['tosrules']) ? strip_tags(trim($_POST['tosrules'])) : '');
 
                $this->config->set('system', 'tosdisplay', $displaytos);
                $this->config->set('system', 'tosprivstatement', $displayprivstatement);
                $this->config->set('system', 'tostext', $tostext);
+               $this->config->set('system', 'tosrules', $tosrules);
 
                $this->baseUrl->redirect('admin/tos');
        }
 
-       public function content(): string
+       protected function content(array $request = []): string
        {
                parent::content();
 
@@ -79,6 +81,7 @@ class Tos extends BaseAdmin
                        '$preview' => $this->t('Privacy Statement Preview'),
                        '$privtext' => $this->tos->privacy_complete,
                        '$tostext' => ['tostext', $this->t('The Terms of Service'), $this->config->get('system', 'tostext'), $this->t('Enter the Terms of Service for your node here. You can use BBCode. Headers of sections should be [h2] and below.')],
+                       '$tosrules' => ['tosrules', $this->t('The rules'), $this->config->get('system', 'tosrules'), $this->t('Enter your system rules here. Each line represents one rule.')],
                        '$form_security_token' => self::getFormSecurityToken('admin_tos'),
                        '$submit' => $this->t('Save Settings'),
                ]);