Merge branch '2.1'

This commit is contained in:
Robbie Averill 2017-12-07 15:46:32 +13:00
commit ab9d361f98
3 changed files with 8 additions and 4 deletions

View File

@ -190,14 +190,14 @@ class DMSDocumentAddController extends LeftAndMain
return Controller::join_links( return Controller::join_links(
$modelAdmin->Link('DMSDocumentSet'), $modelAdmin->Link('DMSDocumentSet'),
'EditForm/field/DMSDocumentSet/item', 'EditForm/field/DMSDocumentSet/item',
$this->getRequest()->getVar('dsid'), (int) $this->getRequest()->getVar('dsid'),
'edit' 'edit'
); );
} }
return $modelAdmin->Link(); return $modelAdmin->Link();
} }
return $this->getPageEditLink($this->currentPageID(), $this->getRequest()->getVar('dsid')); return $this->getPageEditLink($this->currentPageID(), (int) $this->getRequest()->getVar('dsid'));
} }
/** /**
@ -212,7 +212,7 @@ class DMSDocumentAddController extends LeftAndMain
return Controller::join_links( return Controller::join_links(
CMSPageEditController::singleton()->getEditForm($pageId)->FormAction(), CMSPageEditController::singleton()->getEditForm($pageId)->FormAction(),
'field/Document Sets/item', 'field/Document Sets/item',
$documentSetId (int) $documentSetId
); );
} }

View File

@ -1322,6 +1322,9 @@ class DMSDocument extends DataObject implements DMSDocumentInterface
. '<ul>'; . '<ul>';
foreach ($this->actionTasks as $panelKey => $title) { foreach ($this->actionTasks as $panelKey => $title) {
$panelKey = Convert::raw2xml($panelKey);
$title = Convert::raw2xml($title);
$html .= '<li class="ss-ui-button dmsdocument-action" data-panel="' . $panelKey . '">' $html .= '<li class="ss-ui-button dmsdocument-action" data-panel="' . $panelKey . '">'
. _t('DMSDocument.ACTION_' . strtoupper($panelKey), $title) . _t('DMSDocument.ACTION_' . strtoupper($panelKey), $title)
. '</li>'; . '</li>';

View File

@ -82,6 +82,7 @@ class DMSDocument_Controller extends Controller
$finfo = finfo_open(FILEINFO_MIME_TYPE); $finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($finfo, $path); $mime = finfo_file($finfo, $path);
} elseif (is_executable($fileBin)) { } elseif (is_executable($fileBin)) {
$path = escapeshellarg($path);
// try to use the system tool // try to use the system tool
$mime = `$fileBin -i -b $path`; $mime = `$fileBin -i -b $path`;
$mime = explode(';', $mime); $mime = explode(';', $mime);
@ -89,7 +90,7 @@ class DMSDocument_Controller extends Controller
} else { } else {
// make do with what we have // make do with what we have
$ext = $doc->getExtension(); $ext = $doc->getExtension();
if ($ext =='pdf') { if ($ext == 'pdf') {
$mime = 'application/pdf'; $mime = 'application/pdf';
} elseif ($ext == 'html' || $ext =='htm') { } elseif ($ext == 'html' || $ext =='htm') {
$mime = 'text/html'; $mime = 'text/html';