Version 4.3.0

This commit is contained in:
Neo committed 2025-12-19 05:47:12 -08:00
1 parent 96997ddd8e
commit fe1acf984a
1349 files changed
+116159 -67711

No files matched your search

+38 -16
View File
@@ -22,6 +22,35 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _modcp extends \IPS\Dispatcher\Controller
{
/**
* Dispatcher looks for methods to match do param, which may exist in the extension files, so this method
* prevents dispatcher throwing a 2S106/1 and allows the extensions to use the values
*
* @param string $method Desired method
* @param array $args Arguments
* @return void
*/
public function __call( $method, $args )
{
if ( isset( \IPS\Request::i()->do ) )
{
$activeTab = \IPS\Request::i()->tab ?: 'overview';
foreach ( \IPS\Application::allExtensions( 'core', 'ModCp', TRUE ) as $key => $extension )
{
if( method_exists( $extension, 'getTab' ) and mb_strtolower( $extension->getTab() ) == mb_strtolower( $activeTab ) )
{
if ( method_exists( $extension, \IPS\Request::i()->do ) )
{
return $this->manage();
}
}
}
}
/* Still here? */
\IPS\Output::i()->error( 'page_not_found', '2C139/5', 404, '' );
}
/**
* Moderator Control Panel
*
@@ -45,6 +74,9 @@ class _modcp extends \IPS\Dispatcher\Controller
$activeTab = \IPS\Request::i()->tab ?: 'overview';
$tabs = array( 'reports' => array(), 'approval' => array() );
$content = '';
$approvalQueueCount = 0;
foreach ( \IPS\Application::allExtensions( 'core', 'ModCp', TRUE ) as $key => $extension )
{
if( method_exists( $extension, 'getTab' ) )
@@ -55,6 +87,12 @@ class _modcp extends \IPS\Dispatcher\Controller
{
$tabs[ $tab ][] = $key;
}
/* Get the count for the approval queue from the extension */
if( $tab == 'approval' )
{
$approvalQueueCount = $extension->getApprovalQueueCount( false );
}
}
if( mb_strtolower( $extension->getTab() ) == mb_strtolower( $activeTab ) )
@@ -113,22 +151,6 @@ class _modcp extends \IPS\Dispatcher\Controller
}
}
/* Get the count for the approval queue. If the community has a lot of data in the search index, thid can take a long
time, so we cache for a short while */
try
{
$approvalQueueCount = \IPS\Data\Cache::i()->getWithExpire( 'modCpApprovalQueueCount_' . \IPS\Member::loggedIn()->member_id, TRUE );
}
catch ( \OutOfRangeException $e )
{
$approvalQueueCount = \IPS\Content\Search\Query::init()->setHiddenFilter( \IPS\Content\Search\Query::HIDDEN_UNAPPROVED )->count();
if ( \IPS\Settings::i()->clubs and \IPS\Settings::i()->clubs_require_approval and \IPS\Member::loggedIn()->modPermission('can_access_all_clubs') )
{
$approvalQueueCount += \IPS\Db::i()->select( 'COUNT(*)', 'core_clubs', 'approved=0' )->first();
}
\IPS\Data\Cache::i()->storeWithExpire( 'modCpApprovalQueueCount_' . \IPS\Member::loggedIn()->member_id, $approvalQueueCount, \IPS\DateTime::create()->add( new \DateInterval( 'PT15M' ) ), TRUE );
}
/* Display */
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/modcp.css' ) );
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/modcp_responsive.css' ) );