Replace REGISTER_* constants by Module\Register::* ones
This commit is contained in:
parent
0ccb6afdb5
commit
cef6757c92
20 changed files with 75 additions and 47 deletions
|
@ -26,6 +26,7 @@ use Friendica\Model\Contact;
|
|||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Register;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module;
|
||||
use Friendica\Module\Login;
|
||||
use Friendica\Module\Tos;
|
||||
use Friendica\Util\Arrays;
|
||||
|
@ -1509,9 +1510,9 @@ function admin_page_site(App $a)
|
|||
|
||||
/* Register policy */
|
||||
$register_choices = [
|
||||
REGISTER_CLOSED => L10n::t("Closed"),
|
||||
REGISTER_APPROVE => L10n::t("Requires approval"),
|
||||
REGISTER_OPEN => L10n::t("Open")
|
||||
Module\Register::CLOSED => L10n::t("Closed"),
|
||||
Module\Register::APPROVE => L10n::t("Requires approval"),
|
||||
Module\Register::OPEN => L10n::t("Open")
|
||||
];
|
||||
|
||||
$ssl_choices = [
|
||||
|
|
|
@ -20,7 +20,7 @@ function bookmarklet_content(App $a)
|
|||
{
|
||||
if (!local_user()) {
|
||||
$o = '<h2>' . L10n::t('Login') . '</h2>';
|
||||
$o .= Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? false : true);
|
||||
$o .= Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED ? false : true);
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,16 +10,22 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Module\Register;
|
||||
|
||||
function friendica_init(App $a)
|
||||
{
|
||||
if (!empty($a->argv[1]) && ($a->argv[1] == "json")) {
|
||||
$register_policies = ['REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN'];
|
||||
$register_policies = [
|
||||
Register::CLOSED => 'REGISTER_CLOSED',
|
||||
Register::APPROVE => 'REGISTER_APPROVE',
|
||||
Register::OPEN => 'REGISTER_OPEN'
|
||||
];
|
||||
|
||||
$register_policy = $register_policies[intval(Config::get('config', 'register_policy'))];
|
||||
|
||||
if ($register_policy == 'REGISTER_OPEN' && Config::get('config', 'invitation_only')) {
|
||||
$register_policy_int = intval(Config::get('config', 'register_policy'));
|
||||
if ($register_policy_int === Register::OPEN && Config::get('config', 'invitation_only')) {
|
||||
$register_policy = 'REGISTER_INVITATION';
|
||||
} else {
|
||||
$register_policy = $register_policies[$register_policy_int];
|
||||
}
|
||||
|
||||
$sql_extra = '';
|
||||
|
|
|
@ -48,7 +48,7 @@ function home_content(App $a) {
|
|||
}
|
||||
}
|
||||
|
||||
$login = Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? 0 : 1);
|
||||
$login = Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED ? 0 : 1);
|
||||
|
||||
$content = '';
|
||||
Hook::callAll("home_content",$content);
|
||||
|
|
|
@ -13,6 +13,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Module\Register;
|
||||
use Friendica\Protocol\Email;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -125,14 +126,14 @@ function invite_content(App $a) {
|
|||
|
||||
$dirloc = Config::get('system', 'directory');
|
||||
if (strlen($dirloc)) {
|
||||
if (intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED) {
|
||||
if (intval(Config::get('config', 'register_policy')) === Register::CLOSED) {
|
||||
$linktxt = L10n::t('Visit %s for a list of public sites that you can join. Friendica members on other sites can all connect with each other, as well as with members of many other social networks.', $dirloc . '/servers');
|
||||
} else {
|
||||
$linktxt = L10n::t('To accept this invitation, please visit and register at %s or any other public Friendica website.', System::baseUrl())
|
||||
. "\r\n" . "\r\n" . L10n::t('Friendica sites all inter-connect to create a huge privacy-enhanced social web that is owned and controlled by its members. They can also connect with many traditional social networks. See %s for a list of alternate Friendica sites you can join.', $dirloc . '/servers');
|
||||
}
|
||||
} else { // there is no global directory URL defined
|
||||
if (intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED) {
|
||||
if (intval(Config::get('config', 'register_policy')) === Register::CLOSED) {
|
||||
$o = L10n::t('Our apologies. This system is not currently configured to connect with other public sites or invite members.');
|
||||
return $o;
|
||||
} else {
|
||||
|
|
|
@ -59,7 +59,7 @@ function nodeinfo_init(App $a) {
|
|||
|
||||
$nodeinfo['usage'] = [];
|
||||
|
||||
$nodeinfo['openRegistrations'] = intval(Config::get('config', 'register_policy')) !== REGISTER_CLOSED;
|
||||
$nodeinfo['openRegistrations'] = intval(Config::get('config', 'register_policy')) !== \Friendica\Module\Register::CLOSED;
|
||||
|
||||
$nodeinfo['metadata'] = ['nodeName' => Config::get('config', 'sitename')];
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ function openid_content(App $a) {
|
|||
// Successful OpenID login - but we can't match it to an existing account.
|
||||
// New registration?
|
||||
|
||||
if (intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED) {
|
||||
if (intval(Config::get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED) {
|
||||
notice(L10n::t('Account not found and OpenID registration is not permitted on this site.') . EOL);
|
||||
$a->internalRedirect();
|
||||
}
|
||||
|
|
|
@ -188,7 +188,7 @@ function ping_init(App $a)
|
|||
);
|
||||
$mail_count = count($mails);
|
||||
|
||||
if (intval(Config::get('config', 'register_policy')) === REGISTER_APPROVE && is_site_admin()) {
|
||||
if (intval(Config::get('config', 'register_policy')) === \Friendica\Module\Register::APPROVE && is_site_admin()) {
|
||||
$regs = Friendica\Model\Register::getPending();
|
||||
|
||||
if (DBA::isResult($regs)) {
|
||||
|
|
|
@ -82,7 +82,7 @@ function regmod_content(App $a)
|
|||
{
|
||||
if (!local_user()) {
|
||||
info(L10n::t('Please login.') . EOL);
|
||||
return Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? 0 : 1);
|
||||
return Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED ? 0 : 1);
|
||||
}
|
||||
|
||||
if (!is_site_admin() || !empty($_SESSION['submanage'])) {
|
||||
|
|
|
@ -16,11 +16,15 @@ function statistics_json_init(App $a) {
|
|||
System::httpExit(404);
|
||||
}
|
||||
|
||||
$registration_open =
|
||||
intval(Config::get('config', 'register_policy')) !== \Friendica\Module\Register::CLOSED
|
||||
&& ! Config::get('config', 'invitation_only');
|
||||
|
||||
$statistics = [
|
||||
"name" => Config::get('config', 'sitename'),
|
||||
"network" => FRIENDICA_PLATFORM,
|
||||
"version" => FRIENDICA_VERSION . "-" . DB_UPDATE_VERSION,
|
||||
"registrations_open" => intval(Config::get('config', 'register_policy')) !== REGISTER_CLOSED,
|
||||
"registrations_open" => $registration_open,
|
||||
"total_users" => Config::get('nodeinfo', 'total_users'),
|
||||
"active_users_halfyear" => Config::get('nodeinfo', 'active_users_halfyear'),
|
||||
"active_users_monthly" => Config::get('nodeinfo', 'active_users_monthly'),
|
||||
|
|
|
@ -13,7 +13,7 @@ use Friendica\Core\Renderer;
|
|||
|
||||
function uimport_post(App $a)
|
||||
{
|
||||
if ((Config::get('config', 'register_policy') != REGISTER_OPEN) && !is_site_admin()) {
|
||||
if ((Config::get('config', 'register_policy') != \Friendica\Module\Register::OPEN) && !is_site_admin()) {
|
||||
notice(L10n::t('Permission denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ function uimport_post(App $a)
|
|||
|
||||
function uimport_content(App $a)
|
||||
{
|
||||
if ((Config::get('config', 'register_policy') != REGISTER_OPEN) && !is_site_admin()) {
|
||||
if ((Config::get('config', 'register_policy') != \Friendica\Module\Register::OPEN) && !is_site_admin()) {
|
||||
notice(L10n::t('User imports on closed servers can only be done by an administrator.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue