Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

@@ -12,25 +12,36 @@
namespace IPS\core\modules\admin\stats;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use IPS\core\Statistics\Chart;
use IPS\Dispatcher;
use IPS\Dispatcher\Controller;
use IPS\Http\Url;
use IPS\Member;
use IPS\Output;
use IPS\Request;
use IPS\Theme;
use function defined;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* preferences
*/
class _preferences extends \IPS\Dispatcher\Controller
class preferences extends Controller
{
/**
* Execute
*
* @return void
*/
public function execute()
public function execute() : void
{
\IPS\Dispatcher::i()->checkAcpPermission( 'preferences_manage' );
Dispatcher::i()->checkAcpPermission( 'preferences_manage' );
parent::execute();
}
@@ -39,43 +50,36 @@ class _preferences extends \IPS\Dispatcher\Controller
*
* @return void
*/
protected function manage()
protected function manage() : void
{
$tabs = array(
'theme' => 'stats_member_pref_theme',
'lang' => 'stats_member_pref_lang',
);
\IPS\Request::i()->tab ??= 'lang';
$activeTab = ( isset( \IPS\Request::i()->tab ) and array_key_exists( \IPS\Request::i()->tab, $tabs ) ) ? \IPS\Request::i()->tab : 'lang';
Request::i()->tab ??= 'lang';
$activeTab = ( isset( Request::i()->tab ) and array_key_exists( Request::i()->tab, $tabs ) ) ? Request::i()->tab : 'lang';
switch( $activeTab )
{
case 'theme':
$chart = \IPS\core\Statistics\Chart::loadFromExtension( 'core', 'Theme' )->getChart( \IPS\Http\Url::internal( "app=core&module=stats&controller=preferences&tab=theme" ) );
$chart = Chart::loadFromExtension( 'core', 'Theme' )->getChart( Url::internal( "app=core&module=stats&controller=preferences&tab=theme" ) );
break;
case 'lang':
$chart = \IPS\core\Statistics\Chart::loadFromExtension( 'core', 'Language' )->getChart( \IPS\Http\Url::internal( "app=core&module=stats&controller=preferences&tab=lang" ) );
$chart = Chart::loadFromExtension( 'core', 'Language' )->getChart( Url::internal( "app=core&module=stats&controller=preferences&tab=lang" ) );
break;
}
$chart = $chart->render('PieChart', array(
'backgroundColor' => '#ffffff',
'pieHole' => 0.4,
'chartArea' => array(
'width' =>"90%",
'height' => "90%"
)
) );
if ( \IPS\Request::i()->isAjax() )
if ( Request::i()->isAjax() )
{
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->paddedBlock( (string) $chart, NULL, "ipsPad" );
Output::i()->output = Theme::i()->getTemplate( 'global' )->paddedBlock( (string) $chart, NULL, "i-padding_3" );
}
else
{
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_stats_preferences');
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core' )->tabs( $tabs, $activeTab, (string) $chart, \IPS\Http\Url::internal( "app=core&module=stats&controller=preferences" ), 'tab', '', 'ipsPad' );
Output::i()->title = Member::loggedIn()->language()->addToStack('menu__core_stats_preferences');
Output::i()->output = Theme::i()->getTemplate( 'global', 'core' )->tabs( $tabs, $activeTab, (string) $chart, Url::internal( "app=core&module=stats&controller=preferences" ), 'tab', '', 'i-padding_3' );
}
}