Use YYYY-MM-DD regex due to datepicker switch
This commit is contained in:
parent
ea8aac8d64
commit
49b8b44413
@ -139,8 +139,7 @@ foreach ($hesk_settings['custom_fields'] as $k=>$v) {
|
||||
} elseif ($v['type'] == 'date') {
|
||||
$tmpvar[$k] = hesk_POST($k);
|
||||
$_SESSION["as_$k"] = '';
|
||||
|
||||
if (preg_match("/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/", $tmpvar[$k])) {
|
||||
if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $tmpvar[$k])) {
|
||||
$date = strtotime($tmpvar[$k] . ' t00:00:00');
|
||||
$dmin = strlen($v['value']['dmin']) ? strtotime($v['value']['dmin'] . ' t00:00:00') : false;
|
||||
$dmax = strlen($v['value']['dmax']) ? strtotime($v['value']['dmax'] . ' t00:00:00') : false;
|
||||
|
@ -287,7 +287,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
||||
$dmin_type = $matches[3];
|
||||
}
|
||||
// Minimum date is in "MM/DD/YYYY" format
|
||||
elseif (preg_match("/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/", $dmin))
|
||||
elseif (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $dmin))
|
||||
{
|
||||
$dmin_rf = 1;
|
||||
}
|
||||
@ -359,7 +359,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
||||
$dmax_type = $matches[3];
|
||||
}
|
||||
// Minimum date is in "MM/DD/YYYY" format
|
||||
elseif (preg_match("/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/", $dmax))
|
||||
elseif (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $dmax))
|
||||
{
|
||||
$dmax_rf = 1;
|
||||
}
|
||||
@ -1110,7 +1110,7 @@ function cf_validate()
|
||||
{
|
||||
$dmin = hesk_POST('dmin');
|
||||
|
||||
if (preg_match("/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/", $dmin))
|
||||
if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $dmin))
|
||||
{
|
||||
$cf['dmin'] = $dmin;
|
||||
}
|
||||
@ -1135,7 +1135,7 @@ function cf_validate()
|
||||
{
|
||||
$dmax = hesk_POST('dmax');
|
||||
|
||||
if (preg_match("/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/", $dmax))
|
||||
if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $dmax))
|
||||
{
|
||||
$cf['dmax'] = $dmax;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ if (isset($_POST['save'])) {
|
||||
$tmpvar[$k] = hesk_POST($k);
|
||||
$_SESSION["as_$k"] = '';
|
||||
|
||||
if (preg_match("/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/", $tmpvar[$k])) {
|
||||
if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $tmpvar[$k])) {
|
||||
$date = strtotime($tmpvar[$k] . ' t00:00:00');
|
||||
$dmin = strlen($v['value']['dmin']) ? strtotime($v['value']['dmin'] . ' t00:00:00') : false;
|
||||
$dmax = strlen($v['value']['dmax']) ? strtotime($v['value']['dmax'] . ' t00:00:00') : false;
|
||||
|
@ -284,7 +284,7 @@ foreach ($hesk_settings['custom_fields'] as $k=>$v) {
|
||||
$tmpvar[$k] = hesk_POST($k);
|
||||
$_SESSION["c_$k"] = '';
|
||||
|
||||
if (preg_match("/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/", $tmpvar[$k])) {
|
||||
if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $tmpvar[$k])) {
|
||||
$date = strtotime($tmpvar[$k] . ' t00:00:00');
|
||||
$dmin = strlen($v['value']['dmin']) ? strtotime($v['value']['dmin'] . ' t00:00:00') : false;
|
||||
$dmax = strlen($v['value']['dmax']) ? strtotime($v['value']['dmax'] . ' t00:00:00') : false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user