Skip to content

Commit

Permalink
Improved: show Terms of Service in config menu (FreshRSS#5215)
Browse files Browse the repository at this point in the history
* Use constants for path to TOS

* improve comments

* TOS title moved to template

* TOS available via config menu

* CSS: improve handling of content of TOS/about

* give info about set/unset TOS in system config

* fix target

* i18n FR

* i18n DE
  • Loading branch information
math-GH authored Mar 21, 2023
1 parent 34f6289 commit e679d3d
Show file tree
Hide file tree
Showing 60 changed files with 193 additions and 348 deletions.
2 changes: 1 addition & 1 deletion app/Controllers/authController.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public function registerAction() {
Minz_Error::error(403);
}

$this->view->show_tos_checkbox = file_exists(join_path(DATA_PATH, 'tos.html'));
$this->view->show_tos_checkbox = file_exists(TOS_FILENAME);
$this->view->show_email_field = FreshRSS_Context::$system_conf->force_email_validation;
$this->view->preferred_language = Minz_Translate::getLanguage(null, Minz_Request::getPreferredLanguages(), FreshRSS_Context::$system_conf->language);
FreshRSS_View::prependTitle(_t('gen.auth.registration.title') . ' · ');
Expand Down
6 changes: 3 additions & 3 deletions app/Controllers/indexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,13 @@ public function aboutAction() {
}

/**
* This action displays the EULA page of FreshRSS.
* This action displays the EULA/TOS (Terms of Service) page of FreshRSS.
* This page is enabled only if admin created a data/tos.html file.
* The content of the page is the content of data/tos.html.
* It returns 404 if there is no EULA.
* It returns 404 if there is no EULA/TOS.
*/
public function tosAction() {
$terms_of_service = file_get_contents(join_path(DATA_PATH, 'tos.html'));
$terms_of_service = file_get_contents(TOS_FILENAME);
if (!$terms_of_service) {
Minz_Error::error(404);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Controllers/userController.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public function createAction() {
);
}

$tos_enabled = file_exists(join_path(DATA_PATH, 'tos.html'));
$tos_enabled = file_exists(TOS_FILENAME);
$accept_tos = Minz_Request::param('accept_tos', false);

if ($system_conf->force_email_validation && empty($email)) {
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/cz/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => 'Registrační formulář uživatele',
),
'tos' => array(
'disabled' => 'is not given', // TODO
'enabled' => '<a href="./?a=tos">is enabled</a>', // TODO
'help' => 'How to <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">enable the Terms of Service</a>', // TODO
),
),
'update' => array(
'_' => 'Aktualizace systému',
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/de/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => 'Benutzer-Registrierungsformular',
),
'tos' => array(
'disabled' => 'sind nicht aktiviert',
'enabled' => '<a href="./?a=tos">sind aktiv</a>',
'help' => 'So werden die <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">Nutzungsbedingungen aktiviert</a>',
),
),
'update' => array(
'_' => 'System aktualisieren',
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/el/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => 'Φόρμα εγγραφής χρήστη',
),
'tos' => array(
'disabled' => 'is not given', // TODO
'enabled' => '<a href="./?a=tos">is enabled</a>', // TODO
'help' => 'How to <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">enable the Terms of Service</a>', // TODO
),
),
'update' => array(
'_' => 'Ενημέρωση συστήματος',
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/en-us/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => 'User registration form', // IGNORE
),
'tos' => array(
'disabled' => 'is not given', // IGNORE
'enabled' => '<a href="./?a=tos">is enabled</a>', // IGNORE
'help' => 'How to <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">enable the Terms of Service</a>', // IGNORE
),
),
'update' => array(
'_' => 'Update system', // IGNORE
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/en/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => 'User registration form',
),
'tos' => array(
'disabled' => 'is not given', // TODO
'enabled' => '<a href="./?a=tos">is enabled</a>', // TODO
'help' => 'How to <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">enable the Terms of Service</a>', // TODO
),
),
'update' => array(
'_' => 'Update system',
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/es/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => 'Formulario de registro del usuario',
),
'tos' => array(
'disabled' => 'is not given', // TODO
'enabled' => '<a href="./?a=tos">is enabled</a>', // TODO
'help' => 'How to <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">enable the Terms of Service</a>', // TODO
),
),
'update' => array(
'_' => 'Actualizar sistema',
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/fr/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => 'Formulaire d’inscription utilisateur',
),
'tos' => array(
'disabled' => 'non renseigné',
'enabled' => '<a href="./?a=tos">activées</a>',
'help' => 'Comment <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">activer les conditions d’utilisation</a>',
),
),
'update' => array(
'_' => 'Système de mise à jour',
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/he/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => 'User registration form', // TODO
),
'tos' => array(
'disabled' => 'is not given', // TODO
'enabled' => '<a href="./?a=tos">is enabled</a>', // TODO
'help' => 'How to <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">enable the Terms of Service</a>', // TODO
),
),
'update' => array(
'_' => 'מערכת העדכון',
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/id/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => 'Formulir Pendaftaran Pengguna',
),
'tos' => array(
'disabled' => 'is not given', // TODO
'enabled' => '<a href="./?a=tos">is enabled</a>', // TODO
'help' => 'How to <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">enable the Terms of Service</a>', // TODO
),
),
'update' => array(
'_' => 'Update system', // TODO
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/it/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => 'Form di registrazione utente',
),
'tos' => array(
'disabled' => 'is not given', // TODO
'enabled' => '<a href="./?a=tos">is enabled</a>', // TODO
'help' => 'How to <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">enable the Terms of Service</a>', // TODO
),
),
'update' => array(
'_' => 'Aggiornamento sistema',
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/ja/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => 'ユーザー登録',
),
'tos' => array(
'disabled' => 'is not given', // TODO
'enabled' => '<a href="./?a=tos">is enabled</a>', // TODO
'help' => 'How to <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">enable the Terms of Service</a>', // TODO
),
),
'update' => array(
'_' => 'システムアップデート',
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/ko/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => '사용자 회원가입 양식',
),
'tos' => array(
'disabled' => 'is not given', // TODO
'enabled' => '<a href="./?a=tos">is enabled</a>', // TODO
'help' => 'How to <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">enable the Terms of Service</a>', // TODO
),
),
'update' => array(
'_' => '업데이트',
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/nl/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => 'Gebruikersregistratieformulier',
),
'tos' => array(
'disabled' => 'is not given', // TODO
'enabled' => '<a href="./?a=tos">is enabled</a>', // TODO
'help' => 'How to <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">enable the Terms of Service</a>', // TODO
),
),
'update' => array(
'_' => 'Versie controle',
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/oc/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => 'Formulari d’inscripcion utilizaire',
),
'tos' => array(
'disabled' => 'is not given', // TODO
'enabled' => '<a href="./?a=tos">is enabled</a>', // TODO
'help' => 'How to <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">enable the Terms of Service</a>', // TODO
),
),
'update' => array(
'_' => 'Sistèma de mesa a jorn',
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/pl/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => 'Formularz rejestracji użytkowników',
),
'tos' => array(
'disabled' => 'is not given', // TODO
'enabled' => '<a href="./?a=tos">is enabled</a>', // TODO
'help' => 'How to <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">enable the Terms of Service</a>', // TODO
),
),
'update' => array(
'_' => 'Aktualizacja',
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/pt-br/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => 'Formulário de Cadastro de Usuário',
),
'tos' => array(
'disabled' => 'is not given', // TODO
'enabled' => '<a href="./?a=tos">is enabled</a>', // TODO
'help' => 'How to <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">enable the Terms of Service</a>', // TODO
),
),
'update' => array(
'_' => 'Atualização do sistema',
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/ru/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => 'Форма регистрации пользователей',
),
'tos' => array(
'disabled' => 'is not given', // TODO
'enabled' => '<a href="./?a=tos">is enabled</a>', // TODO
'help' => 'How to <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">enable the Terms of Service</a>', // TODO
),
),
'update' => array(
'_' => 'Обновление системы',
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/sk/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => 'Registračný formulár používateľa',
),
'tos' => array(
'disabled' => 'is not given', // TODO
'enabled' => '<a href="./?a=tos">is enabled</a>', // TODO
'help' => 'How to <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">enable the Terms of Service</a>', // TODO
),
),
'update' => array(
'_' => 'Aktualizácia systému',
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/tr/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => 'Kullanıcı kayıt formu',
),
'tos' => array(
'disabled' => 'is not given', // TODO
'enabled' => '<a href="./?a=tos">is enabled</a>', // TODO
'help' => 'How to <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">enable the Terms of Service</a>', // TODO
),
),
'update' => array(
'_' => 'Sistem güncelleme',
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/zh-cn/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => '用户注册表单',
),
'tos' => array(
'disabled' => 'is not given', // TODO
'enabled' => '<a href="./?a=tos">is enabled</a>', // TODO
'help' => 'How to <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">enable the Terms of Service</a>', // TODO
),
),
'update' => array(
'_' => '更新系统',
Expand Down
5 changes: 5 additions & 0 deletions app/i18n/zh-tw/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
),
'title' => '使用者註冊表單',
),
'tos' => array(
'disabled' => 'is not given', // TODO
'enabled' => '<a href="./?a=tos">is enabled</a>', // TODO
'help' => 'How to <a href="https://freshrss.github.io/FreshRSS/en/admins/12_User_management.html#enable-terms-of-service-tos" target="_blank">enable the Terms of Service</a>', // TODO
),
),
'update' => array(
'_' => '更新系統',
Expand Down
5 changes: 5 additions & 0 deletions app/layout/aside_configure.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@
<li class="item<?= Minz_Request::actionName() === 'about' ? ' active' : '' ?>">
<a href="<?= _url('index', 'about') ?>"><?= _t('gen.menu.about') ?></a>
</li>
<?php if (file_exists(TOS_FILENAME)) { ?>
<li class="item">
<a href="<?= _url('index', 'tos') ?>"><?= _t('index.tos.title')?></a>
</li>
<?php } ?>
</ul>
</li>
</ul>
Expand Down
5 changes: 5 additions & 0 deletions app/layout/header.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@
<ul>
<li class="item"><a href="<?= _url('index', 'logs') ?>"><?= _t('gen.menu.logs') ?></a></li>
<li class="item"><a href="<?= _url('index', 'about') ?>"><?= _t('gen.menu.about') ?></a></li>
<?php if (file_exists(TOS_FILENAME)) { ?>
<li class="item">
<a href="<?= _url('index', 'tos') ?>"><?= _t('index.tos.title')?></a>
</li>
<?php } ?>
<?= Minz_ExtensionManager::callHook('menu_other_entry') ?>
</ul>
</li>
Expand Down
13 changes: 13 additions & 0 deletions app/views/configure/system.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,19 @@
</div>
</div>

<div class="form-group">
<label class="group-name"><?= _t('index.tos.title') ?></label>
<div class="group-controls">
<?php if (file_exists(TOS_FILENAME)) { ?>
<?= _t('admin.system.tos.enabled') ?>
<?php
} else { ?>
<?= _t('admin.system.tos.disabled') ?>
<p class="help"><?= _i('help') ?> <?= _t('admin.system.tos.help') ?></p>
<?php } ?>
</div>
</div>

<div class="form-group">
<div class="group-controls">
<label class="checkbox" for="force-email-validation">
Expand Down
2 changes: 1 addition & 1 deletion app/views/index/about.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}
?>

