From fc2e6e217cadd58be6f596d274bd4437d132439a Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Sat, 11 Oct 2025 06:19:19 +0200 Subject: [PATCH 01/12] fix folder parameter to hook 'folderRowAction' --- views/bootstrap/class.Bootstrap.php | 2 +- views/bootstrap4/class.Bootstrap4.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index b9e3c70e3..e5960f451 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -3484,7 +3484,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $hookObjs = $this->getHookObjects(); foreach($hookObjs as $hookObj) { if (method_exists($hookObj, 'folderRowAction')) { - $actions = $hookObj->folderRowAction($this, $folder, $actions); + $actions = $hookObj->folderRowAction($this, $subFolder, $actions); } } diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index 90bccc26d..3dfe67b17 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -3586,7 +3586,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $hookObjs = $this->getHookObjects(); foreach($hookObjs as $hookObj) { if (method_exists($hookObj, 'folderRowAction')) { - $actions = $hookObj->folderRowAction($this, $folder, $actions); + $actions = $hookObj->folderRowAction($this, $subFolder, $actions); } } From 804338810942f3594fa1f3209390255a5ae1e7da Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Sat, 11 Oct 2025 06:20:56 +0200 Subject: [PATCH 02/12] add changes for 5.1.42 --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 1815d1586..9c724eb59 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,7 @@ - add endpoints to rest api for setting comment and name of folder - initial support for installation from git - memcached support can be configured (still rarely used) +- fix folder parameter passed to hook 'folderRowAction' -------------------------------------------------------------------------------- Changes in version 5.1.41 From 9df13922e969679ac86bb08c2dd97a81094a1c8e Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 13 Oct 2025 11:08:51 +0200 Subject: [PATCH 03/12] require unrestricted access on document/folder for deletion by rest api --- CHANGELOG | 1 + restapi/index.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 9c724eb59..6ef53b266 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ - initial support for installation from git - memcached support can be configured (still rarely used) - fix folder parameter passed to hook 'folderRowAction' +- require unrestricted access on document/folder for deletion by rest api -------------------------------------------------------------------------------- Changes in version 5.1.41 diff --git a/restapi/index.php b/restapi/index.php index eeb6a5f61..808c45f8a 100644 --- a/restapi/index.php +++ b/restapi/index.php @@ -636,7 +636,7 @@ final class SeedDMS_RestapiController { /* {{{ */ } $mfolder = $dms->getFolder($args['id']); if($mfolder) { - if ($mfolder->getAccessMode($userobj, 'removeFolder') >= M_READWRITE) { + if ($mfolder->getAccessMode($userobj, 'removeFolder') > M_READWRITE) { if($mfolder->remove()) { return $this->renderer->json($response, array('success'=>true, 'message'=>'', 'data'=>''))->withStatus(200); } else { @@ -1214,7 +1214,7 @@ final class SeedDMS_RestapiController { /* {{{ */ $document = $dms->getDocument($args['id']); if($document) { - if ($document->getAccessMode($userobj, 'deleteDocument') >= M_READWRITE) { + if ($document->getAccessMode($userobj, 'deleteDocument') > M_READWRITE) { if($document->remove()) { return $this->renderer->json($response, array('success'=>true, 'message'=>'', 'data'=>''))->withStatus(200); } else { From ebdc85d5104d99dccc99f7e69ee3cd9751b98904 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 16 Oct 2025 10:36:22 +0200 Subject: [PATCH 04/12] update some packages --- composer.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index d969e6e18..479f6b3b0 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "require": { "php": ">=8.2.0", "phing/phing": "3.*", - "pear/http_request2": "2.5.0", + "pear/http_request2": "^2", "robthree/twofactorauth": "^3.0", "php-mime-mail-parser/php-mime-mail-parser": "*", "slim/slim": "^4.0", @@ -56,12 +56,12 @@ }, "require-dev": { "composer/composer": "dev-main", - "behat/mink": "1.8.1", - "behat/mink-selenium2-driver": "1.4.0", - "dmore/chrome-mink-driver": "2.8.0", - "friendsofphp/php-cs-fixer": "3.87.2", + "behat/mink": "^1", + "behat/mink-selenium2-driver": "^1", + "dmore/chrome-mink-driver": "^2", + "friendsofphp/php-cs-fixer": "^3", "phpunit/phpunit": "9.5.9", - "squizlabs/php_codesniffer": "3.6.0", + "squizlabs/php_codesniffer": "^3", "phpstan/phpstan": "^2.1", "pear/archive_tar": "*" }, From 19eb2db195efb0cd8e5873623db3087e4af1b83a Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 16 Oct 2025 10:48:18 +0200 Subject: [PATCH 05/12] update some packages --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 479f6b3b0..7ed1d81b1 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,7 @@ "alecrabbit/php-console-colour": "*", "zf1/zend-search-lucene": "*", "symfony/http-foundation": "^5.4", - "php-di/php-di": "^6.4", + "php-di/php-di": "^7", "hfig/mapi": "*", "slim/psr7": "^1.7", "chillerlan/php-qrcode": "^5.0", @@ -61,7 +61,7 @@ "dmore/chrome-mink-driver": "^2", "friendsofphp/php-cs-fixer": "^3", "phpunit/phpunit": "9.5.9", - "squizlabs/php_codesniffer": "^3", + "squizlabs/php_codesniffer": "^4", "phpstan/phpstan": "^2.1", "pear/archive_tar": "*" }, From c6d3b707994d34545ee7bdd8843e8ac5b66ae785 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 16 Oct 2025 10:48:35 +0200 Subject: [PATCH 06/12] update some packages --- composer-dist.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer-dist.json b/composer-dist.json index eb0c5fc52..8d63f2f38 100644 --- a/composer-dist.json +++ b/composer-dist.json @@ -16,7 +16,7 @@ } }, "require": { - "pear/http_request2": "2.5.0", + "pear/http_request2": "^2", "robthree/twofactorauth": "^3.0", "php-mime-mail-parser/php-mime-mail-parser": "*", "slim/slim": "^4.0", @@ -37,7 +37,7 @@ "alecrabbit/php-console-colour": "*", "zf1/zend-search-lucene": "*", "symfony/http-foundation": "^5.4", - "php-di/php-di": "^6.4", + "php-di/php-di": "^7", "hfig/mapi": "*", "slim/psr7": "^1.7", "chillerlan/php-qrcode": "^5.0", From 69b82fde4b3cb91876352013280e8da7f5d37832 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 16 Oct 2025 15:30:35 +0200 Subject: [PATCH 07/12] fix code formating --- www/index.php | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/www/index.php b/www/index.php index 9c0106cbe..23f2951da 100644 --- a/www/index.php +++ b/www/index.php @@ -34,7 +34,7 @@ require "inc/inc.Settings.php"; use DI\ContainerBuilder; use Slim\Factory\AppFactory; -if(true) { +if (true) { require_once("inc/inc.Utils.php"); require_once("inc/inc.LogInit.php"); require_once("inc/inc.Language.php"); @@ -60,18 +60,18 @@ if(true) { $container->set('notifier', $notifier); $container->set('authenticator', $authenticator); - if(isset($GLOBALS['SEEDDMS_HOOKS']['initDMS'])) { - foreach($GLOBALS['SEEDDMS_HOOKS']['initDMS'] as $hookObj) { - if (method_exists($hookObj, 'addMiddleware')) { - $hookObj->addMiddleware($app); - } + if (isset($GLOBALS['SEEDDMS_HOOKS']['initDMS'])) { + foreach ($GLOBALS['SEEDDMS_HOOKS']['initDMS'] as $hookObj) { + if (method_exists($hookObj, 'addMiddleware')) { + $hookObj->addMiddleware($app); } + } } $app->addErrorMiddleware(false, true, true); - if(isset($GLOBALS['SEEDDMS_HOOKS']['initDMS'])) { - foreach($GLOBALS['SEEDDMS_HOOKS']['initDMS'] as $hookObj) { + if (isset($GLOBALS['SEEDDMS_HOOKS']['initDMS'])) { + foreach ($GLOBALS['SEEDDMS_HOOKS']['initDMS'] as $hookObj) { if (method_exists($hookObj, 'addRoute')) { // FIXME: pass $app only just like initRestAPI. $app has a container // which contains all other objects @@ -81,16 +81,14 @@ if(true) { } /* Catch all route */ - $app->get('/{path:.*}', function($request, $response) use ($settings) { + $app->get('/{path:.*}', function ($request, $response) use ($settings) { return $response ->withHeader('Location', $settings->_httpRoot.'out/out.ViewFolder.php') ->withStatus(302); - }); $app->run(); } else { - header("Location: ". (isset($settings->_siteDefaultPage) && strlen($settings->_siteDefaultPage)>0 ? $settings->_siteDefaultPage : "out/out.ViewFolder.php")); ?> From edbf6b60da733676f665585c19f0db10da04b9b3 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 16 Oct 2025 15:30:46 +0200 Subject: [PATCH 08/12] add script 'phpcs' --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 7ed1d81b1..75bac27ec 100644 --- a/composer.json +++ b/composer.json @@ -102,6 +102,9 @@ } } ], + "scripts": { + "phpcs": "phpcs -s" + }, "extra": { "merge-plugin": { "include": [ From db70d2e4326690559e5a5f71ab9b8c319842badc Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 17 Oct 2025 14:06:07 +0200 Subject: [PATCH 09/12] note about removal of dir pear in favour of vendor --- doc/README.Install.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/README.Install.md b/doc/README.Install.md index 284f29571..7ba04f53c 100644 --- a/doc/README.Install.md +++ b/doc/README.Install.md @@ -241,6 +241,8 @@ in your current installation with new versions from the quickstart archive. 3. copy the directory `pear` from the unpacked archive into your current installation, replacing the existing directory. Make a backup of `pear` before the replacement if you want to ensure to be able to go back to your old version. + Since version 5.1.42 and 6.0.35 of SeeDMS the directory `pear` was replaced + by `vendor`, which was previously a ѕubdirectory of `pear`. 4. you may compare your `conf/settings.xml` file with the shipped version `conf/settings.xml.template` for new parameters. If you don't do it, the next time you save the configuration the default values will be used. From eb2f4d6206a2bc886cc72c20c232932a32cbb03b Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 17 Oct 2025 14:06:50 +0200 Subject: [PATCH 10/12] add video/mpeg to list of mimetypes having a preview --- views/bootstrap/class.ViewDocument.php | 1 + 1 file changed, 1 insertion(+) diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php index 80abf593a..caae6a61f 100644 --- a/views/bootstrap/class.ViewDocument.php +++ b/views/bootstrap/class.ViewDocument.php @@ -599,6 +599,7 @@ $(document).ready( function() { break; case 'video/webm': case 'video/mp4': + case 'video/mpeg': case 'video/avi': case 'video/msvideo': case 'video/x-msvideo': From 917ba91d959a9a63911fb03ebde2dd00152a17e0 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 20 Oct 2025 12:41:52 +0200 Subject: [PATCH 11/12] do not load content of modal box from href url, if href is not set --- views/bootstrap4/styles/application.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/views/bootstrap4/styles/application.js b/views/bootstrap4/styles/application.js index ae89354f6..39d229062 100644 --- a/views/bootstrap4/styles/application.js +++ b/views/bootstrap4/styles/application.js @@ -1718,7 +1718,8 @@ $(document).ready(function() { /* {{{ */ $(document).ready(function() { /* {{{ */ $('body').on('click.modal.data-api', '[data-toggle="modal"]', function(){ - $($(this).data("target")+' .modal-body').load($(this).attr('href')); + if($(this).attr('href')) + $($(this).data("target")+' .modal-body').load($(this).attr('href')); }); }); /* }}} */ From 3782e71ae6df9d0198e43b1288feb7599c4171e6 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 20 Oct 2025 12:42:31 +0200 Subject: [PATCH 12/12] add method makeRandomString() --- inc/inc.Utils.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/inc/inc.Utils.php b/inc/inc.Utils.php index 67dbd7d0c..6c1aa9c44 100644 --- a/inc/inc.Utils.php +++ b/inc/inc.Utils.php @@ -1293,6 +1293,20 @@ class SeedDMS_Utils { /* {{{ */ } } /* }}} */ + /** + * Create a random string + * + * @param integer $n number of chars + * @param string $alph alphabet used as source for chars + * @return string random string + */ + static public function makeRandomString($n, $alph = "0123456789abcdefghijklmnopqrstuvwxyz") { /* {{{ */ + $s = ""; + for ($i = 0; $i != $n; ++$i) + $s .= $alph[mt_rand(0, 35)]; + return $s; + } /* }}} */ + } /* }}} */ /**