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 - fix possible xss attacks
- saver way to collect plugin configuration - saver way to collect plugin configuration
- fix update of postgres database - fix update of postgres database
- add hook displayPreviewThumb
- add searching for mimetype in database
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 5.1.39 Changes in version 5.1.39

View File

@ -293,7 +293,7 @@ if ($action == "saveSettings")
// SETTINGS - ADVANCED - SERVER // SETTINGS - ADVANCED - SERVER
setStrValue("coreDir"); setStrValue("coreDir");
setStrValue("luceneClassDir"); setStrValue("luceneClassDir");
setIntValue("contentOffsetDir"); setStrValue("contentOffsetDir");
setIntValue("maxDirID"); setIntValue("maxDirID");
setIntValue("updateNotifyTime"); setIntValue("updateNotifyTime");
setIntValue("maxExecutionTime"); 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
$status = isset($_GET['status']) ? $_GET['status'] : array(); $status = isset($_GET['status']) ? $_GET['status'] : array();
/* /*
@ -695,6 +710,7 @@ if($fullsearch) {
'startFolder'=>$startFolder, 'startFolder'=>$startFolder,
'owner'=>$ownerobjs, 'owner'=>$ownerobjs,
'status'=>$status, 'status'=>$status,
'mimetype'=>$mimetype,
'creationstartdate'=>$created['from'], //$createstartdate ? $createstartdate : array(), 'creationstartdate'=>$created['from'], //$createstartdate ? $createstartdate : array(),
'creationenddate'=>$created['to'], //$createenddate ? $createenddate : array(), 'creationenddate'=>$created['to'], //$createenddate ? $createenddate : array(),
'modificationstartdate'=>$modified['from'], 'modificationstartdate'=>$modified['from'],

View File

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

View File

@ -246,34 +246,36 @@ $(document).ready( function() {
protected function getSearchUrl($type, $item) { protected function getSearchUrl($type, $item) {
$dms = $this->params['dms']; $dms = $this->params['dms'];
$settings = $this->params['settings'];
$searchurl = null; $searchurl = null;
switch($type) { switch($type) {
case 'docsperuser': case 'docsperuser':
case 'sizeperuser': 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; break;
case 'foldersperuser': 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; break;
case 'docspercategory': 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; break;
case 'docsperstatus': 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; break;
case 'docspermonth': case 'docspermonth':
case 'sizepermonth': case 'sizepermonth':
$startmonth = $item['key'].'-01'; $startmonth = $item['key'].'-01';
$endmonth = date('Y-m-t', strtotime($startmonth)); $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; break;
case 'docspermimetype': case 'docspermimetype':
$searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&mimetype%5B%5D='.urlencode($item['key']);
break; break;
case 'docsaccumulated': case 'docsaccumulated':
$start = date('Y-m-d', $item['key']/1000); $start = date('Y-m-d', $item['key']/1000);
$end = date('Y-m-d', $item['key']/1000 + 86400); $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; break;
} }
return $searchurl; 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> <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 <?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> </ul>
<div class="tab-content"> <div class="tab-content">
@ -712,6 +718,8 @@ $(document).ready(function() {
$openfilterdlg = true; $openfilterdlg = true;
if($status) if($status)
$openfilterdlg = true; $openfilterdlg = true;
if($mimetype)
$openfilterdlg = true;
if($modifyenddate || $modifystartdate) if($modifyenddate || $modifystartdate)
$openfilterdlg = true; $openfilterdlg = true;
if($revisionstartdate || $revisionenddate) if($revisionstartdate || $revisionenddate)
@ -773,6 +781,22 @@ $(document).ready(function() {
'options'=>$options '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( $this->formField(
getMLText("modified")." (".getMLText('from').")", getMLText("modified")." (".getMLText('from').")",
$this->getDateChooser(!empty($modifystartdate) ? getReadableDate($modifystartdate) : null, "modified[from]", $this->params['session']->getLanguage()) $this->getDateChooser(!empty($modifystartdate) ? getReadableDate($modifystartdate) : null, "modified[from]", $this->params['session']->getLanguage())
@ -1486,6 +1510,14 @@ $(document).ready(function() {
echo "</div>\n"; 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> </div>
<?php <?php

View File

@ -327,8 +327,8 @@ $(document).ready( function() {
print "<tr>"; print "<tr>";
print "<td>"; print "<td>";
$previewer->createPreview($file, $previewwidthdetail);
if($file_exists) { if($file_exists) {
$previewer->createPreview($file, $previewwidthdetail);
if ($viewonlinefiletypes && (in_array(strtolower($file->getFileType()), $viewonlinefiletypes) || in_array(strtolower($file->getMimeType()), $viewonlinefiletypes))) { if ($viewonlinefiletypes && (in_array(strtolower($file->getFileType()), $viewonlinefiletypes) || in_array(strtolower($file->getMimeType()), $viewonlinefiletypes))) {
if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) { 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()."\">"; 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()."\">"; print "<a href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\">";
} }
} }
}
if($previewer->hasPreview($file)) { 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())."\">"); 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 { } else {
print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">"; print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">";
} }
if($file_exists) {
if($accessobject->check_controller_access('Download', array('action'=>'run')) || $accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) if($accessobject->check_controller_access('Download', array('action'=>'run')) || $accessobject->check_controller_access('ViewOnline', array('action'=>'run')))
print "</a>"; print "</a>";
} else {
print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">";
} }
print "</td>"; print "</td>";
@ -440,7 +440,7 @@ $(document).ready( function() {
?> ?>
<tr> <tr>
<td><?php printMLText("name");?>:</td> <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>
<tr> <tr>
<td><?php printMLText("owner");?>:</td> <td><?php printMLText("owner");?>:</td>
@ -747,6 +747,11 @@ $(document).ready( function() {
$this->rowStart(); $this->rowStart();
$this->columnStart(3); $this->columnStart(3);
if ($file_exists) { if ($file_exists) {
$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 ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes))) {
if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) 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()."\">"; print "<a target=\"_blank\" href=\"".$this->params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion()."\">";
@ -754,16 +759,18 @@ $(document).ready( function() {
if($accessobject->check_controller_access('Download', array('action'=>'version'))) 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()."\">"; print "<a href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\">";
} }
}
$previewer->createPreview($latestContent);
if($previewer->hasPreview($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())."\">"); 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 { } 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 && ($accessobject->check_controller_access('ViewOnline', array('action'=>'run')) || $accessobject->check_controller_access('Download', array('action'=>'version')))) { if ($accessobject->check_controller_access('ViewOnline', array('action'=>'run')) || $accessobject->check_controller_access('Download', array('action'=>'version'))) {
print "</a>"; print "</a>";
} }
}
} else {
print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
}
// print "</td>\n"; // print "</td>\n";
// print "<td>"; // print "<td>";

View File

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

View File

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

View File

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