* fix bug #1347.
This commit is contained in:
@@ -1356,6 +1356,10 @@ class baseDAO
|
||||
{
|
||||
$field['rule'] = 'date';
|
||||
}
|
||||
elseif($type == 'datetime')
|
||||
{
|
||||
$field['rule'] = 'datetime';
|
||||
}
|
||||
else
|
||||
{
|
||||
$field['rule'] = 'skip';
|
||||
|
||||
@@ -262,12 +262,30 @@ class baseValidater
|
||||
*/
|
||||
public static function checkDate($date)
|
||||
{
|
||||
if(empty($date)) return true;
|
||||
if($date == '0000-00-00') return true;
|
||||
$stamp = strtotime($date);
|
||||
if(!is_numeric($stamp)) return false;
|
||||
return checkdate(date('m', $stamp), date('d', $stamp), date('Y', $stamp));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check datetime.
|
||||
*
|
||||
* @param string $datetime
|
||||
* @static
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public static function checkDatetime($datetime)
|
||||
{
|
||||
if(empty($datetime)) return true;
|
||||
if($datetime == '0000-00-00 00:00:00') return true;
|
||||
$stamp = strtotime($datetime);
|
||||
if(!is_numeric($stamp)) return false;
|
||||
return checkdate(date('m', $stamp), date('d', $stamp), date('Y', $stamp));
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查正则表达式。
|
||||
* REG checking.
|
||||
|
||||
@@ -425,6 +425,7 @@ $lang->error->int = array("『%s』should be numbers", "『%s』shou
|
||||
$lang->error->float = "『%s』should be numbers, decimals included.";
|
||||
$lang->error->email = "『%s』should be valid Email.";
|
||||
$lang->error->date = "『%s』should be valid date.";
|
||||
$lang->error->datetime = "『%s』should be valid date.";
|
||||
$lang->error->code = "『%s』should be letters or numbers.";
|
||||
$lang->error->account = "『%s』should be valid account.";
|
||||
$lang->error->passwordsame = "Two passwords should be consistent.";
|
||||
|
||||
@@ -425,6 +425,7 @@ $lang->error->int = array("『%s』应当是数字。", "『%s』应
|
||||
$lang->error->float = "『%s』应当是数字,可以是小数。";
|
||||
$lang->error->email = "『%s』应当为合法的EMAIL。";
|
||||
$lang->error->date = "『%s』应当为合法的日期。";
|
||||
$lang->error->datetime = "『%s』应当为合法的日期。";
|
||||
$lang->error->code = "『%s』应当为字母或数字的组合。";
|
||||
$lang->error->account = "『%s』应当为合法的用户名。";
|
||||
$lang->error->passwordsame = "两次密码应当相等。";
|
||||
|
||||
Reference in New Issue
Block a user