This commit is contained in:
nobody 2022-02-15 19:52:32 -08:00
parent 16334196b5
commit 9bd7cd2a5e
3 changed files with 10 additions and 6 deletions

View file

@ -7,7 +7,7 @@ use Zotlabs\Lib\System;
use Zotlabs\Access\PermissionRoles; use Zotlabs\Access\PermissionRoles;
use Zotlabs\Lib\Channel; use Zotlabs\Lib\Channel;
use Zotlabs\Render\Theme; use Zotlabs\Render\Theme;
use Zotlabs\Lib\Addon;
class Site class Site
{ {
@ -57,6 +57,7 @@ class Site
if (!$first_page) { if (!$first_page) {
$first_page = 'profiles'; $first_page = 'profiles';
} }
$tos_required = ((x($_POST, 'tos_required')) ? intval(trim($_POST['tos_required'])) : 0);
$mirror_frontpage = ((x($_POST, 'mirror_frontpage')) ? intval(trim($_POST['mirror_frontpage'])) : 0); $mirror_frontpage = ((x($_POST, 'mirror_frontpage')) ? intval(trim($_POST['mirror_frontpage'])) : 0);
$directory_server = ((x($_POST, 'directory_server')) ? trim($_POST['directory_server']) : ''); $directory_server = ((x($_POST, 'directory_server')) ? trim($_POST['directory_server']) : '');
$force_publish = ((x($_POST, 'publish_all')) ? true : false); $force_publish = ((x($_POST, 'publish_all')) ? true : false);
@ -124,7 +125,7 @@ class Site
set_config('system', 'pubstream_excl', $pub_excl); set_config('system', 'pubstream_excl', $pub_excl);
set_config('system', 'max_imported_follow', $max_imported_follow); set_config('system', 'max_imported_follow', $max_imported_follow);
set_config('system', 'animated_avatars', $animations); set_config('system', 'animated_avatars', $animations);
set_config('system', 'tos_required', $tos_required);
if ($directory_server) { if ($directory_server) {
set_config('system', 'directory_server', $directory_server); set_config('system', 'directory_server', $directory_server);
@ -229,8 +230,8 @@ class Site
$vars = ''; $vars = '';
$f = basename($file); $f = basename($file);
$info = get_theme_info($f); $info = Theme::get_info($f);
$compatible = check_plugin_versions($info); $compatible = Addon::check_versions($info);
if (!$compatible) { if (!$compatible) {
$theme_choices[$f] = $theme_choices_mobile[$f] = sprintf(t('%s - (Incompatible)'), $f); $theme_choices[$f] = $theme_choices_mobile[$f] = sprintf(t('%s - (Incompatible)'), $f);
continue; continue;
@ -335,6 +336,7 @@ class Site
'$minimum_age' => ['minimum_age', t("Minimum age"), (x(get_config('system', 'minimum_age')) ? get_config('system', 'minimum_age') : 13), t("Minimum age (in years) for who may register on this site.")], '$minimum_age' => ['minimum_age', t("Minimum age"), (x(get_config('system', 'minimum_age')) ? get_config('system', 'minimum_age') : 13), t("Minimum age (in years) for who may register on this site.")],
'$access_policy' => ['access_policy', t("Which best describes the types of account offered by this hub?"), get_config('system', 'access_policy'), t("If a public server policy is selected, this information may be displayed on the public server site list."), $access_choices], '$access_policy' => ['access_policy', t("Which best describes the types of account offered by this hub?"), get_config('system', 'access_policy'), t("If a public server policy is selected, this information may be displayed on the public server site list."), $access_choices],
'$register_text' => ['register_text', t("Register text"), htmlspecialchars(get_config('system', 'register_text'), ENT_QUOTES, 'UTF-8'), t("Will be displayed prominently on the registration page.")], '$register_text' => ['register_text', t("Register text"), htmlspecialchars(get_config('system', 'register_text'), ENT_QUOTES, 'UTF-8'), t("Will be displayed prominently on the registration page.")],
'$tos_required' => [ 'tos_required', t('Require acceptance of Terms of Service'),get_config('system','tos_required'),'', [ t('No'), t('Yes') ] ],
'$role' => $role, '$role' => $role,
'$frontpage' => ['frontpage', t("Site homepage to show visitors (default: login box)"), get_config('system', 'frontpage'), t("example: 'public' to show public stream, 'page/sys/home' to show a system webpage called 'home' or 'include:home.html' to include a file.")], '$frontpage' => ['frontpage', t("Site homepage to show visitors (default: login box)"), get_config('system', 'frontpage'), t("example: 'public' to show public stream, 'page/sys/home' to show a system webpage called 'home' or 'include:home.html' to include a file.")],
'$mirror_frontpage' => ['mirror_frontpage', t("Preserve site homepage URL"), get_config('system', 'mirror_frontpage'), t('Present the site homepage in a frame at the original location instead of redirecting')], '$mirror_frontpage' => ['mirror_frontpage', t("Preserve site homepage URL"), get_config('system', 'mirror_frontpage'), t('Present the site homepage in a frame at the original location instead of redirecting')],

View file

@ -5,6 +5,7 @@ namespace Zotlabs\Module;
use Zotlabs\Lib\Account; use Zotlabs\Lib\Account;
use Zotlabs\Web\Controller; use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel; use Zotlabs\Lib\Channel;
use Zotlabs\Lib\Config;
use Zotlabs\Access\PermissionRoles; use Zotlabs\Access\PermissionRoles;
use Zotlabs\Render\Theme; use Zotlabs\Render\Theme;
@ -66,7 +67,7 @@ class Register extends Controller
} }
} }
if (!(isset($_POST['tos']) && intval($_POST['tos']))) { if (Config::Get('system','tos_required') && !(isset($_POST['tos']) && intval($_POST['tos']))) {
notice(t('Please indicate acceptance of the Terms of Service. Registration failed.') . EOL); notice(t('Please indicate acceptance of the Terms of Service. Registration failed.') . EOL);
return; return;
} }
@ -268,7 +269,7 @@ class Register extends Controller
$label_tos = sprintf(t('I am over %s years of age and accept the %s for this website'), $age, $toslink); $label_tos = sprintf(t('I am over %s years of age and accept the %s for this website'), $age, $toslink);
} }
$enable_tos = 1 - intval(get_config('system', 'no_termsofservice')); $enable_tos = Config::Get('system','tos_required');
$email = ['email', t('Your email address'), ((x($_REQUEST, 'email')) ? strip_tags(trim($_REQUEST['email'])) : ""), '', '', ' required ']; $email = ['email', t('Your email address'), ((x($_REQUEST, 'email')) ? strip_tags(trim($_REQUEST['email'])) : ""), '', '', ' required '];
$password = ['password', t('Choose a password'), '', '', '', ' required ']; $password = ['password', t('Choose a password'), '', '', '', ' required '];

View file

@ -86,6 +86,7 @@
{{include file="field_select.tpl" field=$access_policy}} {{include file="field_select.tpl" field=$access_policy}}
{{include file="field_input.tpl" field=$register_text}} {{include file="field_input.tpl" field=$register_text}}
{{include file="field_select_grouped.tpl" field=$role}} {{include file="field_select_grouped.tpl" field=$role}}
{{include file="field_checkbox.tpl" field=$tos_required}}
{{include file="field_input.tpl" field=$minimum_age}} {{include file="field_input.tpl" field=$minimum_age}}
{{include file="field_input.tpl" field=$location}} {{include file="field_input.tpl" field=$location}}
{{include file="field_input.tpl" field=$sellpage}} {{include file="field_input.tpl" field=$sellpage}}