Version 4.2.0

This commit is contained in:
Neo committed 2025-12-19 05:44:59 -08:00
1 parent 0dc2aee5ed
commit 96997ddd8e
2074 files changed
+125454 -55780

No files matched your search

+42 -22
View File
@@ -1,13 +1,12 @@
<?php
/**
* @brief Block Model
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Content
* @since 19 Feb 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\cms\Blocks;
@@ -189,30 +188,39 @@ class _Block extends \IPS\Node\Model implements \IPS\Node\Permissions
if ( $block->type === 'custom' )
{
$functionName = 'content_blocks_' . $block->id;
if ( ! isset( \IPS\Data\Store::i()->$functionName ) )
try
{
$content = $block->content;
$functionName = 'content_blocks_' . $block->id;
if ( ! isset( \IPS\Data\Store::i()->$functionName ) )
{
$content = $block->content;
if( $block->getConfig('editor') == 'php' )
{
ob_start();
eval( $content );
$content = ob_get_clean();
}
\IPS\Data\Store::i()->$functionName = \IPS\Theme::compileTemplate( $content, $functionName, null, true );
}
\IPS\Theme::runProcessFunction( \IPS\Data\Store::i()->$functionName, $functionName );
if( $block->getConfig('editor') == 'php' )
{
ob_start();
eval( $content );
$content = ob_get_clean();
unset( \IPS\Data\Store::i()->$functionName );
}
\IPS\Data\Store::i()->$functionName = \IPS\Theme::compileTemplate( $content, $functionName, null, true );
return call_user_func( 'IPS\\Theme\\'. $functionName );
}
\IPS\Theme::runProcessFunction( \IPS\Data\Store::i()->$functionName, $functionName );
if( $block->getConfig('editor') == 'php' )
catch ( \ParseError $e )
{
unset( \IPS\Data\Store::i()->$functionName );
@ob_end_clean();
\IPS\Log::log( $e, 'block_error' );
return "<span style='background:black;color:white;padding:6px;'>[[Block {$block->key} is throwing an error]]</span>";
}
return call_user_func( 'IPS\\Theme\\'. $functionName );
}
else
{
@@ -632,6 +640,18 @@ EOF;
else
{
$form->add( new \IPS\Helpers\Form\Codemirror( 'block_content', htmlentities( $this->content, \IPS\HTMLENTITIES, 'UTF-8', TRUE ), FALSE, array(), function( $val ) {
if ( \IPS\Request::i()->block_editor == 'php' )
{
try
{
@eval( $val );
}
catch ( \ParseError $e )
{
throw new \DomainException( $e->getMessage() );
}
}
if ( mb_strpos( $val, '{block="' . \IPS\Request::i()->block_key . '"}' ) !== FALSE )
{
throw new \DomainException('block_content_recursive_error');