Version 4.3.6

This commit is contained in:
Neo committed 2025-12-19 05:49:12 -08:00
1 parent fe1acf984a
commit 1a0c7fd3c2
609 files changed
+14707 -5726

No files matched your search

+6 -1
View File
@@ -92,7 +92,12 @@ class _Color extends FormAbstract
public function validate()
{
parent::validate();
if( !$this->required AND ( !$this->value OR $this->value == '#' ) )
{
return TRUE;
}
if ( !preg_match( '/^(?:#)?(([a-f0-9]{3})|([a-f0-9]{6}))$/i', $this->value ) )
{
throw new \InvalidArgumentException('form_color_bad');
+5 -1
View File
@@ -177,7 +177,7 @@ class _Date extends FormAbstract
{
if ( is_int( $v ) or ( $v and is_string( $v ) and preg_match( '/^[0-9]+$/', $v ) ) )
{
return \IPS\DateTime::ts( $v );
return \IPS\DateTime::ts( $v, $timezone );
}
else if( is_array( $v ) )
{
@@ -207,6 +207,10 @@ class _Date extends FormAbstract
}
else if( $v instanceof \IPS\DateTime )
{
if ( $timezone )
{
$v->setTimeZone( $timezone );
}
return $v;
}
else
+13 -3
View File
@@ -45,6 +45,7 @@ class _Editor extends FormAbstract
'maxLength' => FALSE, // The maximum length. Note that the content is HTML, so this isn't the maximum number of visible characters, so should only be used for database limits. The database's max allowed packet will override if smaller
'editorId' => NULL, // Passed to editorAttachments. Only necessary if the name may be changed
'allowAttachments => TRUE, // Should the editor show upload options?
'embedLocalOnly' => FALSE, // Allow local embeds only
);
* @endcode
*/
@@ -64,6 +65,7 @@ class _Editor extends FormAbstract
'maxLength' => 16777215, // The default for MEDIUMTEXT */
'editorId' => NULL,
'allowAttachments' => TRUE,
'embedLocalOnly' => FALSE
);
/**
@@ -113,6 +115,11 @@ class _Editor extends FormAbstract
}
$this->extension = $extensions[ $args[3]['key'] ];
if ( method_exists( $this->extension, 'embedLocalOnly' ) )
{
$args[3]['embedLocalOnly'] = $this->extension->embedLocalOnly();
}
}
/* Don't minimize if we have a value */
@@ -251,8 +258,8 @@ class _Editor extends FormAbstract
$value = \IPS\Text\Parser::mungeResources( $value );
}
/* Fix Emoji */
\IPS\Output::i()->replaceEmojiWithImages( $value );
/* Fix Emoji */
$value = \IPS\Output::i()->replaceEmojiWithImages( $value );
/* CKEditor will replace <p></p> (which doesn't display anything in a normal post) with <p><br></p> (which does)
which creates a discrepency between wheat displays in a post and what displays in the editor */
@@ -345,7 +352,7 @@ class _Editor extends FormAbstract
$parser = $this->_getParser();
$value = $parser->parse( $value );
}
/* Add any attachments that weren't inserted in the content */
if ( $this->uploader )
{
@@ -618,6 +625,9 @@ class _Editor extends FormAbstract
/* Handle delete calls */
if ( isset( \IPS\Request::i()->postKey ) and \IPS\Request::i()->postKey == $this->postKey and isset( \IPS\Request::i()->deleteFile ) )
{
/* CSRF check */
\IPS\Session::i()->csrfCheck();
/* Get the attachment */
try
{
+1 -1
View File
@@ -156,7 +156,7 @@ class _Item extends FormAbstract
{
if ( isset( $itemClass::$databaseColumnMap[ $this->options['orderResults'][0] ] ) )
{
$order = $itemClass::$databaseTable . '.' . $itemClass::$databaseColumnMap[ $this->options['orderResults'][0] ] . ' ' . $this->options['orderResults'][1];
$order = $itemClass::$databaseTable . '.' . $itemClass::$databasePrefix . $itemClass::$databaseColumnMap[ $this->options['orderResults'][0] ] . ' ' . $this->options['orderResults'][1];
}
}
+8 -1
View File
@@ -248,7 +248,14 @@ class _Matrix extends \IPS\Helpers\Form
{
if( is_array( $inputValue ) AND isset( $inputValue[ $newId ] ) )
{
$data = array_merge( $data, $inputValue[ $newId ] );
/* @note This previously used an array_merge() however this was causing elements to be overwritten with a blank value in some cases */
foreach( $inputValue[ $newId ] AS $key => $value )
{
if ( $value )
{
$data[ $key ] = $value;
}
}
}
}
}
+28 -2
View File
@@ -83,6 +83,7 @@ class _Stack extends FormAbstract
foreach( $this->value as $k => $v )
{
$class = ( new $classType( $this->name . '[' . count($fields) . ']', $v, FALSE, $this->options, $this->customValidationCode, $this->prefix, $this->suffix, $this->htmlId . '_' . count($fields) ) );
$class->setValue( TRUE );
$html = $class->html();
if( !\IPS\Login::compareHashes( $remove, md5( $html ) ) )
@@ -94,6 +95,7 @@ class _Stack extends FormAbstract
else
{
$class = ( new $classType( $this->name . '[0]', NULL, FALSE, $this->options, $this->customValidationCode, $this->prefix, $this->suffix, $this->htmlId . '_' . count($fields) ) );
$class->setValue( TRUE );
$html = $class->html();
if( !\IPS\Login::compareHashes( $remove, md5( $html ) ) )
@@ -106,6 +108,7 @@ class _Stack extends FormAbstract
if ( $this->reloadForm === TRUE AND $remove === NULL )
{
$class = ( new $classType( $this->name . '[]', NULL, FALSE, $this->options, $this->customValidationCode, $this->prefix, $this->suffix, $this->htmlId . '_' . count($fields) ) );
$class->setValue( TRUE );
$html = $class->html();
$fields[] = $html;
}
@@ -113,6 +116,27 @@ class _Stack extends FormAbstract
return \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->stack( $this->name, $fields, $this->options );
}
/**
* @brief Temporarily store if this is the intitial setValue call
*/
protected $_setValueInitial = NULL;
/**
* Set the value of the element
*
* @param bool $initial Whether this is the initial call or not. Do not reset default values on subsequent calls.
* @param bool $force Set the value even if one was not submitted (done on the final validation when getting values)?
* @return void
*/
public function setValue( $initial=FALSE, $force=FALSE )
{
$this->_setValueInitial = $initial;
parent::setValue( $initial, $force );
$this->_setValueInitial = NULL;
}
/**
* Format Value
*
@@ -130,7 +154,8 @@ class _Stack extends FormAbstract
{
foreach( \IPS\Request::i()->$name as $k => $v )
{
$class = ( new $classType( $this->name . '[]', $v, FALSE, $this->options, $this->customValidationCode, $this->prefix, $this->suffix, $this->htmlId ) );
$class = ( new $classType( $this->name . '[' . $k . ']', $v, FALSE, $this->options, $this->customValidationCode, $this->prefix, $this->suffix, $this->htmlId ) );
$class->setValue( $this->_setValueInitial, $this->_setValueInitial ? FALSE : TRUE );
$values[] = $class->value;
}
}
@@ -141,7 +166,8 @@ class _Stack extends FormAbstract
{
foreach( $this->value as $k => $v )
{
$class = ( new $classType( $this->name . '[]', $v, FALSE, $this->options, $this->customValidationCode, $this->prefix, $this->suffix, $this->htmlId ) );
$class = ( new $classType( $this->name . '[' . $k . ']', $v, FALSE, $this->options, $this->customValidationCode, $this->prefix, $this->suffix, $this->htmlId ) );
$class->setValue( $this->_setValueInitial, $this->_setValueInitial ? FALSE : TRUE );
$values[] = $class->value;
}
+6 -4
View File
@@ -190,13 +190,15 @@ class _Text extends TextArea
{
foreach( $return as $k => $v )
{
$return = preg_replace( '/\p{C}+/u', '', $return );
$return[ $k ] = preg_replace( '/\p{C}+/u', '', $v );
}
}
}
if ( isset( $this->options['autocomplete']['prefix'] ) and $this->options['autocomplete']['prefix'] )
{
$return = is_array( $return ) ? $return : ( $return ? array( $return ) : array() );
$firstAsPrefix = $this->name . '_first_as_prefix';
$freechoicePrefixCheckbox = $this->name . '_freechoice_prefix';
$freechoicePrefix = $this->name . '_prefix';
@@ -437,7 +439,7 @@ class _Text extends TextArea
}
/* Split on profanity */
if( $this->options['bypassProfanity'] === FALSE and is_string( $this->value ) and \IPS\Dispatcher::i() instanceof \IPS\Dispatcher\Front and !\IPS\Member::loggedIn()->group['g_bypass_badwords'] )
if( $this->options['bypassProfanity'] === FALSE and is_string( $this->value ) and \IPS\Dispatcher::i() instanceof \IPS\Dispatcher\Front and !\IPS\Member::loggedIn()->group['g_bypass_badwords'] AND !$this->options['accountUsername'] )
{
$newVal = NULL;
if ( count( $exactProfanityBreakpoints ) )
@@ -457,7 +459,7 @@ class _Text extends TextArea
}
else
{
throw new \DomainException( 'Profanity Filter' );
throw new \DomainException( \IPS\Member::loggedIn()->language()->addToStack( 'form_tags_not_allowed', FALSE, array( 'sprintf' => array( $section ) ) ) );
}
}
else
@@ -483,7 +485,7 @@ class _Text extends TextArea
{
if ( mb_stristr( $value, $type ) )
{
throw new \DomainException( 'Profanity Filter' );
throw new \DomainException( \IPS\Member::loggedIn()->language()->addToStack( 'form_tags_not_allowed', FALSE, array( 'sprintf' => array( $row->type ) ) ) );
}
}
}
+2
View File
@@ -282,6 +282,8 @@ class _Upload extends FormAbstract
}
catch ( \Exception $e )
{
\IPS\Log::log( $e, 'upload_failure' );
$message = $e->getMessage();
if ( \IPS\Member::loggedIn()->isAdmin() and \IPS\Member::loggedIn()->language()->checkKeyExists("uploaderr_{$e->getMessage()}_admin") )
{