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

This commit is contained in:
Uwe Steinmann 2025-03-26 09:30:49 +01:00
commit b7e075cdba
11 changed files with 48 additions and 29 deletions

View File

@ -325,6 +325,9 @@
Changes in version 5.1.40
--------------------------------------------------------------------------------
- fix saving user data when language selection is turned of (Closes: #568)
- add much better support for new storage drivers
- fix possible xss attacks
- saver way to collect plugin configuration
--------------------------------------------------------------------------------
Changes in version 5.1.39

View File

@ -49,6 +49,9 @@ application/vnd.openxmlformats-officedocument.wordprocessingml.document
application/msword
catdoc %s
application/vnd.oasis.opendocument.text
odt2txt %s
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
xlsx2csv -d tab %s

View File

@ -210,13 +210,19 @@ class SeedDMS_Extension_Mgr {
$fp = @fopen(self::getExtensionsConfFile(), "w");
if($fp) {
if($extensions) {
$EXT_CONF = [];
foreach($extensions as $_ext) {
if(file_exists($this->extdir . "/" . $_ext . "/conf.php")) {
$content = file_get_contents($this->extdir . "/" . $_ext . "/conf.php");
fwrite($fp, $content);
include $this->extdir . "/" . $_ext . "/conf.php";
// $content = file_get_contents($this->extdir . "/" . $_ext . "/conf.php");
// fwrite($fp, $content);
}
}
}
// fclose($fp);
// $fp = @fopen(self::getExtensionsConfFile(), "w");
fwrite($fp, '<?php
$EXT_CONF = '.var_export($EXT_CONF, true).';');
fclose($fp);
return true;
} else {

View File

@ -81,7 +81,7 @@ if(true) {
}
/* Catch all route */
$app->get('/{path:.*}', function($request, $response) {
$app->get('/{path:.*}', function($request, $response) use ($settings) {
return $response
->withHeader('Location', $settings->_httpRoot.'out/out.ViewFolder.php')
->withStatus(302);

View File

@ -3417,7 +3417,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$extracontent = array_merge($extracontent, $ec);
$content .= "<td>";
if (file_exists($dms->contentDir . $latestContent->getPath())) {
if ($latestContent->exists()) {
$previewhtml = $this->callHook('documentListPreview', $previewer, $document, $latestContent);
if(is_string($previewhtml))
$content .= $previewhtml;

View File

@ -52,12 +52,12 @@ class SeedDMS_View_Clipboard extends SeedDMS_Theme_Style {
$subitems = [];
foreach($clipboard['folders'] as $folderid) {
if($folder = $this->params['dms']->getFolder($folderid)) {
$subitems[] = array('label'=>'<i class="fa fa-folder-o"></i> '.$folder->getName(), 'link'=>$this->params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->getID(), 'class'=>"table-row-folder droptarget", 'attributes'=>array(array('data-droptarget', "folder_".$folder->getID()), array('rel', "folder_".$folder->getID()), array('data-name', htmlspecialchars($folder->getName(), ENT_QUOTES))));
$subitems[] = array('label'=>'<i class="fa fa-folder-o"></i> '.htmlspecialchars($folder->getName()), 'link'=>$this->params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->getID(), 'class'=>"table-row-folder droptarget", 'attributes'=>array(array('data-droptarget', "folder_".$folder->getID()), array('rel', "folder_".$folder->getID()), array('data-name', htmlspecialchars($folder->getName(), ENT_QUOTES))));
}
}
foreach($clipboard['docs'] as $docid) {
if($document = $this->params['dms']->getDocument($docid))
$subitems[] = array('label'=>'<i class="fa fa-file"></i> '.$document->getName(), 'link'=>$this->params['settings']->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(), 'class'=>"table-row-document droptarget", 'attributes'=>array(array('data-droptarget', "document_".$document->getID()), array('rel', "document_".$document->getID()), array('formtoken', createFormKey('')), array('data-name', htmlspecialchars($document->getName(), ENT_QUOTES))));
$subitems[] = array('label'=>'<i class="fa fa-file"></i> '.htmlspecialchars($document->getName()), 'link'=>$this->params['settings']->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(), 'class'=>"table-row-document droptarget", 'attributes'=>array(array('data-droptarget', "document_".$document->getID()), array('rel', "document_".$document->getID()), array('formtoken', createFormKey('')), array('data-name', htmlspecialchars($document->getName(), ENT_QUOTES))));
}
if((count($clipboard['docs']) + count($clipboard['folders'])) > 0) {
$subitems[] = array('divider'=>true);

View File

@ -13,11 +13,6 @@
* @version Release: @package_version@
*/
/**
* Include parent class
*/
//require_once("class.Bootstrap.php");
/**
* Class which outputs the html page for Info view
*
@ -60,17 +55,30 @@ class SeedDMS_View_Info extends SeedDMS_Theme_Style {
$this->rowStart();
$this->columnStart(6);
$this->contentHeading(getMLText("seeddms_info"));
$seedextensions = $extmgr->getExtensionConfiguration();
echo "<table class=\"table table-condensed table-sm\">\n";
echo "<thead>\n<tr>\n";
echo "<th></th>";
echo "<th>".getMLText("name");
echo "</th>\n";
echo "<th>".getMLText("name")."</th>\n";
echo "</tr>\n</thead>\n<tbody>\n";
$dbversion = $dms->getDBVersion();
echo "<tr><td></td><td></td><td>".getMLText('seeddms_version')."</td><td>".$version->version()."</td></tr>\n";
echo "<tr><td>".getMLText('seeddms_version')."</td><td>".$version->version()."</td></tr>\n";
if($user->isAdmin()) {
echo "<tr><td></td><td></td><td>".getMLText('database_schema_version')."</td><td>".$dbversion['major'].".".$dbversion['minor'].".".$dbversion['subminor']."</td></tr>\n";
$storage = $dms->getStorage();
echo "<tr><td>".getMLText('database_schema_version')."</td><td>".$dbversion['major'].".".$dbversion['minor'].".".$dbversion['subminor']."</td></tr>\n";
echo "<tr></td><td>".getMLText('storage')."</td><td>".($storage ? $storage->info() : "legacy")."</td></tr>\n";
}
echo "</tbody>\n</table>\n";
if($user->isAdmin()) {
$this->contentHeading(getMLText("extension_info"));
echo "<table class=\"table table-condensed table-sm\">\n";
echo "<thead>\n<tr>\n";
echo "<th></th>";
echo "<th></th>";
echo "<th>".getMLText("name");
echo "<th>".getMLText("version")."</th>\n";
echo "</th>\n";
echo "</tr>\n</thead>\n<tbody>\n";
$seedextensions = $extmgr->getExtensionConfiguration();
foreach($seedextensions as $extname=>$extconf) {
echo "<tr><td>";
if(!$settings->extensionIsDisabled($extname))
@ -85,8 +93,8 @@ class SeedDMS_View_Info extends SeedDMS_Theme_Style {
echo "<td>".$extname."<br />".$extconf['title']."</td><td>".$extconf['version']."</td>";
echo "</tr>\n";
}
echo "</tbody>\n</table>\n";
}
echo "</tbody>\n</table>\n";
$this->columnEnd();
$this->columnStart(6);
if($user->isAdmin()) {

View File

@ -724,7 +724,7 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk))
switch($conf['type']) {
case 'checkbox':
?>
<input type="hidden" name="<?php echo "extensions[".$extname."][".$confkey."]"; ?>" value=""><input type="checkbox" name="<?php echo "extensions[".$extname."][".$confkey."]"; ?>" value="1" <?php if(isset($settings->_extensions[$extname][$confkey]) && $settings->_extensions[$extname][$confkey]) echo 'checked'; ?> />
<input type="hidden" name="<?php echo "extensions[".$extname."][".$confkey."]"; ?>" value=""><input type="checkbox" id="extension_<?= $extname ?>_<?= $confkey ?>" name="<?php echo "extensions[".$extname."][".$confkey."]"; ?>" value="1" <?php if(isset($settings->_extensions[$extname][$confkey]) && $settings->_extensions[$extname][$confkey]) echo 'checked'; ?> />
<?php
break;
case 'select':
@ -733,7 +733,7 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk))
$order = empty($conf['order']) ? '' : $conf['order'];
if(!empty($conf['options'])) {
$selections = empty($settings->_extensions[$extname][$confkey]) ? array() : explode(",", $settings->_extensions[$extname][$confkey]);
echo "<select class=\"chzn-select\"".($allowempty ? " data-allow-clear=\"true\"" : "").($order ? " order=\"".$order."\"" : "")." name=\"extensions[".$extname."][".$confkey."][]\"".($multiple ? " multiple" : "").(!empty($conf['size']) ? " size=\"".$conf['size']."\"" : "")." data-placeholder=\"".getMLText("select_option")."\" style=\"width: 100%;\">";
echo "<select id=\"extension_".$extname."_".$confkey."\" class=\"chzn-select\"".($allowempty ? " data-allow-clear=\"true\"" : "").($order ? " order=\"".$order."\"" : "")." name=\"extensions[".$extname."][".$confkey."][]\"".($multiple ? " multiple" : "").(!empty($conf['size']) ? " size=\"".$conf['size']."\"" : "")." data-placeholder=\"".getMLText("select_option")."\" style=\"width: 100%;\">";
if(is_array($conf['options'])) {
$options = $conf['options'];
} elseif(is_string($conf['options']) && $conf['options'] == 'hook') {

View File

@ -298,7 +298,7 @@ class SeedDMS_View_Tasks extends SeedDMS_Theme_Style {
$subitems = [];
foreach($tasks['review'] as $t) {
$doc = $dms->getDocument($t['id']);
$subitems[] = array('label'=>$doc->getName(), 'link'=>$this->params['settings']->_httpRoot."out/out.ViewDocument.php?documentid=".$doc->getID()."&currenttab=revapp", 'class'=>"table-row-document", 'rel'=>"document_".$doc->getID());
$subitems[] = array('label'=>htmlspecialchars($doc->getName()), 'link'=>$this->params['settings']->_httpRoot."out/out.ViewDocument.php?documentid=".$doc->getID()."&currenttab=revapp", 'class'=>"table-row-document", 'rel'=>"document_".$doc->getID());
}
$menuitems['tasks']['children']['review'] = array('label'=>getMLText('documents_to_review'), 'children'=>$subitems);
@ -307,7 +307,7 @@ class SeedDMS_View_Tasks extends SeedDMS_Theme_Style {
$subitems = [];
foreach($tasks['approval'] as $t) {
$doc = $dms->getDocument($t['id']);
$subitems[] = array('label'=>$doc->getName(), 'link'=>$this->params['settings']->_httpRoot."out/out.ViewDocument.php?documentid=".$doc->getID()."&currenttab=revapp", 'class'=>"table-row-document", 'rel'=>"document_".$doc->getID());
$subitems[] = array('label'=>htmlspecialchars($doc->getName()), 'link'=>$this->params['settings']->_httpRoot."out/out.ViewDocument.php?documentid=".$doc->getID()."&currenttab=revapp", 'class'=>"table-row-document", 'rel'=>"document_".$doc->getID());
}
$menuitems['tasks']['children']['approval'] = array('label'=>getMLText('documents_to_approve'), 'children'=>$subitems);
}
@ -315,7 +315,7 @@ class SeedDMS_View_Tasks extends SeedDMS_Theme_Style {
$subitems = [];
foreach($tasks['workflow'] as $t) {
$doc = $dms->getDocument($t['id']);
$subitems[] = array('label'=>$doc->getName(), 'link'=>$this->params['settings']->_httpRoot."out/out.ViewDocument.php?documentid=".$doc->getID()."&currenttab=workflow", 'class'=>"table-row-document", 'rel'=>"document_".$doc->getID());
$subitems[] = array('label'=>htmlspecialchars($doc->getName()), 'link'=>$this->params['settings']->_httpRoot."out/out.ViewDocument.php?documentid=".$doc->getID()."&currenttab=workflow", 'class'=>"table-row-document", 'rel'=>"document_".$doc->getID());
}
$menuitems['tasks']['children']['workflow'] = array('label'=>getMLText('documents_to_trigger_workflow'), 'children'=>$subitems);
}
@ -347,7 +347,7 @@ class SeedDMS_View_Tasks extends SeedDMS_Theme_Style {
$subitems = [];
foreach($tasks['rejected'] as $t) {
$doc = $dms->getDocument($t['id']);
$subitems[] = array('label'=>$doc->getName(), 'link'=>$this->params['settings']->_httpRoot."out/out.ViewDocument.php?documentid=".$doc->getID()."&currenttab=docinfo", 'class'=>"table-row-document", 'rel'=>"document_".$doc->getID());
$subitems[] = array('label'=>htmlspecialchars($doc->getName()), 'link'=>$this->params['settings']->_httpRoot."out/out.ViewDocument.php?documentid=".$doc->getID()."&currenttab=docinfo", 'class'=>"table-row-document", 'rel'=>"document_".$doc->getID());
}
$menuitems['tasks']['children']['rejected'] = array('label'=>getMLText('documents_rejected'), 'children'=>$subitems);
}

View File

@ -321,7 +321,7 @@ $(document).ready( function() {
foreach($files as $file) {
$file_exists=file_exists($dms->contentDir . $file->getPath());
$file_exists = $file->exists();//file_exists($dms->contentDir . $file->getPath());
$responsibleUser = $file->getUser();
@ -357,7 +357,7 @@ $(document).ready( function() {
print "<li>".htmlspecialchars($file->getOriginalFileName())."</li>\n";
if ($file_exists) {
$realmimetype = $file->getRealMimeType();
print "<li>".SeedDMS_Core_File::format_filesize(filesize($dms->contentDir . $file->getPath())) ." bytes, ".htmlspecialchars($file->getMimeType())."</li>";
print "<li>".SeedDMS_Core_File::format_filesize($file->size()) ." bytes, ".htmlspecialchars($file->getMimeType())."</li>";
} else print "<li>".htmlspecialchars($file->getMimeType())." - <span class=\"warning\">".getMLText("document_deleted")."</span></li>";
print "<li>".getMLText("uploaded_by")." <a href=\"mailto:".htmlspecialchars($responsibleUser->getEmail())."\">".htmlspecialchars($responsibleUser->getFullName())."</a></li>";
@ -733,7 +733,7 @@ $(document).ready( function() {
$previewwidthdetail = $this->params['previewWidthDetail'];
// verify if file exists
$file_exists=file_exists($dms->contentDir . $latestContent->getPath());
$file_exists = $latestContent->exists(); //file_exists($dms->contentDir . $latestContent->getPath());
$status = $latestContent->getStatus();
@ -2050,4 +2050,3 @@ $(document).ready( function() {
$this->htmlEndPage();
} /* }}} */
}
?>

View File

@ -3390,7 +3390,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$extracontent = array_merge($extracontent, $ec);
$content .= "<td>";
if (file_exists($dms->contentDir . $latestContent->getPath())) {
if ($latestContent->exists()) {
$previewhtml = $this->callHook('documentListPreview', $previewer, $document, $latestContent);
if(is_string($previewhtml))
$content .= $previewhtml;