Version 4.7.13

This commit is contained in:
Neo committed 2025-12-19 16:14:56 -08:00
1 parent fd22d99e69
commit 7124a02564
954 files changed
+29277 -59308

No files matched your search

+1 -1
View File
@@ -160,7 +160,7 @@ class _Editor extends FormAbstract
/* Don't minimize if we have a value */
$name = isset( $options['editorId'] ) ? $options['editorId'] : $name;
if ( ( !isset( $options['minimizeWithContent'] ) or !$options['minimizeWithContent'] ) and ( $defaultValue or \IPS\Request::i()->$name or ( isset( \IPS\Request::i()->cookie['vle_editor'] ) and \IPS\Request::i()->cookie['vle_editor'] ) ) )
if ( ( !isset( $options['minimizeWithContent'] ) or !$options['minimizeWithContent'] ) and ( $defaultValue or \IPS\Request::i()->$name or ( \IPS\Lang::vleActive() ) ) )
{
$options['minimize'] = NULL;
}
+7
View File
@@ -33,6 +33,7 @@ class _Email extends Text
public $childDefaultOptions = array(
'accountEmail' => FALSE,
'htmlAutocomplete' => "email",
'bypassProfanity' => \IPS\Helpers\Form\Text::BYPASS_PROFANITY_ALL
);
/**
@@ -65,6 +66,12 @@ class _Email extends Text
/* Check Banned and Allowed Emails only if the data are not coming from an administrator */
if ( !\IPS\Member::loggedIn()->isAdmin() )
{
/* Check it's not known to be undeliverable */
if ( \IPS\Email::emailIsBlocked( $value ) )
{
throw new \DomainException( 'member_email_blocked_info' );
}
/* Check it's not a banned address */
foreach ( \IPS\Db::i()->select( 'ban_content', 'core_banfilters', array( "ban_type=?", 'email' ) ) as $bannedEmail )
{
+15 -10
View File
@@ -51,22 +51,27 @@ class _Member extends Text
public function __construct( $name, $defaultValue=NULL, $required=FALSE, $options=array(), $customValidationCode=NULL, $prefix=NULL, $suffix=NULL, $id=NULL )
{
$this->defaultOptions['autocomplete'] = array(
'source' => 'app=core&module=system&controller=ajax&do=findMember',
'resultItemTemplate' => 'core.autocomplete.memberItem',
'commaTrigger' => false,
'unique' => true,
'minAjaxLength' => 3,
'disallowedCharacters' => array(),
'lang' => 'mem_optional',
'source' => 'app=core&module=system&controller=ajax&do=findMember',
'resultItemTemplate' => 'core.autocomplete.memberItem',
'commaTrigger' => false,
'unique' => true,
'minAjaxLength' => 3,
'disallowedCharacters' => array(),
'lang' => 'mem_optional',
);
if( \count( $options ) and array_key_exists( 'multiple', $options ) and $options['multiple'] > 0 )
if (\count($options) and array_key_exists('multiple', $options) and $options['multiple'] > 0)
{
$this->defaultOptions['autocomplete']['maxItems'] = $options['multiple'];
}
elseif ( !array_key_exists( 'multiple', $options ) )
} elseif (!array_key_exists('multiple', $options))
{
$this->defaultOptions['autocomplete']['maxItems'] = $this->childDefaultOptions['multiple'];
}
/* Explicitly merge autocomplete options */
if( array_key_exists('autocomplete', $options ) )
{
$options['autocomplete'] = array_merge( $options['autocomplete'], $this->defaultOptions['autocomplete'] );
}
parent::__construct( $name, $defaultValue, $required, $options, $customValidationCode, $prefix, $suffix, $id );
}
+7 -1
View File
@@ -43,7 +43,8 @@ class _Text extends TextArea
'resultItemTemplate'=> 'core.foo.bar', // Can be used to specify a custom JavaScript template to use for the result
'minAjaxLength' => 3, // Minimum length of value before sending AJAX lookup call
'disallowedCharacters' => array(), // An array of disallowed characters (default < > ' ")
'minimized' => TRUE // Whether the autocomplete shows a 'choose' link to activate. Existing values or required = true will always override this.
'minimized' => TRUE // Whether the autocomplete shows a 'choose' link to activate. Existing values or required = true will always override this.
'alphabetical' => FALSE, // Force values to be sorted alphabetically.
),
'placeholder' => 'e.g. ...', // A placeholder (NB: Will only work on compatible browsers)
'regex' => '/[A-Z]+/i', // RegEx of acceptable value
@@ -202,6 +203,11 @@ class _Text extends TextArea
{
$return = array_filter( array_map( 'trim', explode( "\n", $return ) ) );
}
if ( \is_array( $return ) AND isset( $this->options['autocomplete']['alphabetical'] ) AND $this->options['autocomplete']['alphabetical'] )
{
natcasesort( $return );
}
}
/* Remove all invisible characters if this is a username */
+14 -9
View File
@@ -244,7 +244,8 @@ class _Upload extends FormAbstract
/* If there is an error, an exception will be thrown and will be caught below like normal */
\IPS\File::validateUpload( $fileArray, $this->options['allowedFileTypes'], $this->options['maxFileSize'] );
$exif = NULL;
if ( $fileObj->isImage() )
{
try
@@ -254,6 +255,7 @@ class _Upload extends FormAbstract
if( $image::exifSupported() )
{
$image->setExifData( $fileObj->contents() );
$exif = $image->parseExif();
}
$hasBeenResized = $image->resizeToMax( $this->options['image']['maxWidth'] ?? NULL, $this->options['image']['maxHeight'] ?? NULL );
@@ -266,16 +268,17 @@ class _Upload extends FormAbstract
}
catch ( \Exception $e ) { }
}
$insertId = \IPS\Db::i()->insert( 'core_files_temp', array(
'upload_key' => md5( $this->name . session_id() ),
'filename' => $fileObj->originalFilename,
'mime' => \IPS\File::getMimeType( $fileObj->originalFilename ),
'contents' => (string) $fileObj,
'time' => time(),
'storage_extension' => $this->options['storageExtension']
'storage_extension' => $this->options['storageExtension'],
'exif' => $exif ? json_encode( $exif ) : NULL
) );
if ( $this->options['callback'] )
{
$callbackFunction = $this->options['callback'];
@@ -466,7 +469,7 @@ class _Upload extends FormAbstract
/* The html() method is called more than once, however $this->value is wiped out so if it was an attachments array all of the array properties are lost */
$templateFunction = $this->template;
$this->builtHtml = $templateFunction( $this->name, $this->value, $this->options['minimize'], $maxFileSize, $this->options['maxFiles'], $this->maxChunkSize, $this->options['totalMaxSize'], $this->options['allowedFileTypes'], $uploadKey, $this->options['multiple'], $this->options['postKey'], $this->options['temporary'] or ( isset( \IPS\Request::i()->cookie['vle_editor'] ) and \IPS\Request::i()->cookie['vle_editor'] ), $this->options['template'], $existing, $this->options['default'], $this->options['supportsDelete'], $maxImageDims, $this->options['allowStockPhotos'] );
$this->builtHtml = $templateFunction( $this->name, $this->value, $this->options['minimize'], $maxFileSize, $this->options['maxFiles'], $this->maxChunkSize, $this->options['totalMaxSize'], $this->options['allowedFileTypes'], $uploadKey, $this->options['multiple'], $this->options['postKey'], $this->options['temporary'] or ( \IPS\Lang::vleActive() ), $this->options['template'], $existing, $this->options['default'], $this->options['supportsDelete'], $maxImageDims, $this->options['allowStockPhotos'] );
return $this->builtHtml;
}
@@ -721,8 +724,9 @@ class _Upload extends FormAbstract
{
$options = $this->options;
$canBeModerated = $options['canBeModerated'];
$exifData = array();
$fileObjects = \IPS\File::createFromUploads( $this->options['storageExtension'], $fieldName, $this->options['allowedFileTypes'], $this->options['maxFileSize'], $this->options['totalMaxSize'], 0, function( $contents, $filename, $i ) use ( $options, &$requiresModeration, $canBeModerated )
$fileObjects = \IPS\File::createFromUploads( $this->options['storageExtension'], $fieldName, $this->options['allowedFileTypes'], $this->options['maxFileSize'], $this->options['totalMaxSize'], 0, function( $contents, $filename, $i ) use ( $options, &$requiresModeration, $canBeModerated, &$exifData )
{
$ext = mb_strtolower( mb_substr( $filename, mb_strrpos( $filename, '.' ) + 1 ) );
@@ -740,6 +744,7 @@ class _Upload extends FormAbstract
/* If type JPG, image handler may strip meta data on image output */
if( $hasBeenResized OR $image->hasBeenRotated OR $image->type == 'jpeg' )
{
$exifData[ $i ] = $image->parseExif();
$contents = (string) $image;
}
}
@@ -748,14 +753,14 @@ class _Upload extends FormAbstract
return $contents;
}, $this->options['storageContainer'], $this->options['obscure'] );
foreach ( $fileObjects as $i => $fileObj )
{
$exif = NULL;
if( \IPS\Image::exifSupported() and $fileObj->isImage() and $fileObj->exifData )
if( isset( $exifData[ $i ] ) AND $fileExifData = $exifData[ $i ] OR ( \IPS\Image::exifSupported() and $fileObj->isImage() and $fileExifData = $fileObj->exifData ) )
{
$exif = json_encode( $fileObj->exifData );
$exif = json_encode( $fileExifData );
}
$data = $this->populateTempData( array(