Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -37,7 +37,7 @@ class _register extends \IPS\Dispatcher\Controller
|
||||
if( \IPS\Request::i()->do !== 'complete'
|
||||
and \IPS\Request::i()->do !== 'changeEmail' and \IPS\Request::i()->do !== 'validate'
|
||||
and \IPS\Request::i()->do !== 'validating' and \IPS\Request::i()->do !== 'reconfirm'
|
||||
and \IPS\Request::i()->do !== 'finish' )
|
||||
and \IPS\Request::i()->do !== 'finish' and \IPS\Request::i()->do !== 'cancel' )
|
||||
{
|
||||
if ( \IPS\Login::registrationType() == 'redirect' )
|
||||
{
|
||||
@@ -165,7 +165,7 @@ class _register extends \IPS\Dispatcher\Controller
|
||||
/* Handle submissions */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
if( !\IPS\Settings::i()->quick_register )
|
||||
if( \IPS\Login::registrationType() == 'full' )
|
||||
{
|
||||
foreach ( \IPS\core\ProfileFields\Field::fields( array(), \IPS\core\ProfileFields\Field::REG ) as $group => $fields )
|
||||
{
|
||||
@@ -224,7 +224,7 @@ class _register extends \IPS\Dispatcher\Controller
|
||||
try
|
||||
{
|
||||
$ref = \IPS\Http\Url::createFromString( $ref );
|
||||
if ( !( $ref instanceof \IPS\Http\Url\Internal ) or $ref->base !== 'front' )
|
||||
if ( !( $ref instanceof \IPS\Http\Url\Internal ) or $ref->base !== 'front' or $ref->openRedirect() )
|
||||
{
|
||||
throw new \Exception;
|
||||
}
|
||||
@@ -261,6 +261,12 @@ class _register extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function finish()
|
||||
{
|
||||
/* You must be logged in for this action */
|
||||
if( !\IPS\Member::loggedIn()->member_id )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_module_permission', '2C223/B', 403, '' );
|
||||
}
|
||||
|
||||
$steps = \IPS\Member\ProfileStep::loadAll();
|
||||
|
||||
/* Do we need to bother? We should only show this form if there are required items, but will show both required and suggested where possible to allow the user to complete as much of their profile as possible */
|
||||
@@ -416,18 +422,8 @@ class _register extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Checkbox( 'reg_admin_mails', \IPS\Settings::i()->updates_consent_default == 'enabled' ? TRUE : FALSE, FALSE ) );
|
||||
|
||||
\IPS\Member::loggedIn()->language()->words[ "reg_agreed_terms" ] = sprintf( \IPS\Member::loggedIn()->language()->get("reg_agreed_terms"), \IPS\Http\Url::internal( 'app=core&module=system&controller=terms', 'front', 'terms', array(), \IPS\Http\Url::PROTOCOL_RELATIVE ) );
|
||||
|
||||
/* Build the appropriate links for registration terms & privacy policy */
|
||||
if ( \IPS\Settings::i()->privacy_type == "internal" )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words[ "reg_agreed_terms" ] .= sprintf( \IPS\Member::loggedIn()->language()->get("reg_privacy_link"), \IPS\Http\Url::internal( 'app=core&module=system&controller=privacy', 'front', 'privacy', array(), \IPS\Http\Url::PROTOCOL_RELATIVE ), 'data-ipsDialog data-ipsDialog-size="wide" data-ipsDialog-title="' . \IPS\Member::loggedIn()->language()->get("privacy") . '"' );
|
||||
}
|
||||
else if ( \IPS\Settings::i()->privacy_type == "external" )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words[ "reg_agreed_terms" ] .= sprintf( \IPS\Member::loggedIn()->language()->get("reg_privacy_link"), \IPS\Http\Url::external( \IPS\Settings::i()->privacy_link ), 'target="_blank"' );
|
||||
}
|
||||
|
||||
\IPS\core\modules\front\system\register::buildRegistrationTerm();
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Checkbox( 'reg_agreed_terms', NULL, TRUE, array(), function( $val )
|
||||
{
|
||||
@@ -588,10 +584,7 @@ class _register extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* Save custom field values */
|
||||
if ( ! \IPS\Settings::i()->quick_register )
|
||||
{
|
||||
\IPS\Db::i()->replace( 'core_pfields_content', array_merge( array( 'member_id' => $member->member_id ), $profileFields ) );
|
||||
}
|
||||
\IPS\Db::i()->replace( 'core_pfields_content', array_merge( array( 'member_id' => $member->member_id ), $profileFields ) );
|
||||
|
||||
/* Log that we gave consent for admin emails */
|
||||
$member->logHistory( 'core', 'admin_mails', array( 'enabled' => (boolean) $member->allow_admin_mails ) );
|
||||
@@ -770,17 +763,19 @@ class _register extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Email( 'email_address', NULL, TRUE, array( 'accountEmail' => TRUE ) ) );
|
||||
}
|
||||
if ( \IPS\Member::loggedIn()->members_bitoptions['must_reaccept_terms'] )
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Checkbox( 'reg_admin_mails', \IPS\Settings::i()->updates_consent_default == 'enabled' ? TRUE : FALSE, FALSE ) );
|
||||
|
||||
\IPS\core\modules\front\system\register::buildRegistrationTerm();
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Checkbox( 'reg_agreed_terms', NULL, TRUE, array(), function( $val )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words[ "reg_agreed_terms" ] = sprintf( \IPS\Member::loggedIn()->language()->get("reg_agreed_terms"), \IPS\Http\Url::internal( 'app=core&module=system&controller=terms', 'front', 'terms' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Checkbox( 'reg_agreed_terms', NULL, TRUE, array(), function( $val )
|
||||
if ( !$val )
|
||||
{
|
||||
if ( !$val )
|
||||
{
|
||||
throw new \InvalidArgumentException('reg_not_agreed_terms');
|
||||
}
|
||||
} ) );
|
||||
}
|
||||
throw new \InvalidArgumentException('reg_not_agreed_terms');
|
||||
}
|
||||
} ) );
|
||||
|
||||
$form->addButton( 'cancel', 'link', \IPS\Http\Url::internal( 'app=core&module=system&controller=register&do=cancel', 'front', 'register' )->csrf() );
|
||||
|
||||
/* Handle the submission */
|
||||
@@ -814,9 +809,21 @@ class _register extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
\IPS\Member::loggedIn()->members_bitoptions['must_reaccept_terms'] = FALSE;
|
||||
\IPS\Member::loggedIn()->allow_admin_mails = $values['reg_admin_mails'];
|
||||
|
||||
/* Save */
|
||||
\IPS\Member::loggedIn()->save();
|
||||
/* Log that we gave consent for admin emails */
|
||||
\IPS\Member::loggedIn()->logHistory( 'core', 'admin_mails', array( 'enabled' => (boolean) \IPS\Member::loggedIn()->allow_admin_mails ) );
|
||||
|
||||
/* Log that we gave consent for terms and privacy */
|
||||
if ( \IPS\Settings::i()->privacy_type != 'none' )
|
||||
{
|
||||
\IPS\Member::loggedIn()->logHistory( 'core', 'terms_acceptance', array( 'type' => 'privacy' ) );
|
||||
}
|
||||
|
||||
/* Log that the terms were accepted */
|
||||
\IPS\Member::loggedIn()->logHistory( 'core', 'terms_acceptance', array( 'type' => 'terms' ) );
|
||||
\IPS\Member::loggedIn()->logHistory( 'core', 'account', array( 'type' => 'complete' ), FALSE );
|
||||
|
||||
/* Handle validation */
|
||||
@@ -831,7 +838,7 @@ class _register extends \IPS\Dispatcher\Controller
|
||||
try
|
||||
{
|
||||
$ref = \IPS\Http\Url::createFromString( $ref );
|
||||
if ( !( $ref instanceof \IPS\Http\Url\Internal ) or $ref->base !== 'front' )
|
||||
if ( !( $ref instanceof \IPS\Http\Url\Internal ) or $ref->base !== 'front' or $ref->openRedirect() )
|
||||
{
|
||||
throw new \Exception;
|
||||
}
|
||||
@@ -1004,6 +1011,12 @@ class _register extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
protected function reconfirm()
|
||||
{
|
||||
/* You must be logged in for this action */
|
||||
if( !\IPS\Member::loggedIn()->member_id )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_module_permission', '2C223/C', 403, '' );
|
||||
}
|
||||
|
||||
/* Generate form */
|
||||
$form = new \IPS\Helpers\Form( 'reconfirm_checkbox', 'reconfirm_checkbox' );
|
||||
if ( isset( \IPS\Request::i()->ref ) )
|
||||
@@ -1035,7 +1048,7 @@ class _register extends \IPS\Dispatcher\Controller
|
||||
try
|
||||
{
|
||||
$ref = \IPS\Http\Url\Friendly::createFromString( base64_decode( \IPS\Request::i()->ref ) );
|
||||
if ( $ref instanceof \IPS\Http\Url\Internal )
|
||||
if ( $ref instanceof \IPS\Http\Url\Internal and !$ref->openRedirect() )
|
||||
{
|
||||
\IPS\Output::i()->redirect( $ref );
|
||||
}
|
||||
@@ -1050,4 +1063,24 @@ class _register extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('terms_of_use');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('system')->reconfirmTerms( \IPS\Member::loggedIn()->members_bitoptions['must_reaccept_terms'], \IPS\Member::loggedIn()->members_bitoptions['must_reaccept_privacy'], $form );
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the reg_agreed_terms language string which takes the privacy type settings into account
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function buildRegistrationTerm()
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words[ "reg_agreed_terms" ] = sprintf( \IPS\Member::loggedIn()->language()->get("reg_agreed_terms"), \IPS\Http\Url::internal( 'app=core&module=system&controller=terms', 'front', 'terms' ) );
|
||||
|
||||
/* Build the appropriate links for registration terms & privacy policy */
|
||||
if ( \IPS\Settings::i()->privacy_type == "internal" )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words[ "reg_agreed_terms" ] .= sprintf( \IPS\Member::loggedIn()->language()->get("reg_privacy_link"), \IPS\Http\Url::internal( 'app=core&module=system&controller=privacy', 'front', 'privacy', array(), \IPS\Http\Url::PROTOCOL_RELATIVE ), 'data-ipsDialog data-ipsDialog-size="wide" data-ipsDialog-title="' . \IPS\Member::loggedIn()->language()->get("privacy") . '"' );
|
||||
}
|
||||
else if ( \IPS\Settings::i()->privacy_type == "external" )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words[ "reg_agreed_terms" ] .= sprintf( \IPS\Member::loggedIn()->language()->get("reg_privacy_link"), \IPS\Http\Url::external( \IPS\Settings::i()->privacy_link ), 'target="_blank" rel="noopener"' );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user