Security fixes in filedfield and imagefield
This commit is contained in:
parent
83392e732e
commit
001ee79c2a
2 changed files with 179 additions and 152 deletions
|
|
@ -60,6 +60,8 @@ class FileField extends PhangoField {
|
|||
|
||||
if($_FILES[$file_field]['tmp_name']!='')
|
||||
{
|
||||
if(is_uploaded_file($_FILES[$file_field]['tmp_name']))
|
||||
{
|
||||
|
||||
$name_file=basename($_FILES[$file_field]['tmp_name']);
|
||||
|
||||
|
|
@ -97,6 +99,18 @@ class FileField extends PhangoField {
|
|||
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$this->std_error=I18n::lang('common', 'error_cannot_upload_this_file_to_the_server', 'Error: Cannot upload this file to the server');
|
||||
|
||||
$this->error=1;
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -78,6 +78,8 @@ class ImageField extends PhangoField {
|
|||
|
||||
if(trim($_FILES[$file_name]['tmp_name'])!=='')
|
||||
{
|
||||
if(is_uploaded_file($_FILES[$file_name]['tmp_name']))
|
||||
{
|
||||
|
||||
$name_image=$_FILES[$file_name]['name'];
|
||||
|
||||
|
|
@ -209,6 +211,17 @@ class ImageField extends PhangoField {
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$this->std_error=I18n::lang('common', 'no_valid_image', 'This image is not upload');
|
||||
|
||||
$this->error=1;
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return $old_image;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue