Оптимизации и исправления топов.

This commit is contained in:
CORP\phedor 2018-03-23 12:35:10 +03:00
parent 77fa3dbd5e
commit 0f4b2fb722
25 changed files with 109 additions and 53 deletions

View file

@ -25,7 +25,8 @@ class Validator_Rule_Code extends Validator_Rule_Abstract
$name = $this->field;
if (is_array($_POST[$name . '_code_genre'])) {
for($n = 0; $n < count($_POST[$name . '_code_genre']); $n++) {
$count = count($_POST[$name . '_code_genre']);
for($n = 0; $n < $count; $n++) {
$code = array(
$_POST[$name . '_code_genre'][$n],
$_POST[$name . '_code_f'][$n],

View file

@ -6,7 +6,7 @@
class Validator_Rule_Count extends Validator_Rule_Abstract
{
public $size = 1;
public $max = false;
public $max = null;
public function getErrorMsg()
{

View file

@ -15,6 +15,7 @@ class Validator_Rule_Date extends Validator_Rule_Abstract
public function isValid(Collection $container, $status = null)
{
$pattern = "/^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4})$/";
$matches = [];
return (preg_match($pattern, $container->get($this->field), $matches)
&& checkdate($matches[2], $matches[1], $matches[3]));
}

View file

@ -23,7 +23,7 @@ class Validator_Rule_Time extends Validator_Rule_Abstract
{
$tmp = explode($this->split, $container->get($this->field), 2);
if ($tmp) {
if (self::checktime ($tmp[0], $tmp[1])) {
if (self::checktime ((int)$tmp[0], (int)$tmp[1])) {
return true;
}
}