Version 4.2.0

This commit is contained in:
Neo committed 2025-12-19 05:44:59 -08:00
1 parent 0dc2aee5ed
commit 96997ddd8e
2074 files changed
+125454 -55780

No files matched your search

@@ -1,12 +1,11 @@
<?php
/**
* @brief ban
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 12 Apr 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\modules\admin\membersettings;
@@ -51,6 +50,7 @@ class _ban extends \IPS\Dispatcher\Controller
$table->include = array( 'ban_type', 'ban_content', 'ban_reason', 'ban_date' );
$table->mainColumn = 'ban_content';
$table->rowClasses = array( 'ban_reason' => array( 'ipsTable_wrap' ) );
$table->sortBy = $table->sortBy ?: 'ban_date';
$table->sortDirection = $table->sortDirection ?: 'asc';
@@ -109,8 +109,9 @@ class _ban extends \IPS\Dispatcher\Controller
};
/* Specify the buttons */
$table->rootButtons = array(
\IPS\Output::i()->sidebar['actions'] = array(
'add' => array(
'primary' => TRUE,
'icon' => 'plus',
'title' => 'ban_filter_add',
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('ban_filter_add') ),
@@ -119,9 +120,8 @@ class _ban extends \IPS\Dispatcher\Controller
);
/* Display */
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_membersettings_ban');
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'menu__core_membersettings_ban', (string) $table );
\IPS\Output::i()->output = (string) $table;
}
/**
@@ -1,12 +1,11 @@
<?php
/**
* @brief Notification Settings
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 23 Apr 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\modules\admin\membersettings;
@@ -53,7 +52,7 @@ class _notifications extends \IPS\Dispatcher\Controller
{
if ( mb_substr( $key, 0, -7 ) === 'new_likes' )
{
if ( \IPS\Settings::i()->reputation_point_types === 'like' )
if ( \IPS\Content\Reaction::isLikeMode() )
{
return 'notifications__new_likes_like';
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Profile Fields and Settings
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 09 Apr 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\modules\admin\membersettings;
@@ -55,65 +54,13 @@ class _profiles extends \IPS\Node\Controller
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'membersettings', 'profiles_manage' ) )
{
$tabs['settings'] = 'profile_settings';
$tabs['completion'] = 'profile_completion';
}
/* Get contents */
if ( $activeTab == 'fields' )
{
parent::manage();
$activeTabContents = \IPS\Output::i()->output;
}
else
$method = '_tab' . ucwords( $activeTab );
if ( method_exists( $this, $method ) )
{
\IPS\Dispatcher::i()->checkAcpPermission( 'profiles_manage' );
$form = new \IPS\Helpers\Form;
$form->addHeader( 'photos' );
$form->add( new \IPS\Helpers\Form\YesNo( 'allow_gravatars', \IPS\Settings::i()->allow_gravatars ) );
$form->addHeader( 'usernames' );
$form->add( new \IPS\Helpers\Form\Custom( 'user_name_length', array( \IPS\Settings::i()->min_user_name_length, \IPS\Settings::i()->max_user_name_length ), FALSE, array(
'getHtml' => function( $field ) {
return \IPS\Theme::i()->getTemplate('members')->usernameLengthSetting( $field->name, $field->value );
}
),
function( $val )
{
if ( $val[0] < 1 )
{
throw new \DomainException('user_name_length_too_low');
}
if ( $val[1] > 255 )
{
throw new \DomainException('user_name_length_too_high');
}
if ( $val[0] > $val[1] )
{
throw new \DomainException('user_name_length_no_match');
}
} ) );
$form->add( new \IPS\Helpers\Form\Text( 'username_characters', \IPS\Settings::i()->username_characters, FALSE, array( 'max' => 255 ) ) );
$form->addHeader( 'signatures' );
$form->add( new \IPS\Helpers\Form\YesNo( 'signatures_enabled', \IPS\Settings::i()->signatures_enabled ) );
$form->addHeader( 'statuses_profile_comments' );
$form->add( new \IPS\Helpers\Form\YesNo( 'profile_comments', \IPS\Settings::i()->profile_comments, FALSE, array( 'togglesOn' => array( 'profile_comment_approval' ) ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'profile_comment_approval', \IPS\Settings::i()->profile_comment_approval, FALSE, array(), NULL, NULL, NULL, 'profile_comment_approval' ) );
$form->addHeader( 'profile_settings_birthdays' );
$form->add( new \IPS\Helpers\Form\Radio( 'profile_birthday_type', \IPS\Settings::i()->profile_birthday_type, TRUE, array(
'options' => array( 'public' => 'profile_birthday_type_public', 'private' => 'profile_birthday_type_private', 'none' => 'profile_birthday_type_none' )
), NULL, NULL, NULL, 'profile_birthday_type' ) );
if ( $values = $form->values() )
{
$values['min_user_name_length'] = $values['user_name_length'][0];
$values['max_user_name_length'] = $values['user_name_length'][1];
unset( $values['user_name_length'] );
$form->saveAsSettings( $values );
\IPS\Session::i()->log( 'acplog__profile_settings' );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=profiles&tab=settings' ), 'saved' );
}
$activeTabContents = (string) $form;
$activeTabContents = (string) $this->$method();
}
/* Display */
@@ -127,4 +74,270 @@ class _profiles extends \IPS\Node\Controller
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->tabs( $tabs, $activeTab, $activeTabContents, \IPS\Http\Url::internal( "app=core&module=membersettings&controller=profiles" ) );
}
}
/**
* Fields Tab
*
* @return string
*/
protected function _tabFields()
{
parent::manage();
return \IPS\Output::i()->output;
}
/**
* Settings Tab
*
* @return \IPS\Helpers\Form
*/
protected function _tabSettings()
{
\IPS\Dispatcher::i()->checkAcpPermission( 'profiles_manage' );
$form = new \IPS\Helpers\Form;
$form->addHeader( 'photos' );
$form->add( new \IPS\Helpers\Form\YesNo( 'allow_gravatars', \IPS\Settings::i()->allow_gravatars ) );
if( \IPS\Image::canWriteText() )
{
$form->add( new \IPS\Helpers\Form\Radio( 'letter_photos', \IPS\Settings::i()->letter_photos, FALSE, array( 'options' => array( 'default' => 'letterphoto_default', 'letters' => 'letterphoto_letters' ) ) ) );
}
$form->addHeader( 'usernames' );
$form->add( new \IPS\Helpers\Form\Custom( 'user_name_length', array( \IPS\Settings::i()->min_user_name_length, \IPS\Settings::i()->max_user_name_length ), FALSE, array(
'getHtml' => function( $field ) {
return \IPS\Theme::i()->getTemplate('members')->usernameLengthSetting( $field->name, $field->value );
}
),
function( $val )
{
if ( $val[0] < 1 )
{
throw new \DomainException('user_name_length_too_low');
}
if ( $val[1] > 255 )
{
throw new \DomainException('user_name_length_too_high');
}
if ( $val[0] > $val[1] )
{
throw new \DomainException('user_name_length_no_match');
}
} ) );
$form->add( new \IPS\Helpers\Form\Text( 'username_characters', \IPS\Settings::i()->username_characters, FALSE, array( 'max' => 255 ) ) );
$form->addHeader( 'signatures' );
$form->add( new \IPS\Helpers\Form\YesNo( 'signatures_enabled', \IPS\Settings::i()->signatures_enabled ) );
$form->addHeader( 'statuses_profile_comments' );
$form->add( new \IPS\Helpers\Form\YesNo( 'profile_comments', \IPS\Settings::i()->profile_comments, FALSE, array( 'togglesOn' => array( 'profile_comment_approval' ) ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'profile_comment_approval', \IPS\Settings::i()->profile_comment_approval, FALSE, array(), NULL, NULL, NULL, 'profile_comment_approval' ) );
$form->addHeader( 'profile_settings_birthdays' );
$form->add( new \IPS\Helpers\Form\Radio( 'profile_birthday_type', \IPS\Settings::i()->profile_birthday_type, TRUE, array(
'options' => array( 'public' => 'profile_birthday_type_public', 'private' => 'profile_birthday_type_private', 'none' => 'profile_birthday_type_none' )
), NULL, NULL, NULL, 'profile_birthday_type' ) );
if( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'profiles', 'member_history_prune' ) )
{
$form->addHeader( 'profile_member_history' );
$form->add( new \IPS\Helpers\Form\Number( 'prune_member_history', \IPS\Settings::i()->prune_member_history, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), \IPS\Member::loggedIn()->language()->addToStack('days'), 'prune_member_history' ) );
}
$form->addHeader( 'profile_settings_ignore' );
$form->add( new \IPS\Helpers\Form\YesNo( 'ignore_system_on', \IPS\Settings::i()->ignore_system_on, FALSE, array(), NULL, NULL, NULL, 'ignore_system_on' ) );
if ( $values = $form->values() )
{
$values['min_user_name_length'] = $values['user_name_length'][0];
$values['max_user_name_length'] = $values['user_name_length'][1];
unset( $values['user_name_length'] );
$form->saveAsSettings( $values );
\IPS\Session::i()->log( 'acplog__profile_settings' );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=profiles&tab=settings' ), 'saved' );
}
return $form;
}
/**
* Completion Tab
*
* @return \IPS\Helpers\Form
*/
protected function _tabCompletion()
{
/* Is the quick register function disabled? */
if ( ! \IPS\Settings::i()->quick_register )
{
return \IPS\Theme::i()->getTemplate( 'members' )->quickRegisterDisabled();
}
$table = new \IPS\Helpers\Table\Db( 'core_profile_steps', \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=profiles&tab=completion' ) );
$table->langPrefix = 'profile_acp_table_';
$table->include = array( 'step_extension', 'step_required' );
$table->rootButtons = array(
array(
'icon' => 'plus',
'title' => 'add',
'link' => \IPS\Http\Url::internal( "app=core&module=membersettings&controller=profiles&do=step" )
)
);
$table->parsers = array(
'step_extension' => function( $val, $row )
{
return \IPS\Theme::i()->getTemplate( 'members' )->profileCompleteTitle( $row );
},
'step_required' => function( $val ) {
if ( $val )
{
return '&#10003;';
}
else
{
return '&#10007;';
}
}
);
$table->rowButtons = function( $row )
{
return array(
'edit' => array(
'title' => 'edit',
'icon' => 'pencil',
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=profiles&do=step&id=' . $row['step_id'] )
),
'delete' => array(
'title' => 'delete',
'icon' => 'times-circle',
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=profiles&do=deleteStep&id=' . $row['step_id'] ),
'data' => array( 'delete' => '' )
),
);
};
return \IPS\Theme::i()->getTemplate( 'members' )->profileCompleteBlurb() . $table;
}
/**
* Enable quick registration
*
* @return void
*/
public function enableQuickRegister()
{
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => 1 ), array( 'conf_key=?', 'quick_register' ) );
unset( \IPS\Data\Store::i()->settings );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=profiles&tab=completion' ), 'profile_complete_quick_register_off_enabled' );
}
/**
* Add Step Form
*
* @return void
*/
public function step()
{
$form = new \IPS\Helpers\Form;
if ( isset( \IPS\Request::i()->id ) )
{
try
{
$step = \IPS\Member\ProfileStep::load( \IPS\Request::i()->id );
}
catch( \OutOFRangeException $e )
{
\IPS\Output::i()->error( 'node_error', '2C360/1', 404, '' );
}
}
else
{
$step = new \IPS\Member\ProfileStep;
}
$step->form( $form );
if ( $values = $form->values() )
{
$values = $step->formatFormValues( $values );
$step->extension = \IPS\Member\ProfileStep::findExtensionFromAction( $values['step_completion_act'] );
if ( isset( $values['step_required'] ) )
{
$step->required = $values['step_required'];
}
else
{
$step->required = FALSE;
}
$step->completion_act = $values['step_completion_act'];
$step->subcompletion_act = $values['step_subcompletion_act'];
$step->save();
$step->postSaveForm( $values );
if ( method_exists( $step->extension, 'postAcpSave' ) )
{
$step->extension->postAcpSave( $step, $values );
}
\IPS\Member::updateAllMembers( array( "members_bitoptions2 = members_bitoptions2 & ~" . \IPS\Member::$bitOptions['members_bitoptions']['members_bitoptions2']['profile_completed'] ) );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=membersettings&controller=profiles&tab=completion" ), 'saved' );
}
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=profiles&tab=completion' ), \IPS\Member::loggedIn()->language()->addToStack('profile_completion') );
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'profile_completion' );
\IPS\Output::i()->output = $form;
}
/**
* Delete Step
*
* @return void
*/
public function deleteStep()
{
try
{
$step = \IPS\Member\ProfileStep::load( \IPS\Request::i()->id );
}
catch( \OutOfRangeException $e )
{
\IPS\Output::i()->error( 'node_error', '2C360/2', 404, '' );
}
/* Make sure the user confirmed the deletion */
\IPS\Request::i()->confirmedDelete();
$step->delete();
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=membersettings&controller=profiles&tab=completion" ), 'deleted' );
}
/**
* Get Root Buttons
*
* @return array
*/
public function _getRootButtons()
{
$nodeClass = $this->nodeClass;
if ( $nodeClass::canAddRoot() )
{
$add = array(
'icon' => 'plus',
'title' => 'add',
'link' => $this->url->setQueryString( 'do', 'form' ),
'data' => ( $nodeClass::$modalForms ? array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('add') ) : array() )
);
return array( 'add' => $add );
}
return array();
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief ranks
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 10 Apr 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\modules\admin\membersettings;
@@ -74,13 +73,14 @@ class _ranks extends \IPS\Dispatcher\Controller
/* Root Buttons */
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'membersettings', 'ranks_manage' ) )
{
$table->rootButtons = array(
'add' => array(
'icon' => 'plus',
'title' => 'member_ranks_add',
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('member_ranks_add') ),
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=ranks&do=form' ),
)
\IPS\Output::i()->sidebar['actions'] = array(
'add' => array(
'primary' => TRUE,
'icon' => 'plus',
'title' => 'member_ranks_add',
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('member_ranks_add') ),
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=ranks&do=form' ),
)
);
}
@@ -137,7 +137,7 @@ class _ranks extends \IPS\Dispatcher\Controller
/* Display */
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('ranks');
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global' )->block( 'ranks', (string) $table );
\IPS\Output::i()->output .= (string) $table;
}
/**
@@ -1,12 +1,11 @@
<?php
/**
* @brief Registration
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 18 Jul 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\modules\admin\membersettings;
@@ -41,26 +40,21 @@ class _registration extends \IPS\Dispatcher\Controller
*/
protected function manage()
{
$form = new \IPS\Helpers\Form;
$form->addHeader('registration');
$form->add( new \IPS\Helpers\Form\YesNo( 'allow_reg', \IPS\Settings::i()->allow_reg, FALSE, array( 'togglesOn' => array( 'new_reg_notify', 'reg_auth_type', 'form_header_coppa', 'use_coppa' ) ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'new_reg_notify', \IPS\Settings::i()->new_reg_notify, FALSE, array(), NULL, NULL, NULL, 'new_reg_notify' ) );
$form->add( new \IPS\Helpers\Form\Radio( 'reg_auth_type', \IPS\Settings::i()->reg_auth_type, TRUE, array(
'options' => array( 'user' => 'reg_auth_type_user', 'admin' => 'reg_auth_type_admin', 'admin_user' => 'reg_auth_type_admin_user', 'none' => 'reg_auth_type_none' ),
'toggles' => array( 'user' => array( 'validate_day_prune' ), 'admin_user' => array( 'validate_day_prune' ) )
), NULL, NULL, NULL, 'reg_auth_type' ) );
$form->add( new \IPS\Helpers\Form\Number( 'validate_day_prune', \IPS\Settings::i()->validate_day_prune, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), \IPS\Member::loggedIn()->language()->addToStack('days'), 'validate_day_prune' ) );
$form->addHeader('age_requirements');
$form->add( new \IPS\Helpers\Form\Number( 'minimum_age', \IPS\Settings::i()->minimum_age, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'any_age' ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'use_coppa', \IPS\Settings::i()->use_coppa, FALSE, array( 'togglesOn' => array( 'coppa_fax', 'coppa_address' ) ), NULL, NULL, NULL, 'use_coppa' ) );
$form->add( new \IPS\Helpers\Form\Tel( 'coppa_fax', \IPS\Settings::i()->coppa_fax, FALSE, array(), NULL, NULL, NULL, 'coppa_fax' ) );
$form->add( new \IPS\Helpers\Form\Address( 'coppa_address', \IPS\GeoLocation::buildFromJson( \IPS\Settings::i()->coppa_address ), FALSE, array(), NULL, NULL, NULL, 'coppa_address' ) );
if ( $form->values() )
$form = $this->getSettingsForm();
if ( $values = $form->values() )
{
$form->saveAsSettings();
if ( isset( $values['allowed_reg_email'] ) and is_array( $values['allowed_reg_email'] ) )
{
$values['allowed_reg_email'] = implode( ',', $values['allowed_reg_email'] );
}
if ( $values['use_coppa'] OR $values['minimum_age'] )
{
$values['quick_register'] = 0;
}
$form->saveAsSettings( $values );
/* Clear guest page caches */
\IPS\Data\Cache::i()->clearAll();
@@ -71,4 +65,33 @@ class _registration extends \IPS\Dispatcher\Controller
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('membersettings_registration_title');
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global' )->block( 'membersettings_registration_title', $form );
}
/**
* Get the settings form
*
* @return \IPS\Helpers\Form
*/
protected function getSettingsForm()
{
$form = new \IPS\Helpers\Form;
$form->addHeader('registration');
$form->add( new \IPS\Helpers\Form\YesNo( 'allow_reg', \IPS\Settings::i()->allow_reg, FALSE, array( 'togglesOn' => array( 'quick_register', 'new_reg_notify', 'reg_auth_type', 'form_header_coppa', 'use_coppa' ) ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'quick_register', \IPS\Settings::i()->quick_register, FALSE, array(), NULL, NULL, NULL, 'quick_register' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'new_reg_notify', \IPS\Settings::i()->new_reg_notify, FALSE, array(), NULL, NULL, NULL, 'new_reg_notify' ) );
$form->add( new \IPS\Helpers\Form\Radio( 'reg_auth_type', \IPS\Settings::i()->reg_auth_type, TRUE, array(
'options' => array( 'user' => 'reg_auth_type_user', 'admin' => 'reg_auth_type_admin', 'admin_user' => 'reg_auth_type_admin_user', 'none' => 'reg_auth_type_none' ),
'toggles' => array( 'user' => array( 'validate_day_prune' ), 'admin_user' => array( 'validate_day_prune' ) )
), NULL, NULL, NULL, 'reg_auth_type' ) );
$form->add( new \IPS\Helpers\Form\Number( 'validate_day_prune', \IPS\Settings::i()->validate_day_prune, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), \IPS\Member::loggedIn()->language()->addToStack('days'), 'validate_day_prune' ) );
$form->add( new \IPS\Helpers\Form\Stack( 'allowed_reg_email', explode( ',', \IPS\Settings::i()->allowed_reg_email ), FALSE, array(), NULL, NULL, NULL ) );
$form->addHeader('age_requirements');
$form->add( new \IPS\Helpers\Form\Number( 'minimum_age', \IPS\Settings::i()->minimum_age, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'any_age', 'unlimitedToggles' => array( 'quick_register' ) ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'use_coppa', \IPS\Settings::i()->use_coppa, FALSE, array( 'togglesOn' => array( 'coppa_fax', 'coppa_address' ), 'togglesOff' => array( 'quick_register' ) ), NULL, NULL, NULL, 'use_coppa' ) );
$form->add( new \IPS\Helpers\Form\Tel( 'coppa_fax', \IPS\Settings::i()->coppa_fax, FALSE, array(), NULL, NULL, NULL, 'coppa_fax' ) );
$form->add( new \IPS\Helpers\Form\Address( 'coppa_address', \IPS\GeoLocation::buildFromJson( \IPS\Settings::i()->coppa_address ), FALSE, array(), NULL, NULL, NULL, 'coppa_address' ) );
return $form;
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Reputation
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 27 Mar 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\modules\admin\membersettings;
@@ -21,8 +20,18 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* reputation
*/
class _reputation extends \IPS\Dispatcher\Controller
class _reputation extends \IPS\Node\Controller
{
/**
* Node Class
*/
protected $nodeClass = '\IPS\Content\Reaction';
/**
* Title can contain HTML?
*/
public $_titleHtml = TRUE;
/**
* Execute
*
@@ -41,7 +50,7 @@ class _reputation extends \IPS\Dispatcher\Controller
*/
protected function manage()
{
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('reputation');
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('reputation_title');
/* Init */
$activeTab = \IPS\Request::i()->tab ?: NULL;
@@ -52,6 +61,17 @@ class _reputation extends \IPS\Dispatcher\Controller
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'membersettings', 'reps_settings' ) )
{
$tabs['settings'] = 'reputation_settings';
}
/* Reactions */
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'membersettings', 'reactions_manage' ) )
{
$tabs['reactions'] = 'reactions';
}
/* Leaderboard */
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'membersettings', 'reps_settings' ) )
{
$tabs['leaderboard'] = 'reputation_leaderboard';
}
@@ -73,7 +93,13 @@ class _reputation extends \IPS\Dispatcher\Controller
}
/* Do it */
if ( $activeTab === 'settings' )
if ( $activeTab === 'reactions' )
{
\IPS\Dispatcher::i()->checkAcpPermission( 'reactions_manage' );
parent::manage();
$activeTabContents = \IPS\Theme::i()->getTemplate( 'global' )->paddedBlock( \IPS\Output::i()->output );
}
else if ( $activeTab === 'settings' )
{
\IPS\Dispatcher::i()->checkAcpPermission( 'reps_settings' );
@@ -119,26 +145,12 @@ class _reputation extends \IPS\Dispatcher\Controller
/* Build Form */
$form = new \IPS\Helpers\Form();
$form->add( new \IPS\Helpers\Form\YesNo( 'reputation_enabled', \IPS\Settings::i()->reputation_enabled, FALSE, array( 'togglesOn' => array( 'reputation_point_types', 'reputation_protected_groups', 'reputation_can_self_vote', 'reputation_highlight', 'reputation_show_profile' ) ) ) );
$form->add( new \IPS\Helpers\Form\Radio( 'reputation_point_types', \IPS\Settings::i()->reputation_point_types, FALSE, array(
'options' => array(
'like' => \IPS\Theme::i()->getTemplate( 'settings' )->reputationLike( $blurb ),
'both' => \IPS\Theme::i()->getTemplate( 'settings' )->reputationNormal( TRUE, TRUE ),
'positive' => \IPS\Theme::i()->getTemplate( 'settings' )->reputationNormal( TRUE, FALSE ),
'negative' => \IPS\Theme::i()->getTemplate( 'settings' )->reputationNormal( FALSE, TRUE ),
),
'toggles' => array(
'both' => array( 'reputation_show_content' ),
'positive' => array( 'reputation_show_content' ),
'negative' => array( 'reputation_show_content' )
),
'parse' => 'raw'
), NULL, NULL, NULL, 'reputation_point_types' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'reputation_show_content', \IPS\Settings::i()->reputation_show_content, FALSE, array(), NULL, NULL, NULL, 'reputation_show_content' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'reputation_enabled', \IPS\Settings::i()->reputation_enabled, FALSE, array( 'togglesOn' => array( 'reputation_point_types', 'reputation_protected_groups', 'reputation_can_self_vote', 'reputation_highlight', 'reputation_show_profile', 'overall_reaction_count' ) ) ) );
$form->add( new \IPS\Helpers\Form\Select( 'reputation_protected_groups', explode( ',', \IPS\Settings::i()->reputation_protected_groups ), FALSE, array( 'options' => \IPS\Member\Group::groups( TRUE, FALSE ), 'parse' => 'normal', 'multiple' => TRUE ), NULL, NULL, NULL, 'reputation_protected_groups' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'reputation_can_self_vote', \IPS\Settings::i()->reputation_can_self_vote, FALSE, array(), NULL, NULL, NULL, 'reputation_can_self_vote' ) );
$form->add( new \IPS\Helpers\Form\Number( 'reputation_highlight', \IPS\Settings::i()->reputation_highlight, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, \IPS\Member::loggedIn()->language()->addToStack('reputation_highlight_prefix'), \IPS\Member::loggedIn()->language()->addToStack('reputation_highlight_suffix'), 'reputation_highlight' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'reputation_show_profile', \IPS\Settings::i()->reputation_show_profile, FALSE, array(), NULL, NULL, NULL, 'reputation_show_profile' ) );
$form->add( new \IPS\Helpers\Form\Radio( 'reaction_count_display', \IPS\Settings::i()->reaction_count_display, FALSE, array( 'options' => array( 'individual' => 'individual_reactions', 'count' => 'overall_reaction_count' ) ) ) );
/* Save */
if ( $form->saveAsSettings() )
@@ -156,31 +168,31 @@ class _reputation extends \IPS\Dispatcher\Controller
else if ( $activeTab === 'leaderboard' )
{
\IPS\Dispatcher::i()->checkAcpPermission( 'reps_settings' );
/* Get available filters */
$topMemberFilters = \IPS\Member::topMembersOptions();
/* Build Form */
$form = new \IPS\Helpers\Form();
$form->add( new \IPS\Helpers\Form\YesNo( 'reputation_leaderboard_on', \IPS\Settings::i()->reputation_leaderboard_on, FALSE, array( 'togglesOn' => array( 'reputation_timezone', 'reputation_show_days_won_trophy', 'reputation_leaderboard_default_tab', 'reputation_max_members' ) ), NULL, NULL, NULL, 'reputation_leaderboard_on' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'reputation_show_days_won_trophy', \IPS\Settings::i()->reputation_show_days_won_trophy, FALSE, array( 'togglesOn' => array() ), NULL, NULL, NULL, 'reputation_show_days_won_trophy' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'reputation_leaderboard_on', \IPS\Settings::i()->reputation_leaderboard_on, FALSE, array( 'togglesOn' => array( 'reputation_leaderboard_default_tab', 'form_header_leaderboard_tabs_leaderboard', 'reputation_show_days_won_trophy', 'reputation_timezone', 'form_header_leaderboard_tabs_members', 'reputation_top_members_overview', 'reputation_overview_max_members', 'reputation_top_members_filters', 'reputation_max_members' ) ), NULL, NULL, NULL, 'reputation_leaderboard_on' ) );
$form->add( new \IPS\Helpers\Form\Radio( 'reputation_leaderboard_default_tab', \IPS\Settings::i()->reputation_leaderboard_default_tab, FALSE, array( 'options' => array( 'leaderboard' => 'leaderboard_tabs_leaderboard', 'history' => 'leaderboard_tabs_history', 'members' => 'leaderboard_tabs_members' ) ), NULL, NULL, NULL, 'reputation_leaderboard_default_tab' ) );
$form->addHeader('leaderboard_tabs_leaderboard');
$form->add( new \IPS\Helpers\Form\YesNo( 'reputation_show_days_won_trophy', \IPS\Settings::i()->reputation_show_days_won_trophy, FALSE, array( 'togglesOn' => array() ), NULL, NULL, NULL, 'reputation_show_days_won_trophy' ) );
$form->add( new \IPS\Helpers\Form\Timezone( 'reputation_timezone', \IPS\Settings::i()->reputation_timezone, FALSE, array(), NULL, NULL, NULL, 'reputation_timezone' ) );
$form->addHeader('leaderboard_tabs_members');
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'reputation_top_members_overview', explode( ',', \IPS\Settings::i()->reputation_top_members_overview ), FALSE, array( 'options' => $topMemberFilters ), NULL, NULL, NULL, 'reputation_max_members' ) );
$form->add( new \IPS\Helpers\Form\Number( 'reputation_overview_max_members', \IPS\Settings::i()->reputation_overview_max_members, FALSE, array( 'min' => 3, 'max' => 100 ), NULL, NULL, NULL, 'reputation_overview_max_members' ) );
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'reputation_top_members_filters', \IPS\Settings::i()->reputation_top_members_filters == '*' ? array_keys( $topMemberFilters ) : explode( ',', \IPS\Settings::i()->reputation_top_members_filters ), FALSE, array( 'options' => $topMemberFilters ), NULL, NULL, NULL, 'reputation_top_members_filters' ) );
$form->add( new \IPS\Helpers\Form\Number( 'reputation_max_members', \IPS\Settings::i()->reputation_max_members, FALSE, array( 'min' => 3, 'max' => '100' ), NULL, NULL, NULL, 'reputation_max_members' ) );
$timezones = array();
foreach ( \DateTimeZone::listIdentifiers() as $tz )
{
if ( $pos = mb_strpos( $tz, '/' ) )
{
$timezones[ 'timezone__' . mb_substr( $tz, 0, $pos ) ][ $tz ] = 'timezone__' . $tz;
}
else
{
$timezones[ $tz ] = 'timezone__' . $tz;
}
}
$form->add( new \IPS\Helpers\Form\Select( 'reputation_timezone', \IPS\Settings::i()->reputation_timezone, FALSE, array( 'options' => $timezones, 'sort' => TRUE ), NULL, NULL, NULL, 'reputation_timezone' ) );
/* Save */
if ( $form->saveAsSettings() )
if ( $values = $form->values() )
{
/* Save */
$values['reputation_top_members_overview'] = implode( ',', $values['reputation_top_members_overview'] );
$values['reputation_top_members_filters'] = $values['reputation_top_members_filters'] == array_keys( $topMemberFilters ) ? '*' : implode( ',', $values['reputation_top_members_filters'] );
$form->saveAsSettings( $values );
/* Clear guest page caches */
\IPS\Data\Cache::i()->clearAll();
@@ -227,7 +239,7 @@ class _reputation extends \IPS\Dispatcher\Controller
'add' => array(
'title' => 'add',
'icon' => 'plus',
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=reputation&do=form' ),
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=reputation&do=levelForm' ),
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('add') )
),
);
@@ -237,21 +249,23 @@ class _reputation extends \IPS\Dispatcher\Controller
'edit' => array(
'title' => 'edit',
'icon' => 'pencil',
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=reputation&do=form&id=' ) . $row['level_id'],
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=reputation&do=levelForm&id=' ) . $row['level_id'],
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('edit') )
),
'delete' => array(
'title' => 'delete',
'icon' => 'times-circle',
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=reputation&do=delete&id=' ) . $row['level_id'],
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=reputation&do=deleteLevel&id=' ) . $row['level_id'],
'data' => array( 'delete' => '' )
),
);
};
/* Display */
$activeTabContents = \IPS\Theme::i()->getTemplate( 'forms' )->blurb( 'reputation_levels_blurb', TRUE, TRUE ) . (string) $table;
$activeTabContents = (string) $table;
}
$activeTabContents = \IPS\Theme::i()->getTemplate( 'forms' )->blurb( 'rep_' . $activeTab . '_blurb', TRUE, TRUE ) . $activeTabContents;
/* Display */
if( \IPS\Request::i()->isAjax() )
@@ -269,7 +283,7 @@ class _reputation extends \IPS\Dispatcher\Controller
*
* @return void
*/
public function form()
public function levelForm()
{
$current = NULL;
if ( \IPS\Request::i()->id )
@@ -320,7 +334,7 @@ class _reputation extends \IPS\Dispatcher\Controller
*
* @return void
*/
public function delete()
public function deleteLevel()
{
\IPS\Dispatcher::i()->checkAcpPermission( 'reps_delete' );
@@ -364,4 +378,114 @@ class _reputation extends \IPS\Dispatcher\Controller
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=reputation&tab=leaderboard' ), 'reputation_leaderboard_rebuilding' );
}
}
/**
* Function to execute after nodes are reordered. Do nothing by default but plugins can extend.
*
* @param array $order The new ordering that was saved
* @return void
*/
protected function _afterReorder( $order )
{
unset( \IPS\Data\Store::i()->reactions );
}
/**
* Redirect after save
*
* @param \IPS\Node\Model $old A clone of the node as it was before or NULL if this is a creation
* @param \IPS\Node\Model $new The node now
* @param string $lastUsedTab The tab last used in the form
* @return void
*/
protected function _afterSave( \IPS\Node\Model $old = NULL, \IPS\Node\Model $new, $lastUsedTab = FALSE )
{
if( \IPS\Request::i()->isAjax() )
{
\IPS\Output::i()->json( array() );
}
else
{
if( isset( \IPS\Request::i()->save_and_reload ) )
{
$buttons = $new->getButtons( $this->url, !( $new instanceof $this->nodeClass ) );
\IPS\Output::i()->redirect( ( $lastUsedTab ? $buttons['edit']['link']->setQueryString('activeTab', $lastUsedTab ) : $buttons['edit']['link'] ), 'saved' );
}
else
{
\IPS\Output::i()->redirect( $this->url->setQueryString( array( 'root' => ( $new->parent() ? $new->parent()->_id : '' ), 'tab' => 'reactions' ) ), 'saved' );
}
}
}
/**
* Delete
*
* @return void
*/
protected function delete()
{
/* Get node */
$nodeClass = $this->nodeClass;
if ( \IPS\Request::i()->subnode )
{
$nodeClass = $nodeClass::$subnodeClass;
}
try
{
$node = call_user_func( "{$nodeClass}::load", \IPS\Request::i()->id );
}
catch ( \OutOfRangeException $e )
{
\IPS\Output::i()->error( 'node_error', '2S101/J', 404, '' );
}
/* Permission check */
if( !$node->canDelete() )
{
\IPS\Output::i()->error( 'node_noperm_delete', '2S101/H', 403, '' );
}
/* Do we have any children or content? */
$form = new \IPS\Helpers\Form;
$form->add( new \IPS\Helpers\Form\Radio( 'existing_reactions', NULL, TRUE, array( 'options' => array( 'change' => 'change_new_reaction', 'delete' => 'delete' ), 'toggles' => array( 'change' => array( 'new_reaction' ) ) ) ) );
$form->add( new \IPS\Helpers\Form\Node( 'new_reaction', NULL, TRUE, array( 'class' => 'IPS\Content\Reaction', 'permissionCheck' => function( $row ) use ( $node ) {
if ( $row->_id == $node->_id )
{
return FALSE;
}
return TRUE;
} ), NULL, NULL, NULL, 'new_reaction' ) );
if ( $values = $form->values() )
{
if ( $values['existing_reactions'] == 'change' AND array_key_exists( 'new_reaction', $values ) )
{
\IPS\Db::i()->update( 'core_reputation_index', array( 'reaction' => $values['new_reaction']->_id ), array( "reaction=?", $node->_id ) );
}
else
{
\IPS\Db::i()->delete( 'core_reputation_index', array( "reaction=?", $node->_id ) );
}
/* Delete it */
\IPS\Session::i()->log( 'acplog__node_deleted', array( $this->title => TRUE, $node->titleForLog() => FALSE ) );
$node->delete();
/* Boink */
if( \IPS\Request::i()->isAjax() )
{
\IPS\Output::i()->json( "OK" );
}
else
{
\IPS\Output::i()->redirect( $this->url->setQueryString( array( 'root' => ( $node->parent() ? $node->parent()->_id : '' ) ) ), 'deleted' );
}
}
\IPS\Output::i()->output = $form;
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Spam Prevention Settings
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 18 Apr 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\modules\admin\membersettings;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Warnings
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 23 Apr 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\modules\admin\membersettings;