Permalink
Browse files

Revert: Show the correct date/time format when validating front end f…

…orms (see #5238)
  • Loading branch information...
1 parent 9f888cb commit 2576ef96087157d7f43e3b047c0032b322ebe767 @leofeyer leofeyer committed Feb 1, 2013
Showing with 6 additions and 14 deletions.
  1. +0 −3 CHANGELOG.md
  2. +6 −11 system/libraries/Widget.php
View
@@ -28,9 +28,6 @@ Make sure there is an array in `Controller::generateMargin()` (see #5217).
More robust input validation in the back end filter menu and no more absolute
paths in error messages printed to the screen (thanks to aulmn) (see #4971).
-### Fixed
-Show the correct date/time format when validating front end forms (see #5238).
-
### Fixed
Unset non-existing fields when restoring versions (see #5219).
@@ -604,8 +604,6 @@ protected function getPost($strKey)
*/
protected function validator($varInput)
{
- global $objPage;
-
if (is_array($varInput))
{
foreach ($varInput as $k=>$v)
@@ -717,11 +715,10 @@ protected function validator($varInput)
// Check whether the current value is a valid date format
case 'date':
$objDate = new Date();
- $strFormat = (TL_MODE == 'FE') ? $objPage->dateFormat : $GLOBALS['TL_CONFIG']['dateFormat'];
- if (!preg_match('~^'. $objDate->getRegexp($strFormat) .'$~i', $varInput))
+ if (!preg_match('~^'. $objDate->getRegexp($GLOBALS['TL_CONFIG']['dateFormat']) .'$~i', $varInput))
{
- $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['date'], $objDate->getInputFormat($strFormat)));
+ $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['date'], $objDate->getInputFormat($GLOBALS['TL_CONFIG']['dateFormat'])));
}
else
{
@@ -740,22 +737,20 @@ protected function validator($varInput)
// Check whether the current value is a valid time format
case 'time':
$objDate = new Date();
- $strFormat = (TL_MODE == 'FE') ? $objPage->timeFormat : $GLOBALS['TL_CONFIG']['timeFormat'];
- if (!preg_match('~^'. $objDate->getRegexp($strFormat) .'$~i', $varInput))
+ if (!preg_match('~^'. $objDate->getRegexp($GLOBALS['TL_CONFIG']['timeFormat']) .'$~i', $varInput))
{
- $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['time'], $objDate->getInputFormat($strFormat)));
+ $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['time'], $objDate->getInputFormat($GLOBALS['TL_CONFIG']['timeFormat'])));
}
break;
// Check whether the current value is a valid date and time format
case 'datim':
$objDate = new Date();
- $strFormat = (TL_MODE == 'FE') ? $objPage->datimFormat : $GLOBALS['TL_CONFIG']['datimFormat'];
- if (!preg_match('~^'. $objDate->getRegexp($strFormat) .'$~i', $varInput))
+ if (!preg_match('~^'. $objDate->getRegexp($GLOBALS['TL_CONFIG']['datimFormat']) .'$~i', $varInput))
{
- $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['dateTime'], $objDate->getInputFormat($strFormat)));
+ $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['dateTime'], $objDate->getInputFormat($GLOBALS['TL_CONFIG']['datimFormat'])));
}
else
{

0 comments on commit 2576ef9

Please sign in to comment.