public static function validateToken($unique, $class, $value, $tokenPost) { $vrf = new \Rebond\Core\Field('token'); if (self::encrypt($class . $value) != $tokenPost) { $log = '[field: token ' . $unique . ', value: ' . $value . ', tokenPost: ' . $tokenPost . ']'; Log::log(Error::TOKEN, 'Invalid token ' . $log, __FILE__, __LINE__); $vrf->setResult(ResultType::ERROR); $vrf->setMessage(Lang::lang('errorInvalidToken')); return $vrf; } return $vrf; }
public static function validateImage($field, $condition) { $vrf = new \Rebond\Core\Field($field); if (!$condition) { return $vrf; } if (!isset($_FILES[$field . 'Id']) || $_FILES[$field . 'Id']['name'] == '') { return $vrf; } if (self::isImage($_FILES[$field . 'Id']['type'])) { return $vrf; } $vrf->setResult(ResultType::ERROR); $vrf->setMessage(Lang::lang('errorInvalidImage', [$field])); return $vrf; }