Version 4.2.0

This commit is contained in:
Neo committed 2025-12-19 05:44:59 -08:00
1 parent 0dc2aee5ed
commit 96997ddd8e
2074 files changed
+125454 -55780

No files matched your search

+79 -17
View File
@@ -1,13 +1,12 @@
<?php
/**
* @brief Database Field Node
* @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 2 Apr 2014
* @version SVN_VERSION_NUMBER
*/
/**
@@ -512,7 +511,7 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
{
$value = $row->truncate( $value, TRUE );
if ( $value )
if ( $value !== '' AND $value !== NULL )
{
$value = $row->formatForDisplay( $value, $formValue, 'listing', $record );
}
@@ -546,7 +545,7 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
}
}
if ( $value )
if ( $value !== '' AND $value !== NULL )
{
$value = $row->formatForDisplay( $value, $formValue, 'display', $record );
}
@@ -627,6 +626,29 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
{
return $value;
}
else if ( $type === 'thumbs' and $this->type === 'Upload' )
{
if ( isset( $this->extra['thumbsize'] ) )
{
$thumbs = iterator_to_array( \IPS\Db::i()->select( '*', 'cms_database_fields_thumbnails', array( array( 'thumb_field_id=?', $this->id ) ) )->setKeyField('thumb_original_location')->setValueField('thumb_location') );
$images = array();
foreach( $thumbs as $orig => $thumb )
{
try
{
$images[] = \IPS\File::get( static::$uploadStorageExtension, $thumb )->url;
}
catch( \Exception $e ) { }
}
return $images;
}
else
{
return $this->formatForDisplay( $value, $formValue, 'raw', $record );
}
}
$options = $this->display_json;
@@ -757,7 +779,29 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
{
$value .= \IPS\GeoLocation::buildFromJson( $formValue )->map()->render( $options[ $type ]['mapDims'][0], $options[ $type ]['mapDims'][1] );
}
else if ( $this->type === 'Upload' )
{
if ( mb_stristr( $value, ',' ) )
{
$files = explode( ',', $value );
}
else
{
$files = array( $value );
}
if ( count( $files ) )
{
$parsed = array();
foreach( $files AS $file )
{
$file = \IPS\File::get( static::$uploadStorageExtension, (string) $file );
$parsed[] = \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->basicUrl( $file->fullyQualifiedUrl( $file->url ) );
}
$value = implode( '', $parsed );
}
}
$value = \IPS\Theme::i()->getTemplate( 'records', 'cms', 'global' )->fieldDefault( $this->_title, $value );
}
@@ -1193,10 +1237,11 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
/**
* Display Value
*
* @param mixed $value The value
* @param mixed $value The value
* @param bool $showSensitiveInformation If TRUE, potentially sensitive data (like passwords) will be displayed - otherwise will be blanked out
* @return string
*/
public function displayValue( $value=NULL )
public function displayValue( $value=NULL, $showSensitiveInformation=FALSE )
{
$database = \IPS\cms\Databases::load( static::$customDatabaseId );
@@ -1315,7 +1360,7 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
}
}
return \IPS\Lang::wordbreak( $time->localeDate() );
return \IPS\Lang::wordbreak( $this->extra['time'] ? (string) $time : $time->localeDate() );
}
if ( ! is_array( $value ) )
@@ -1388,7 +1433,7 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
/* Formatters */
try
{
return parent::displayValue( $value );
return parent::displayValue( $value, $showSensitiveInformation );
}
catch( \InvalidArgumentException $ex )
{
@@ -1622,7 +1667,7 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
'Checkbox' => array_merge( array( 'field_default_value', 'field_truncate' ), $displayDefaults ),
'CheckboxSet' => array_merge( array( 'field_extra', 'field_default_value', 'field_truncate' ), $displayDefaults ),
'Date' => array_merge( array( 'field_default_value', 'field_date_time_override', 'field_date_time_time' ), $displayDefaults ),
'Editor' => array_merge( array( 'field_max_length', 'field_default_value', 'field_truncate' ), $displayDefaults ),
'Editor' => array_merge( array( 'field_max_length', 'field_default_value', 'field_truncate', 'field_allow_attachments' ), $displayDefaults ),
'Email' => array_merge( array( 'field_max_length', 'field_default_value', 'field_unique' ), $displayDefaults ),
'Item' => array_merge( array( 'field_is_multiple', 'field_relational_db', 'field_crosslink' ), $displayDefaults ),
'Member' => array_merge( array( 'field_is_multiple', 'field_unique' ), $displayDefaults ),
@@ -1633,7 +1678,7 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
'Tel' => array_merge( array( 'field_default_value', 'field_unique' ), $displayDefaults ),
'Text' => array_merge( array( 'field_validator', 'field_format_opts_on', 'field_max_length', 'field_default_value', 'field_html', 'field_truncate', 'field_unique' ), $displayDefaults ),
'TextArea' => array_merge( array( 'field_validator', 'field_format_opts_on', 'field_max_length', 'field_default_value', 'field_html', 'field_truncate', 'field_unique' ), $displayDefaults ),
'Upload' => array_merge( array( 'field_upload_is_image', 'field_upload_is_multiple' ), $displayDefaults ),
'Upload' => array_merge( array( 'field_upload_is_image', 'field_upload_is_multiple', 'field_upload_thumb' ), $displayDefaults ),
'Url' => array_merge( array( 'field_default_value', 'field_unique' ), $displayDefaults ),
'YesNo' => array_merge( array( 'field_default_value' ), $displayDefaults ),
'Youtube' => array( 'media_params', 'media_display_listing_method', 'media_display_display_method', 'field_unique' ),
@@ -1732,24 +1777,35 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
),
'toggles' => array(
'yes' => array( 'field_image_size' ),
'yes' => array( 'field_image_size', 'field_upload_thumb' ),
'no' => array( 'field_allowed_extensions' )
)
), NULL, NULL, NULL, 'field_upload_is_image' ) );
$widthHeight = NULL;
$thumbWidthHeight = array( 0, 0 );
if ( isset( $this->extra['type'] ) and $this->extra['type'] === 'image' )
{
$widthHeight = $this->extra['maxsize'];
if ( isset( $this->extra['thumbsize'] ) )
{
$thumbWidthHeight = $this->extra['thumbsize'];
}
}
$form->add( new \IPS\Helpers\Form\WidthHeight( 'field_image_size', $this->id ? $widthHeight : array( 0, 0 ), FALSE, array( 'resizableDiv' => FALSE, 'unlimited' => array( 0, 0 ) ), NULL, NULL, NULL, 'field_image_size' ) );
$form->add( new \IPS\Helpers\Form\WidthHeight( 'field_upload_thumb', $this->id ? $thumbWidthHeight : array( 0, 0 ), FALSE, array( 'resizableDiv' => FALSE, 'unlimited' => array( 0, 0 ), 'unlimitedLang' => 'field_upload_thumb_none' ), NULL, NULL, NULL, 'field_upload_thumb' ) );
$form->add( new \IPS\Helpers\Form\Text( 'field_allowed_extensions', $this->id ? ( $this->allowed_extensions ?: NULL ) : NULL, FALSE, array(
'autocomplete' => array( 'unique' => 'true' ),
'nullLang' => 'content_any_extensions'
), NULL, NULL, NULL, 'field_allowed_extensions' ) );
/* Editor Specific */
$form->add( new \IPS\Helpers\Form\YesNo( 'field_allow_attachments', $this->id ? $this->allow_attachments : 1, FALSE, array( ), NULL, NULL, NULL, 'field_allow_attachments' ) );
/* Date specific */
$tzValue = 'UTC';
if ( isset( $this->extra['timezone'] ) and $this->extra['timezone'] )
@@ -2462,6 +2518,11 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
if ( isset( $values['field_upload_is_image'] ) and $values['field_upload_is_image'] === 'yes')
{
$values['extra'] = array( 'type' => 'image', 'maxsize' => $values['field_image_size'] );
if ( $values['field_upload_thumb'][0] > 0 )
{
$values['extra']['thumbsize'] = $values['field_upload_thumb'];
}
}
else
{
@@ -2539,7 +2600,7 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
$this->_oldDefaultValue = $this->default_value;
}
foreach( array( 'field_crosslink', 'field_number_decimals_on', 'field_number_decimals', 'field_format_opts_on', 'field_relational_db', 'field_upload_is_multiple', 'field_default_update_existing', 'field_date_time_override', 'field_date_timezone', 'field_date_time_time', 'field_upload_is_image', 'field_image_size', 'field_title', 'field_display_display_json_badge', 'field_display_display_json_custom', 'field_display_listing_json_badge', 'field_display_listing_json_custom', 'field_display_listing_json_badge_right', 'media_display_listing_method', 'media_display_display_method', 'field_show_map_listing', 'field_show_map_listing_dims', 'field_show_map_display', 'field_show_map_display_dims', 'field_display_display_json_where' ) as $field )
foreach( array( 'field_crosslink', 'field_number_decimals_on', 'field_number_decimals', 'field_format_opts_on', 'field_relational_db', 'field_upload_is_multiple', 'field_default_update_existing', 'field_date_time_override', 'field_date_timezone', 'field_date_time_time', 'field_upload_is_image', 'field_image_size', 'field_upload_thumb', 'field_title', 'field_display_display_json_badge', 'field_display_display_json_custom', 'field_display_listing_json_badge', 'field_display_listing_json_custom', 'field_display_listing_json_badge_right', 'media_display_listing_method', 'media_display_display_method', 'field_show_map_listing', 'field_show_map_listing_dims', 'field_show_map_display', 'field_show_map_display_dims', 'field_display_display_json_where' ) as $field )
{
if ( array_key_exists( $field, $values ) )
{
@@ -2720,6 +2781,7 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
case 'Editor':
$options['app'] = 'cms';
$options['key'] = 'Records';
$options['allowAttachments'] = $this->allow_attachments;
$options['autoSaveKey'] = 'RecordField_' . ( $record === NULL ? 'new' : $record->_id ) . '_' . $this->id;
$options['attachIds'] = ( $record === NULL ) ? NULL : array( $record->_id, $this->id, static::$customDatabaseId );
break;