From 3e5497a7fdedb4c82f24459bd6e99e959923d236 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 17 Feb 2023 06:57:42 +0100 Subject: [PATCH 1/8] add more error checking when including extensions.php --- inc/inc.ClassExtensionMgr.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/inc/inc.ClassExtensionMgr.php b/inc/inc.ClassExtensionMgr.php index ae2e036c1..f409b6a51 100644 --- a/inc/inc.ClassExtensionMgr.php +++ b/inc/inc.ClassExtensionMgr.php @@ -122,9 +122,10 @@ class SeedDMS_Extension_Mgr { if(!file_exists($this->getExtensionsConfFile())) { $this->createExtensionConf(); } - include($this->getExtensionsConfFile()); - if(!empty($EXT_CONF)) { - $this->extconf = $EXT_CONF; + if(@include($this->getExtensionsConfFile())) { + if(!empty($EXT_CONF)) { + $this->extconf = $EXT_CONF; + } } } } /* }}} */ From bea6ab35a897ee98584dc53171fd0cce57507098 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 17 Feb 2023 12:42:05 +0100 Subject: [PATCH 2/8] add changes in 5.1.30 --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index d396fba11..732125b18 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,7 @@ Changes in version 5.1.30 -------------------------------------------------------------------------------- - conversion from pdf to png replaces alpha channel with white +- add list of conversion services in debug menu of admin tool -------------------------------------------------------------------------------- Changes in version 5.1.29 From 4e08744631471a26ea490cbc1e2025415a87ff19 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 17 Feb 2023 16:10:59 +0100 Subject: [PATCH 3/8] addDirSep() can check for arbitrary chars at end of string --- inc/inc.Utils.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/inc/inc.Utils.php b/inc/inc.Utils.php index 25d3a0ecb..ace755d68 100644 --- a/inc/inc.Utils.php +++ b/inc/inc.Utils.php @@ -663,16 +663,19 @@ function get_extension($mimetype) { /* {{{ */ } /* }}} */ /** - * Adds a missing front slash to a string + * Adds a missing directory separator (or any other char) to a string * * This function is used for making sure a directory name has a - * trailing directory separator + * trailing directory separator. It can also be used to add + * any other char at the end of a string, e.g. an URL which must + * end in '/' (DIRECTORY_SEPARATOR wouldn't be right in that case, + * because it is '\' on Windows) */ -function addDirSep($str) { /* {{{ */ +function addDirSep($str, $chr=DIRECTORY_SEPARATOR) { /* {{{ */ if(trim($str) == '') return ''; - if(substr(trim($str), -1, 1) != DIRECTORY_SEPARATOR) - return trim($str).DIRECTORY_SEPARATOR; + if(substr(trim($str), -1, 1) != $chr) + return trim($str).$chr; else return trim($str); } /* }}} */ From dc868bd83b5988350da90f7ccfc3e5205572e29b Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Sat, 18 Feb 2023 15:49:04 +0100 Subject: [PATCH 4/8] getBaseUrl() checks for HTTP_X_FORWARDED_HOST and HTTP_X_FORWARDED_PROTO --- inc/inc.Utils.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/inc/inc.Utils.php b/inc/inc.Utils.php index ace755d68..b33a24199 100644 --- a/inc/inc.Utils.php +++ b/inc/inc.Utils.php @@ -803,12 +803,12 @@ function getBaseUrl() { /* {{{ */ if(!empty($settings->_baseUrl)) return $settings->_baseUrl; - if(isset($_SERVER['X-Forwarded-Host'])) - $host = $_SERVER['X-Forwarded-Host']; + if(isset($_SERVER['HTTP_X_FORWARDED_HOST'])) + $host = $_SERVER['HTTP_X_FORWARDED_HOST']; else $host = $_SERVER['HTTP_HOST']; - if(isset($_SERVER['X-Forwarded-Proto'])) - $ssl = $_SERVER['X-Forwarded-Proto'] == 'https'; + if(isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) + $ssl = $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'; else $ssl = (isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)); From 535de29e7d890bc53fce9a99409cf50b80deaca6 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Sat, 18 Feb 2023 15:49:55 +0100 Subject: [PATCH 5/8] check return value of postInitDMS --- inc/inc.DBInit.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/inc/inc.DBInit.php b/inc/inc.DBInit.php index 9949c5e9f..2662bb2a0 100644 --- a/inc/inc.DBInit.php +++ b/inc/inc.DBInit.php @@ -61,7 +61,11 @@ $dms->setMaxDirID($settings->_maxDirID); if(isset($GLOBALS['SEEDDMS_HOOKS']['initDMS'])) { foreach($GLOBALS['SEEDDMS_HOOKS']['initDMS'] as $hookObj) { if (method_exists($hookObj, 'postInitDMS')) { - $hookObj->postInitDMS(array('dms'=>$dms, 'settings'=>$settings, 'logger'=>$logger)); + $ret = $hookObj->postInitDMS(array('dms'=>$dms, 'settings'=>$settings, 'logger'=>$logger)); + if($ret === false) { + echo "Fatal error in postInitDMS Hook. No way to recover."; + exit; + } } } } From 2ffe130666a798c9494dcb634f3faba39e0d3f72 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 20 Feb 2023 16:05:55 +0100 Subject: [PATCH 6/8] set theme to bootstrap4, fulltext engine to sqlitefts, turn on theme selector --- conf/settings.xml.template | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/settings.xml.template b/conf/settings.xml.template index 01704a1ce..84c4b9437 100644 --- a/conf/settings.xml.template +++ b/conf/settings.xml.template @@ -15,7 +15,7 @@ footNote = "SeedDMS free document management system - www.seeddms.org" printDisclaimer = "true" language = "en_GB" - theme = "bootstrap" + theme = "bootstrap4" previewWidthList = "40" previewWidthDetail = "100" onePageMode="true" @@ -60,8 +60,8 @@ enableDropUpload = "false" enableRecursiveCount = "false" maxRecursiveCount = "0" - enableThemeSelector = "false" - fullSearchEngine = "lucene" + enableThemeSelector = "true" + fullSearchEngine = "sqlitefts" sortFoldersDefault = "u" defaultDocPosition = "end" defaultFolderPosition = "end" From 44d043ef21afde8033d83d7bd90efd6cce028f6c Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 20 Feb 2023 16:06:43 +0100 Subject: [PATCH 7/8] add fold marks --- inc/inc.ClassFulltextService.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/inc/inc.ClassFulltextService.php b/inc/inc.ClassFulltextService.php index 23309cf6c..131a4f747 100644 --- a/inc/inc.ClassFulltextService.php +++ b/inc/inc.ClassFulltextService.php @@ -181,14 +181,14 @@ class SeedDMS_FulltextService { * document if its content is below the configured size. * @return object indexed Document ready for passing to the indexer */ - public function IndexedDocument($object, $forceupdate=false) { + public function IndexedDocument($object, $forceupdate=false) { /* {{{ */ if($object->isType('document')) $nocontent = $object->getLatestContent()->getFileSize() > $this->maxsize && $this->maxsize && !$forceupdate; else $nocontent = true; $convcallback = $this->getConversionWithPreviewCallback(); return new $this->services[0]['IndexedDocument']($object->getDMS(), $object, $convcallback /*$this->conversionmgr ? $this->conversionmgr : $this->converters*/, $nocontent, $this->cmdtimeout); - } + } /* }}} */ /** * Returns an instance of the indexer @@ -198,7 +198,7 @@ class SeedDMS_FulltextService { * * @return object instance of class specified in 'Indexer' */ - public function Indexer($recreate=false) { + public function Indexer($recreate=false) { /* {{{ */ if($this->index) return $this->index; @@ -210,9 +210,9 @@ class SeedDMS_FulltextService { return $this->index; } else return null; - } + } /* }}} */ - public function Search() { + public function Search() { /* {{{ */ if($this->search) return $this->search; if($this->services[0]) { @@ -221,7 +221,7 @@ class SeedDMS_FulltextService { } else { return null; } - } + } /* }}} */ } From a7b00ae22add12e10641d8ae582db6c9777767be Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 20 Feb 2023 16:07:22 +0100 Subject: [PATCH 8/8] add new key 'attrcallback' to configuration of fulltext engine --- inc/inc.FulltextInit.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/inc/inc.FulltextInit.php b/inc/inc.FulltextInit.php index 450086571..53cfec9a5 100644 --- a/inc/inc.FulltextInit.php +++ b/inc/inc.FulltextInit.php @@ -1,5 +1,11 @@ getAllAttributeDefinitions(); + }; +} + $fulltextservice = null; if($settings->_enableFullSearch) { require_once("inc.ClassFulltextService.php"); @@ -10,7 +16,10 @@ if($settings->_enableFullSearch) { 'Indexer' => 'SeedDMS_SQLiteFTS_Indexer', 'Search' => 'SeedDMS_SQLiteFTS_Search', 'IndexedDocument' => 'SeedDMS_SQLiteFTS_IndexedDocument', - 'Conf' => array('indexdir' => $settings->_luceneDir) + 'Conf' => array( + 'indexdir' => $settings->_luceneDir, + 'attrcallback' => getAttributesCallback($dms) + ) ); $fulltextservice->addService('sqlitefts', $indexconf);