Version 4.1.2

This commit is contained in:
Neo committed 2025-12-19 05:32:19 -08:00
1 parent 3ba79295ee
commit 28bd025b35
1131 files changed
+63658 -20579

No files matched your search

+15 -5
View File
@@ -27,8 +27,8 @@ class _Date extends FormAbstract
* @brief Default Options
* @code
$defaultOptions = array(
'min' => new \IPS\DateTime('1970-01-01'), // Minimum date. NULL will mean no minimum (though note hard limits if it will be stored as a UNIX timestamp). Default is null.
'max' => new \IPS\DateTime('2038-01-19'), // Maximum date. NULL will mean no maximum (though note hard limits if it will be stored as a UNIX timestamp). Default is null.
'min' => new \IPS\DateTime('1970-01-01'), // Minimum date. NULL will mean 1901-12-13 20:45:52 (the minimum 32-bit timestamp). Default is null.
'max' => new \IPS\DateTime('2038-01-19'), // Maximum date. NULL will mean 2038-01-19 03:14:07 (the maximum 32-bit timestamp). Default is null.
'disabled' => FALSE, // Disables input. Default is FALSE.
'time' => FALSE, // Also allow time input?
'unlimited' => -1, // If any value other than NULL is provided, an "Unlimited" checkbox will be displayed. If checked, the value specified will be sent.
@@ -85,9 +85,19 @@ class _Date extends FormAbstract
$this->timeName = "{$name}_time";
$this->unlimitedName = "{$name}_unlimited";
}
/* Call parent constructor */
call_user_func_array( 'parent::__construct', func_get_args() );
/* Set min/max - hardcoded to 32bit values rather than using PHP_INT_MAX because the MySQL server may be 32-bit even if the web server is 64 */
if ( !isset( $this->options['min'] ) or $this->options['min']->getTimestamp() < 2147483648 )
{
$this->options['min'] = \IPS\DateTime::ts( -2147483648 );
}
if ( !isset( $this->options['max'] ) or $this->options['max']->getTimestamp() > 2147483647 )
{
$this->options['max'] = \IPS\DateTime::ts( 2147483647 );
}
}
/**
@@ -267,13 +277,13 @@ class _Date extends FormAbstract
}
/* Check minimum */
if ( $this->options['min'] !== NULL and $this->options['min'] > $this->value )
if ( $this->value and $this->options['min'] !== NULL and $this->options['min'] > $this->value )
{
throw new \LengthException( \IPS\Member::loggedIn()->language()->addToStack('form_date_min', FALSE, array( 'sprintf' => array( $this->options['min']->localeDate() ) ) ) );
}
/* Check maximum */
if ( $this->options['max'] !== NULL and $this->options['max'] < $this->value )
if ( $this->value and $this->options['max'] !== NULL and $this->options['max'] < $this->value )
{
throw new \LengthException( \IPS\Member::loggedIn()->language()->addToStack('form_date_max', FALSE, array( 'sprintf' => array( $this->options['max']->localeDate() ) ) ) );
}