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:
Sean Harvey 2009-10-21 02:26:01 +00:00
parent 25e7f4413b
commit 2cc2f41b45

View File

@ -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,8 +108,10 @@ class FileIFrameField extends FileField {
$fileSources = array();
if(singleton($this->dataClass())->canCreate()) {
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;
}
}