Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

@@ -2,10 +2,10 @@
/**
* @brief Settings
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage Board
* @package IPS Community Suite
* @subpackage Forums
* @since 20 Jan 2014
* @version SVN_VERSION_NUMBER
*/
@@ -34,11 +34,11 @@ class _settings extends \IPS\Dispatcher\Controller
\IPS\Dispatcher::i()->checkAcpPermission( 'settings_access' );
$tabs = array();
if ( \IPS\Member::loggedIn()->hasAcpRestriction('forum_settings') )
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'forums', 'forums', 'forum_settings' ) )
{
$tabs['settings'] = 'forum_settings';
}
if ( \IPS\Member::loggedIn()->hasAcpRestriction('archive_manage') )
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'forums', 'forums', 'archive_manage' ) )
{
$tabs['archiving'] = 'archiving';
}
@@ -128,20 +128,20 @@ class _settings extends \IPS\Dispatcher\Controller
$members = array();
foreach( explode( ',', $rule['archive_text'] ) AS $v )
{
$members[] = \IPS\Member::load( $v )->name;
$members[] = \IPS\Member::load( $v );
}
$existingValues['archive_topic_starter'] = implode( ',', $members );
$existingValues['archive_topic_starter'] = $members;
}
else
{
$members = array();
foreach( explode( ',', $rule['archive_text'] ) AS $v )
{
$members[] = \IPS\Member::load( $v )->name;
$members[] = \IPS\Member::load( $v );
}
$existingValues['archive_topic_starter_not'] = implode( ',', $members );
$existingValues['archive_topic_starter_not'] = $members;
}
break;
}
@@ -224,7 +224,7 @@ class _settings extends \IPS\Dispatcher\Controller
{
if ( in_array( $k, array( 'archive_last_post' ) ) )
{
if ( !isset( $v[3] ) or !$v[3] )
if ( ( !isset( $v[3] ) or !$v[3] ) and $v[1] )
{
$rules[] = array(
'archive_key' => md5( "forums_{$k}" ),
@@ -239,7 +239,7 @@ class _settings extends \IPS\Dispatcher\Controller
}
elseif ( in_array( $k, array( 'archive_not_last_post' ) ) )
{
if ( !isset( $v[3] ) or !$v[3] )
if ( ( !isset( $v[3] ) or !$v[3] ) and $v[1] )
{
$rules[] = array(
'archive_key' => md5( "forums_{$k}" ),
@@ -299,7 +299,7 @@ class _settings extends \IPS\Dispatcher\Controller
}
elseif( in_array( $k, array( 'archive_topic_post', 'archive_topic_view', 'archive_topic_rating' ) ) )
{
if ( !isset( $v[2] ) )
if ( !isset( $v[2] ) and $v[1] )
{
$rules[] = array(
'archive_key' => md5( "forums_{$k}" ),
@@ -314,7 +314,7 @@ class _settings extends \IPS\Dispatcher\Controller
}
elseif( in_array( $k, array( 'archive_not_topic_post', 'archive_not_topic_view', 'archive_not_topic_rating' ) ) )
{
if ( !isset( $v[2] ) )
if ( !isset( $v[2] ) and $v[1] )
{
$rules[] = array(
'archive_key' => md5( "forums_{$k}" ),
@@ -329,7 +329,7 @@ class _settings extends \IPS\Dispatcher\Controller
}
elseif( in_array( $k, array( 'archive_topic_starter' ) ) )
{
if ( is_array( $v ) )
if ( is_array( $v ) and count( $v ) )
{
$ids = array();
foreach( $v AS $member )
@@ -350,7 +350,7 @@ class _settings extends \IPS\Dispatcher\Controller
}
elseif( in_array( $k, array( 'archive_topic_starter_not' ) ) )
{
if ( is_array( $v ) )
if ( is_array( $v ) AND count( $v ) )
{
$ids = array();
foreach( $v AS $member )
@@ -446,10 +446,19 @@ class _settings extends \IPS\Dispatcher\Controller
$_whereClause[] = $bind;
}
if( $values['archive_on'] )
{
\IPS\Db::i()->update( 'core_tasks', array( 'enabled' => (int)$values['archive_on'] ), array( '`key`=?', 'archive' ) );
}
/* Make sure the unarchive task is enabled - it will disable itself if there is no work to do */
\IPS\Db::i()->update( 'core_tasks', array( 'enabled' => 1 ), array( '`key`=?', 'unarchive' ) );
/* And disable the archive task if archiving is disabled */
if( !$values['archive_on'] )
{
\IPS\Db::i()->update( 'core_tasks', array( 'enabled' => 0 ), array( '`key`=?', 'archive' ) );
}
/* Or enable it if archiving is enabled */
else
{
\IPS\Db::i()->update( 'core_tasks', array( 'enabled' => 1 ), array( '`key`=?', 'archive' ) );
}
/* Log and redirect */
\IPS\Session::i()->log( 'acplogs__archive_settings' );
@@ -563,6 +572,7 @@ class _settings extends \IPS\Dispatcher\Controller
}
) ) );
$form->add( new \IPS\Helpers\Form\Number( 'forums_posts_per_page', \IPS\Settings::i()->forums_posts_per_page , TRUE, array( 'min' => 2, 'max' => 250 ) ) );
$form->add( new \IPS\Helpers\Form\Number( 'forums_topics_per_page', \IPS\Settings::i()->forums_topics_per_page , TRUE, array( 'min' => 5, 'max' => 100 ) ) );
$form->addHeader('question_settings');
$form->add( new \IPS\Helpers\Form\YesNo( 'forums_questions_downvote', \IPS\Settings::i()->forums_questions_downvote ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'forums_answers_downvote', \IPS\Settings::i()->forums_answers_downvote ) );