Version 4.6.0
This commit is contained in:
1 parent
f79dcf067a
commit
517a5e1f70
2036 files changed
+110041
-26162
No files matched your search
@@ -214,6 +214,11 @@ class _databases extends \IPS\Node\Controller
|
||||
'link' => \IPS\Http\Url::internal( 'app=cms&module=databases&controller=databases&do=delete&id=' . $row['database_id'] ),
|
||||
'data' => array( 'delete' => '' )
|
||||
);
|
||||
|
||||
if ( \IPS\cms\Databases::isUsedAsReciprocalField( $row['database_id'] ) )
|
||||
{
|
||||
unset( $return['delete']['data'] );
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
@@ -228,7 +233,7 @@ class _databases extends \IPS\Node\Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a theme dialog
|
||||
* Add a database dialog
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -283,8 +288,7 @@ class _databases extends \IPS\Node\Controller
|
||||
function( $data )
|
||||
{
|
||||
/* Open XML file */
|
||||
$xml = new \IPS\Xml\XMLReader;
|
||||
$xml->open( \IPS\Request::i()->file );
|
||||
$xml = \IPS\Xml\XMLReader::safeOpen( \IPS\Request::i()->file );
|
||||
|
||||
if ( ! @$xml->read() )
|
||||
{
|
||||
@@ -304,7 +308,7 @@ class _databases extends \IPS\Node\Controller
|
||||
/* Set default perms, these will be editable post DB import */
|
||||
\IPS\Db::i()->replace( 'core_permission_index', array(
|
||||
'app' => 'cms',
|
||||
'perm_type' => $database::$permType,
|
||||
'perm_type' => $database::$permType,
|
||||
'perm_type_id' => $database->id,
|
||||
'perm_view' => '*',
|
||||
'perm_2' => '*', #read
|
||||
@@ -508,6 +512,12 @@ class _databases extends \IPS\Node\Controller
|
||||
{
|
||||
$attrs['field_type'] = 'Text';
|
||||
}
|
||||
|
||||
/* Upload field has a special "is multiple" option we need to set */
|
||||
if( mb_ucfirst( $attrs['field_type'] ) == 'Upload' )
|
||||
{
|
||||
$attrs['field_upload_is_multiple'] = $attrs['field_is_multiple'];
|
||||
}
|
||||
|
||||
$attrs['_skip_formatting'] = TRUE;
|
||||
|
||||
@@ -522,7 +532,7 @@ class _databases extends \IPS\Node\Controller
|
||||
if ( isset( $attrs['field_extra'] ) )
|
||||
{
|
||||
/* The export format is always correct */
|
||||
$values['field_extra'] = $attrs['field_extra'];
|
||||
$values['extra'] = $attrs['field_extra'];
|
||||
}
|
||||
|
||||
$obj->saveForm( $values );
|
||||
@@ -874,7 +884,7 @@ class _databases extends \IPS\Node\Controller
|
||||
|
||||
$arrays = array();
|
||||
foreach( array( 'use_categories', 'template_listing', 'template_display', 'template_categories', 'all_editable', 'revisions', 'field_title', 'field_content', 'field_sort', 'field_direction', 'field_perpage', 'comment_approve', 'record_approve', 'rss',
|
||||
'comment_bump', 'forum_record', 'forum_comments', 'forum_delete', 'forum_forum', 'forum_prefix', 'forum_suffix', 'search', 'tags_enabled', 'tags_noprefixes', 'tags_predefined', 'fixed_field_perms',
|
||||
'comment_bump', 'forum_record', 'forum_comments', 'forum_delete', 'forum_forum', 'forum_prefix', 'forum_suffix', 'search', 'tags_enabled', 'tags_noprefixes', 'tags_predefined', 'fixed_field_perms', 'fixed_field_settings',
|
||||
'cat_index_type', 'template_form', 'template_featured', 'featured_settings', 'options' ) as $field )
|
||||
{
|
||||
if ( \is_array( $database->$field ) )
|
||||
@@ -948,7 +958,7 @@ class _databases extends \IPS\Node\Controller
|
||||
if ( isset( $row[ $field ] ) )
|
||||
{
|
||||
$xml->startElement( $field );
|
||||
if ( preg_match( '/<|>|&/', $row[ $field ] ) )
|
||||
if ( preg_match( '/<|>|&|"/', $row[ $field ] ) )
|
||||
{
|
||||
$xml->writeCData( str_replace( ']]>', ']]]]><![CDATA[>', $row[ $field ] ) );
|
||||
}
|
||||
@@ -1098,9 +1108,6 @@ class _databases extends \IPS\Node\Controller
|
||||
protected function delete()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'databases_delete' );
|
||||
|
||||
/* Make sure the user confirmed the deletion */
|
||||
\IPS\Request::i()->confirmedDelete();
|
||||
|
||||
/* Load the database */
|
||||
try
|
||||
@@ -1112,6 +1119,17 @@ class _databases extends \IPS\Node\Controller
|
||||
\IPS\Output::i()->error( 'cms_database_not_exist', '3T259/2', 403, '' );
|
||||
}
|
||||
|
||||
/* Make sure the user confirmed the deletion */
|
||||
if( \IPS\cms\Databases::isUsedAsReciprocalField( \IPS\Request::i()->id ) )
|
||||
{
|
||||
/* SHow a custom deletion confirmation for the DB if it used as reciprocal field in any other DB */
|
||||
\IPS\Request::i()->confirmedDelete( 'delete_confirm', 'delete_db_confirm_detail_msg' );
|
||||
}
|
||||
else
|
||||
{ /* Make sure the user confirmed the deletion */
|
||||
\IPS\Request::i()->confirmedDelete();
|
||||
}
|
||||
|
||||
/* Delete the database and clear the 'create' menu cache */
|
||||
$database->delete();
|
||||
\IPS\Member::clearCreateMenu();
|
||||
@@ -1533,7 +1551,8 @@ class _databases extends \IPS\Node\Controller
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=cms&module=databases&controller=databases' ), 'saved' );
|
||||
}
|
||||
|
||||
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'admin_databases.js', 'cms', 'admin' ) );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core' )->block( $current ? "content_db_" . $current->id : 'add', $form, FALSE );
|
||||
\IPS\Output::i()->title = ( $current ) ? \IPS\Member::loggedIn()->language()->addToStack('cms_editing_database', NULL, array( 'sprintf' => array( $current->_title ) ) ) : \IPS\Member::loggedIn()->language()->addToStack('cms_adding_database');
|
||||
}
|
||||
|
||||
@@ -108,13 +108,9 @@ class _records extends \IPS\Dispatcher\Controller
|
||||
|
||||
$table->advancedSearch = array(
|
||||
'category_id' => array( \IPS\Helpers\Table\SEARCH_NODE, array(
|
||||
'class' => '\IPS\cms\Categories',
|
||||
'class' => '\IPS\cms\Categories' . $database->id,
|
||||
'disabled' => false,
|
||||
'zeroVal' => 'content_db_table_as_no_cat',
|
||||
'permissionCheck' => function( $node )
|
||||
{
|
||||
return $node->database_id == \IPS\Request::i()->database_id;
|
||||
}
|
||||
'zeroVal' => 'content_db_table_as_no_cat'
|
||||
),
|
||||
),
|
||||
'record_comments'=> array( \IPS\Helpers\Table\SEARCH_SELECT, array( 'options' => array(
|
||||
|
||||
@@ -215,7 +215,7 @@ class _ajax extends \IPS\Dispatcher\Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function loadTags(): void
|
||||
public function loadTags()
|
||||
{
|
||||
$page = NULL;
|
||||
if ( isset( \IPS\Request::i()->pageId ) )
|
||||
|
||||
@@ -234,7 +234,7 @@ class _blocks extends \IPS\Node\Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function loadTags(): void
|
||||
public function loadTags()
|
||||
{
|
||||
$tags = array();
|
||||
$tagLinks = array();
|
||||
@@ -257,4 +257,32 @@ class _blocks extends \IPS\Node\Controller
|
||||
|
||||
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->blankTemplate( \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->editorTags( $tags, $tagLinks ) ), 200, 'text/html' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Store the custom code to use for a block preview
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function storeTemporaryBlock()
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
$key = md5( mt_rand() );
|
||||
|
||||
while( isset( \IPS\Data\Store::i()->$key ) )
|
||||
{
|
||||
$key = md5( mt_rand() );
|
||||
}
|
||||
|
||||
$data = array();
|
||||
|
||||
foreach( \IPS\Request::i() as $k => $v )
|
||||
{
|
||||
$data[ $k ] = $v;
|
||||
}
|
||||
|
||||
\IPS\Data\Store::i()->$key = $data;
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=cms&module=pages&controller=builder&do=previewBlock&_key=" . $key, 'front' ) );
|
||||
}
|
||||
}
|
||||
@@ -103,6 +103,8 @@ class _media extends \IPS\Node\Controller
|
||||
if ( \count( $ids ) )
|
||||
{
|
||||
\IPS\cms\Media::deleteByFileIds( $ids );
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__cms_deleted_media', array( \count( $ids ) => FALSE ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -269,6 +271,8 @@ class _media extends \IPS\Node\Controller
|
||||
/* Wipe out included JS just in case we're using this media thing */
|
||||
\IPS\cms\Templates::deleteCompiledFiles();
|
||||
\IPS\cms\Pages\Page::deleteCachedIncludes();
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__cms_replaced_media', array( $values['media_filename']->originalFilename => FALSE ) );
|
||||
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
@@ -372,6 +376,8 @@ class _media extends \IPS\Node\Controller
|
||||
/* Wipe out included JS just in case we're using this media thing */
|
||||
\IPS\cms\Templates::deleteCompiledFiles();
|
||||
\IPS\cms\Pages\Page::deleteCachedIncludes();
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__cms_uploaded_media', array( $count => FALSE ) );
|
||||
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
|
||||
@@ -360,7 +360,7 @@ FILE;
|
||||
* @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 )
|
||||
protected function _afterSave( ?\IPS\Node\Model $old, \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 */
|
||||
|
||||
@@ -73,6 +73,8 @@ class _templates extends \IPS\Dispatcher\Controller
|
||||
$tempFile = tempnam( \IPS\TEMP_DIRECTORY, 'IPS' );
|
||||
move_uploaded_file( $values['cms_templates_import'], $tempFile );
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__cms_imported_templates' );
|
||||
|
||||
/* Initate a redirector */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=cms&module=pages&controller=templates&do=importProcess' )->csrf()->setQueryString( array( 'file' => $tempFile, 'key' => md5_file( $tempFile ) ) ) );
|
||||
}
|
||||
@@ -127,16 +129,16 @@ class _templates extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function conflicts()
|
||||
{
|
||||
$key = \intval( \IPS\Request::i()->key );
|
||||
$key = \IPS\Request::i()->key;
|
||||
$form = new \IPS\Helpers\Form( 'form', 'theme_conflict_save' );
|
||||
$conflicts = array();
|
||||
|
||||
/* If this is part of plugin/app installation, set relevant form data */
|
||||
if( \IPS\Request::i()->app OR \IPS\Request::i()->plugin )
|
||||
if( \IPS\Request::i()->application OR \IPS\Request::i()->plugin )
|
||||
{
|
||||
if( \IPS\Request::i()->app )
|
||||
if( \IPS\Request::i()->application )
|
||||
{
|
||||
$form->hiddenValues['app'] = \IPS\Request::i()->app;
|
||||
$form->hiddenValues['application'] = \IPS\Request::i()->application;
|
||||
}
|
||||
elseif( \IPS\Request::i()->plugin )
|
||||
{
|
||||
@@ -177,7 +179,7 @@ class _templates extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
$conflicts[ $cid ]['diff'] = \IPS\Theme::i()->getTemplate( 'customization' )->templateConflictLarge( $template->content, $data['conflict_content'], 'html' );
|
||||
$conflicts[ $cid ]['diff'] = \IPS\Theme::i()->getTemplate( 'customization', 'core' )->templateConflictLarge( $template->content, $data['conflict_content'], 'html' );
|
||||
$conflicts[ $cid ]['large'] = true;
|
||||
}
|
||||
|
||||
@@ -258,7 +260,7 @@ class _templates extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=marketplace&controller=marketplace&do=viewFile&id=' . $values['marketplace'] ), $lang );
|
||||
}
|
||||
elseif( !empty( $values['app'] ) )
|
||||
elseif( !empty( $values['application'] ) )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=applications&controller=applications' ), $lang );
|
||||
}
|
||||
@@ -303,6 +305,9 @@ class _templates extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
\IPS\Output::i()->error( 'cms_no_templates_selected', '1T285/1', 403, '' );
|
||||
}
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__cms_exported_templates' );
|
||||
|
||||
\IPS\Output::i()->sendOutput( $xml->outputMemory(), 200, 'application/xml', array( 'Content-Disposition' => \IPS\Output::getContentDisposition( 'attachment', "pages_templates.xml" ) ) );
|
||||
}
|
||||
|
||||
@@ -457,6 +462,8 @@ class _templates extends \IPS\Dispatcher\Controller
|
||||
'name' => $values['container_name'],
|
||||
'type' => 'template_' . $type
|
||||
) );
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__cms_template_container', array( $container->title => false ) );
|
||||
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
@@ -760,6 +767,8 @@ class _templates extends \IPS\Dispatcher\Controller
|
||||
$newTemplate = \IPS\cms\Templates::add( $save );
|
||||
}
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__cms_template_add', array( $newTemplate->title => false ) );
|
||||
|
||||
/* Done */
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
@@ -803,6 +812,8 @@ class _templates extends \IPS\Dispatcher\Controller
|
||||
'template_content' => NULL,
|
||||
'template_id' => NULL
|
||||
);
|
||||
|
||||
$originalTemplate = \IPS\cms\Templates::load( $key );
|
||||
|
||||
try
|
||||
{
|
||||
@@ -831,6 +842,8 @@ class _templates extends \IPS\Dispatcher\Controller
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__cms_template_delete', array( $originalTemplate->title => false ) );
|
||||
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->json( $return );
|
||||
@@ -947,6 +960,8 @@ class _templates extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Clear block caches */
|
||||
\IPS\cms\Blocks\Block::deleteCompiled();
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__cms_template_save', array( \IPS\Request::i()->t_name => false ) );
|
||||
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
@@ -1093,6 +1108,8 @@ class _templates extends \IPS\Dispatcher\Controller
|
||||
\IPS\Db::i()->delete( 'cms_templates', array( 'template_location=? and template_group=?', 'database', \IPS\Request::i()->group ) );
|
||||
|
||||
unset( \IPS\Data\Store::i()->cms_databases );
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__cms_template_group_delete', array( \IPS\Request::i()->group => false ) );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=cms&module=pages&controller=templates' . ( isset( \IPS\Request::i()->t_location ) ? '&t_location=' . \IPS\Request::i()->t_location : '' ) ), 'deleted' );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user