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

+26 -19
View File
@@ -11,44 +11,50 @@
namespace IPS\Theme;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use Exception;
use IPS\Db;
use IPS\Theme;
use RuntimeException;
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;
}
/**
* Template Exception Class
*/
class _TemplateException extends \RuntimeException
class TemplateException extends RuntimeException
{
/**
* @brief Template data
*/
public $template = array( 'location' => NULL, 'group' => NULL, 'app' => NULL );
public array $template = array( 'location' => NULL, 'group' => NULL, 'app' => NULL );
/**
* @brief Theme
*/
public $theme = NULL;
public ?Theme $theme = NULL;
/**
* Constructor
*
* @param string $message MySQL Error message
* @param int $code MySQL Error Code
* @param \Exception|NULL $previous Previous Exception
* @param array $template Template data (app, group, location)
* @param \IPS\Theme $theme Theme object
* @return void
* @param string|null $message MySQL Error message
* @param int $code MySQL Error Code
* @param Exception|NULL $previous Previous Exception
* @param array|null $template Template data (app, group, location)
* @param Theme|null $theme Theme object
*/
public function __construct( $message = null, $code = 0, $previous = null, $template=NULL, $theme=NULL )
public function __construct( ?string $message = null, int $code = 0, ?Exception $previous = null, ?array $template=NULL, ?Theme $theme=NULL )
{
/* Store these for the extraLogData() method */
$this->template = $template;
$this->theme = $theme;
return parent::__construct( $message, $code, $previous );
parent::__construct( $message, $code, $previous );
}
/**
@@ -56,18 +62,19 @@ class _TemplateException extends \RuntimeException
*
* @return bool
*/
public function isThirdPartyError()
public function isThirdPartyError() : bool
{
/* Try to see if the template group has any modifications...if so, ignore the exception for reporting purposes */
/* Look for a custom template inserted via hookpoint */
try
{
return (bool) \IPS\Db::i()->select( 'COUNT(*)', 'core_theme_templates', array( 'template_set_id=? AND template_group=? AND template_location=? AND template_app=?', $this->theme->id, $this->template['group'], $this->template['location'], $this->template['app'] ) )->first();
return (bool) Db::i()->select( 'count(*)', 'core_theme_templates_custom', [
[ 'template_set_id=?', $this->theme->id ],
[ "template_hook_point LIKE CONCAT(?,'%')", ( $this->template['app'] . '/' . $this->template['location'] . '/' . $this->template['group'] . '/' ) ]
])->first();
}
catch( \Exception $e )
catch( Exception $e )
{
return FALSE;
}
return FALSE;
}
}