mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-10-22 14:05:56 +02:00
Merge pull request #34 from ajshort/pull-2
Fixed upload issues in 3.1 (escaping and session)
This commit is contained in:
commit
43e925d2db
@ -7,6 +7,8 @@ class DMSDocumentAddController extends LeftAndMain {
|
||||
private static $required_permission_codes = 'CMS_ACCESS_AssetAdmin';
|
||||
private static $menu_title = 'Edit Page';
|
||||
private static $tree_class = 'SiteTree';
|
||||
private static $session_namespace = 'CMSMain';
|
||||
|
||||
static $allowed_extensions = array();
|
||||
|
||||
private static $allowed_actions = array (
|
||||
@ -44,15 +46,7 @@ class DMSDocumentAddController extends LeftAndMain {
|
||||
* Return fake-ID "root" if no ID is found (needed to upload files into the root-folder)
|
||||
*/
|
||||
public function currentPageID() {
|
||||
if(is_numeric($this->request->requestVar('ID'))) {
|
||||
return $this->request->requestVar('ID');
|
||||
} elseif (is_numeric($this->urlParams['ID'])) {
|
||||
return $this->urlParams['ID'];
|
||||
} elseif(Session::get("{$this->class}.currentPage")) {
|
||||
return Session::get("{$this->class}.currentPage");
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return ($result = parent::currentPageID()) === null ? 0 : $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -154,7 +154,7 @@ class DMSUploadField extends UploadField {
|
||||
'thumbnail_url' => $document->Icon($document->getExtension()),
|
||||
'edit_url' => $this->getItemHandler($document->ID)->EditLink(),
|
||||
'size' => $document->getFileSizeFormatted(),
|
||||
'buttons' => $document->renderWith($this->getTemplateFileButtons()),
|
||||
'buttons' => (string) $document->renderWith($this->getTemplateFileButtons()),
|
||||
'showeditform' => true
|
||||
));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user