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,8 +517,10 @@ $(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))) {
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()."\">"; print "<a target=\"_blank\" href=\"../op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion()."\">";
} else { } else {
if($accessop->check_controller_access('Download', array('action'=>'version')))
print "<a href=\"../op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\">"; print "<a href=\"../op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\">";
} }
} }
@ -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,7 +574,9 @@ $(document).ready( function() {
$this->columnStart(4); $this->columnStart(4);
if ($file_exists){ if ($file_exists){
$items = array(); $items = array();
if($accessop->check_controller_access('Download', array('action'=>'version')))
$items[] = array('link'=>"../op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'download', 'label'=>'download'); $items[] = array('link'=>"../op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'download', 'label'=>'download');
if($accessop->check_controller_access('ViewOnline', array('action'=>'run')))
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)))
$items[] = array('link'=>"../op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion(), 'icon'=>'eye', 'label'=>'view_online', 'target'=>'_blank'); $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))