Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Customization AJAX actions
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Content
|
||||
* @since 07 May 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\cms\modules\admin\pages;
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Block Controller
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Content
|
||||
* @since 19 Feb 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\cms\modules\admin\pages;
|
||||
@@ -48,7 +47,29 @@ class _blocks extends \IPS\Node\Controller
|
||||
public function manage()
|
||||
{
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__cms_pages_blocks');
|
||||
$nodeClass = $this->nodeClass;
|
||||
|
||||
if ( $nodeClass::canAddRoot() )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['actions']['add_meow'] = array(
|
||||
'primary' => true,
|
||||
'icon' => 'plus',
|
||||
'title' => 'content_block_cat_add',
|
||||
'link' => $this->url->setQueryString( 'do', 'form' ),
|
||||
'data' => ( $nodeClass::$modalForms ? array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('content_block_cat_add') ) : array() )
|
||||
);
|
||||
}
|
||||
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'cms', 'pages', 'block_add' ) )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['actions']['add_block'] = array(
|
||||
'primary' => true,
|
||||
'icon' => 'puzzle-piece',
|
||||
'title' => 'content_block_block_add',
|
||||
'link' => $this->url->setQueryString( array( 'do' => 'addBlockType', 'subnode' => 1 ) ),
|
||||
'data' => ( $nodeClass::$modalForms ? array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('content_block_block_add') ) : array() )
|
||||
);
|
||||
}
|
||||
parent::manage();
|
||||
}
|
||||
|
||||
@@ -77,26 +98,6 @@ class _blocks extends \IPS\Node\Controller
|
||||
$nodeClass = $this->nodeClass;
|
||||
$buttons = array();
|
||||
|
||||
if ( $nodeClass::canAddRoot() )
|
||||
{
|
||||
$buttons['add_meow'] = array(
|
||||
'icon' => 'plus',
|
||||
'title' => 'content_block_cat_add',
|
||||
'link' => $this->url->setQueryString( 'do', 'form' ),
|
||||
'data' => ( $nodeClass::$modalForms ? array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('content_block_cat_add') ) : array() )
|
||||
);
|
||||
}
|
||||
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'cms', 'pages', 'block_add' ) )
|
||||
{
|
||||
$buttons['add_block'] = array(
|
||||
'icon' => 'puzzle-piece',
|
||||
'title' => 'content_block_block_add',
|
||||
'link' => $this->url->setQueryString( array( 'do' => 'addBlockType', 'subnode' => 1 ) ),
|
||||
'data' => ( $nodeClass::$modalForms ? array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('content_block_block_add') ) : array() )
|
||||
);
|
||||
}
|
||||
|
||||
return $buttons;
|
||||
}
|
||||
|
||||
@@ -130,13 +131,23 @@ class _blocks extends \IPS\Node\Controller
|
||||
{
|
||||
if ( $widget['app'] )
|
||||
{
|
||||
$plugins[ \IPS\Application::load( $widget['app'] )->_title ][ 'app__' . $widget['app'] . '__' . $widget['key'] ] = \IPS\Member::loggedIn()->language()->addToStack( 'block_' . $widget['key'] );
|
||||
$app = \IPS\Application::load( $widget['app'] );
|
||||
if ( $app->enabled )
|
||||
{
|
||||
$plugins[ $app->_title ][ 'app__' . $widget['app'] . '__' . $widget['key'] ] = \IPS\Member::loggedIn()->language()->addToStack( 'block_' . $widget['key'] );
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$plugins[ \IPS\Plugin::load( $widget['plugin'] )->_title ][ 'plugin__' . $widget['plugin'] . '__' . $widget['key'] ] = \IPS\Member::loggedIn()->language()->addToStack( 'block_' . $widget['key'] );
|
||||
$plugin = \IPS\Plugin::load( $widget['plugin'] );
|
||||
if ( $plugin->enabled )
|
||||
{
|
||||
$plugins[ $plugin->_title ][ 'plugin__' . $widget['plugin'] . '__' . $widget['key'] ] = \IPS\Member::loggedIn()->language()->addToStack( 'block_' . $widget['key'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( \UnexpectedValueException $e ) { }
|
||||
catch ( \OutOfRangeException $e ) { }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Pages Media Management
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Content
|
||||
* @since 07 Jul 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\cms\modules\admin\pages;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Pages Controller
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Content
|
||||
* @since 15 Jan 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
@@ -55,23 +55,6 @@ class _pages extends \IPS\Node\Controller
|
||||
$nodeClass = $this->nodeClass;
|
||||
$buttons = array();
|
||||
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'cms', 'pages', 'page_add' ) )
|
||||
{
|
||||
$buttons['add_folder'] = array(
|
||||
'icon' => 'folder-open',
|
||||
'title' => 'content_add_folder',
|
||||
'link' => \IPS\Http\Url::internal( 'app=cms&module=pages&controller=pages&do=form' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('content_add_folder') )
|
||||
);
|
||||
|
||||
$buttons['add_page'] = array(
|
||||
'icon' => 'plus-circle',
|
||||
'title' => 'content_add_page',
|
||||
'link' => \IPS\Http\Url::internal( 'app=cms&module=pages&controller=pages&subnode=1&do=add' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('content_add_page') )
|
||||
);
|
||||
}
|
||||
|
||||
return $buttons;
|
||||
}
|
||||
|
||||
@@ -146,6 +129,25 @@ class _pages extends \IPS\Node\Controller
|
||||
'link' => \IPS\Http\Url::internal( 'app=cms&module=pages&controller=pages&do=settings' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('cms_pages_settings') )
|
||||
);
|
||||
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'cms', 'pages', 'page_add' ) )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['actions']['add_folder'] = array(
|
||||
'primary' => true,
|
||||
'icon' => 'folder-open',
|
||||
'title' => 'content_add_folder',
|
||||
'link' => \IPS\Http\Url::internal( 'app=cms&module=pages&controller=pages&do=form' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('content_add_folder') )
|
||||
);
|
||||
|
||||
\IPS\Output::i()->sidebar['actions']['add_page'] = array(
|
||||
'primary' => true,
|
||||
'icon' => 'plus-circle',
|
||||
'title' => 'content_add_page',
|
||||
'link' => \IPS\Http\Url::internal( 'app=cms&module=pages&controller=pages&subnode=1&do=add' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('content_add_page') )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -436,4 +438,36 @@ 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 $new The node now
|
||||
* @param string $lastUsedTab The tab last used in the form
|
||||
* @return void
|
||||
*/
|
||||
protected function _afterSave( \IPS\Node\Model $old = NULL, \IPS\Node\Model $new, $lastUsedTab = FALSE )
|
||||
{
|
||||
/* If this page was the default in a folder, and it was moved to a new folder that already has a default, we need to unset the
|
||||
default page flag or there will be two defaults in the destination folder */
|
||||
if( $old !== NULL AND $old->folder_id != $new->folder_id AND $old->default )
|
||||
{
|
||||
/* Is there already a default page in the new folder? */
|
||||
try
|
||||
{
|
||||
$existingDefault = \IPS\Db::i()->select( 'page_id', 'cms_pages', array( 'page_folder_id=? and page_default=?', $new->folder_id, 1 ) )->first();
|
||||
|
||||
\IPS\Db::i()->update( 'cms_pages', array( 'page_default' => 0 ), array( 'page_id=?', $new->id ) );
|
||||
|
||||
\IPS\cms\Pages\Page::buildPageUrlStore();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
/* No default found in destination folder, do nothing */
|
||||
}
|
||||
}
|
||||
|
||||
parent::_afterSave( $old, $new, $lastUsedTab );
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Templates Controller
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Content
|
||||
* @since 25 Feb 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\cms\modules\admin\pages;
|
||||
@@ -517,7 +516,15 @@ class _templates extends \IPS\Dispatcher\Controller
|
||||
$form = new \IPS\Helpers\Form();
|
||||
$form->hiddenValues['type'] = $type;
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'template_title', NULL, TRUE, array( 'regex' => '/^([A-Z_][A-Z0-9_]+?)$/i' ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'template_title', NULL, TRUE, array( 'regex' => '/^([A-Z_][A-Z0-9_]+?)$/i' ), function ( $val ) {
|
||||
/* PHP Keywords cannot be used as template names - so make sure the full template name is not in the list */
|
||||
$keywords = array( 'abstract', 'and', 'array', 'as', 'break', 'callable', 'case', 'catch', 'class', 'clone', 'const', 'continue', 'declare', 'default', 'die', 'do', 'echo', 'else', 'elseif', 'empty', 'enddeclare', 'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile', 'eval', 'exit', 'extends', 'final', 'for', 'foreach', 'function', 'global', 'goto', 'if', 'implements', 'include', 'include_once', 'instanceof', 'insteadof', 'interface', 'isset', 'list', 'namespace', 'new', 'or', 'print', 'private', 'protected', 'public', 'require', 'require_once', 'return', 'static', 'switch', 'throw', 'trait', 'try', 'unset', 'use', 'var', 'while', 'xor' );
|
||||
|
||||
if ( in_array( $val, $keywords ) )
|
||||
{
|
||||
throw new \DomainException( \IPS\Member::loggedIn()->language()->addToStack( 'template_reserved_word', FALSE, array( 'htmlsprintf' => array( \IPS\Member::loggedIn()->language()->formatList( $keywords ) ) ) ) );
|
||||
}
|
||||
} ) );
|
||||
|
||||
/* Very specific */
|
||||
if ( $type === 'database' )
|
||||
@@ -547,6 +554,12 @@ class _templates extends \IPS\Dispatcher\Controller
|
||||
$plugins = array();
|
||||
foreach ( \IPS\Db::i()->select( "*", 'core_widgets', array( 'embeddable=1') ) as $widget )
|
||||
{
|
||||
/* Skip disabled applications */
|
||||
if ( !in_array( $widget['app'], array_keys( \IPS\Application::enabledApplications() ) ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$plugins[ \IPS\Application::load( $widget['app'] )->_title ][ $widget['app'] . '__' . $widget['key'] ] = \IPS\Member::loggedIn()->language()->addToStack( 'block_' . $widget['key'] );
|
||||
|
||||
Reference in new issue
Block a user