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,50 +12,59 @@
namespace IPS\core\modules\admin\overview;
use IPS\core\Statistics\Chart;
use IPS\Dispatcher\Controller;
use IPS\Http\Url;
use IPS\Member;
use IPS\Output;
use IPS\Request;
use IPS\Theme;
use Throwable;
use function count;
use function defined;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
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;
}
/**
* mycharts
*/
class _mycharts extends \IPS\Dispatcher\Controller
class mycharts extends Controller
{
/**
* @brief Has been CSRF-protected
*/
public static $csrfProtected = TRUE;
public static bool $csrfProtected = TRUE;
/**
* @brief Allow MySQL RW separation for efficiency
*/
public static $allowRWSeparation = TRUE;
public static bool $allowRWSeparation = TRUE;
/**
* Manage
*
* @return void
*/
protected function manage()
protected function manage() : void
{
$charts = [];
foreach( Chart::getChartsForMember( \IPS\Http\Url::internal( "app=core&module=overview&controller=mycharts" ), TRUE ) AS $id )
foreach( Chart::getChartsForMember( Url::internal( "app=core&module=overview&controller=mycharts" ), TRUE ) AS $id )
{
$charts[] = $id;
}
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_overview_mycharts');
if ( !\count( $charts ) )
Output::i()->title = Member::loggedIn()->language()->addToStack('menu__core_overview_mycharts');
if ( !count( $charts ) )
{
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('stats')->mychartsEmpty();
Output::i()->output = Theme::i()->getTemplate('stats')->mychartsEmpty();
}
else
{
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('stats')->mycharts( $charts );
Output::i()->output = Theme::i()->getTemplate('stats')->mycharts( $charts );
}
}
@@ -64,35 +73,35 @@ class _mycharts extends \IPS\Dispatcher\Controller
*
* @return void
*/
public function getChart()
public function getChart() : void
{
if ( !isset( \IPS\Request::i()->chartId ) )
if ( !isset( Request::i()->chartId ) )
{
if ( \IPS\Request::i()->isAjax() )
if ( Request::i()->isAjax() )
{
\IPS\Output::i()->output = '';
Output::i()->output = '';
}
else
{
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=overview&controller=mycharts" ) );
Output::i()->redirect( Url::internal( "app=core&module=overview&controller=mycharts" ) );
}
}
try
{
$chart = Chart::constructMemberChartFromData( \IPS\Request::i()->chartId, \IPS\Http\Url::internal( "app=core&module=overview&controller=mycharts&do=getChart&chartId=" . \IPS\Request::i()->chartId ) );
\IPS\Output::i()->output = (string) $chart;
$chart = Chart::constructMemberChartFromData( Request::i()->chartId, Url::internal( "app=core&module=overview&controller=mycharts&do=getChart&chartId=" . Request::i()->chartId ) );
Output::i()->output = (string) $chart;
}
catch( \Throwable )
catch( Throwable )
{
if ( \IPS\Request::i()->isAjax() )
if ( Request::i()->isAjax() )
{
\IPS\Output::i()->output = '';
Output::i()->output = '';
}
else
{
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=overview&controller=mycharts" ) );
Output::i()->redirect( Url::internal( "app=core&module=overview&controller=mycharts" ) );
}
}
}