1
1
Fork 0

Merge pull request #12458 from MrPetovan/bug/12456-tos-rules

Trim terms of service rules before turning them to an array
This commit is contained in:
Michael Vogel 2022-12-18 06:23:55 +01:00 committed by GitHub
commit af4164b86a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -251,7 +251,7 @@ class System
// Don't show multiple calls from the Database classes to show the essential parts of the callstack
$func['database'] = in_array($func['class'], ['Friendica\Database\DBA', 'Friendica\Database\Database']);
if (!$previous['database'] || !$func['database']) {
if (!$previous['database'] || !$func['database']) {
$classparts = explode("\\", $func['class']);
$callstack[] = array_pop($classparts).'::'.$func['function'];
$previous = $func;
@ -678,7 +678,7 @@ class System
$html = BBCode::convert($rulelist, false, BBCode::EXTERNAL);
$msg = HTML::toPlaintext($html, 0, true);
foreach (explode("\n", $msg) as $line) {
foreach (explode("\n", trim($msg)) as $line) {
$line = trim($line);
if ($line) {
$rules[] = ['id' => (string)++$id, 'text' => $line];

View file

@ -83,8 +83,8 @@ class Tos extends BaseModule
$tpl = Renderer::getMarkupTemplate('tos.tpl');
if ($this->config->get('system', 'tosdisplay')) {
$lines = $this->config->get('system', 'tosrules');
if (!empty($lines)) {
$lines = trim($this->config->get('system', 'tosrules') ?: '');
if ($lines) {
$rules = "[list=1]";
foreach (explode("\n", $lines) as $line) {
$rules .= "\n[*]" . $line;