diff options
author | Hilmar R <u02@u29lx193> | 2021-01-27 00:20:18 +0100 |
---|---|---|
committer | Hilmar R <u02@u29lx193> | 2021-01-27 00:20:18 +0100 |
commit | d0d6170a71a1acd73995450e16586a7b69abb3e1 (patch) | |
tree | b5f3562d5a19480ef4c58322cad82d0676a009d1 /Zotlabs/Module/Register.php | |
parent | cd98e75a42023f568a73556ec8e2a7bd4b406118 (diff) | |
download | volse-hubzilla-d0d6170a71a1acd73995450e16586a7b69abb3e1.tar.gz volse-hubzilla-d0d6170a71a1acd73995450e16586a7b69abb3e1.tar.bz2 volse-hubzilla-d0d6170a71a1acd73995450e16586a7b69abb3e1.zip |
login panel, reg limits.
Diffstat (limited to 'Zotlabs/Module/Register.php')
-rw-r--r-- | Zotlabs/Module/Register.php | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php index 60d08caf0..64db7a253 100644 --- a/Zotlabs/Module/Register.php +++ b/Zotlabs/Module/Register.php @@ -109,7 +109,7 @@ class Register extends Controller { } // s2 max daily - if ( self::check_max_daily_exceeded() ) return; + if ( self::check_reg_limits() ) return; // accept tos if(! x($_POST,'tos')) { @@ -423,8 +423,9 @@ class Register extends Controller { $invitations = true; } - if ( self::check_max_daily_exceeded() ) - $duty['atform'] = 'disabled'; + $opal = self::check_reg_limits(); + if ( $opal['is']) + $duty['atform'] = 'disabled'; $privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : ""); @@ -496,6 +497,7 @@ class Register extends Controller { '$reg_is' => $registration_is, '$registertext' => bbcode(get_config('system','register_text')), '$other_sites' => $other_sites, + '$msg' => $opal['rn'] . ',' . $opal['an'], '$invitations' => $invitations, '$invite_code' => $invite_code, '$haveivc' => t('I have an invite code') . '.<sup>ZAR0134I</sup>', @@ -521,28 +523,36 @@ class Register extends Controller { return $o; } - function check_max_daily_exceeded() { + function check_reg_limits() { // check against register, account + $rear = array( 'is' => false, 'rn' => 0, 'an' => 0, 'msg' => '' ); + $max_dailies = intval(get_config('system','max_daily_registrations')); + if ( $max_dailies ) { + $r = q("SELECT COUNT(reg_id) AS nr FROM register WHERE reg_vital = 1 AND reg_created > %s - INTERVAL %s", db_utcnow(), db_quoteinterval('1 day') ); - $re = ( $r && $r[0]['nr'] >= $max_dailies ) ? true : false; - if ( !$re ) { + + $rear['is'] = ( $r && $r[0]['nr'] >= $max_dailies ) ? true : false; + $rear['rn'] = $r[0]['nr']; + + if ( !$rear['is']) { $r = q("SELECT COUNT(account_id) AS nr FROM account WHERE account_created > %s - INTERVAL %s", db_utcnow(), db_quoteinterval('1 day') ); - $re = ( $r && $r[0]['nr'] >= $max_dailies ) ? true : false; + + $rear['is'] = ( $r && ($r[0]['nr'] + $rear['rn']) >= $max_dailies ) ? true : false; + $rear['ra'] = $r[0]['nr']; } - if ( $re ) { - zar_log('ZAR0333W max daily registrations exceeded.'); - notice( 'ZAR0333W ' - . t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.') - . EOL); - return true; + + if ( $rear['is']) { + $rear['msg'] = 'ZAR0333W ' . t('This site has exceeded the number of allowed daily account registrations'); + zar_log($msg); + $rear['is'] = true; } } - return false; + return $rear; } } |