Version 4.1.2

This commit is contained in:
Neo committed 2025-12-19 05:32:19 -08:00
1 parent 3ba79295ee
commit 28bd025b35
1131 files changed
+63658 -20579

No files matched your search

+360 -82
View File
@@ -51,7 +51,7 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
/**
* @brief [Node] Parent ID Database Column
*/
public static $databaseColumnParent = null;
public static $databaseColumnParent = 'folder_id';
/**
* @brief [Node] Parent Node ID Database Column
@@ -367,7 +367,6 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
{
$url->data['query'] = $queryString;
}
return \IPS\Http\Url::createFromArray( $url->data );
}
@@ -384,7 +383,7 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
/* Do we have a page with this path? */
try
{
return static::load( $newPath, 'page_full_path' )->url();
return static::load( $newPath, 'page_full_path' );
}
catch( \OutOfRangeException $ex )
{
@@ -499,6 +498,33 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
}
}
/**
* Show a custom error page
*
* @param string $title Title of the page
* @param string $message language key for error message
* @param mixed $code Error code
* @param int $httpStatusCode HTTP Status Code
* @param array $httpHeaders Additional HTTP Headers
* @return void
*/
static public function errorPage( $title, $message, $code, $httpStatusCode, $httpHeaders )
{
try
{
$page = static::load( \IPS\Settings::i()->cms_error_page );
$page->content = str_replace( '{error_message}', $message, $page->content );
$page->content = str_replace( '{error_code}', $code, $page->content );
$page->output( $title, $httpStatusCode, $httpHeaders );
}
catch( \Exception $ex )
{
\IPS\Output::i()->sidebar['enabled'] = FALSE;
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->globalTemplate( $title, \IPS\Theme::i()->getTemplate( 'global', 'core' )->error( $title, $message, $code, NULL ), array( 'app' => \IPS\Dispatcher::i()->application ? \IPS\Dispatcher::i()->application->directory : NULL, 'module' => \IPS\Dispatcher::i()->module ? \IPS\Dispatcher::i()->module->key : NULL, 'controller' => \IPS\Dispatcher::i()->controller ) ), $httpStatusCode, 'text/html', $httpHeaders, FALSE, FALSE );
}
}
/**
* Form elements
*
@@ -562,54 +588,50 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
'subnodes' => false
), NULL, NULL, NULL, 'page_folder_id' );
if ( $pageType === 'html' )
$return['page_ipb_wrapper'] = new \IPS\Helpers\Form\YesNo( 'page_ipb_wrapper', $item AND $item->id ? $item->ipb_wrapper : 1, TRUE, array(
'togglesOn' => array( 'page_show_sidebar' ),
'togglesOff' => array( 'page_wrapper_template' )
), NULL, NULL, NULL, 'page_ipb_wrapper' );
$return['page_show_sidebar'] = new \IPS\Helpers\Form\YesNo( 'page_show_sidebar', $item ? $item->show_sidebar : TRUE, FALSE, array(), NULL, NULL, NULL, 'page_show_sidebar' );
$wrapperTemplates = array( '_none_' => \IPS\Member::loggedIn()->language()->addToStack('cms_page_wrapper_template_none') );
foreach( \IPS\cms\Templates::getTemplates( \IPS\cms\Templates::RETURN_PAGE + \IPS\cms\Templates::RETURN_DATABASE_AND_IN_DEV ) as $id => $obj )
{
$return['page_ipb_wrapper'] = new \IPS\Helpers\Form\YesNo( 'page_ipb_wrapper', $item AND $item->id ? $item->ipb_wrapper : 1, TRUE, array(
'togglesOn' => array( 'page_show_sidebar' ),
'togglesOff' => array( 'page_wrapper_template' )
), NULL, NULL, NULL, 'page_ipb_wrapper' );
$return['page_show_sidebar'] = new \IPS\Helpers\Form\YesNo( 'page_show_sidebar', $item ? $item->show_sidebar : TRUE, FALSE, array(), NULL, NULL, NULL, 'page_show_sidebar' );
$wrapperTemplates = array( '_none_' => \IPS\Member::loggedIn()->language()->addToStack('cms_page_wrapper_template_none') );
foreach( \IPS\cms\Templates::getTemplates( \IPS\cms\Templates::RETURN_PAGE + \IPS\cms\Templates::RETURN_DATABASE_AND_IN_DEV ) as $id => $obj )
if ( $obj->isSuitableForCustomWrapper() )
{
if ( $obj->isSuitableForCustomWrapper() )
{
$wrapperTemplates[ \IPS\cms\Templates::readableGroupName( $obj->group ) ][ $obj->group . '__' . $obj->title . '__' . $obj->key ] = \IPS\cms\Templates::readableGroupName( $obj->title );
}
$wrapperTemplates[ \IPS\cms\Templates::readableGroupName( $obj->group ) ][ $obj->group . '__' . $obj->title . '__' . $obj->key ] = \IPS\cms\Templates::readableGroupName( $obj->title );
}
/* List of templates */
$return['page_wrapper_template'] = new \IPS\Helpers\Form\Select( 'page_wrapper_template', ( $item ? $item->wrapper_template : NULL ), FALSE, array(
'options' => $wrapperTemplates
), NULL, NULL, \IPS\Theme::i()->getTemplate( 'pages', 'cms', 'admin' )->previewTemplateLink(), 'page_wrapper_template' );
}
else
/* List of templates */
$return['page_wrapper_template'] = new \IPS\Helpers\Form\Select( 'page_wrapper_template', ( $item ? $item->wrapper_template : NULL ), FALSE, array(
'options' => $wrapperTemplates
), NULL, NULL, \IPS\Theme::i()->getTemplate( 'pages', 'cms', 'admin' )->previewTemplateLink(), 'page_wrapper_template' );
if ( count( \IPS\Theme::themes() ) > 1 )
{
if ( count( \IPS\Theme::themes() ) > 1 )
$themes = array( 0 => 'cms_page_theme_id_default' );
foreach ( \IPS\Theme::themes() as $theme )
{
$themes = array( 0 => 'cms_page_theme_id_default' );
foreach ( \IPS\Theme::themes() as $theme )
{
$themes[ $theme->id ] = $theme->_title;
}
$return['page_theme'] = new \IPS\Helpers\Form\Select( 'page_theme', $item ? $item->theme : 0, FALSE, array( 'options' => $themes ), NULL, NULL, NULL, 'page_theme' );
$themes[ $theme->id ] = $theme->_title;
}
$builderTemplates = array();
foreach( \IPS\cms\Templates::getTemplates( \IPS\cms\Templates::RETURN_PAGE + \IPS\cms\Templates::RETURN_DATABASE_AND_IN_DEV ) as $id => $obj )
{
if ( $obj->isSuitableForBuilderWrapper() )
{
$builderTemplates[ \IPS\cms\Templates::readableGroupName( $obj->group ) ][ $obj->group . '__' . $obj->title . '__' . $obj->key ] = \IPS\cms\Templates::readableGroupName( $obj->title );
}
}
$return['page_template'] = new \IPS\Helpers\Form\Select( 'page_template', $item->template ? $item->template : FALSE, FALSE, array( 'options' => $builderTemplates ), NULL, NULL, NULL, 'page_template' );
$return['page_theme'] = new \IPS\Helpers\Form\Select( 'page_theme', $item ? $item->theme : 0, FALSE, array( 'options' => $themes ), NULL, NULL, NULL, 'page_theme' );
}
$builderTemplates = array();
foreach( \IPS\cms\Templates::getTemplates( \IPS\cms\Templates::RETURN_PAGE + \IPS\cms\Templates::RETURN_DATABASE_AND_IN_DEV ) as $id => $obj )
{
if ( $obj->isSuitableForBuilderWrapper() )
{
$builderTemplates[ \IPS\cms\Templates::readableGroupName( $obj->group ) ][ $obj->group . '__' . $obj->title . '__' . $obj->key ] = \IPS\cms\Templates::readableGroupName( $obj->title );
}
}
$return['page_template'] = new \IPS\Helpers\Form\Select( 'page_template', ( $item and $item->template ) ? $item->template : FALSE, FALSE, array( 'options' => $builderTemplates ), NULL, NULL, NULL, 'page_template' );
/* Page CSS and JS */
$js = \IPS\cms\Templates::getTemplates( \IPS\cms\Templates::RETURN_ONLY_JS + \IPS\cms\Templates::RETURN_DATABASE_ONLY );
$css = \IPS\cms\Templates::getTemplates( \IPS\cms\Templates::RETURN_ONLY_CSS + \IPS\cms\Templates::RETURN_DATABASE_ONLY );
@@ -647,21 +669,32 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
$return['tab_content'] = array( 'content_page_form_tab__content', NULL, NULL, 'ipsForm_vertical' );
$tags = array();
if ( $item and $item->id == \IPS\Settings::i()->cms_error_page )
{
$tags['cms_error_page']['{error_message}'] = 'cms_error_page_message';
$tags['cms_error_page']['{error_code}'] = 'cms_error_page_code';
}
foreach( \IPS\cms\Databases::roots( NULL, NULL ) as $id => $db )
{
if ( ! $db->page_id )
{
$tags['{database="' . $db->_id . '" title="' . $db->_title . '"}'] = $db->_title;
$tags['cms_tag_databases']['{database="' . $db->key . '"}'] = $db->_title;
}
}
foreach( \IPS\cms\Blocks\Block::roots( NULL, NULL ) as $id => $block )
{
$tags['{block="' . $block->_id . '" title="' . $block->_title . '"}'] = $block->_title;
$tags['cms_tag_blocks']['{block="' . $block->key . '"}'] = $block->_title;
}
$return['page_content'] = new \IPS\Helpers\Form\Codemirror( 'page_content', $item ? $item->content : NULL, FALSE, array( 'tags' => $tags ), function( $val )
foreach( \IPS\Db::i()->select( '*', 'cms_pages', NULL, 'page_full_path ASC', array( 0, 50 ) ) as $page )
{
$tags['cms_tag_pages']['{pageurl="' . $page['page_full_path'] . '"}' ] = \IPS\Member::loggedIn()->language()->addToStack( static::$titleLangPrefix . $page['page_id'] );
}
$return['page_content'] = new \IPS\Helpers\Form\Codemirror( 'page_content', $item ? htmlentities( $item->content, \IPS\HTMLENTITIES, 'UTF-8', TRUE ) : NULL, FALSE, array( 'tags' => $tags, 'height' => 600 ), function( $val )
{
/* Test */
try
@@ -702,12 +735,7 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
$page->saveForm( $page->formatFormValues( $values ), $pageType );
/* Set permissions */
\IPS\Db::i()->insert( 'core_permission_index', array(
'app' => 'cms',
'perm_type' => 'pages',
'perm_type_id' => $page->id,
'perm_view' => '*'
) );
\IPS\Db::i()->update( 'core_permission_index', array( 'perm_view' => '*' ), array( 'app=? and perm_type=? and perm_type_id=?', 'cms', 'pages', $page->id ) );
return $page;
}
@@ -778,7 +806,40 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
\IPS\Db::i()->update( 'cms_pages', array( 'page_js_css_objects' => NULL ) );
\IPS\cms\Templates::deleteCompiledFiles();
}
/**
* Create a datastore object of page IDs and URLs.
*
* @return void
*/
public static function buildPageUrlStore()
{
$store = array();
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'cms_pages' ), 'IPS\cms\Pages\Page' ) as $page )
{
$perms = $page->permissions();
$store[ $page->id ] = array( 'url' => (string) $page->url(), 'perm' => $perms['perm_view'] );
}
\IPS\Data\Store::i()->pages_page_urls = $store;
}
/**
* Returns (and builds if required) the pages id => url datastore
*
* @return array
*/
public static function getPageUrlStore()
{
if ( ! isset( \IPS\Data\Store::i()->pages_page_urls ) )
{
static::buildPageUrlStore();
}
return \IPS\Data\Store::i()->pages_page_urls;
}
/**
* Set JS/CSS include keys
*
@@ -991,7 +1052,7 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
$return = array();
$dbWidgets = array();
$areas = array();
foreach( \IPS\Db::i()->select( '*', 'cms_page_widget_areas', array( 'area_page_id=?', $this->id ) ) as $k => $widgetMain )
{
$widgets[ $widgetMain['area_area'] ] = json_decode( $widgetMain['area_widgets'], TRUE );
@@ -1000,7 +1061,8 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
/* We need to execute database widgets first as this sets up the Database dispatcher correctly */
foreach( $widgets[ $widgetMain['area_area'] ] as $widget )
{
if ( $widget['key'] === 'Database' )
/* Do not attempt to re-parse database widgets if we already have */
if ( ! \IPS\cms\Databases\Dispatcher::i()->databaseId AND $widget['key'] === 'Database' )
{
$orientation = ( ( $widgetMain['area_area'] == 'sidebar' ) ? 'vertical' : ( ( $widgetMain['area_area'] === 'header' OR $widgetMain['area_area'] === 'footer' ) ? 'horizontal' : $widgetMain['area_orientation'] ) );
$dbWidgets[ $widget['unique'] ] = \IPS\Widget::load( \IPS\Application::load( $widget['app'] ), $widget['key'], $widget['unique'], ( isset( $widget['configuration'] ) ) ? $widget['configuration'] : array(), ( isset( $widget['restrict'] ) ? $widget['restrict'] : null ), $orientation );
@@ -1017,7 +1079,7 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
{
try
{
if ( $widget['key'] == 'Database' )
if ( $widget['key'] == 'Database' and array_key_exists( $widget['unique'], $dbWidgets ) )
{
$_widget = $dbWidgets[ $widget['unique'] ];
}
@@ -1156,9 +1218,19 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
{
$pageType = $this->type;
}
foreach( static::formElements( $this ) as $name => $field )
{
if ( $pageType !== 'html' and in_array( $name, array( 'page_ipb_wrapper', 'page_show_sidebar', 'page_wrapper_template' ) ) )
{
continue;
}
if ( $pageType === 'html' and in_array( $name, array( 'page_template' ) ) )
{
continue;
}
if ( is_array( $field ) )
{
if ( mb_substr( $name, 0, 4 ) === 'tab_' )
@@ -1179,20 +1251,42 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
if ( ! $this->id )
{
$form->addTab( 'content_page_form_tab__menu' );
$toggles = array();
$toggles = array( 'menu_manager_access_type', 'menu_parent' );
$formFields = array();
foreach( \IPS\cms\Pages\Menu::formElements( NULL, 'page' ) as $name => $field )
foreach( \IPS\cms\extensions\core\FrontNavigation\Pages::configuration( array() ) as $field )
{
$toggles[] = $name;
$formFields[ $name ] = $field;
if ( $field->name !== 'menu_content_page' )
{
$toggles[] = $field->name;
$formFields[ $field->name ] = $field;
}
}
$form->add( new \IPS\Helpers\Form\YesNo( 'page_add_to_menu', FALSE, FALSE, array( 'togglesOn' => $toggles ) ) );
$roots = array();
foreach ( \IPS\core\FrontNavigation::i()->roots( FALSE ) as $item )
{
$roots[ $item->id ] = $item->title();
}
$form->add( new \IPS\Helpers\Form\Select( 'menu_parent', '*', NULL, array( 'options' => $roots ), NULL, NULL, NULL, 'menu_parent' ) );
foreach( $formFields as $name => $field )
{
$form->add( $field );
}
$groups = array();
foreach ( \IPS\Member\Group::groups() as $group )
{
$groups[ $group->g_id ] = $group->name;
}
$form->add( new \IPS\Helpers\Form\Radio( 'menu_manager_access_type', 0, TRUE, array(
'options' => array( 0 => 'menu_manager_access_type_inherit', 1 => 'menu_manager_access_type_override' ),
'toggles' => array( 1 => array( 'menu_manager_access' ) )
), NULL, NULL, NULL, 'menu_manager_access_type' ) );
$form->add( new \IPS\Helpers\Form\Select( 'menu_manager_access', '*', NULL, array( 'multiple' => TRUE, 'options' => $groups, 'unlimited' => '*', 'unlimitedLang' => 'everyone' ), NULL, NULL, NULL, 'menu_manager_access' ) );
}
if ( $pageType === 'builder' )
@@ -1296,20 +1390,39 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
{
if( $values['page_add_to_menu'] )
{
$menuValues = array(
'menu_type' => 'page',
'menu_title_page' => $values['menu_title_page'],
'menu_content_page' => $this->id,
'menu_permission' => $values['menu_permission'],
'menu_permission_type' => $values['menu_permission_type'],
'menu_parent_id' => $values['menu_parent_id']
$values = \IPS\cms\extensions\core\FrontNavigation\Pages::parseConfiguration( $values, $this->id );
$config = array( 'menu_content_page' => $this->id );
foreach( array( 'menu_title_page_type', 'menu_title_page' ) as $field )
{
if ( isset( $values[ $field ] ) )
{
$config[ $field ] = $values[ $field ];
}
}
$save = array(
'app' => 'cms',
'extension' => 'Pages',
'config' => json_encode( $config ),
'parent' => $values['menu_parent'],
'permissions' => $values['menu_manager_access'] == '*' ? '*' : implode( ',', $values['menu_manager_access'] )
);
$menu = new \IPS\cms\Pages\Menu();
$menu->saveForm( $menu->formatFormValues( $menuValues ) );
try
{
$save['position'] = \IPS\Db::i()->select( 'MAX(position)', 'core_menu', array( 'parent=?', \IPS\Request::i()->parent ) )->first() + 1;
}
catch ( \UnderflowException $e )
{
$save['position'] = 1;
}
\IPS\Db::i()->insert( 'core_menu', $save );
unset( \IPS\Data\Store::i()->frontNavigation );
}
unset( $values['page_add_to_menu'], $values['menu_title_page'], $values['menu_permission'], $values['menu_permission_type'], $values['menu_parent_id'] );
unset( $values['page_add_to_menu'], $values['menu_title_page_type'], $values['menu_title_page'], $values['menu_parent'], $values['menu_manager_access'], $values['menu_manager_access_type'] );
}
return $values;
@@ -1683,13 +1796,42 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
{
}
\IPS\Db::i()->delete( 'cms_page_menu', array( 'menu_type=? AND menu_content=?', 'page', $this->id ) );
unset( \IPS\Data\Store::i()->cms_menu );
$delete = $this->getMenuItemIds();
if ( count( $delete ) )
{
\IPS\Db::i()->delete( 'core_menu', \IPS\Db::i()->in( 'id', $delete ) );
}
unset( \IPS\Data\Store::i()->frontNavigation );
return parent::delete();
}
/**
* Returns core_menu ids for all menu items associated with this page
*
* @return array
*/
public function getMenuItemIds()
{
$items = array();
foreach( \IPS\Db::i()->select( '*', 'core_menu', array( 'app=? AND extension=?', 'cms', 'Pages' ) ) as $item )
{
$json = json_decode( $item['config'], TRUE );
if ( isset( $json['menu_content_page'] ) )
{
if ( $json['menu_content_page'] == $this->id )
{
$items[] = $item['id'];
}
}
}
return $items;
}
/**
* Set the permission index permissions
@@ -1700,9 +1842,9 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
*/
public function setPermissions( $insert, \IPS\Helpers\Form\Matrix $matrix )
{
\IPS\cms\Pages\Menu::clearCaches();
parent::setPermissions( $insert, $matrix );
static::buildPageUrlStore();
/* Update perms if we have a child database */
try
{
@@ -1732,10 +1874,10 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
{
static::deleteCompiled( $this->id );
}
\IPS\cms\Pages\Menu::clearCaches();
parent::save();
static::buildPageUrlStore();
}
/**
@@ -1758,7 +1900,7 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
\IPS\DB::i()->update( 'cms_pages', array( 'page_default' => 0 ), array( 'page_folder_id=?', $this->folder_id ) );
\IPS\DB::i()->update( 'cms_pages', array( 'page_default' => 1 ), array( 'page_id=?', $this->id ) );
\IPS\cms\Pages\Menu::clearCaches();
static::buildPageUrlStore();
}
/**
@@ -1772,4 +1914,140 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
$this->full_path = trim( $path . '/' . $this->seo_name, '/' );
$this->save();
}
/**
* Displays a page
*
* @param int $httpStatusCode HTTP Status Code
* @param array $httpHeaders Additional HTTP Headers
* @throws \ErrorException
* @return void
*/
public function output( $title=NULL, $httpStatusCode=NULL, $httpHeaders=NULL )
{
$includes = $this->getIncludes();
if ( isset( $includes['js'] ) and is_array( $includes['js'] ) )
{
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, array_values( $includes['js'] ) );
}
/* Display */
if ( $this->ipb_wrapper or $this->type === 'builder' )
{
$this->setTheme();
$nav = array();
\IPS\Output::i()->title = $this->getHtmlTitle();
/* This has to be done after setTheme(), otherwise \IPS\Theme::switchTheme() can wipe out CSS includes */
if ( isset( $includes['css'] ) and is_array( $includes['css'] ) )
{
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, array_values( $includes['css'] ) );
}
if ( $this->type === 'builder' )
{
list( $group, $name, $key ) = explode( '__', $this->template );
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('pages')->globalWrap( $nav, \IPS\cms\Theme::i()->getTemplate($group, 'cms', 'page')->$name( $this, $this->getWidgets() ), $this );
}
else
{
/* Populate \IPS\Output::i()->sidebar['widgets'] sidebar/header/footer widgets */
$this->getWidgets();
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('pages')->globalWrap( $nav, $this->getHtmlContent(), $this );
}
\IPS\Output::i()->sidebar['enabled'] = true;
/* Set the meta tags, but do not reset them if they are already set - articles can define custom meta tags and this code
overwrites the ones set by articles if we don't verify they aren't set first */
if ( $this->meta_keywords AND ( !isset( \IPS\Output::i()->metaTags['keywords'] ) OR !\IPS\Output::i()->metaTags['keywords'] ) )
{
\IPS\Output::i()->metaTags['keywords'] = $this->meta_keywords;
}
if ( $this->meta_description AND ( !isset( \IPS\Output::i()->metaTags['description'] ) OR !\IPS\Output::i()->metaTags['description'] ) )
{
\IPS\Output::i()->metaTags['description'] = $this->meta_description;
}
/* Can only disable sidebar if HTML page */
if ( ! $this->show_sidebar and $this->type === 'html' )
{
\IPS\Output::i()->sidebar['enabled'] = false;
}
if ( isset( \IPS\Settings::i()->cms_error_page ) and \IPS\Settings::i()->cms_error_page and \IPS\Settings::i()->cms_error_page == $this->id )
{
\IPS\Output::i()->sidebar['enabled'] = false;
}
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'pages/page.css', 'cms', 'front' ) );
if ( ! ( \IPS\Application::load('cms')->default AND ! $this->folder_id AND $this->default ) )
{
\IPS\Output::i()->breadcrumb['module'] = array( $this->url(), $this->_title );
}
if ( isset( \IPS\Settings::i()->cms_error_page ) and \IPS\Settings::i()->cms_error_page and \IPS\Settings::i()->cms_error_page == $this->id )
{
/* Set the title */
\IPS\Output::i()->title = ( $title ) ? $title : $this->getHtmlTitle();
\IPS\Output::i()->output = $this->getHtmlContent();
\IPS\Member::loggedIn()->language()->parseOutputForDisplay( \IPS\Output::i()->title );
/* Send straight to the output engine */
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->globalTemplate( \IPS\Output::i()->title, \IPS\Output::i()->output, array( 'app' => \IPS\Dispatcher::i()->application->directory, 'module' => \IPS\Dispatcher::i()->module->key, 'controller' => \IPS\Dispatcher::i()->controller ) ), ( $httpStatusCode ? $httpStatusCode : 200 ), 'text/html', ( $httpHeaders ? $httpHeaders : \IPS\Output::i()->httpHeaders ) );
}
else
{
\IPS\Output::i()->allowDefaultWidgets = FALSE;
/* Let the dispatcher finish off and show page */
return;
}
}
else
{
if ( isset( $includes['css'] ) and is_array( $includes['css'] ) )
{
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, array_values( $includes['css'] ) );
}
if ( $this->meta_keywords AND ( !isset( \IPS\Output::i()->metaTags['keywords'] ) OR !\IPS\Output::i()->metaTags['keywords'] ) )
{
\IPS\Output::i()->metaTags['keywords'] = $this->meta_keywords;
}
if ( $this->meta_description AND ( !isset( \IPS\Output::i()->metaTags['description'] ) OR !\IPS\Output::i()->metaTags['description'] ) )
{
\IPS\Output::i()->metaTags['description'] = $this->meta_description;
}
/* Meta tags */
\IPS\Output::i()->buildMetaTags();
if ( $this->wrapper_template and $this->wrapper_template !== '_none_' and ! \IPS\Request::i()->isAjax() )
{
try
{
list( $group, $name, $key ) = explode( '__', $this->wrapper_template );
\IPS\Output::i()->sendOutput( \IPS\cms\Theme::i()->getTemplate($group, 'cms', 'page')->$name( $this->getHtmlContent(), $this->getHtmlTitle() ), 200, $this->getContentType(), \IPS\Output::i()->httpHeaders );
}
catch( \OutOfRangeException $e )
{
}
}
/* Set the title */
\IPS\Output::i()->title = ( $title ) ? $title : $this->getHtmlTitle();
\IPS\Member::loggedIn()->language()->parseOutputForDisplay( \IPS\Output::i()->title );
/* Send straight to the output engine */
\IPS\Output::i()->sendOutput( $this->getHtmlContent(), ( $httpStatusCode ? $httpStatusCode : 200 ), $this->getContentType(), ( $httpHeaders ? $httpHeaders : \IPS\Output::i()->httpHeaders ) );
}
}
}