Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -128,20 +128,20 @@ abstract class _Controller
|
||||
$commentClass = $class::$commentClass;
|
||||
if ( isset( $class::$archiveClass ) )
|
||||
{
|
||||
$item = $class::loadAndCheckPerms( \IPS\Request::i()->id );
|
||||
$item = $class::load( \IPS\Request::i()->id );
|
||||
if ( $item->isArchived() )
|
||||
{
|
||||
$commentClass = $class::$archiveClass;
|
||||
}
|
||||
}
|
||||
|
||||
$content = $commentClass::loadAndCheckPerms( \IPS\Request::i()->embedComment );
|
||||
$content = $commentClass::load( \IPS\Request::i()->embedComment );
|
||||
$title = $content->item()->mapped('title');
|
||||
}
|
||||
elseif( \IPS\Request::i()->embedReview )
|
||||
{
|
||||
$reviewClass = $class::$reviewClass;
|
||||
$content = $reviewClass::loadAndCheckPerms( \IPS\Request::i()->embedReview );
|
||||
$content = $reviewClass::load( \IPS\Request::i()->embedReview );
|
||||
$title = $content->item()->mapped('title');
|
||||
}
|
||||
else
|
||||
@@ -154,25 +154,21 @@ abstract class _Controller
|
||||
{
|
||||
$params['do'] = \IPS\Request::i()->embedDo;
|
||||
}
|
||||
|
||||
$content = $class::loadAndCheckPerms( \IPS\Request::i()->id );
|
||||
$title = $content instanceof \IPS\Node\Model ? $content->_title : $content->mapped('title');
|
||||
|
||||
$content = $class::load( \IPS\Request::i()->id );
|
||||
$title = $content instanceof \IPS\Node\Model ? $content->_title : $content->mapped( 'title' );
|
||||
}
|
||||
|
||||
if ( !( $content instanceof \IPS\Content\Embeddable ) )
|
||||
{
|
||||
$output = \IPS\Theme::i()->getTemplate( 'embed', 'core', 'global' )->embedUnavailable();
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = $content->embedContent( $params );
|
||||
}
|
||||
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
$output = \IPS\Theme::i()->getTemplate( 'embed', 'core', 'global' )->embedNoPermission();
|
||||
}
|
||||
$output = $this->getEmbedOutput( $content, $params );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
$output = \IPS\Theme::i()->getTemplate( 'embed', 'core', 'global' )->embedUnavailable();
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
\IPS\Log::log( $e, 'embed_error' );
|
||||
$output = \IPS\Theme::i()->getTemplate( 'embed', 'core', 'global' )->embedNoPermission();
|
||||
}
|
||||
}
|
||||
|
||||
/* Make sure our iframe contents get the necessary elements and JS */
|
||||
@@ -213,4 +209,30 @@ abstract class _Controller
|
||||
|
||||
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core', 'front' )->embedInternal( $output, $js ), 200, 'text/html', \IPS\Output::i()->httpHeaders );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the content item or the proper error message
|
||||
*
|
||||
* @param \IPS\Content $content
|
||||
* @param array $params
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getEmbedOutput( $content, array $params = array() )
|
||||
{
|
||||
if ( !$content->canView() )
|
||||
{
|
||||
$output = \IPS\Theme::i()->getTemplate( 'embed', 'core', 'global' )->embedNoPermission();
|
||||
}
|
||||
else if ( !( $content instanceof \IPS\Content\Embeddable ) )
|
||||
{
|
||||
$output = \IPS\Theme::i()->getTemplate( 'embed', 'core', 'global' )->embedUnavailable();
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = $content->embedContent( $params );
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user