Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
+25
-18
@@ -10,28 +10,35 @@
|
||||
*
|
||||
*/
|
||||
|
||||
\define('REPORT_EXCEPTIONS', TRUE);
|
||||
use IPS\cms\Blocks\Block;
|
||||
use IPS\Dispatcher\External;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
use IPS\Settings;
|
||||
use IPS\Theme;
|
||||
|
||||
define('REPORT_EXCEPTIONS', TRUE);
|
||||
require_once str_replace( 'applications/cms/interface/external/external.php', '', str_replace( '\\', '/', __FILE__ ) ) . 'init.php';
|
||||
\IPS\Dispatcher\External::i();
|
||||
External::i();
|
||||
|
||||
$id = \IPS\Request::i()->blockid;
|
||||
$k = \IPS\Request::i()->widgetid;
|
||||
$blockHtml = \IPS\cms\Blocks\Block::display( $id );
|
||||
$id = Request::i()->blockid;
|
||||
$k = Request::i()->widgetid;
|
||||
$blockHtml = Block::display( $id );
|
||||
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_external.js', 'cms', 'front' ) );
|
||||
\IPS\Output::i()->globalControllers[] = 'cms.front.external.communication';
|
||||
Output::i()->jsFiles = array_merge( Output::i()->jsFiles, Output::i()->js( 'front_external.js', 'cms', 'front' ) );
|
||||
Output::i()->globalControllers[] = 'cms.front.external.communication';
|
||||
|
||||
$cache = FALSE;
|
||||
|
||||
try
|
||||
{
|
||||
if ( \is_numeric( $id ) )
|
||||
if ( is_numeric( $id ) )
|
||||
{
|
||||
$block = \IPS\cms\Blocks\Block::load( $id );
|
||||
$block = Block::load( $id );
|
||||
}
|
||||
else if ( \is_string( $id ) )
|
||||
else if ( is_string( $id ) )
|
||||
{
|
||||
$block = \IPS\cms\Blocks\Block::load( $id, 'block_key' );
|
||||
$block = Block::load( $id, 'block_key' );
|
||||
}
|
||||
|
||||
if ( $block->active )
|
||||
@@ -39,25 +46,25 @@ try
|
||||
$cache = ( $block->type == 'custom' ) ? $block->cache : TRUE;
|
||||
}
|
||||
}
|
||||
catch( \OutOfRangeException $ex ){}
|
||||
catch(OutOfRangeException $ex ){}
|
||||
|
||||
if( !$cache OR !\IPS\Settings::i()->widget_cache_ttl )
|
||||
if( !$cache OR !Settings::i()->widget_cache_ttl )
|
||||
{
|
||||
\IPS\Output::setCacheTime( false );
|
||||
Output::i()->pageCaching = FALSE;
|
||||
$headers = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
$headers = \IPS\Output::getCacheHeaders( time(), \IPS\Settings::i()->widget_cache_ttl );
|
||||
$headers = Output::getCacheHeaders( time(), Settings::i()->widget_cache_ttl );
|
||||
}
|
||||
|
||||
/* Remove protection headers. This is fine in this case because we only output */
|
||||
if( isset( \IPS\Output::i()->httpHeaders['X-Frame-Options'] ) )
|
||||
if( isset( Output::i()->httpHeaders['X-Frame-Options'] ) )
|
||||
{
|
||||
foreach( [ 'Content-Security-Policy','X-Content-Security-Policy', 'X-Frame-Options' ] as $toRemove )
|
||||
{
|
||||
unset( \IPS\Output::i()->httpHeaders[$toRemove] );
|
||||
unset( Output::i()->httpHeaders[$toRemove] );
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->blankTemplate( $blockHtml ), 200, 'text/html', $headers );
|
||||
Output::i()->sendOutput( Theme::i()->getTemplate( 'global', 'core' )->blankTemplate( $blockHtml ), 200, 'text/html', $headers );
|
||||
Reference in new issue
Block a user