Enforce systen.register_policy value type
This commit is contained in:
parent
9b01a23c9b
commit
67dc08d120
|
@ -3345,7 +3345,7 @@ function api_statusnet_config($type)
|
|||
$server = $a->get_hostname();
|
||||
$logo = System::baseUrl() . '/images/friendica-64.png';
|
||||
$email = Config::get('config', 'admin_email');
|
||||
$closed = Config::get('config', 'register_policy') == REGISTER_CLOSED ? 'true' : 'false';
|
||||
$closed = intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? 'true' : 'false';
|
||||
$private = Config::get('system', 'block_public') ? 'true' : 'false';
|
||||
$textlimit = (string) Config::get('config', 'api_import_size', Config::get('config', 'max_import_size', 200000));
|
||||
$ssl = Config::get('system', 'have_ssl') ? 'true' : 'false';
|
||||
|
|
|
@ -22,7 +22,7 @@ function bookmarklet_content(App $a)
|
|||
{
|
||||
if (!local_user()) {
|
||||
$o = '<h2>' . L10n::t('Login') . '</h2>';
|
||||
$o .= Login::form($a->query_string, Config::get('config', 'register_policy') === REGISTER_CLOSED ? false : true);
|
||||
$o .= Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? false : true);
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ function friendica_init(App $a)
|
|||
'url' => System::baseUrl(),
|
||||
'addons' => $visible_addons,
|
||||
'locked_features' => $locked_features,
|
||||
'register_policy' => $register_policy[Config::get('config', 'register_policy')],
|
||||
'register_policy' => $register_policy[intval(Config::get('config', 'register_policy'))],
|
||||
'admin' => $admin,
|
||||
'site_name' => Config::get('config', 'sitename'),
|
||||
'platform' => FRIENDICA_PLATFORM,
|
||||
|
|
|
@ -47,7 +47,7 @@ function home_content(App $a) {
|
|||
}
|
||||
}
|
||||
|
||||
$login = Login::form($a->query_string, Config::get('config', 'register_policy') === REGISTER_CLOSED ? 0 : 1);
|
||||
$login = Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? 0 : 1);
|
||||
|
||||
$content = '';
|
||||
Addon::callHooks("home_content",$content);
|
||||
|
|
|
@ -126,14 +126,14 @@ function invite_content(App $a) {
|
|||
|
||||
$dirloc = Config::get('system', 'directory');
|
||||
if (strlen($dirloc)) {
|
||||
if (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 (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 {
|
||||
|
|
|
@ -61,7 +61,7 @@ function nodeinfo_init(App $a) {
|
|||
|
||||
$nodeinfo['usage'] = [];
|
||||
|
||||
$nodeinfo['openRegistrations'] = Config::get('config', 'register_policy') !== REGISTER_CLOSED;
|
||||
$nodeinfo['openRegistrations'] = intval(Config::get('config', 'register_policy')) !== REGISTER_CLOSED;
|
||||
|
||||
$nodeinfo['metadata'] = ['nodeName' => Config::get('config', 'sitename')];
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ function openid_content(App $a) {
|
|||
// Successful OpenID login - but we can't match it to an existing account.
|
||||
// New registration?
|
||||
|
||||
if (Config::get('config', 'register_policy') === REGISTER_CLOSED) {
|
||||
if (intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED) {
|
||||
notice(L10n::t('Account not found and OpenID registration is not permitted on this site.') . EOL);
|
||||
goaway(System::baseUrl());
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ function ping_init(App $a)
|
|||
);
|
||||
$mail_count = count($mails);
|
||||
|
||||
if (Config::get('config', 'register_policy') === REGISTER_APPROVE && is_site_admin()) {
|
||||
if (intval(Config::get('config', 'register_policy')) === REGISTER_APPROVE && is_site_admin()) {
|
||||
$regs = q(
|
||||
"SELECT `contact`.`name`, `contact`.`url`, `contact`.`micro`, `register`.`created`
|
||||
FROM `contact` RIGHT JOIN `register` ON `register`.`uid` = `contact`.`uid`
|
||||
|
|
|
@ -74,7 +74,7 @@ function register_post(App $a)
|
|||
|
||||
$user = $result['user'];
|
||||
|
||||
if ($netpublish && Config::get('config', 'register_policy') !== REGISTER_APPROVE) {
|
||||
if ($netpublish && intval(Config::get('config', 'register_policy')) !== REGISTER_APPROVE) {
|
||||
$url = System::baseUrl() . '/profile/' . $user['nickname'];
|
||||
Worker::add(PRIORITY_LOW, "Directory", $url);
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ function register_post(App $a)
|
|||
$num_invites = Config::get('system', 'number_invites');
|
||||
$invite_id = ((x($_POST, 'invite_id')) ? notags(trim($_POST['invite_id'])) : '');
|
||||
|
||||
if (Config::get('config', 'register_policy') === REGISTER_OPEN) {
|
||||
if (intval(Config::get('config', 'register_policy')) === REGISTER_OPEN) {
|
||||
if ($using_invites && $invite_id) {
|
||||
q("delete * from register where hash = '%s' limit 1", dbesc($invite_id));
|
||||
PConfig::set($user['uid'], 'system', 'invites_remaining', $num_invites);
|
||||
|
@ -109,7 +109,7 @@ function register_post(App $a)
|
|||
info(L10n::t('Registration successful.') . EOL);
|
||||
goaway(System::baseUrl());
|
||||
}
|
||||
} elseif (Config::get('config', 'register_policy') === REGISTER_APPROVE) {
|
||||
} elseif (intval(Config::get('config', 'register_policy')) === REGISTER_APPROVE) {
|
||||
if (!strlen(Config::get('config', 'admin_email'))) {
|
||||
notice(L10n::t('Your registration can not be processed.') . EOL);
|
||||
goaway(System::baseUrl());
|
||||
|
@ -177,7 +177,7 @@ function register_content(App $a)
|
|||
return;
|
||||
}
|
||||
|
||||
if ((!local_user()) && (Config::get('config', 'register_policy') === REGISTER_CLOSED)) {
|
||||
if ((!local_user()) && (intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED)) {
|
||||
notice("Permission denied." . EOL);
|
||||
return;
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ function register_content(App $a)
|
|||
$o = replace_macros($tpl, [
|
||||
'$oidhtml' => $oidhtml,
|
||||
'$invitations' => Config::get('system', 'invitation_only'),
|
||||
'$permonly' => Config::get('config', 'register_policy') === REGISTER_APPROVE,
|
||||
'$permonly' => intval(Config::get('config', 'register_policy')) === REGISTER_APPROVE,
|
||||
'$permonlybox' => ['permonlybox', L10n::t('Note for the admin'), '', L10n::t('Leave a message for the admin, why you want to join this node')],
|
||||
'$invite_desc' => L10n::t('Membership on this site is by invitation only.'),
|
||||
'$invite_label' => L10n::t('Your invitation code: '),
|
||||
|
|
|
@ -99,7 +99,7 @@ function regmod_content(App $a)
|
|||
{
|
||||
if (!local_user()) {
|
||||
info(L10n::t('Please login.') . EOL);
|
||||
$o = '<br /><br />' . Login::form($a->query_string, Config::get('config', 'register_policy') === REGISTER_CLOSED ? 0 : 1);
|
||||
$o = '<br /><br />' . Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? 0 : 1);
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ function statistics_json_init(App $a) {
|
|||
"name" => Config::get('config', 'sitename'),
|
||||
"network" => FRIENDICA_PLATFORM,
|
||||
"version" => FRIENDICA_VERSION . "-" . DB_UPDATE_VERSION,
|
||||
"registrations_open" => Config::get('config', 'register_policy') !== REGISTER_CLOSED,
|
||||
"registrations_open" => intval(Config::get('config', 'register_policy')) !== REGISTER_CLOSED,
|
||||
"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'),
|
||||
|
|
|
@ -42,7 +42,7 @@ function uimport_post(App $a)
|
|||
|
||||
function uimport_content(App $a) {
|
||||
|
||||
if ((!local_user()) && (Config::get('config', 'register_policy') === REGISTER_CLOSED)) {
|
||||
if ((!local_user()) && (intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED)) {
|
||||
notice("Permission denied." . EOL);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ class Nav
|
|||
$nav['home'] = [$homelink, L10n::t('Home'), '', L10n::t('Home Page')];
|
||||
}
|
||||
|
||||
if ((Config::get('config', 'register_policy') === REGISTER_OPEN) && (! local_user()) && (! remote_user())) {
|
||||
if (intval(Config::get('config', 'register_policy')) === REGISTER_OPEN && !local_user() && !remote_user()) {
|
||||
$nav['register'] = ['register', L10n::t('Register'), '', L10n::t('Create an account')];
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class Login extends BaseModule
|
|||
goaway(self::getApp()->get_baseurl());
|
||||
}
|
||||
|
||||
return self::form(self::getApp()->get_baseurl(), Config::get('config', 'register_policy') !== REGISTER_CLOSED);
|
||||
return self::form(self::getApp()->get_baseurl(), intval(Config::get('config', 'register_policy')) !== REGISTER_CLOSED);
|
||||
}
|
||||
|
||||
public static function post()
|
||||
|
|
Loading…
Reference in New Issue
Block a user