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

+20 -13
View File
@@ -11,29 +11,36 @@
namespace IPS\Theme;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use Error;
use ErrorException;
use IPS\Log;
use Throwable;
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;
}
/**
* Sameboxed Template Class
*/
class _SandboxedTemplate
class SandboxedTemplate
{
/**
* @brief Template
*/
public $template;
public Template $template;
/**
* Contructor
*
* @param \IPS\Theme\Template $template Template to use
* @param Template $template Template to use
* @return void
*/
public function __construct( $template )
public function __construct( Template $template )
{
$this->template = $template;
}
@@ -41,11 +48,11 @@ class _SandboxedTemplate
/**
* Call
*
* @param string $name Method name
* @param array $args Method arguments
* @param string $name Method name
* @param array $args Method arguments
* @return string
*/
public function __call( $name, $args )
public function __call( string $name, array $args )
{
try
{
@@ -60,15 +67,15 @@ class _SandboxedTemplate
{
return $this->template->$name( ...$args );
}
catch ( \ErrorException $e )
catch ( ErrorException $e )
{
throw new \Error( $e );
throw new Error( $e );
}
}
}
catch( \Throwable $e )
catch( Throwable $e )
{
\IPS\Log::log( $e, 'template_error' );
Log::log( $e, 'template_error' );
return "<span style='background:black;color:white;padding:6px;'>[[Template {$this->template->app}/{$this->template->templateLocation}/{$this->template->templateName}/{$name} is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]</span>";
}