Merge pull request #34 from ajshort/pull-2

Fixed upload issues in 3.1 (escaping and session)
This commit is contained in:
Stephen Shkardoon 2013-10-08 14:28:01 -07:00
commit 43e925d2db
2 changed files with 4 additions and 10 deletions

View File

@ -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;
}
/**

View File

@ -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
));