Skip to content

Commit

Permalink
Merge pull request #34 from ajshort/pull-2
Browse files Browse the repository at this point in the history
Fixed upload issues in 3.1 (escaping and session)
  • Loading branch information
ss23 committed Oct 8, 2013
2 parents 0d9f011 + 893c109 commit 43e925d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
12 changes: 3 additions & 9 deletions code/cms/DMSDocumentAddController.php
Expand Up @@ -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 (
Expand Down Expand Up @@ -44,15 +46,7 @@ public function currentPage() {
* 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;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion code/cms/DMSUploadField.php
Expand Up @@ -154,7 +154,7 @@ public function upload(SS_HTTPRequest $request) {
'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
));

Expand Down

0 comments on commit 43e925d

Please sign in to comment.