Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2025-04-29 12:38:22 +02:00
commit 2288be497c
10 changed files with 94 additions and 37 deletions

View File

@ -329,6 +329,8 @@
- fix possible xss attacks
- saver way to collect plugin configuration
- fix update of postgres database
- add hook displayPreviewThumb
- add searching for mimetype in database
--------------------------------------------------------------------------------
Changes in version 5.1.39

View File

@ -293,7 +293,7 @@ if ($action == "saveSettings")
// SETTINGS - ADVANCED - SERVER
setStrValue("coreDir");
setStrValue("luceneClassDir");
setIntValue("contentOffsetDir");
setStrValue("contentOffsetDir");
setIntValue("maxDirID");
setIntValue("updateNotifyTime");
setIntValue("maxExecutionTime");

View File

@ -594,6 +594,21 @@ if($fullsearch) {
}
/* }}} */
// Check to see if the search has been restricted to a particular
// mimetype. {{{
$mimetype = [];
if (isset($_GET["mimetype"])) {
if (!is_array($_GET['mimetype'])) {
if(!empty($_GET['mimetype']))
$mimetype[] = $_GET['mimetype'];
} else {
foreach($_GET["mimetype"] as $l) {
if($l)
$mimetype[] = $l;
}
}
} /* }}} */
// status
$status = isset($_GET['status']) ? $_GET['status'] : array();
/*
@ -695,6 +710,7 @@ if($fullsearch) {
'startFolder'=>$startFolder,
'owner'=>$ownerobjs,
'status'=>$status,
'mimetype'=>$mimetype,
'creationstartdate'=>$created['from'], //$createstartdate ? $createstartdate : array(),
'creationenddate'=>$created['to'], //$createenddate ? $createenddate : array(),
'modificationstartdate'=>$modified['from'],

View File

@ -2691,9 +2691,9 @@ $(function() {
*
* @param string text
*/
function printInlineEdit($text, $object){ /* {{{ */
function printInlineEditDocumentName($text, $object){ /* {{{ */
if(!empty($this->params['settings']->_inlineEditing)) {
echo "<span class=\"editable\" contenteditable=\"true\"";
echo "<span class=\"editdocname editable\" contenteditable=\"true\"";
if($object->isType('document'))
echo " data-document=\"".$object->getId()."\" data-formtoken=\"".createFormKey('setdocumentname')."\"";
echo ">".$text;

View File

@ -246,34 +246,36 @@ $(document).ready( function() {
protected function getSearchUrl($type, $item) {
$dms = $this->params['dms'];
$settings = $this->params['settings'];
$searchurl = null;
switch($type) {
case 'docsperuser':
case 'sizeperuser':
$searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&owner%5B%5D='.$item['res'];
$searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&owner%5B%5D='.$item['res'];
break;
case 'foldersperuser':
$searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=2&owner%5B%5D='.$item['res'];
$searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=2&owner%5B%5D='.$item['res'];
break;
case 'docspercategory':
$searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&category%5B%5D='.$item['res'];
$searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&category%5B%5D='.$item['res'];
break;
case 'docsperstatus':
$searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&status%5B%5D='.$item['res'];
$searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&status%5B%5D='.$item['res'];
break;
case 'docspermonth':
case 'sizepermonth':
$startmonth = $item['key'].'-01';
$endmonth = date('Y-m-t', strtotime($startmonth));
$searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&created%5Bfrom%5D='.$startmonth.'&created%5Bto%5D='.$endmonth;
$searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&created%5Bfrom%5D='.$startmonth.'&created%5Bto%5D='.$endmonth;
break;
case 'docspermimetype':
$searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&mimetype%5B%5D='.urlencode($item['key']);
break;
case 'docsaccumulated':
$start = date('Y-m-d', $item['key']/1000);
$end = date('Y-m-d', $item['key']/1000 + 86400);
$searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&created%5Bfrom%5D='.$start.'&created%5Bto%5D='.$end;
$searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&created%5Bfrom%5D='.$start.'&created%5Bto%5D='.$end;
break;
}
return $searchurl;

View File

@ -547,6 +547,12 @@ $(document).ready(function() {
<li class="nav-item <?php echo ($facetsearch == true && $facetsearch == true) ? 'active' : ''; ?>"><a class="nav-link <?php echo ($facetsearch == true && $facetsearch == true) ? 'active' : ''; ?>" data-target="#facetfulltext" data-toggle="tab" role="button"><?php printMLText('facetfullsearch'); ?></a></li>
<?php
}
$tabs = $this->callHook('extraTabs');
if($tabs) {
foreach($tabs as $tabid=>$tab) {
echo '<li class="nav-item"><a class="nav-link" data-target="#'.$tabid.'" data-toggle="tab" role="button">'.$tab['title'].'</a></li>';
}
}
?>
</ul>
<div class="tab-content">
@ -712,6 +718,8 @@ $(document).ready(function() {
$openfilterdlg = true;
if($status)
$openfilterdlg = true;
if($mimetype)
$openfilterdlg = true;
if($modifyenddate || $modifystartdate)
$openfilterdlg = true;
if($revisionstartdate || $revisionenddate)
@ -773,6 +781,22 @@ $(document).ready(function() {
'options'=>$options
)
);
$options = [];
foreach($dms->getMimeTypes() as $m) {
$options[] = array($m['mimeType'], $m['mimeType'], in_array($m['mimeType'], $mimetype)/*, array(array('data-subtitle', htmlspecialchars($m['c'].' ×')))*/);
}
$this->formField(
getMLText("mimetype"),
array(
'element'=>'select',
'class'=>'chzn-select',
'name'=>'mimetype[]',
'multiple'=>true,
'attributes'=>array(array('data-placeholder', getMLText('select_mimetype')), array('data-no_results_text', getMLText('no_mimetype'))),
'options'=>$options
)
);
$this->formField(
getMLText("modified")." (".getMLText('from').")",
$this->getDateChooser(!empty($modifystartdate) ? getReadableDate($modifystartdate) : null, "modified[from]", $this->params['session']->getLanguage())
@ -1486,6 +1510,14 @@ $(document).ready(function() {
echo "</div>\n";
}
// }}}
if($tabs) {
foreach($tabs as $tabid=>$tab) {
echo '<div class="tab-pane" id="'.$tabid.'" role="tabpanel">';
echo $tab['content'];
echo "</div>\n";
}
}
?>
</div>
<?php

View File

@ -327,8 +327,8 @@ $(document).ready( function() {
print "<tr>";
print "<td>";
$previewer->createPreview($file, $previewwidthdetail);
if($file_exists) {
$previewer->createPreview($file, $previewwidthdetail);
if ($viewonlinefiletypes && (in_array(strtolower($file->getFileType()), $viewonlinefiletypes) || in_array(strtolower($file->getMimeType()), $viewonlinefiletypes))) {
if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) {
print "<a target=\"_blank\" href=\"".$this->params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$documentid."&file=". $file->getID()."\">";
@ -338,15 +338,15 @@ $(document).ready( function() {
print "<a href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\">";
}
}
}
if($previewer->hasPreview($file)) {
print("<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&file=".$file->getID()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($file->getMimeType())."\">");
} else {
print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">";
}
if($file_exists) {
if($previewer->hasPreview($file)) {
print("<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&file=".$file->getID()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($file->getMimeType())."\">");
} else {
print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">";
}
if($accessobject->check_controller_access('Download', array('action'=>'run')) || $accessobject->check_controller_access('ViewOnline', array('action'=>'run')))
print "</a>";
} else {
print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">";
}
print "</td>";
@ -440,7 +440,7 @@ $(document).ready( function() {
?>
<tr>
<td><?php printMLText("name");?>:</td>
<td><?php $this->printInlineEdit(htmlspecialchars($document->getName()), $document);?></td>
<td><?php $this->printInlineEditDocumentName(htmlspecialchars($document->getName()), $document);?></td>
</tr>
<tr>
<td><?php printMLText("owner");?>:</td>
@ -747,23 +747,30 @@ $(document).ready( function() {
$this->rowStart();
$this->columnStart(3);
if ($file_exists) {
if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes))) {
if($accessobject->check_controller_access('ViewOnline', array('action'=>'run')))
print "<a target=\"_blank\" href=\"".$this->params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion()."\">";
} else {
if($accessobject->check_controller_access('Download', array('action'=>'version')))
print "<a href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\">";
$previewer->createPreview($latestContent);
$previewhtml = $this->callHook('documentPreviewThumb', $previewer, $latestContent->getDocument(), $latestContent);
if(is_string($previewhtml))
echo $previewhtml;
else {
if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes))) {
if($accessobject->check_controller_access('ViewOnline', array('action'=>'run')))
print "<a target=\"_blank\" href=\"".$this->params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion()."\">";
} else {
if($accessobject->check_controller_access('Download', array('action'=>'version')))
print "<a href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\">";
}
if($previewer->hasPreview($latestContent)) {
print("<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->params['settings']->_httpRoot."op/op.Preview.php?documentid=".$latestContent->getDocument()->getID()."&version=".$latestContent->getVersion()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">");
} else {
print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
}
if ($accessobject->check_controller_access('ViewOnline', array('action'=>'run')) || $accessobject->check_controller_access('Download', array('action'=>'version'))) {
print "</a>";
}
}
}
$previewer->createPreview($latestContent);
if($previewer->hasPreview($latestContent)) {
print("<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->params['settings']->_httpRoot."op/op.Preview.php?documentid=".$latestContent->getDocument()->getID()."&version=".$latestContent->getVersion()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">");
} else {
print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
}
if ($file_exists && ($accessobject->check_controller_access('ViewOnline', array('action'=>'run')) || $accessobject->check_controller_access('Download', array('action'=>'version')))) {
print "</a>";
}
// print "</td>\n";
// print "<td>";

View File

@ -721,8 +721,7 @@ $(document).ready( function() {
window.history.back();
}); /* }}} */
$("body").on("blur", "span.editable", function(e) { /* {{{ */
console.log($(this).data('document'));
$("body").on("blur", "span.editdocname", function(e) { /* {{{ */
e.preventDefault();
$.post(seeddms_webroot+"op/op.Ajax.php", { command: "setdocumentname", id: $(this).data('document'), formtoken: $(this).data('formtoken'), name: $(this).text() })
.done(function( data ) {

View File

@ -2641,9 +2641,9 @@ $(function() {
*
* @param string text
*/
function printInlineEdit($text, $object){ /* {{{ */
function printInlineEditDocumentName($text, $object){ /* {{{ */
if(!empty($this->params['settings']->_inlineEditing)) {
echo "<span class=\"editable\" contenteditable=\"true\"";
echo "<span class=\"editdocname editable\" contenteditable=\"true\"";
if($object->isType('document'))
echo " data-document=\"".$object->getId()."\" data-formtoken=\"".createFormKey('setdocumentname')."\"";
echo ">".$text;

View File

@ -769,8 +769,7 @@ $(document).ready( function() {
window.history.back();
}); /* }}} */
$("body").on("blur", "span.editable", function(e) { /* {{{ */
console.log($(this).data('document'));
$("body").on("blur", "span.editdocname", function(e) { /* {{{ */
e.preventDefault();
$.post(seeddms_webroot+"op/op.Ajax.php", { command: "setdocumentname", id: $(this).data('document'), formtoken: $(this).data('formtoken'), name: $(this).text() })
.done(function( data ) {