Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -40,6 +40,19 @@ class _page extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function manage()
|
||||
{
|
||||
/* As we bypass the normal URL checks, we need to perform this here */
|
||||
if ( \IPS\Settings::i()->use_friendly_urls and ! empty( \IPS\Request::i()->url()->data['query'] ) and ( mb_stripos( \IPS\Request::i()->url()->data['query'], 'app=cms&module=pages&controller=page&path=' ) !== FALSE ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$url = \IPS\Request::i()->url();
|
||||
$url->makeFriendly( 'content_page_path', \IPS\Request::i()->url()->queryString['path'] );
|
||||
|
||||
\IPS\Output::i()->redirect( $url );
|
||||
}
|
||||
catch( \Exception $ex ) { }
|
||||
}
|
||||
|
||||
$this->view();
|
||||
}
|
||||
|
||||
@@ -61,105 +74,14 @@ class _page extends \IPS\Dispatcher\Controller
|
||||
return;
|
||||
}
|
||||
|
||||
$includes = $page->getIncludes();
|
||||
|
||||
if ( isset( $includes['js'] ) and is_array( $includes['js'] ) )
|
||||
if ( \IPS\Request::i()->path == $page->full_path )
|
||||
{
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, array_values( $includes['js'] ) );
|
||||
/* Just viewing this page, no database categories or records */
|
||||
$permissions = $page->permissions();
|
||||
\IPS\Session::i()->setLocation( $page->url(), explode( ",", $permissions['perm_view'] ), 'loc_cms_viewing_page', array( 'cms_page_' . $page->_id => TRUE ) );
|
||||
}
|
||||
|
||||
/* Display */
|
||||
if ( $page->ipb_wrapper or $page->type === 'builder' )
|
||||
{
|
||||
$page->setTheme();
|
||||
$nav = array();
|
||||
|
||||
\IPS\Output::i()->title = $page->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 ( $page->type === 'builder' )
|
||||
{
|
||||
list( $group, $name, $key ) = explode( '__', $page->template );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('pages')->globalWrap( $nav, \IPS\cms\Theme::i()->getTemplate($group, 'cms', 'page')->$name( $page, $page->getWidgets() ), $page );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Populate \IPS\Output::i()->sidebar['widgets'] sidebar/header/footer widgets */
|
||||
$page->getWidgets();
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('pages')->globalWrap( $nav, $page->getHtmlContent(), $page );
|
||||
}
|
||||
|
||||
\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 ( $page->meta_keywords AND ( !isset( \IPS\Output::i()->metaTags['keywords'] ) OR !\IPS\Output::i()->metaTags['keywords'] ) )
|
||||
{
|
||||
\IPS\Output::i()->metaTags['keywords'] = $page->meta_keywords;
|
||||
}
|
||||
|
||||
if ( $page->meta_description AND ( !isset( \IPS\Output::i()->metaTags['description'] ) OR !\IPS\Output::i()->metaTags['description'] ) )
|
||||
{
|
||||
\IPS\Output::i()->metaTags['description'] = $page->meta_description;
|
||||
}
|
||||
|
||||
/* Can only disable sidebar if HTML page */
|
||||
if ( ! $page->show_sidebar and $page->type === 'html' )
|
||||
{
|
||||
\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\Request::i()->path == $page->full_path )
|
||||
{
|
||||
/* Just viewing this page, no database categories or records */
|
||||
$permissions = $page->permissions();
|
||||
\IPS\Session::i()->setLocation( $page->url(), explode( ",", $permissions['perm_view'] ), 'loc_cms_viewing_page', array( 'cms_page_' . $page->_id => TRUE ) );
|
||||
}
|
||||
|
||||
if ( ! ( \IPS\Application::load('cms')->default AND ! $page->folder_id AND $page->default ) )
|
||||
{
|
||||
\IPS\Output::i()->breadcrumb['module'] = array( $page->url(), $page->_title );
|
||||
}
|
||||
|
||||
\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 ( $page->wrapper_template and $page->wrapper_template !== '_none_' and ! \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
try
|
||||
{
|
||||
list( $group, $name, $key ) = explode( '__', $page->wrapper_template );
|
||||
\IPS\Output::i()->sendOutput( \IPS\cms\Theme::i()->getTemplate($group, 'cms', 'page')->$name( $page->getHtmlContent(), $page->getHtmlTitle() ), 200, $page->getContentType(), \IPS\Output::i()->httpHeaders );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the title */
|
||||
\IPS\Output::i()->title = $page->getHtmlTitle();
|
||||
\IPS\Member::loggedIn()->language()->parseOutputForDisplay( \IPS\Output::i()->title );
|
||||
|
||||
/* Send straight to the output engine */
|
||||
\IPS\Output::i()->sendOutput( $page->getHtmlContent(), 200, $page->getContentType(), \IPS\Output::i()->httpHeaders );
|
||||
}
|
||||
$page->output();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user