check if download/viewonline is allowed

This commit is contained in:
Uwe Steinmann 2021-05-31 19:32:39 +02:00
parent 13d1e92434
commit 9ae4a01705

View File

@ -517,9 +517,11 @@ $(document).ready( function() {
$this->columnStart(4); $this->columnStart(4);
if ($file_exists) { if ($file_exists) {
if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes))) { if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes))) {
print "<a target=\"_blank\" href=\"../op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion()."\">"; if($accessop->check_controller_access('ViewOnline', array('action'=>'run')))
print "<a target=\"_blank\" href=\"../op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion()."\">";
} else { } else {
print "<a href=\"../op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\">"; if($accessop->check_controller_access('Download', array('action'=>'version')))
print "<a href=\"../op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\">";
} }
} }
$previewer->createPreview($latestContent); $previewer->createPreview($latestContent);
@ -528,7 +530,7 @@ $(document).ready( function() {
} else { } else {
print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
} }
if ($file_exists) { if ($file_exists && ($accessop->check_controller_access('ViewOnline', array('action'=>'run')) || $accessop->check_controller_access('Download', array('action'=>'version')))) {
print "</a>"; print "</a>";
} }
// print "</td>\n"; // print "</td>\n";
@ -572,9 +574,11 @@ $(document).ready( function() {
$this->columnStart(4); $this->columnStart(4);
if ($file_exists){ if ($file_exists){
$items = array(); $items = array();
$items[] = array('link'=>"../op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'download', 'label'=>'download'); if($accessop->check_controller_access('Download', array('action'=>'version')))
if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes))) $items[] = array('link'=>"../op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'download', 'label'=>'download');
$items[] = array('link'=>"../op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion(), 'icon'=>'eye', 'label'=>'view_online', 'target'=>'_blank'); if($accessop->check_controller_access('ViewOnline', array('action'=>'run')))
if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes)))
$items[] = array('link'=>"../op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion(), 'icon'=>'eye', 'label'=>'view_online', 'target'=>'_blank');
if($newitems = $this->callHook('extraVersionViews', $latestContent)) if($newitems = $this->callHook('extraVersionViews', $latestContent))
$items = array_merge($items, $newitems); $items = array_merge($items, $newitems);
if($items) { if($items) {