Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

+16 -5
View File
@@ -2,10 +2,10 @@
/**
* @brief Custom Blocks Block
* @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
* @subpackage content
* @package IPS Community Suite
* @subpackage Content
* @since 17 Oct 2014
* @version SVN_VERSION_NUMBER
*/
@@ -80,8 +80,19 @@ class _Blocks extends \IPS\Widget\PermissionCache
{
$form = new \IPS\Helpers\Form;
}
$form->add( new \IPS\Helpers\Form\Node( 'cms_widget_custom_block', ( isset( $this->configuration['cms_widget_custom_block'] ) ? $this->configuration['cms_widget_custom_block'] : NULL ), FALSE, array(
/* A block may be deleted on the back end */
$block = NULL;
try
{
if ( isset( $this->configuration['cms_widget_custom_block'] ) )
{
$block = \IPS\cms\Blocks\Block::load( $this->configuration['cms_widget_custom_block'], 'block_key' );
}
}
catch( \OutOfRangeException $e ) { }
$form->add( new \IPS\Helpers\Form\Node( 'cms_widget_custom_block', $block, FALSE, array(
'class' => '\IPS\cms\Blocks\Container',
'permissionCheck' => function( $node )
{
+3 -3
View File
@@ -2,10 +2,10 @@
/**
* @brief Categories Widget
* @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
* @subpackage content
* @package IPS Community Suite
* @subpackage Content
* @since 24 Sept 2014
* @version SVN_VERSION_NUMBER
*/
+7 -7
View File
@@ -2,10 +2,10 @@
/**
* @brief Database Widget
* @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
* @subpackage content
* @package IPS Community Suite
* @subpackage Content
* @since 22 Aug 2014
* @version SVN_VERSION_NUMBER
*/
@@ -114,18 +114,18 @@ class _Database extends \IPS\Widget
*/
public function render()
{
if ( self::$html === NULL )
if ( static::$html === NULL )
{
if ( isset( $this->configuration['database'] ) )
{
try
{
$database = \IPS\cms\Databases::load( intval( $this->configuration['database'] ) );
self::$html = \IPS\cms\Databases\Dispatcher::i()->setDatabase( $database->id )->run();
static::$html = \IPS\cms\Databases\Dispatcher::i()->setDatabase( $database->id )->run();
}
catch ( \OutOfRangeException $e )
{
self::$html = '';
static::$html = '';
}
}
else
@@ -134,6 +134,6 @@ class _Database extends \IPS\Widget
}
}
return self::$html;
return static::$html;
}
}
+44 -6
View File
@@ -2,10 +2,10 @@
/**
* @brief DatabaseFilters Widget
* @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
* @subpackage content
* @package IPS Community Suite
* @subpackage Content
* @since 02 Sept 2014
* @version SVN_VERSION_NUMBER
*/
@@ -46,8 +46,8 @@ class _DatabaseFilters extends \IPS\Widget
*/
public function render()
{
/* Viewing a record */
if ( \IPS\cms\Databases\Dispatcher::i()->recordId )
/* Viewing or adding/editing a record */
if ( \IPS\cms\Databases\Dispatcher::i()->recordId or \IPS\Request::i()->do == 'form' )
{
return '';
}
@@ -87,6 +87,24 @@ class _DatabaseFilters extends \IPS\Widget
$cookie = $category->getFilterCookie();
$cookieValues = ( $cookie !== NULL ) ? array_combine( array_map( create_function( '$k', 'return "field_" . $k;'), array_keys( $cookie ) ), $cookie ) : array();
$urlValues = array();
foreach( \IPS\Request::i() as $k => $v )
{
if( mb_strpos( $k, 'content_field_' ) !== FALSE )
{
/* YesNo fields come in as _checkbox */
if ( mb_substr( $k, -9 ) === '_checkbox' )
{
$k = mb_substr( $k, 0, -9 );
}
$urlValues[ str_replace( 'content_', '', $k ) ] = is_array( $v ) ? implode( ',', $v ) : $v;
}
}
$cookieValues = array_merge( $urlValues, $cookieValues );
foreach( $fieldClass::fields( $cookieValues, 'view', $category, $fieldClass::FIELD_SKIP_TITLE_CONTENT | $fieldClass::FIELD_DISPLAY_FILTERS ) as $id => $field )
{
$fields[ $id ] = $field;
@@ -126,7 +144,27 @@ class _DatabaseFilters extends \IPS\Widget
{
if ( mb_substr( $k, 0, 14 ) === 'content_field_' )
{
$cookie[ mb_substr( $k, 14 ) ] = $v;
$id = mb_substr( $k, 14 );
if ( isset( $fields[ $id ] ) and $fields[ $id ] instanceof \IPS\Helpers\Form\CheckboxSet )
{
/* We need to reformat this a little */
$v = array_combine( $v, $v );
}
else if ( isset( $fields[ $id ] ) and $fields[ $id ] instanceof \IPS\Helpers\Form\YesNo )
{
/* The form class looks for {$name}_checkbox to determine the value */
$k = $k . '_checkbox';
}
else if ( isset( $fields[ $id ] ) and $fields[ $id ] instanceof \IPS\Helpers\Form\DateRange )
{
/* We need to reformat this a little */
$start = ( $v['start'] instanceof \IPS\DateTime ) ? $v['start']->getTimestamp() : intval( $v['start'] );
$end = ( $v['end'] instanceof \IPS\DateTime ) ? $v['end']->getTimestamp() : intval( $v['end'] );
$v = array( 'start' => $start, 'end' => $end );
}
$cookie[ $id ] = $v;
$params[ $k ] = $v;
}
}
+169 -7
View File
@@ -2,10 +2,10 @@
/**
* @brief RecordFeed Widget
* @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
* @subpackage cms
* @package IPS Community Suite
* @subpackage Content
* @since 24 Nov 2014
* @version SVN_VERSION_NUMBER
*/
@@ -73,16 +73,59 @@ class _RecordFeed extends \IPS\Content\Widget
}
}
$form->add( new \IPS\Helpers\Form\Select( 'cms_rf_database', isset( $this->configuration['cms_rf_database'] ) ? $this->configuration['cms_rf_database'] : 0, FALSE, array(
'disabled' => isset( $this->configuration['cms_rf_database'] ) ? true : false,
'options' => $databases
) ) );
if ( isset( $this->configuration['cms_rf_database'] ) )
{
$form->addDummy( 'cms_rf_database', $database->_title, \IPS\Member::loggedIn()->language()->addToStack( 'cms_rf_database_description' ) );
$form->hiddenValues['cms_rf_database'] = $database->_id;
}
else
{
$form->add( new \IPS\Helpers\Form\Select( 'cms_rf_database', 0, FALSE, array(
'disabled' => false,
'options' => $databases
) ) );
}
$form = parent::configuration( $form );
/* Tags */
if ( $database and $database->tags_enabled )
{
/* Sort */
$sortOptions = array(
'primary_id_field' => 'database_field__id',
'member_id' => 'database_field__member',
'record_publish_date' => 'database_field__saved',
'record_last_comment' => ( $database and $database->_comment_bump === \IPS\cms\Databases::BUMP_ON_EDIT ) ? 'database_field__edited' : 'database_field__updated',
'record_rating' => 'database_field__rating'
);
$class = static::$class;
foreach ( array( 'num_comments', 'date', 'views', 'rating_average' ) as $k )
{
if ( isset( $class::$databaseColumnMap[ $k ] ) )
{
$sortOptions[ $class::$databaseColumnMap[ $k ] ] = 'sort_' . $k;
}
}
if ( $database )
{
$FieldsClass = '\IPS\cms\Fields' . $database->id;
foreach( $FieldsClass::data() as $id => $field )
{
if ( in_array( $field->type, array( 'checkbox', 'multiselect', 'attachments' ) ) )
{
continue;
}
$sortOptions[ 'field_' . $field->id ] = $field->_title;
}
}
$form->add( new \IPS\Helpers\Form\Select( 'widget_feed_sort_on', isset( $this->configuration['widget_feed_sort_on'] ) ? $this->configuration['widget_feed_sort_on'] : $class::$databaseColumnMap['updated'], FALSE, array( 'options' => $sortOptions ) ), NULL, NULL, NULL, 'widget_feed_sort_on' );
$options = array( 'autocomplete' => array( 'unique' => TRUE, 'source' => NULL, 'freeChoice' => TRUE ) );
if ( \IPS\Settings::i()->tags_force_lower )
@@ -100,14 +143,49 @@ class _RecordFeed extends \IPS\Content\Widget
$form->add( new \IPS\Helpers\Form\Text( 'widget_feed_tags', ( isset( $this->configuration['widget_feed_tags'] ) ? $this->configuration['widget_feed_tags'] : array( 'tags' => NULL ) ), FALSE, $options ) );
}
/* Any filterable fields */
if ( $database )
{
$fieldClass = 'IPS\cms\Fields' . $database->id;
foreach( $fieldClass::fields( $this->_getCustomValuesFromConfiguration(), 'view', NULL, $fieldClass::FIELD_SKIP_TITLE_CONTENT | $fieldClass::FIELD_DISPLAY_FILTERS ) as $id => $field )
{
$form->add( $field );
}
}
if ( $database )
{
\IPS\Member::loggedIn()->language()->words['widget_feed_container_content_db_lang_su_' . $database->id ] = \IPS\Member::loggedIn()->language()->addToStack('widget_feed_container_cms');
if ( $database->_comment_bump === \IPS\cms\Databases::BUMP_ON_EDIT )
{
\IPS\Member::loggedIn()->language()->words['sort_updated'] = \IPS\Member::loggedIn()->language()->addToStack('database_field__edited');
}
}
return $form;
}
/**
* Fetch custom field values from the saved configuration
*
* @param boolean $keyAsInt Returns an array with just the field ID, as opposed to 'field_x'
* @return array
*/
protected function _getCustomValuesFromConfiguration( $keyAsInt=false )
{
$customValues = array();
foreach( $this->configuration as $k => $v )
{
if ( mb_substr( $k, 0, 8 ) === 'content_' )
{
$customValues[ $keyAsInt ? str_replace( 'content_field_', '', $k ) : mb_substr( $k, 8 ) ] = $v;
}
}
return $customValues;
}
/**
* Ran before saving widget configuration
*
@@ -117,8 +195,92 @@ class _RecordFeed extends \IPS\Content\Widget
public function preConfig( $values )
{
static::$class = '\IPS\cms\Records' . $values['cms_rf_database'];
foreach( $values as $k => $v )
{
/* We need to reformat this a little */
if ( is_array( $v ) and isset( $v['start'] ) and isset( $v['end'] ) )
{
$start = ( $v['start'] instanceof \IPS\DateTime ) ? $v['start']->getTimestamp() : intval( $v['start'] );
$end = ( $v['end'] instanceof \IPS\DateTime ) ? $v['end']->getTimestamp() : intval( $v['end'] );
$values[ $k ] = array( 'start' => $start, 'end' => $end );
}
}
return parent::preConfig( $values );
}
/**
* Get where clause
*
* @return array
*/
protected function buildWhere()
{
$where = parent::buildWhere();
$fieldClass = 'IPS\cms\Fields' . $this->configuration['cms_rf_database'];
$customFields = $fieldClass::data( 'view', NULL, $fieldClass::FIELD_SKIP_TITLE_CONTENT | $fieldClass::FIELD_DISPLAY_FILTERS );
if ( !isset( $this->configuration['widget_feed_use_perms'] ) or $this->configuration['widget_feed_use_perms'] )
{
$where['container'][] = array( 'category_can_view_others=1' );
}
foreach( $this->_getCustomValuesFromConfiguration( TRUE ) as $f => $v )
{
$k = 'field_' . $f;
if ( isset( $customFields[ $f ] ) and $v !== '___any___' AND $v !== NULL )
{
if ( is_array( $v ) )
{
if ( array_key_exists( 'start', $v ) or array_key_exists( 'end', $v ) )
{
$start = ( $v['start'] instanceof \IPS\DateTime ) ? $v['start']->getTimestamp() : intval( $v['start'] );
$end = ( $v['end'] instanceof \IPS\DateTime ) ? $v['end']->getTimestamp() : intval( $v['end'] );
if ( $start or $end )
{
$where[] = array( '( ' . $k . ' BETWEEN ' . $start . ' AND ' . $end . ' )' );
}
}
else
{
$like = array();
if ( count( $v ) )
{
foreach( $v as $val )
{
if ( $val === 0 or ! empty( $val ) )
{
$like[] = "CONCAT( ',', " . $k . ", ',') LIKE '%," . \IPS\Db::i()->real_escape_string( $val ) . ",%'";
}
}
$where[] = array( '( ' . \IPS\Db::i()->in( $k, $v ) . ( count( $like ) ? " OR (" . implode( ' OR ', $like ) . ') )' : ')' ) );
}
}
}
else
{
if ( $v === false )
{
continue;
}
if ( $v !== 0 and ! $v )
{
$where[] = array( $k . " IS NULL" );
}
else
{
$where[] = array( $k . "=?", $v );
}
}
}
}
return $where;
}
/**
* Render a widget
+3 -3
View File
@@ -2,10 +2,10 @@
/**
* @brief Rss Widget
* @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
* @subpackage cms
* @package IPS Community Suite
* @subpackage Content
* @since 10 Dec 2014
* @version SVN_VERSION_NUMBER
*/
+3 -3
View File
@@ -2,10 +2,10 @@
/**
* @brief WYSIWYG Widget
* @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
* @subpackage content
* @package IPS Community Suite
* @subpackage Content
* @since 22 Aug 2014
* @version SVN_VERSION_NUMBER
*/