<main class="post content">
<main class="post content<?= !FreshRSS_Auth::hasAccess() ? ' centered' : ''?>">
<?php if (FreshRSS_Auth::hasAccess()) {?>
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
Expand Down
33 changes: 24 additions & 9 deletions app/views/index/tos.phtml
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
<?php /** @var FreshRSS_View $this */ ?>
<main class="post content">
<?php if ($this->can_register) { ?>
<a href="<?= _url('auth', 'register') ?>">
<?= _t('gen.action.back') ?>
</a>
<?php
/** @var FreshRSS_View $this */
if (FreshRSS_Auth::hasAccess()) {
$this->partial('aside_configure');
}
?>

<main class="post content<?= !FreshRSS_Auth::hasAccess() ? ' centered' : ''?>">
<?php if (FreshRSS_Auth::hasAccess()) {?>
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
</div>
<?php } elseif ($this->can_register) { ?>
<div class="link-back-wrapper">
<a href="<?= _url('auth', 'register') ?>">
<?= _t('gen.action.back') ?>
</a>
</div>
<?php } else { ?>
<a href="<?= _url('index', 'index') ?>">
<?= _t('gen.action.back') ?>
</a>
<div class="link-back-wrapper">
<a href="<?= _url('index', 'index') ?>">
<?= _t('gen.action.back') ?>
</a>
</div>
<?php } ?>

<h1><?= _t('index.tos.title')?></h1>
<?= $this->terms_of_service ?>
</main>
3 changes: 2 additions & 1 deletion constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
defined('LOG_FILENAME') or define('LOG_FILENAME', 'log.txt');
defined('ADMIN_LOG') or define('ADMIN_LOG', USERS_PATH . '/_/' . LOG_FILENAME);
defined('API_LOG') or define('API_LOG', USERS_PATH . '/_/log_api.txt');
defined('TOS_FILENAME') or define('TOS_FILENAME', DATA_PATH . '/tos.html');
defined('CACHE_PATH') or define('CACHE_PATH', DATA_PATH . '/cache');
defined('PSHB_LOG') or define('PSHB_LOG', USERS_PATH . '/_/log_pshb.txt');
defined('PSHB_PATH') or define('PSHB_PATH', DATA_PATH . '/PubSubHubbub');
Expand All @@ -58,5 +59,5 @@
//Directory used for feed mutex with *.freshrss.lock files. Must be writable.
defined('TMP_PATH') or define('TMP_PATH', sys_get_temp_dir());

//clean the chacke after x hours (720 hours = 30 days)
//clean the cache after x hours (720 hours = 30 days)
defined('CLEANCACHE_HOURS') or define('CLEANCACHE_HOURS', 720);
2 changes: 1 addition & 1 deletion data/tos.example.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1>Terms of Service</h1>
<!-- <h1>Terms of Service</h1> -->

<h2>Article 1: Lorem ipsum</h2>

Expand Down
Loading

0 comments on commit e679d3d

Please sign in to comment.