diff --git a/admin/admin_submit_ticket.php b/admin/admin_submit_ticket.php index 56cce5d4..53386536 100644 --- a/admin/admin_submit_ticket.php +++ b/admin/admin_submit_ticket.php @@ -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; diff --git a/admin/custom_fields.php b/admin/custom_fields.php index b8a7ef8d..bdfc69ab 100755 --- a/admin/custom_fields.php +++ b/admin/custom_fields.php @@ -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; } diff --git a/admin/edit_post.php b/admin/edit_post.php index 1b15e20e..354f2a34 100644 --- a/admin/edit_post.php +++ b/admin/edit_post.php @@ -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; diff --git a/submit_ticket.php b/submit_ticket.php index 81cea406..0a015ce5 100644 --- a/submit_ticket.php +++ b/submit_ticket.php @@ -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;