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' );
|
||||
}
|
||||
|
||||
@@ -263,6 +263,11 @@ class _category extends \IPS\cms\Databases\Controller
|
||||
{
|
||||
$where = NULL;
|
||||
}
|
||||
|
||||
if( \IPS\Request::i()->advanced_search_submitted )
|
||||
{
|
||||
\IPS\Request::i()->csrfKey = \IPS\Session::i()->csrfKey;
|
||||
}
|
||||
|
||||
$table = new \IPS\Helpers\Table\Content( 'IPS\cms\Records' . \IPS\cms\Databases\Dispatcher::i()->databaseId, $category->url(), $where, $category, NULL, 'read', isset( \IPS\Request::i()->rss ) ? FALSE : TRUE );
|
||||
$table->tableTemplate = array( \IPS\cms\Theme::i()->getTemplate( $category->_template_listing, 'cms', 'database' ), 'categoryTable' );
|
||||
|
||||
@@ -139,7 +139,16 @@ class _record extends \IPS\Content\Controller
|
||||
|
||||
$record->save();
|
||||
$record->processAfterEdit( $values );
|
||||
|
||||
|
||||
$fieldObjects = $fieldsClass::data( NULL, $record->category_id ? $category : NULL );
|
||||
|
||||
foreach( $fieldObjects as $id => $row )
|
||||
{
|
||||
if ( $row->type == 'Item' )
|
||||
{
|
||||
$record->processItemFieldData( $row );
|
||||
}
|
||||
}
|
||||
\IPS\Output::i()->redirect( $record->url() );
|
||||
}
|
||||
}
|
||||
@@ -214,14 +223,14 @@ class _record extends \IPS\Content\Controller
|
||||
'author' => array(
|
||||
'@type' => 'Person',
|
||||
'name' => (string) \IPS\Member::load( $record->member_id )->name,
|
||||
'image' => (string) \IPS\Member::load( $record->member_id )->get_photo()
|
||||
'image' => (string) \IPS\Member::load( $record->member_id )->get_photo( TRUE, TRUE )
|
||||
),
|
||||
'publisher' => array(
|
||||
'@id' => \IPS\Settings::i()->base_url . '#organization',
|
||||
'member' => array(
|
||||
'@type' => "Person",
|
||||
'name' => \IPS\Member::load( $record->member_id )->name,
|
||||
'image' => (string) \IPS\Member::load( $record->member_id )->get_photo(),
|
||||
'image' => (string) \IPS\Member::load( $record->member_id )->get_photo( TRUE, TRUE ),
|
||||
)
|
||||
),
|
||||
'interactionStatistic' => array(
|
||||
@@ -258,7 +267,7 @@ class _record extends \IPS\Content\Controller
|
||||
}
|
||||
\IPS\Output::i()->jsonLd['article']['publisher']['logo'] = array(
|
||||
'@type' => 'ImageObject',
|
||||
'url' => $logo ? (string) $logo : (string) \IPS\Member::load( $record->member_id )->get_photo(),
|
||||
'url' => $logo ? (string) $logo : (string) \IPS\Member::load( $record->member_id )->get_photo( TRUE, TRUE ),
|
||||
);
|
||||
|
||||
/* Image is required */
|
||||
@@ -283,7 +292,7 @@ class _record extends \IPS\Content\Controller
|
||||
|
||||
\IPS\Output::i()->jsonLd['article']['image'] = array(
|
||||
'@type' => 'ImageObject',
|
||||
'url' => \IPS\Member::load( $record->member_id )->get_photo(),
|
||||
'url' => \IPS\Member::load( $record->member_id )->get_photo( TRUE, TRUE ),
|
||||
'width' => $photoVars[0],
|
||||
'height' => $photoVars[1]
|
||||
);
|
||||
|
||||
@@ -30,23 +30,47 @@ class _builder extends \IPS\core\modules\front\system\widgets
|
||||
*/
|
||||
public function previewBlock()
|
||||
{
|
||||
if ( !\IPS\Member::loggedIn()->hasAcpRestriction( 'cms', 'blocks', 'block_manage' ) )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_module_permission', '3T419/1', 403, '' );
|
||||
}
|
||||
|
||||
$output = "";
|
||||
|
||||
if ( \IPS\Request::i()->_key )
|
||||
{
|
||||
try
|
||||
{
|
||||
$key = \IPS\Request::i()->_key;
|
||||
$data = \IPS\Data\Store::i()->$key;
|
||||
unset( \IPS\Data\Store::i()->$key );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
$data = array();
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( \IPS\Request::i()->block_plugin ) )
|
||||
if ( isset( $data['block_plugin'] ) )
|
||||
{
|
||||
$block = new \IPS\cms\Blocks\Block;
|
||||
$block->type = "plugin";
|
||||
$block->plugin = \IPS\Request::i()->block_plugin;
|
||||
$block->plugin_app = ( isset( \IPS\Request::i()->block_plugin_app ) ) ? \IPS\Request::i()->block_plugin_app : \IPS\Request::i()->block_app;
|
||||
$block->plugin_plugin = \IPS\Request::i()->block_plugin_plugin;
|
||||
$block->plugin = $data['block_plugin'];
|
||||
$block->plugin_app = ( isset( $data['block_plugin_app'] ) ) ? $data['block_plugin_app'] : $data['block_app'];
|
||||
|
||||
if( isset( $data['block_plugin_plugin'] ) )
|
||||
{
|
||||
$block->plugin_plugin = $data['block_plugin_plugin'];
|
||||
}
|
||||
|
||||
$block->key = md5( mt_rand() );
|
||||
|
||||
$params = array();
|
||||
$block->content = NULL;
|
||||
|
||||
if ( isset( \IPS\Request::i()->_sending ) )
|
||||
if ( isset( $data['_sending'] ) )
|
||||
{
|
||||
foreach( explode( ",", \IPS\Request::i()->_sending ) as $field )
|
||||
foreach( explode( ",", $data['_sending'] ) as $field )
|
||||
{
|
||||
/* Multi-Selects will pass their parameters through as an array, so we need to make sure we check those properly to include all options. */
|
||||
if ( mb_strstr( $field, '[]' ) !== FALSE )
|
||||
@@ -59,15 +83,15 @@ class _builder extends \IPS\core\modules\front\system\widgets
|
||||
$isArray = FALSE;
|
||||
}
|
||||
|
||||
if ( $field and isset( \IPS\Request::i()->$field ) )
|
||||
if ( $field and isset( $data[ $field ] ) )
|
||||
{
|
||||
if ( $field == 'block_content' )
|
||||
{
|
||||
$block->content = \IPS\Request::i()->$field;
|
||||
$block->content = $data[ $field ];
|
||||
|
||||
if ( isset( \IPS\Request::i()->template_params ) )
|
||||
if ( isset( $data['template_params'] ) )
|
||||
{
|
||||
$block->template_params = \IPS\Request::i()->template_params;
|
||||
$block->template_params = $data['template_params'];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -75,35 +99,35 @@ class _builder extends \IPS\core\modules\front\system\widgets
|
||||
if( mb_strpos( $field, "widget_feed_container_" ) !== FALSE )
|
||||
{
|
||||
/* On means that the all checkbox is ticked */
|
||||
$params[ 'widget_feed_container'] = \IPS\Request::i()->$field == 'on' ? 0 : ( \is_array( \IPS\Request::i()->$field ) ? \IPS\Request::i()->$field : explode( ',', \IPS\Request::i()->$field ) );
|
||||
$params[ 'widget_feed_container'] = $data[ $field ] == 'on' ? 0 : ( \is_array( $data[ $field ] ) ? $data[ $field ] : explode( ',', $data[ $field ] ) );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* We need to handle tags special */
|
||||
if( $field == 'widget_feed_tags' )
|
||||
{
|
||||
$params[ $field ] = \IPS\Request::i()->$field ? explode( ',', \IPS\Request::i()->$field ) : array();
|
||||
$params[ $field ] = $data[ $field ] ? explode( ',', $data[ $field ] ) : array();
|
||||
continue;
|
||||
}
|
||||
|
||||
/* We need to handle authors special */
|
||||
if( $field == 'widget_feed_author' )
|
||||
{
|
||||
$params[ $field ] = \IPS\Request::i()->$field ? array( \IPS\Member::load( \IPS\Request::i()->$field, 'name' )->member_id ) : array();
|
||||
$params[ $field ] = $data[ $field ] ? array( \IPS\Member::load( $data[ $field ], 'name' )->member_id ) : array();
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Is it an array? */
|
||||
if ( $isArray )
|
||||
{
|
||||
foreach( \IPS\Request::i()->$field AS $multi )
|
||||
foreach( $data[ $field ] AS $multi )
|
||||
{
|
||||
$params[ $field ][] = $multi;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
$params[ $field ] = \IPS\Request::i()->$field;
|
||||
$params[ $field ] = $data[ $field ];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,7 +135,7 @@ class _builder extends \IPS\core\modules\front\system\widgets
|
||||
$block->plugin_config = json_encode( $params );
|
||||
|
||||
/* Template stuffs */
|
||||
if ( \IPS\Request::i()->block_template_use_how == 'copy' )
|
||||
if ( $data['block_template_use_how'] == 'copy' )
|
||||
{
|
||||
$block->widget()->template( array( $block, 'getTemplate' ) );
|
||||
}
|
||||
|
||||
@@ -63,43 +63,47 @@ class _page extends \IPS\Dispatcher\Controller
|
||||
|
||||
if ( \IPS\Request::i()->path == $page->full_path )
|
||||
{
|
||||
/* Did we have a trailing slash? */
|
||||
if ( \IPS\Settings::i()->htaccess_mod_rewrite and mb_substr( \IPS\Request::i()->url()->data[ \IPS\Http\Url::COMPONENT_PATH ], -1 ) != '/' )
|
||||
/* Are we using Friendly URL's at all? */
|
||||
if ( \IPS\Settings::i()->use_friendly_urls )
|
||||
{
|
||||
$url = $page->url();
|
||||
|
||||
foreach( \IPS\Request::i()->url()->queryString as $k => $v )
|
||||
/* Did we have a trailing slash? */
|
||||
if ( \IPS\Settings::i()->htaccess_mod_rewrite and mb_substr( \IPS\Request::i()->url()->data[ \IPS\Http\Url::COMPONENT_PATH ], -1 ) != '/' )
|
||||
{
|
||||
$url = $url->setQueryString( $k, $v );
|
||||
}
|
||||
|
||||
if ( ! empty( \IPS\Request::i()->url()->fragment ) )
|
||||
{
|
||||
$url = $url->setFragment( \IPS\Request::i()->url()->fragment );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( $url, NULL, 301 );
|
||||
}
|
||||
else if ( ! \IPS\Settings::i()->htaccess_mod_rewrite and ! mb_strstr( \IPS\Request::i()->url()->data[ \IPS\Http\Url::COMPONENT_QUERY ], $page->url()->data[ \IPS\Http\Url::COMPONENT_QUERY ] ) )
|
||||
{
|
||||
$url = $page->url();
|
||||
|
||||
foreach( \IPS\Request::i()->url()->queryString as $k => $v )
|
||||
{
|
||||
if ( mb_substr( $k, 0, 1 ) == '/' and mb_substr( $k, -1 ) != '/' )
|
||||
$url = $page->url();
|
||||
|
||||
foreach( \IPS\Request::i()->url()->queryString as $k => $v )
|
||||
{
|
||||
$k .= '/';
|
||||
$url = $url->setQueryString( $k, $v );
|
||||
}
|
||||
|
||||
if ( ! empty( \IPS\Request::i()->url()->fragment ) )
|
||||
{
|
||||
$url = $url->setFragment( \IPS\Request::i()->url()->fragment );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( $url, NULL, 301 );
|
||||
}
|
||||
|
||||
$url = $url->setQueryString( $k, $v );
|
||||
|
||||
if ( ! empty( \IPS\Request::i()->url()->fragment ) )
|
||||
else if ( ! \IPS\Settings::i()->htaccess_mod_rewrite and ! mb_strstr( \IPS\Request::i()->url()->data[ \IPS\Http\Url::COMPONENT_QUERY ], $page->url()->data[ \IPS\Http\Url::COMPONENT_QUERY ] ) )
|
||||
{
|
||||
$url = $url->setFragment( \IPS\Request::i()->url()->fragment );
|
||||
$url = $page->url();
|
||||
|
||||
foreach( \IPS\Request::i()->url()->queryString as $k => $v )
|
||||
{
|
||||
if ( mb_substr( $k, 0, 1 ) == '/' and mb_substr( $k, -1 ) != '/' )
|
||||
{
|
||||
$k .= '/';
|
||||
}
|
||||
}
|
||||
|
||||
$url = $url->setQueryString( $k, $v );
|
||||
|
||||
if ( ! empty( \IPS\Request::i()->url()->fragment ) )
|
||||
{
|
||||
$url = $url->setFragment( \IPS\Request::i()->url()->fragment );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( $url, NULL, 301 );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( $url, NULL, 301 );
|
||||
}
|
||||
|
||||
/* Just viewing this page, no database categories or records */
|
||||
|
||||
Reference in new issue
Block a user