fixing bugs in validator and file classes.
This commit is contained in:
@@ -167,7 +167,10 @@ class File {
|
|||||||
{
|
{
|
||||||
$mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path);
|
$mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path);
|
||||||
|
|
||||||
if (isset($mimes[$extension]) and in_array((array) $mimes[$extension])) return true;
|
if (isset($mimes[$extension]) and in_array($mime, (array) $mimes[$extension]))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -225,9 +225,7 @@ class Validator {
|
|||||||
{
|
{
|
||||||
$confirmed = $attribute.'_confirmation';
|
$confirmed = $attribute.'_confirmation';
|
||||||
|
|
||||||
$confirmation = $this->attributes[$confirmed];
|
return isset($this->attributes[$confirmed]) and $value == $this->attributes[$confirmed];
|
||||||
|
|
||||||
return array_key_exists($confirmed, $this->attributes) and $value == $confirmation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -241,7 +239,7 @@ class Validator {
|
|||||||
*/
|
*/
|
||||||
protected function validate_accepted($attribute, $value)
|
protected function validate_accepted($attribute, $value)
|
||||||
{
|
{
|
||||||
return $this->validate_required($attribute) and ($value == 'yes' or $value == '1');
|
return $this->validate_required($attribute, $value) and ($value == 'yes' or $value == '1');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user