Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -78,21 +78,76 @@ class _terms extends \IPS\Dispatcher\Controller
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
/* What were our previous values? */
|
||||
$existingPrivacyPolicy = iterator_to_array( \IPS\Db::i()->select( 'word_custom', 'core_sys_lang_words', array( 'word_key=?', 'privacy_text_value' ) ) );
|
||||
$existingRegistrationTerms = iterator_to_array( \IPS\Db::i()->select( 'word_custom', 'core_sys_lang_words', array( 'word_key=?', 'reg_rules_value' ) ) );
|
||||
|
||||
/* Save */
|
||||
foreach ( array( 'gl_guidelines' => 'guidelines_value', 'privacy_text' => 'privacy_text_value', 'reg_rules' => 'reg_rules_value' ) as $k => $v )
|
||||
{
|
||||
\IPS\Lang::saveCustom( 'core', $v, $values[ $k ] );
|
||||
unset( $values[ $k ] );
|
||||
}
|
||||
|
||||
$form->saveAsSettings( $values );
|
||||
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
|
||||
/* Log */
|
||||
\IPS\Session::i()->log( 'acplogs__terms_edited' );
|
||||
|
||||
/* Do we need to ask the admin if they want to ask members to reconfirm? */
|
||||
$changedPrivacyPolicy = $existingPrivacyPolicy != iterator_to_array( \IPS\Db::i()->select( 'word_custom', 'core_sys_lang_words', array( 'word_key=?', 'privacy_text_value' ) ) );
|
||||
$changedRegistrationTerms = $existingRegistrationTerms != iterator_to_array( \IPS\Db::i()->select( 'word_custom', 'core_sys_lang_words', array( 'word_key=?', 'reg_rules_value' ) ) );
|
||||
if ( $changedPrivacyPolicy or $changedRegistrationTerms )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=core&module=settings&controller=terms&do=reconfirm')->setQueryString( array(
|
||||
'privacy' => intval( $changedPrivacyPolicy ),
|
||||
'reg' => intval( $changedRegistrationTerms )
|
||||
) ) );
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_settings_terms');
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global' )->block( 'menu__core_settings_terms', $form );
|
||||
}
|
||||
|
||||
/**
|
||||
* Ask the admin if they want users to re-confirm
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function reconfirm()
|
||||
{
|
||||
$form = new \IPS\Helpers\Form;
|
||||
|
||||
$form->addMessage( 'admin_reconfirm_blurb' );
|
||||
|
||||
if ( \IPS\Request::i()->reg )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'admin_reconfirm_reg_terms', FALSE ) );
|
||||
}
|
||||
|
||||
if ( \IPS\Request::i()->privacy )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'admin_reconfirm_privacy', FALSE ) );
|
||||
}
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
if ( isset( $values['admin_reconfirm_reg_terms'] ) and $values['admin_reconfirm_reg_terms'] )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_members', "members_bitoptions2 = members_bitoptions2 | " . \IPS\Member::$bitOptions['members_bitoptions']['members_bitoptions2']['must_reaccept_terms'] );
|
||||
}
|
||||
if ( isset( $values['admin_reconfirm_privacy'] ) and $values['admin_reconfirm_privacy'] )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_members', "members_bitoptions2 = members_bitoptions2 | " . \IPS\Member::$bitOptions['members_bitoptions']['members_bitoptions2']['must_reaccept_privacy'] );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=core&module=settings&controller=terms') );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_settings_terms');
|
||||
\IPS\Output::i()->output = $form;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user