Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
@@ -2,9 +2,10 @@
|
||||
/**
|
||||
* @brief Pages Controller
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @subpackage Content
|
||||
* @since 15 Jan 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -27,7 +28,12 @@ class _pages extends \IPS\Node\Controller
|
||||
* Node Class
|
||||
*/
|
||||
protected $nodeClass = '\IPS\cms\Pages\Folder';
|
||||
|
||||
|
||||
/**
|
||||
* Store the database page map to prevent many queries
|
||||
*/
|
||||
protected static $pageToDatabaseMap = NULL;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
@@ -77,6 +83,7 @@ class _pages extends \IPS\Node\Controller
|
||||
protected function manage()
|
||||
{
|
||||
$url = \IPS\Http\Url::internal( "app=cms&module=pages&controller=pages" );
|
||||
static::$pageToDatabaseMap = iterator_to_array( \IPS\Db::i()->select( 'database_id, database_page_id', 'cms_databases', array( 'database_page_id > 0' ) )->setKeyField('database_page_id')->setValueField('database_id') );
|
||||
|
||||
/* Display the table */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__cms_pages_pages');
|
||||
@@ -197,7 +204,7 @@ class _pages extends \IPS\Node\Controller
|
||||
|
||||
$page = \IPS\cms\Pages\Page::getDefaultPage();
|
||||
|
||||
$response = \IPS\Http\Url::external( ( \IPS\Settings::i()->htaccess_mod_rewrite ? $val . $page->full_path : $val . 'index.php?/' . $page->full_path ) )->request( 5, '1.1', FALSE )->get();
|
||||
$response = \IPS\Http\Url::external( ( \IPS\Settings::i()->htaccess_mod_rewrite ? $val . $page->full_path : $val . 'index.php?/' . $page->full_path ) )->request( NULL, NULL, FALSE )->get();
|
||||
|
||||
if ( $response->httpResponseCode != 200 and $response->httpResponseCode != 303 and ( \IPS\Settings::i()->site_online OR $response->httpResponseCode != 503 ) )
|
||||
{
|
||||
@@ -247,14 +254,28 @@ class _pages extends \IPS\Node\Controller
|
||||
protected function htaccess()
|
||||
{
|
||||
$dir = str_replace( \IPS\CP_DIRECTORY . '/index.php', '', $_SERVER['PHP_SELF'] );
|
||||
$dirs = explode( '/', trim( $dir, '/' ) );
|
||||
|
||||
if ( count( $dirs ) )
|
||||
{
|
||||
array_pop( $dirs );
|
||||
$dir = implode( '/', $dirs );
|
||||
|
||||
if ( ! $dir )
|
||||
{
|
||||
$dir = '/';
|
||||
}
|
||||
}
|
||||
|
||||
$path = $dir . 'index.php';
|
||||
|
||||
|
||||
if( \strpos( $dir, ' ' ) !== FALSE )
|
||||
{
|
||||
$dir = '"' . $dir . '"';
|
||||
$path = '"' . $path . '"';
|
||||
}
|
||||
|
||||
|
||||
$htaccess = <<<FILE
|
||||
<IfModule mod_rewrite.c>
|
||||
Options -MultiViews
|
||||
@@ -319,7 +340,7 @@ FILE;
|
||||
\IPS\cms\Pages\Page::deleteCompiled( \IPS\Request::i()->id );
|
||||
}
|
||||
|
||||
parent::delete();
|
||||
return parent::delete();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -367,7 +388,13 @@ FILE;
|
||||
*/
|
||||
public static function getPageRow( $page, $url )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'trees', 'core' )->row( $url, $page->id, $page->seo_name, false, $page->getButtons( \IPS\Http\url::internal('app=cms&module=pages&controller=pages'), true ), "", 'file-text-o', NULL, FALSE, NULL, NULL, NULL, FALSE, FALSE, FALSE );
|
||||
$badge = NULL;
|
||||
|
||||
if ( isset( static::$pageToDatabaseMap[ $page->id ] ) )
|
||||
{
|
||||
$badge = array( 0 => 'style7', 1 => \IPS\Member::loggedIn()->language()->addToStack( 'page_database_display', NULL, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->addToStack('content_db_' . static::$pageToDatabaseMap[ $page->id ] ) ) ) ) );
|
||||
}
|
||||
return \IPS\Theme::i()->getTemplate( 'trees', 'core' )->row( $url, $page->id, $page->seo_name, false, $page->getButtons( \IPS\Http\url::internal('app=cms&module=pages&controller=pages'), true ), "", 'file-text-o', NULL, FALSE, NULL, NULL, $badge, FALSE, FALSE, FALSE );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -409,32 +436,4 @@ FILE;
|
||||
|
||||
return \IPS\cms\Pages\Folder::munge( $folders, $pages );
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect after save
|
||||
*
|
||||
* @param \IPS\Node\Model $old A clone of the node as it was before or NULL if this is a creation
|
||||
* @param \IPS\Node\Model $node The node now
|
||||
* @return void
|
||||
*/
|
||||
protected function _afterSave( \IPS\Node\Model $old = NULL, \IPS\Node\Model $new )
|
||||
{
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->json( array() );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( isset( \IPS\Request::i()->save_and_reload ) )
|
||||
{
|
||||
$buttons = $new->getButtons( $this->url, !( $new instanceof $this->nodeClass ) );
|
||||
|
||||
\IPS\Output::i()->redirect( $buttons['edit']['link'], 'saved' );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( $this->url->setQueryString( array( 'root' => ( $new->parent() ? $new->parent()->_id : '' ) ) ), 'saved' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user