X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FTos.php;h=af64810086b77cbc4016ba2601f7222b00f73b09;hb=8038c1b04ffa723ebd28610fb72927d8d21b3577;hp=2bc3393b2362f65d634d0dcb8e2abbadbf302a33;hpb=aa0b485f3dca72c5448076e913fa54d948cd7731;p=friendica.git
diff --git a/src/Module/Tos.php b/src/Module/Tos.php
index 2bc3393b23..af64810086 100644
--- a/src/Module/Tos.php
+++ b/src/Module/Tos.php
@@ -1,6 +1,6 @@
privacy_operate = DI::l10n()->t('At the time of registration, and for providing communications between the user account and their contacts, the user has to provide a display name (pen name), an username (nickname) and a working email address. The names will be accessible on the profile page of the account by any visitor of the page, even if other profile details are not displayed. The email address will only be used to send the user notifications about interactions, but wont be visibly displayed. The listing of an account in the node\'s user directory or the global user directory is optional and can be controlled in the user settings, it is not necessary for communication.');
- $this->privacy_distribute = DI::l10n()->t('This data is required for communication and is passed on to the nodes of the communication partners and is stored there. Users can enter additional private data that may be transmitted to the communication partners accounts.');
- $this->privacy_delete = DI::l10n()->t('At any point in time a logged in user can export their account data from the account settings. If the user wants to delete their account they can do so at %1$s/removeme. The deletion of the account will be permanent. Deletion of the data will also be requested from the nodes of the communication partners.', DI::baseUrl());
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
+
+ $this->config = $config;
+
+ $this->privacy_operate = $this->t('At the time of registration, and for providing communications between the user account and their contacts, the user has to provide a display name (pen name), an username (nickname) and a working email address. The names will be accessible on the profile page of the account by any visitor of the page, even if other profile details are not displayed. The email address will only be used to send the user notifications about interactions, but wont be visibly displayed. The listing of an account in the node\'s user directory or the global user directory is optional and can be controlled in the user settings, it is not necessary for communication.');
+ $this->privacy_distribute = $this->t('This data is required for communication and is passed on to the nodes of the communication partners and is stored there. Users can enter additional private data that may be transmitted to the communication partners accounts.');
+ $this->privacy_delete = $this->t('At any point in time a logged in user can export their account data from the account settings. If the user wants to delete their account they can do so at %1$s/settings/removeme. The deletion of the account will be permanent. Deletion of the data will also be requested from the nodes of the communication partners.', $this->baseUrl);
// In some cases we don't need every single one of the above separate, but all in one block.
// So here is an array to look over
- $this->privacy_complete = [DI::l10n()->t('Privacy Statement'), $this->privacy_operate, $this->privacy_distribute, $this->privacy_delete];
- }
-
- /**
- * initialize the TOS module.
- *
- * If this is a single user instance, we expect the user to know their
- * dealings with their own node so a TOS is not necessary.
- *
- **/
- public static function init(array $parameters = [])
- {
- if (strlen(DI::config()->get('system','singleuser'))) {
- DI::baseUrl()->redirect('profile/' . DI::config()->get('system','singleuser'));
- }
+ $this->privacy_complete = [$this->t('Privacy Statement'), $this->privacy_operate,
+ $this->privacy_distribute, $this->privacy_delete];
}
/**
@@ -77,20 +75,40 @@ class Tos extends BaseModule
* @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function content(array $parameters = []) {
+ protected function content(array $request = []): string
+ {
+ if ($this->config->get('system', 'singleuser')) {
+ $this->baseUrl->redirect('profile/' . $this->config->get('system', 'singleuser'));
+ }
+
$tpl = Renderer::getMarkupTemplate('tos.tpl');
- if (DI::config()->get('system', 'tosdisplay')) {
+ if ($this->config->get('system', 'tosdisplay')) {
+ $lines = trim($this->config->get('system', 'tosrules') ?: '');
+ if ($lines) {
+ $rules = "[ol]";
+ foreach (explode("\n", $lines) as $line) {
+ if (trim($line)) {
+ $rules .= "\n[*]" . trim($line);
+ }
+ }
+ $rules .= "\n[/ol]\n";
+ } else {
+ $rules = '';
+ }
+
return Renderer::replaceMacros($tpl, [
- '$title' => DI::l10n()->t('Terms of Service'),
- '$tostext' => BBCode::convert(DI::config()->get('system', 'tostext')),
- '$displayprivstatement' => DI::config()->get('system', 'tosprivstatement'),
- '$privstatementtitle' => DI::l10n()->t('Privacy Statement'),
- '$privacy_operate' => DI::l10n()->t('At the time of registration, and for providing communications between the user account and their contacts, the user has to provide a display name (pen name), an username (nickname) and a working email address. The names will be accessible on the profile page of the account by any visitor of the page, even if other profile details are not displayed. The email address will only be used to send the user notifications about interactions, but wont be visibly displayed. The listing of an account in the node\'s user directory or the global user directory is optional and can be controlled in the user settings, it is not necessary for communication.'),
- '$privacy_distribute' => DI::l10n()->t('This data is required for communication and is passed on to the nodes of the communication partners and is stored there. Users can enter additional private data that may be transmitted to the communication partners accounts.'),
- '$privacy_delete' => DI::l10n()->t('At any point in time a logged in user can export their account data from the account settings. If the user wants to delete their account they can do so at %1$s/removeme. The deletion of the account will be permanent. Deletion of the data will also be requested from the nodes of the communication partners.', DI::baseUrl())
+ '$title' => $this->t('Terms of Service'),
+ '$tostext' => BBCode::convert($this->config->get('system', 'tostext')),
+ '$rulestitle' => $this->t('Rules'),
+ '$rules' => BBCode::convert($rules),
+ '$displayprivstatement' => $this->config->get('system', 'tosprivstatement'),
+ '$privstatementtitle' => $this->t('Privacy Statement'),
+ '$privacy_operate' => $this->t('At the time of registration, and for providing communications between the user account and their contacts, the user has to provide a display name (pen name), an username (nickname) and a working email address. The names will be accessible on the profile page of the account by any visitor of the page, even if other profile details are not displayed. The email address will only be used to send the user notifications about interactions, but wont be visibly displayed. The listing of an account in the node\'s user directory or the global user directory is optional and can be controlled in the user settings, it is not necessary for communication.'),
+ '$privacy_distribute' => $this->t('This data is required for communication and is passed on to the nodes of the communication partners and is stored there. Users can enter additional private data that may be transmitted to the communication partners accounts.'),
+ '$privacy_delete' => $this->t('At any point in time a logged in user can export their account data from the account settings. If the user wants to delete their account they can do so at %1$s/settings/removeme. The deletion of the account will be permanent. Deletion of the data will also be requested from the nodes of the communication partners.', $this->baseUrl)
]);
} else {
- return;
+ return '';
}
}
}