mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX: disabling user ability to upload images into the CMS from their local computer (from r82573)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@89716 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
25e7f4413b
commit
2cc2f41b45
@ -16,6 +16,8 @@ class FileIFrameField extends FileField {
|
||||
'DeleteFileForm'
|
||||
);
|
||||
|
||||
protected $canUploadNewImage = true; //flag that controls whether or not new images can be uploaded by the user from their local computer
|
||||
|
||||
/**
|
||||
* The data class that this field is editing.
|
||||
* @return string Class name
|
||||
@ -106,7 +108,9 @@ class FileIFrameField extends FileField {
|
||||
$fileSources = array();
|
||||
|
||||
if(singleton($this->dataClass())->canCreate()) {
|
||||
$fileSources["new//$uploadFile"] = new FileField('Upload', '');
|
||||
if ($this->canUploadNewImage) { //allow local image uploading only if this flag is true
|
||||
$fileSources["new//$uploadFile"] = new FileField('Upload', '');
|
||||
}
|
||||
}
|
||||
|
||||
$fileSources["existing//$selectFile"] = new TreeDropdownField('ExistingFile', '', $this->dataClass());
|
||||
@ -227,4 +231,10 @@ class FileIFrameField extends FileField {
|
||||
return _t('FileIFrameField.FILE', 'File');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether or not files can be uploaded into the CMS from the user's local computer
|
||||
*/
|
||||
public function setCanUploadNewImage($can) {
|
||||
$this->canUploadNewImage = $can;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user