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

+49 -14
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Custom 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
* @since 11 Apr 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS;
@@ -139,7 +138,7 @@ abstract class _CustomField extends \IPS\Node\Model
'Address' => array( 'pf_not_null', "{$form->id}_header_pfield_displayoptions", 'pf_format' ),
'Color' => array( 'pf_not_null', "{$form->id}_header_pfield_displayoptions", 'pf_format' ),
'Date' => array( 'pf_not_null', "{$form->id}_header_pfield_displayoptions", 'pf_format' ),
'Editor' => array( 'pf_not_null', "{$form->id}_header_pfield_displayoptions", 'pf_format', 'pf_search_type' ),
'Editor' => array( 'pf_not_null', "{$form->id}_header_pfield_displayoptions", 'pf_format', 'pf_search_type', 'pf_allow_attachments' ),
'Number' => array( 'pf_not_null', "{$form->id}_header_pfield_displayoptions", 'pf_format' ),
'Poll' => array( 'pf_not_null' ),
'Rating' => array( 'pf_not_null', "{$form->id}_header_pfield_displayoptions", 'pf_format' ),
@@ -149,6 +148,17 @@ abstract class _CustomField extends \IPS\Node\Model
{
$toggles[ $k ] = isset( static::$additionalFieldToggles[ $k ] ) ? static::$additionalFieldToggles[ $k ] : array( 'pf_not_null' );
}
foreach ( static::$additionalFieldToggles as $k => $v )
{
if ( isset( $toggles[ $k ] ) )
{
$toggles[ $k ] = array_merge( $toggles[ $k ], $v );
}
else
{
$toggles[ $k ] = $v;
}
}
ksort( $options );
@@ -166,12 +176,19 @@ abstract class _CustomField extends \IPS\Node\Model
}
$form->add( new \IPS\Helpers\Form\Select( 'pf_type', $this->id ? $this->type : 'Text', TRUE, array( 'options' => $options, 'toggles' => $toggles ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'pf_allow_attachments', $this->id ? $this->allow_attachments : 1, FALSE, array( ), NULL, NULL, NULL, 'pf_allow_attachments' ) );
$form->add( new \IPS\Helpers\Form\Stack( 'pf_content', $this->id ? json_decode( $this->content, TRUE ) : array(), FALSE, array( 'removeEmptyValues' => FALSE ), NULL, NULL, NULL, 'pf_content' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'pf_multiple', $this->id ? $this->multiple : FALSE, FALSE, array(), NULL, NULL, NULL, 'pf_multiple' ) );
$requiredColumn = ( isset( $this::$databaseColumnMap['not_null'] ) and $this::$databaseColumnMap['not_null'] ) ? $this::$databaseColumnMap['not_null'] : NULL;
$form->add( new \IPS\Helpers\Form\YesNo( 'pf_not_null', $this->id ? $this->$requiredColumn : TRUE, FALSE, array(), NULL, NULL, NULL, 'pf_not_null' ) );
$requiredColumn = ( isset( static::$databaseColumnMap['not_null'] ) and static::$databaseColumnMap['not_null'] ) ? static::$databaseColumnMap['not_null'] : NULL;
if ( isset( static::$databaseColumnMap['not_null'] ) )
{
$form->add( new \IPS\Helpers\Form\YesNo( 'pf_not_null', $this->id ? $this->$requiredColumn : TRUE, FALSE, array(), NULL, NULL, NULL, 'pf_not_null' ) );
}
$form->add( new \IPS\Helpers\Form\Number( 'pf_max_input', $this->id ? $this->max_input : 0, FALSE, array( 'unlimited' => 0 ), NULL, NULL, NULL, 'pf_max_input' ) );
$form->add( new \IPS\Helpers\Form\Text( 'pf_input_format', $this->id ? $this->input_format : NULL, FALSE, array( 'placeholder' => '/[A-Z0-9]+/i' ), function( $val )
{
@@ -443,9 +460,9 @@ abstract class _CustomField extends \IPS\Node\Model
$values['pf_not_null'] = FALSE;
}
if ( isset( $values['pf_search_type_on_off'] ) and isset( $values['pf_type'] ) and ( $values['pf_type'] == 'Select' or $values['pf_type'] == 'Radio' ) )
if ( array_key_exists( 'pf_search_type_on_off', $values ) and isset( $values['pf_type'] ) and ( $values['pf_type'] == 'Select' or $values['pf_type'] == 'Radio' ) )
{
$values['pf_search_type'] = $values['pf_search_type_on_off'];
$values['pf_search_type'] = (string) $values['pf_search_type_on_off'];
}
unset( $values['pf_search_type_on_off'] );
@@ -693,6 +710,8 @@ abstract class _CustomField extends \IPS\Node\Model
{
$options['autoSaveKey'] = md5( get_class( $this ) . '-' . $this->id );
}
$options['allowAttachments'] = $this->allow_attachments;
break;
case 'Address':
@@ -762,10 +781,11 @@ abstract class _CustomField extends \IPS\Node\Model
/**
* 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 )
{
switch ( $this->type )
{
@@ -842,6 +862,13 @@ abstract class _CustomField extends \IPS\Node\Model
return \IPS\Member::load( $id )->link();
}, explode( "\n", $value ) ) );
case 'Password':
if ( $value )
{
return $showSensitiveInformation ? htmlspecialchars( $value, \IPS\HTMLENTITIES | ENT_QUOTES, 'UTF-8', FALSE ) : '********';
}
return '';
case 'Poll':
return $value ? ( (string) \IPS\Poll::load( $value ) ) : NULL;
@@ -865,7 +892,15 @@ abstract class _CustomField extends \IPS\Node\Model
case 'Ftp':
$value = is_array( $value ) ? $value : json_decode( \IPS\Text\Encrypt::fromTag( $value )->decrypt(), TRUE );
$url = \IPS\Http\Url::createFromComponents( $value['server'], $value['protocol'] ? ( $value['protocol'] == 'ssl_ftp' ? 'ftps': $value['protocol'] ) : 'ftp', $value['path'] ?: NULL, NULL, $value['port'] ?: 21, $value['un'] ?: NULL, $value['pw'] ?: NULL );
if ( $showSensitiveInformation )
{
$url = \IPS\Http\Url::createFromComponents( $value['server'], $value['protocol'] ? ( $value['protocol'] == 'ssl_ftp' ? 'ftps': $value['protocol'] ) : 'ftp', $value['path'] ?: NULL, NULL, $value['port'] ?: 21, $value['un'] ?: NULL, $value['pw'] ?: NULL );
}
else
{
$url = NULL;
$value['pw'] = '********';
}
return \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->ftpDisplay( $value, $url );