Compare commits

..

49 Commits

Author SHA1 Message Date
Uwe Steinmann
a825bb43fb Merge branch 'seeddms-6.0.x' 2025-05-22 17:50:22 +02:00
Uwe Steinmann
a2a39ce946 Merge branch 'seeddms-6.0.x' 2024-11-08 06:45:24 +01:00
Uwe Steinmann
b9abff5c55 Merge branch 'seeddms-6.0.x' 2024-11-07 07:08:11 +01:00
Uwe Steinmann
24595a234d Merge branch 'master' of ssh://git.code.sf.net/p/seeddms/code 2023-05-04 14:29:51 +02:00
Uwe Steinmann
199fd57151 Merge branch 'seeddms-6.0.x' 2023-05-04 14:24:04 +02:00
Uwe Steinmann
9dfc6e8b1e Merge branch 'seeddms-6.0.x' 2023-02-07 13:16:15 +01:00
Uwe Steinmann
cfc23e0ddf Merge branch 'seeddms-5.1.x' 2022-11-21 15:10:31 +01:00
Uwe Steinmann
7012580476 Merge branch 'seeddms-5.1.x' 2022-09-22 16:52:06 +02:00
Uwe Steinmann
40bd123fe3 Merge branch 'seeddms-5.1.x' 2022-06-27 17:01:18 +02:00
Uwe Steinmann
6c3ecaf9a1 Merge branch 'seeddms-5.1.x' 2022-04-22 13:14:19 +02:00
Uwe Steinmann
40ce4a74e1 Merge branch 'seeddms-5.1.x' 2021-08-19 15:54:46 +02:00
Uwe Steinmann
8fcfd70bd6 Merge branch 'seeddms-5.1.x' 2021-04-13 07:43:43 +02:00
Uwe Steinmann
6f0803e698 Merge branch 'seeddms-5.1.x' 2020-12-29 09:15:13 +01:00
Uwe Steinmann
5d28744758 Merge branch 'seeddms-5.1.x' into master 2020-09-29 14:25:14 +02:00
Uwe Steinmann
a17220d373 Merge branch 'seeddms-5.1.x' into master 2020-09-02 21:25:53 +02:00
Uwe Steinmann
54dea818f7 Merge branch 'seeddms-5.1.x' into master 2020-07-27 20:29:54 +02:00
Uwe Steinmann
a446f45e43 Merge branch 'seeddms-5.1.x' 2020-05-28 11:37:04 +02:00
Uwe Steinmann
6139c781d0 Merge branch 'seeddms-5.1.x' 2020-03-02 12:03:38 +01:00
Uwe Steinmann
0602fad397 Merge branch 'seeddms-5.1.x' 2020-02-17 10:21:29 +01:00
Uwe Steinmann
44bf03c557 Merge branch 'seeddms-5.1.x' 2019-07-19 15:29:20 +02:00
Uwe Steinmann
4bcb5f8e4c Merge branch 'seeddms-5.1.x' 2019-06-20 08:27:24 +02:00
Uwe Steinmann
4fe696f18b Merge branch 'seeddms-5.1.x' 2019-06-14 08:53:26 +02:00
Uwe Steinmann
023c2c58f1 Merge branch 'seeddms-5.1.x' 2019-06-13 11:23:19 +02:00
Uwe Steinmann
1a002c9d18 Merge branch 'seeddms-5.1.x' 2019-04-04 19:18:44 +02:00
Uwe Steinmann
3321b097e6 Merge branch 'seeddms-5.1.x' 2018-11-13 08:55:38 +01:00
Uwe Steinmann
dc2cadc6d8 Merge branch 'seeddms-5.1.x' 2018-07-03 11:42:39 +02:00
Uwe Steinmann
20e9157d01 Merge branch 'seeddms-5.1.x' 2018-01-03 09:23:05 +01:00
Sebastian Bartus-Kunz
02e7066749 Fixed wrong return object in getDocumentLink() 2017-12-20 15:40:20 +01:00
Uwe Steinmann
18c34ce29d Merge branch 'seeddms-5.1.x' 2017-11-02 08:53:59 +01:00
Uwe Steinmann
b7014a6b21 Merge branch 'seeddms-5.1.x' 2017-09-05 09:02:05 +02:00
Uwe Steinmann
fdf14b2a1f Merge branch 'seeddms-5.1.x' 2017-07-19 08:30:53 +02:00
Uwe Steinmann
e79a0015f9 Merge tag '5.1.2' 2017-07-11 18:05:39 +02:00
Uwe Steinmann
0c4103ce34 Merge branch 'seeddms-5.0.x' 2017-03-20 15:46:04 +01:00
Uwe Steinmann
ff3dd800e4 Merge branch 'seeddms-5.0.x' 2017-02-27 20:18:46 +01:00
Uwe Steinmann
211a3bc6bc Merge branch 'seeddms-5.0.x' 2017-01-26 15:51:47 +01:00
Uwe Steinmann
e49c9e1c98 Merge branch 'seeddms-5.0.x' 2016-12-12 10:32:27 +01:00
Uwe Steinmann
e3002fce0b Merge branch 'seeddms-5.0.x' 2016-09-23 09:07:18 +02:00
Uwe Steinmann
2a45854818 Merge tag '5.0.5' 2016-08-29 09:56:36 +02:00
Uwe Steinmann
cb059d53eb Merge branch 'seeddms-5.0.x' 2016-07-06 12:52:35 +02:00
Uwe Steinmann
44bd7fda79 Merge branch 'seeddms-5.0.x' 2016-04-22 17:24:34 +02:00
Uwe Steinmann
5f54964d69 Merge branch 'seeddms-5.0.x' 2016-03-25 17:13:27 +01:00
Uwe Steinmann
3dc3b6f0d2 Merge branch 'seeddms-5.0.x' 2016-02-22 15:20:24 +01:00
Uwe Steinmann
468b146a64 Merge branch 'seeddms-5.0.x' 2016-01-25 09:40:01 +01:00
Uwe Steinmann
d81f946446 Merge branch 'seeddms-5.0.x' 2016-01-22 09:51:45 +01:00
Uwe Steinmann
097aae895f Merge branch 'seeddms-4.3.x' 2016-01-21 08:39:21 +01:00
Uwe Steinmann
a55662ea1b Merge branch 'seeddms-4.3.x' 2015-11-19 17:43:24 +01:00
Uwe Steinmann
8d35bb6a9b Merge branch 'seeddms-4.3.x' 2015-09-28 14:47:29 +02:00
Uwe Steinmann
7826d487cc Merge branch 'seeddms-4.3.x' 2015-08-25 21:31:53 +02:00
Uwe Steinmann
ddbc3839a5 Merge branch 'seeddms-4.3.x' 2015-06-26 16:51:06 +02:00
164 changed files with 9595 additions and 15718 deletions

2
.gitignore vendored
View File

@ -1,6 +1,4 @@
*.tar.gz
SeedDMS_*/*.tgz
ext/*
vendor
webapp/*
www/ext

View File

@ -27,13 +27,13 @@ RewriteRule "^out/images.*$" "-" [L]
RewriteRule "^styles/.*$" "-" [L]
# Accessing a file in an extension is only possible in one
# of the directories op, out, res, node_modules
# of the directories op, out. res
# Added for old extensions which do not use routes
RewriteRule ^ext/[^/]+/icon.(?:png|svg)$ - [L]
RewriteCond %{REQUEST_URI} "ext/[^/]+/"
RewriteRule !^ext/[^/]+/.*(?:op|out|res|node_modules) - [F]
RewriteCond %{REQUEST_URI} "ext/[^/]+/res/.*$" [NC]
RewriteRule !^ext/[^/]+/res/.*\.(?:css|js|mjs|ftl|png|gif|svg|ico|html|woff|ttf) - [F]
RewriteRule !^ext/[^/]+/res/.*\.(?:css|js|png|gif|svg|ico|html|woff|ttf) - [F]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ext/.*$ - [L]

View File

@ -1,27 +1,3 @@
--------------------------------------------------------------------------------
Changes in version 6.0.36
--------------------------------------------------------------------------------
- merge changes up to 5.1.43
--------------------------------------------------------------------------------
Changes in version 6.0.35
--------------------------------------------------------------------------------
- merge changes up to 5.1.42
- allow checking for 2-factor authentication setup
- 2-factor secret can be deleted
- logout is still possible, even if a 2nd factor isn't set
- 2nd factor will only be checked during login if a secret exists
--------------------------------------------------------------------------------
Changes in version 6.0.34
--------------------------------------------------------------------------------
- merge changes up to 5.1.41
- Revisors can be set, even if revision date is not set
- fix saving revision one vote reject
- show statistics on how many have revised a document
- fix possible xss attack in setup of 2-factor authentication
- better layout of page for setup of 2-factor authentication
--------------------------------------------------------------------------------
Changes in version 6.0.33
--------------------------------------------------------------------------------
@ -345,58 +321,6 @@
- add document list which can be exported as an archive
- search results can be exported
--------------------------------------------------------------------------------
Changes in version 5.1.43
--------------------------------------------------------------------------------
- add Slim middleware for Basic authentication (can be used by extensions)
- rest api endpoint 'statstotal' returns number of groups and categories
- add new command line program utils/console
- major code polishing
- add markdown editor editor.md
- less colorful extension manager
- check for missing changes in extension configuration
- use table for list of caches
- propper error msgs when saving extension configuration
- creating backup archives has been removed
- add javascript table sorter
- use table sorter on clear cache page and conversion services page
- droping an url in the drag&drop area will download the url
- add button to all password fields to make password visible
- fix formatting of date input fields
- do not remove custom attributes which were not set when editing attributes
--------------------------------------------------------------------------------
Changes in version 5.1.42
--------------------------------------------------------------------------------
- use proxy when getting latest version
- 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'
- require unrestricted access on document/folder for deletion by rest api
- use php-cache instead of native memcached
- various updates of documentation
--------------------------------------------------------------------------------
Changes in version 5.1.41
--------------------------------------------------------------------------------
- action when clicking on a thumbnail can be set (download or view online)
- major update of polish translation
- fix getting access rights in getMandatoryApprovers() and getMandatoryReviewers()
- better checking for attribute definition when building a search query
- fix list of related documents when hook documentListItem() is implemented
- move EditAttributes into controller and add various hooks (like EditDocument)
- move sending notification mail when attributes are changed into
Notification Service
- more documentation on configuring LDAP
- collect output controller/view hooks with '+' instead of array_merge()
- add hook 'searchExportOptions'
- show how many users have to review/approve a document and how many did
already (in menu task list and document list)
- break long original file names on viewDocument page
- fix potential XSS attack in many fields of settings
- allow to edit original filename, check filename for problematic chars
--------------------------------------------------------------------------------
Changes in version 5.1.40
--------------------------------------------------------------------------------

View File

@ -221,36 +221,6 @@ module.exports = function (grunt) {
],
dest: bootstrapDir + '/jquery-lazy',
flatten: true
},{
expand: true,
src: [
nodeDir + '/editor.md/editormd.min.js'
],
dest: bootstrapDir + '/editor.md',
flatten: true
},{
expand: true,
cwd: nodeDir + '/editor.md/',
src: [
'lib/*',
'languages/*',
'images/*',
'fonts/*',
'plugins/**',
'lib/codemirror/**',
'css/*'
],
dest: bootstrapDir + '/editor.md',
flatten: false
},{
expand: true,
cwd: nodeDir + '/tablesort/dist/',
src: [
'tablesort.min.js',
'sorts/**'
],
dest: bootstrapDir + '/tablesort',
flatten: false
},{
expand: true,
src: [

View File

@ -6,11 +6,7 @@ NODISTFILES=utils/importmail.php utils/seedddms-importmail utils/remote-email-up
PHPDOC=~/Downloads/phpDocumentor.phar
INSTALL_PATH=/home/www-data/seeddms-test
all: dist
olddist:
dist:
mkdir -p tmp/seeddms-$(VERSION)
cp -a $(SRC) tmp/seeddms-$(VERSION)
mkdir -p tmp/seeddms-$(VERSION)/views
@ -27,20 +23,8 @@ olddist:
(cd tmp; tar --exclude=.svn --exclude=.gitignore -czvf ../seeddms-$(VERSION).tar.gz seeddms-$(VERSION))
rm -rf tmp
dist:
php vendor/bin/phing -Dversion=$(VERSION) dist
quickstart:
php8.2 vendor/bin/phing -Dversion=$(VERSION) package
quickstart-dev:
php vendor/bin/phing -Dversion=$(VERSION) -Dmode=development package
install:
php vendor/bin/phing -Dversion=$(VERSION) -Dinstallpath=$(INSTALL_PATH) -Ddomain=dms.seeddms.org install
update:
php vendor/bin/phing -Dversion=$(VERSION) -Dinstallpath=$(INSTALL_PATH) -Ddomain=dms.seeddms.org update
php7.4 vendor/bin/phing -Dversion=$(VERSION) package
unittest:
vendor/bin/phing -Dversion=$(VERSION) phpunitfast
@ -111,4 +95,4 @@ PKGFILE=SeedDMS_Core/package.xml
changelog:
@sgrep 'stag("DATE") .. etag("DATE") or ((stag("RELEASE") .. etag("RELEASE")) in (stag("VERSION") .. etag("VERSION"))) or inner(stag("NOTES") __ etag("NOTES"))' ${PKGFILE} | sed -e 's#^ *<date>\([-0-9]*\)</date><release>\([0-9.preRC]*\)</release>#\n\n\2 (\1)\n---------------------#' | awk -F'\n' -vRS='' -vOFS='|' '{$$1=$$1}1' | sort -V -r | sed 's/$$/\n/' | tr '|' '\n'
.PHONY: doc webdav webapp repository changelog install
.PHONY: doc webdav webapp repository changelog

View File

@ -1,52 +0,0 @@
SeedDMS is a PHP based Document Management System. For more information
check the web site at https://www.seeddms.org
There are detailed installation instructions from a preconfigured distribution
at [doc/README.Install.md]
If you prefer to install from git, you will need to:
1. Create a directory, e.g. seeddms
`mkdir seeddms`
2. Change into that directory
`cd seeddms`
3. Clone the various SeedDMS repositories
```
git clone https://codeberg.org/SeedDMS/preview.git
git clone https://codeberg.org/SeedDMS/lucene.git
git clone https://codeberg.org/SeedDMS/ѕqlitefts.git
git clone https://codeberg.org/SeedDMS/http_webdav_server.git
```
4. For SeedDMS 5.1.x
```
git clone -b seeddms-5.1.x https://codeberg.org/SeedDMS/seeddms.git
git clone -b seeddms-5.1.x https://codeberg.org/SeedDMS/core.git
```
For SeedDMS 6.0.x
```
git clone -b seeddms-6.0.x https://codeberg.org/SeedDMS/seeddms.git
git clone -b seeddms-6.0.x https://codeberg.org/SeedDMS/core.git
```
5. Run composer
`composer update`
6. Create an installable distribution
`vendor/bin/phing -Dversion=$(php -r 'include "inc/inc.Version.php"; echo (new SeedDMS_Version())->version();') package`
or create an installable distribution with softlinks
`vendor/bin/phing -Dversion=$(php -r 'include "inc/inc.Version.php"; echo (new SeedDMS_Version())->version();') -Dmode=development package`
This archive does not contain any sources but only links to the previously
cloned repositories.
The archive created in step 6. can be installed like the official releases of
SeedDMS.

2
TODO
View File

@ -1,5 +1,3 @@
!!! This is hopelessly outdated !!!
This list is hopelessly outdated, but some of the issues are
still worth to be implemented!

372
build.xml
View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="seeddms" basedir="." default="main">
<property name="tmp" value="/tmp" />
<property name="tmp" value="/tmp" />
<property name="package" value="${phing.project.name}" override="true" />
<property name="seeddmsurl" value="http://localhost/seeddms51x" />
<property name="builddir" value="${tmp}/build/${phing.project.name}" override="true" />
@ -16,13 +16,9 @@
<propertyregex property="shortversion" subject="${version} kk" pattern="([56])\.([0-9]).*" replace="seeddms$1$2x" override="true"/>
<property name="majorversion" value="${version}" />
<propertyregex property="majorversion" subject="${version}" pattern="([56])\..*" replace="$1" override="true"/>
<property name="minorversion" value="${version}" />
<propertyregex property="minorversion" subject="${version}" pattern="[56]\.([0-9])\..*" replace="$1" override="true"/>
<property name="subminorversion" value="${version}" />
<propertyregex property="subminorversion" subject="${version}" pattern="[56]\.[0-9]\.(.*)" replace="$1" override="true"/>
<property name="composer_version" value="2.8.5" />
<property name="composer_extra_params" value="" />
<property name="composer_env" value="" />
<property name="composer_version" value="2.8.5" />
<property name="composer_extra_params" value="" />
<property name="composer_env" value="" />
<property name="mink_driver" value="chrome" />
<property name="snooze_multiplier" value="1" />
@ -39,43 +35,44 @@
<include name="webdav/**" />
<include name="install/**" />
<include name="restapi/**" />
<include name="www/index.php" />
<include name="pdfviewer/**" />
<include name="index.php" />
<include name="CHANGELOG" />
<include name="www/.htaccess" />
<include name=".htaccess" />
<include name="LICENSE" />
</fileset>
<target name="main">
<echo>Hello</echo>
</target>
<target name="main">
<echo>Hello</echo>
</target>
<!-- PHP CodeSniffer -->
<target name="phpcbf">
<exec executable="bash" line="${srcdir}/vendor/bin/phpcbf --standard=${srcdir}/phpcs.xml" escape="false" passthru="true" checkreturn="true" />
</target>
<target name="phpcs">
<exec executable="bash" line="${srcdir}/vendor/bin/phpcs --standard=${srcdir}/phpcs.xml --report=checkstyle &gt; ${builddir}/reports/checkstyle.xml" escape="false" />
</target>
<target name="phpcs-console">
<exec executable="bash" line="${srcdir}/vendor/bin/phpcs --standard=${srcdir}/phpcs.xml" escape="false" passthru="true" checkreturn="true" />
</target>
<!-- PHP CodeSniffer -->
<target name="phpcbf">
<exec command="${srcdir}/vendor/bin/phpcbf --standard=${srcdir}/phpcs.xml" escape="false" passthru="true" checkreturn="true" />
</target>
<target name="phpcs">
<exec command="${srcdir}/vendor/bin/phpcs --standard=${srcdir}/phpcs.xml --report=checkstyle &gt; ${builddir}/reports/checkstyle.xml" escape="false" />
</target>
<target name="phpcs-console">
<exec command="${srcdir}/vendor/bin/phpcs --standard=${srcdir}/phpcs.xml" escape="false" passthru="true" checkreturn="true" />
</target>
<target name="php-cs-fixer-dryrun">
<exec executable="bash" line="${srcdir}/vendor/bin/php-cs-fixer fix --dry-run -vvv --diff ${srcdir}/inc" passthru="true" escape="false" checkreturn="true" />
<target name="php-cs-fixer-dryrun">
<exec command="${srcdir}/vendor/bin/php-cs-fixer fix --dry-run -vvv --diff ${srcdir}/inc" passthru="true" escape="false" checkreturn="true" />
</target>
<!-- PHPUnit -->
<target name="phpunitfast" description="Run tests">
<exec dir="${srcdir}/SeedDMS_Core" executable="bash" line="XDEBUG_MODE=coverage SEEDDMS_CORE_SQL=../install/create_tables-sqlite3.sql ${srcdir}/vendor/bin/phpunit --bootstrap ${srcdir}/SeedDMS_Core/bootstrap-${majorversion}.php --coverage-html ${srcdir}/coverage/" passthru="true" checkreturn="true" />
<exec dir="${srcdir}/SeedDMS_Core" command="XDEBUG_MODE=coverage SEEDDMS_CORE_SQL=../install/create_tables-sqlite3.sql ${srcdir}/vendor/bin/phpunit --bootstrap ${srcdir}/SeedDMS_Core/bootstrap-${majorversion}.php --coverage-html ${srcdir}/coverage/" passthru="true" checkreturn="true" />
<!-- exec dir="${srcdir}/tests" command="SEEDDMS_URL=${seeddmsurl} SEEDDMS_MINK_DRIVER=${mink_driver} SEEDDMS_SNOOZE_MULTIPLIER=${snooze_multiplier} ${srcdir}/vendor/bin/phpunit" passthru="true" checkreturn="true" / -->
</target>
<target name="composer" description="Install dependencies with Composer">
<if>
<equals arg1="${composer_version}" arg2="latest-2.x" />
<then>
<httpget url="https://getcomposer.org/composer-2.phar" sslVerifyPeer="false" dir="${srcdir}" filename="composer.phar" />
</then>
<target name="composer" description="Install dependencies with Composer">
<if>
<equals arg1="${composer_version}" arg2="latest-2.x" />
<then>
<httpget url="https://getcomposer.org/composer-2.phar" sslVerifyPeer="false" dir="${srcdir}" filename="composer.phar" />
</then>
<else>
<if>
<not><available file="composer.phar" /></not>
@ -83,16 +80,10 @@
<httpget url="https://getcomposer.org/download/${composer_version}/composer.phar" sslVerifyPeer="false" dir="${srcdir}" />
</then>
</if>
</else>
</if>
<echo message="Installing dependencies..." />
<exec executable="php" passthru="false" dir="${builddir}/export/${shortversion}">
<arg line="${srcdir}/composer.phar install ${composer_extra_params}"/>
<!-- arg line="${composer_env} php ${srcdir}/composer.phar install ${composer_extra_params}"/ -->
</exec>
<exec executable="php" passthru="true" dir="${builddir}/export/${shortversion}">
<arg line="${srcdir}/composer.phar dump -o ${composer_extra_params}"/>
</exec>
</else>
</if>
<echo message="Installing dependencies..." />
<exec command="${composer_env} php ${srcdir}/composer.phar install ${composer_extra_params}" passthru="true" checkreturn="true" />
</target>
<target name="dist" description="build SeedDMS tar archive">
@ -101,29 +92,11 @@
<then><fail msg="Pass version as property 'version'" /></then>
</if>
<echo msg="This is ${version}" />
<echo msg="This is ${shortversion}" />
<delete file="./seeddms-${version}.tar.gz" failonerror="false" />
<tar destfile="./seeddms-${version}.tar.gz" prefix="seeddms-${version}" compression="gzip">
<!-- fileset refid="distfiles" / -->
<fileset dir=".">
<include name="languages/**" />
<include name="op/**" />
<include name="out/**" />
<include name="inc/**" />
<include name="controllers/**" />
<include name="styles/**" />
<include name="views/bootstrap*/**" />
<include name="utils/**" />
<include name="doc/**" />
<include name="webdav/**" />
<include name="install/**" />
<include name="restapi/**" />
<include name="www/index.php" />
<include name="CHANGELOG" />
<include name="www/.htaccess" />
<include name="LICENSE" />
</fileset>
<fileset refid="distfiles" />
</tar>
</target>
@ -134,9 +107,6 @@
</if>
<echo msg="This is ${shortversion}" />
<echo msg="Major version ${majorversion}" />
<echo msg="Minor version ${minorversion}" />
<echo msg="Subminor version ${subminorversion}" />
<if>
<matches string="${version}" pattern="^6\.0\..*" />
@ -144,231 +114,103 @@
<else><echo msg="This is version 5" /></else>
</if>
<!-- make sure the work area is empty, then rebuild it -->
<delete dir="${builddir}/packages" includeemptydirs="true" failonerror="false" />
<mkdir dir="${builddir}/packages" />
<delete dir="${builddir}/export" includeemptydirs="true" failonerror="false" />
<mkdir dir="${builddir}/export" />
<delete dir="${builddir}/packages" includeemptydirs="true" failonerror="false" />
<mkdir dir="${builddir}/packages" />
<delete dir="${builddir}/export" includeemptydirs="true" failonerror="false" />
<mkdir dir="${builddir}/export/${shortversion}" />
<mkdir dir="${builddir}/export/${shortversion}/conf" />
<mkdir dir="${builddir}/export/${shortversion}/data" />
<mkdir dir="${builddir}/export/${shortversion}/data/1048576" />
<mkdir dir="${builddir}/export/${shortversion}/data/log" />
<mkdir dir="${builddir}/export/${shortversion}/data/cache" />
<exec executable="echo" passthru="true" checkreturn="true">
<arg line="'Signature: 8a477f597d28d172789f06886806bc55' &gt; ${builddir}/export/${shortversion}/data/cache/CACHEDIR.TAG" />
</exec>
<exec executable="echo" passthru="true" checkreturn="true">
<arg line="'# This file is a cache directory tag created by seeddms.' &gt;&gt; ${builddir}/export/${shortversion}/data/cache/CACHEDIR.TAG" />
</exec>
<exec executable="echo" passthru="true" checkreturn="true">
<arg line="echo '# For information about cache directory tags, see: http://www.brynosaurus.com/cachedir/' &gt;&gt; ${builddir}/export/${shortversion}/data/cache/CACHEDIR.TAG" />
</exec>
<exec command="echo 'Signature: 8a477f597d28d172789f06886806bc55' &gt; ${builddir}/export/${shortversion}/data/cache/CACHEDIR.TAG" />
<exec command="echo '# This file is a cache directory tag created by seeddms.' &gt;&gt; ${builddir}/export/${shortversion}/data/cache/CACHEDIR.TAG" />
<exec command="echo '# For information about cache directory tags, see: http://www.brynosaurus.com/cachedir/' &gt;&gt; ${builddir}/export/${shortversion}/data/cache/CACHEDIR.TAG" />
<mkdir dir="${builddir}/export/${shortversion}/data/backup" />
<mkdir dir="${builddir}/export/${shortversion}/data/lucene" />
<mkdir dir="${builddir}/export/${shortversion}/data/staging" />
<mkdir dir="${builddir}/export/${shortversion}/pear" />
<mkdir dir="${builddir}/export/${shortversion}/www" />
<mkdir dir="${builddir}/export/${shortversion}/www/ext" />
<if>
<matches string="${mode}" pattern="^development" />
<then></then>
<else>
<mkdir dir="${builddir}/export/${shortversion}/seeddms-${version}" />
</else>
</if>
<mkdir dir="${builddir}/export/${shortversion}/seeddms-${version}" />
<copy file="${srcdir}/conf/settings.xml.template" tofile="${builddir}/export/${shortversion}/conf/settings.xml">
<filterchain>
<replaceregexp>
<replaceregexp>
<regexp pattern="_DBC_DBTYPE_" replace="${dbtype}"/>
<regexp pattern="_DBC_DBSERVER_" replace="${dbhost}"/>
<regexp pattern="_DBC_DBNAME_" replace="${dbname}"/>
<regexp pattern="_DBC_DBUSER_" replace="${dbuser}"/>
<regexp pattern="_DBC_DBPASS_" replace="${dbpass}"/>
<regexp pattern="_SHORT_VERSION_" replace="${shortversion}"/>
</replaceregexp>
</replaceregexp>
</filterchain>
</copy>
<copy file="${srcdir}/conf/.htaccess" tofile="${builddir}/export/${shortversion}/conf/.htaccess" />
<if>
<matches string="${mode}" pattern="^development" />
<then>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}">
<arg line="-s ${srcdir} seeddms" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/op" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/out" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/inc" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/controllers" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/languages" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/views" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/restapi" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/styles" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/install" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/webdav" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/www/index.php" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/www/.htaccess" />
</exec>
</then>
<else>
<copy todir="${builddir}/export/${shortversion}/seeddms-${version}">
<fileset refid="distfiles" />
</copy>
<copy todir="${builddir}/export/${shortversion}/www/ext/example">
<fileset dir="${srcdir}/www/ext/example" defaultexcludes="false" />
</copy>
<if>
<available file="${srcdir}/www/ext/pdfviewer/conf.php"/>
<then>
<copy todir="${builddir}/export/${shortversion}/www/ext/pdfviewer">
<fileset dir="${srcdir}/www/ext/pdfviewer/" expandsymboliclinks="true" defaultexcludes="false">
<include name="**/*" />
</fileset>
</copy>
</then>
<else>
<echo level="warning" message="I didn't find the extension 'pdfviewer'. You need to install it manually." />
</else>
</if>
<copy tofile="${builddir}/export/${shortversion}/composer.json" file="composer-dist.json">
<filterchain>
<replaceregexp>
<regexp pattern="/home/cvs/seeddms-ext/" replace="${srcdir}/../"/>
<regexp pattern="__CORE_BRANCH__" replace="seeddms-${majorversion}.${minorversion}.x"/>
</replaceregexp>
</filterchain>
</copy>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}">
<arg line="-s seeddms-${version} seeddms" />
</exec>
<phingcall target="composer">
<property name="composer_extra_params" value="--working-dir=${builddir}/export/${shortversion}/" />
<property name="composer_envv" value="COMPOSER=${srcdir}/composer-dist.json" />
</phingcall>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ../seeddms/op" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ../seeddms/out" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ../seeddms/inc" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ../seeddms/controllers" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ../seeddms/languages" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ../seeddms/views" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ../seeddms/restapi" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ../seeddms/styles" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ../seeddms/install" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ../seeddms/webdav" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ../seeddms/www/index.php" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ../seeddms/www/.htaccess" />
</exec>
</else>
</if>
<copy todir="${builddir}/export/${shortversion}/seeddms-${version}">
<fileset refid="distfiles" />
</copy>
<copy todir="${builddir}/export/${shortversion}/pear/vendor">
<fileset dir="${srcdir}/vendor" defaultexcludes="false" />
</copy>
<copy todir="${builddir}/export/${shortversion}/www/ext/example">
<fileset dir="${srcdir}/ext/example" defaultexcludes="false" />
</copy>
<!-- copy todir="${builddir}/export/${shortversion}/pear/SeedDMS">
<fileset dir="SeedDMS_Core">
<include name="Core/**" />
<include name="Core.php" />
</fileset>
<fileset dir="SeedDMS_Preview">
<include name="Preview/**" />
<include name="Preview.php" />
</fileset>
<fileset dir="SeedDMS_Lucene">
<include name="Lucene/**" />
<include name="Lucene.php" />
</fileset -->
<!-- fileset dir="SeedDMS_SQLiteFTS">
<include name="SQLiteFTS/**" />
<include name="SQLiteFTS.php" />
</fileset>
</copy -->
<!-- copy todir="${builddir}/export/${shortversion}/pear">
<fileset dir="../seeddms-ext/http_webdav_server">
<include name="HTTP/WebDAV/Server/**" />
<include name="HTTP/WebDAV/Server.php" />
</fileset>
</copy>
<copy todir="${builddir}/export/${shortversion}/pear/HTTP/WebDAV">
<fileset dir="../seeddms-ext/http_webdav_server">
<include name="Tools/**" />
</fileset>
</copy -->
<copy tofile="${builddir}/export/${shortversion}/pear/composer.json" file="composer-dist.json">
</copy>
<phingcall target="composer">
<property name="composer_extra_params" value="--working-dir=${builddir}/export/${shortversion}/pear/" />
<property name="composer_envv" value="COMPOSER=${srcdir}/composer-dist.json" />
</phingcall>
<exec command="cd ${builddir}/export/${shortversion} &amp;&amp; ln -s seeddms-${version} seeddms" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/op" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/out" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/inc" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/controllers" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/languages" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/views" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/restapi" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/styles" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/pdfviewer" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/install" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/webdav" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/index.php" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/.htaccess" />
<!-- create initial empty database -->
<echo message="Creating sqlite3 database ..." />
<exec executable="bash" passthru="true">
<arg value="-c"/>
<arg line='"cat ${srcdir}/install/create_tables-sqlite3.sql | sqlite3 ${builddir}/export/${shortversion}/data/content.db"' />
</exec>
<exec command="cat ${srcdir}/install/create_tables-sqlite3.sql | sqlite3 ${builddir}/export/${shortversion}/data/content.db" />
<!-- build the standard tar.gz archive -->
<echo message="Building .tar.gz ..." />
<exec executable="tar" passthru="true" checkreturn="true" dir="${builddir}/export">
<arg line="czf ../packages/seeddms-quickstart-${version}.tar.gz ${shortversion}" />
</exec>
<!-- build the standard tar.gz archive -->
<echo message="Building .tar.gz...." />
<exec command="cd ${builddir}/export ; tar czf ${builddir}/packages/seeddms-quickstart-${version}.tar.gz ${shortversion}" checkreturn="true" />
<echo message="Built in ${builddir}/packages/seeddms-quickstart-${version}.tar.gz" />
</target>
<target name="install" description="Install SeedDMS">
<if>
<equals arg1="" arg2="${installpath}" />
<then><fail msg="Pass install path as property 'installpath'. Ensure this directory exists and is writeable by the user running this build script." /></then>
</if>
<if>
<not><available file="${installpath}"/></not>
<then><fail msg="Install path '${installpath}' does not exist." /></then>
</if>
<phingcall target="package"></phingcall>
<exec executable="tar" passthru="false" checkreturn="true" dir="${installpath}">
<arg line="-xzvf ${builddir}/packages/seeddms-quickstart-${version}.tar.gz --strip-components=1" />
</exec>
<copy file="${srcdir}/conf/apache.virtualhost.template" tofile="${installpath}/conf/apache.virtualhost.conf">
<filterchain>
<replaceregexp>
<regexp pattern="_INSTALL_PATH_" replace="${installpath}"/>
<regexp pattern="_DOMAIN_" replace="${domain}"/>
</replaceregexp>
</filterchain>
</copy>
<exec executable="bash" passthru="true" dir="${installpath}">
<arg value="-c"/>
<arg line="'sudo chown www-data:www-data ${installpath}'" />
</exec>
<exec executable="bash" passthru="true" dir="${installpath}">
<arg value="-c"/>
<arg line="'sudo chown -R www-data:www-data ${installpath}/data ${installpath}/conf'" />
</exec>
<echo message="Create a link in /etc/apache2/sites-enabled/" />
<echo message="sudo ln -s ${installpath}/conf/apache.virtualhost.conf /etc/apache2/sites-enabled/001-seeddms.conf" />
</target>
<target name="update" description="Update SeedDMS Installation">
<if>
<equals arg1="" arg2="${installpath}" />
<then><fail msg="Pass install path as property 'installpath'. Ensure this directory exists and is writeable by the user running this build script." /></then>
</if>
<if>
<not><available file="${installpath}"/></not>
<then><fail msg="Install path '${installpath}' does not exist." /></then>
</if>
<phingcall target="package"></phingcall>
<exec executable="tar" passthru="false" checkreturn="true" dir="${installpath}">
<arg line="-xzvf ${builddir}/packages/seeddms-quickstart-${version}.tar.gz --strip-components=1 ${shortversion}/vendor ${shortversion}/seeddms-${version}" />
</exec>
<!-- delete file="${installpath}/seeddms" / -->
<!-- symlink target="${installpath}/${shortversion}" link="${installpath}/seeddms" relative="true"/ -->
<echo message="If you have updated to a newer version of SeedDMS, you will have to adjust the link 'seeddms' pointing to 'seeddms-${version}' in '${installpath}'." />
</target>
</project>

View File

@ -1,44 +1,11 @@
{
"name": "seeddms/dms",
"description": "Open Source Document Management System",
"type": "project",
"license": "GPL 2",
"authors": [
{
"name": "Uwe Steinmann",
"email": "steinm@debian.org"
}
],
"minimum-stability": "stable",
"config": {
"platform": {
"php": "8.2"
},
"allow-plugins": {
"wikimedia/composer-merge-plugin": true
}
},
"autoload": {
"psr-4": {
"SeedDMS\\Console\\": "seeddms/utils"
},
"classmap": [
"seeddms/inc/inc.ClassTranslator.php",
"seeddms/inc/inc.ClassSettings.php",
"seeddms/inc/inc.Version.php",
"seeddms/inc/inc.ClassViewCommon.php",
"seeddms/inc/inc.ClassControllerCommon.php",
"seeddms/inc/inc.ClassController.php",
"seeddms/inc/inc.ClassSession.php",
"seeddms/inc/inc.ClassUtilities.php",
"seeddms/inc/inc.ClassExtensionMgr.php",
"seeddms/inc/inc.ClassExtBase.php"
]
},
"require": {
"pear/http_request2": "^2",
"robthree/twofactorauth": "^3.0",
"php-mime-mail-parser/php-mime-mail-parser": "*",
"robthree/twofactorauth": "^1.5",
"slim/slim": "^4.0",
"guzzlehttp/psr7": "*",
"erusev/parsedown": "*",
@ -55,25 +22,16 @@
"pear/db": "*",
"dragonmantank/cron-expression": "^3.1",
"alecrabbit/php-console-colour": "*",
"dragonmantank/cron-expression": "^3",
"zf1/zend-search-lucene": "*",
"symfony/http-foundation": "^7",
"php-di/php-di": "^7",
"hfig/mapi": "*",
"symfony/http-foundation": "^5.4",
"php-di/php-di": "^6.4",
"slim/psr7": "^1.7",
"chillerlan/php-qrcode": "^5.0",
"bacon/bacon-qr-code": "^3.0",
"seeddms/core": "dev-__CORE_BRANCH__",
"seeddms/core": "dev-master",
"seeddms/lucene": "dev-master",
"seeddms/preview": "dev-master",
"seeddms/sqlitefts": "dev-master",
"seeddms/http_webdav_server": "dev-master",
"wikimedia/composer-merge-plugin": "dev-master",
"cache/memcached-adapter": "^1.2",
"symfony/console": "^7.2",
"twig/twig": "^3.0",
"league/commonmark": "^2.7",
"symfony/process": "^7.3",
"symfony/http-client": "^7.4"
"seeddms/http_webdav_server": "dev-master"
},
"require-dev": {
"composer/composer": "dev-main"
@ -114,19 +72,5 @@
"symlink": false
}
}
],
"extra": {
"merge-plugin": {
"include": [
"composer.local.json"
],
"recurse": false,
"replace": true,
"ignore-duplicates": true,
"merge-dev": true,
"merge-extra": false,
"merge-extra-deep": false,
"merge-scripts": true
}
}
]
}

View File

@ -1,146 +0,0 @@
{
"name": "seeddms/dms",
"description": "Open Source Document Management System",
"type": "project",
"license": "GPL 2",
"authors": [
{
"name": "Uwe Steinmann",
"email": "steinm@debian.org"
}
],
"minimum-stability": "stable",
"config": {
"platform": {
"php": "8.2"
},
"allow-plugins": {
"composer/package-versions-deprecated": true,
"wikimedia/composer-merge-plugin": true
}
},
"autoload": {
"psr-4": {
"Seeddms\\Console\\": "utils"
},
"classmap": [
"inc/inc.ClassTranslator.php",
"inc/inc.ClassSettings.php",
"inc/inc.Version.php",
"inc/inc.ClassViewCommon.php",
"inc/inc.ClassControllerCommon.php",
"inc/inc.ClassController.php",
"inc/inc.ClassSession.php",
"inc/inc.ClassUtilities.php",
"inc/inc.ClassExtensionMgr.php",
"inc/inc.ClassExtBase.php"
]
},
"require": {
"php": ">=8.2.0",
"phing/phing": "3.*",
"pear/http_request2": "^2",
"robthree/twofactorauth": "^3.0",
"php-mime-mail-parser/php-mime-mail-parser": "*",
"slim/slim": "^4.0",
"guzzlehttp/psr7": "*",
"erusev/parsedown": "*",
"erusev/parsedown-extra": "*",
"mibe/feedwriter": "^1.1",
"phpoffice/phpspreadsheet": "*",
"sabre/xml": "*",
"sabre/dav": "^4.",
"pear/log": "*",
"pear/mail": "*",
"pear/mail_mime": "*",
"pear/net_smtp": "*",
"pear/auth_sasl": "*",
"pear/db": "*",
"dragonmantank/cron-expression": "^3.1",
"alecrabbit/php-console-colour": "*",
"zf1/zend-search-lucene": "*",
"symfony/http-foundation": "^7",
"php-di/php-di": "^7",
"hfig/mapi": "*",
"slim/psr7": "^1.7",
"chillerlan/php-qrcode": "^5.0",
"bacon/bacon-qr-code": "^3.0",
"seeddms/core": "dev-seeddms-6.0.x",
"seeddms/lucene": "dev-master",
"seeddms/preview": "dev-master",
"seeddms/sqlitefts": "dev-master",
"seeddms/http_webdav_server": "dev-master",
"wikimedia/composer-merge-plugin": "dev-master",
"cache/memcached-adapter": "^1.2",
"symfony/console": "^7.2",
"twig/twig": "^3.0",
"league/commonmark": "^2.7",
"symfony/process": "^7.3",
"symfony/http-client": "^7.4"
},
"require-dev": {
"composer/composer": "dev-main",
"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": "^4",
"phpstan/phpstan": "^2.1",
"pear/archive_tar": "*"
},
"repositories": [
{
"type": "path",
"url": "../core",
"options": {
"symlink": true
}
},
{
"type": "path",
"url": "../lucene",
"options": {
"symlink": true
}
},
{
"type": "path",
"url": "../preview",
"options": {
"symlink": true
}
},
{
"type": "path",
"url": "../sqlitefts",
"options": {
"symlink": true
}
},
{
"type": "path",
"url": "../http_webdav_server",
"options": {
"symlink": true
}
}
],
"scripts": {
"phpcs": "phpcs -s"
},
"extra": {
"merge-plugin": {
"include": [
"composer.local.json"
],
"recurse": false,
"replace": true,
"ignore-duplicates": true,
"merge-dev": true,
"merge-extra": false,
"merge-extra-deep": false,
"merge-scripts": true
}
}
}

View File

@ -1,27 +0,0 @@
<VirtualHost _default_:443>
ServerName _DOMAIN_
ErrorLog /var/log/apache2/seeddms-error.log
CustomLog /var/log/apache2/seeddms-access.log combined
DocumentRoot _INSTALL_PATH_/www
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
# SSLCertificateChainFile /just/if/needed/fullchain.cer
<Directory _INSTALL_PATH_>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
<FilesMatch \.php$>
# Apache 2.4.10+ can proxy to unix socket
SetHandler "proxy:unix:/var/run/php/php8.2-fpm.sock|fcgi://localhost"
</FilesMatch>
# Consider to install the webdav_checkout extension
Alias /checkout _INSTALL_PATH_/www/ext/webdav_checkout/op/remote.php
</VirtualHost>

View File

@ -23,6 +23,8 @@
class SeedDMS_Controller_ClearCache extends SeedDMS_Controller_Common {
public function run() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$settings = $this->params['settings'];
$post = $this->params['post'];

View File

@ -1,123 +0,0 @@
<?php
/**
* Implementation of EditAttributes controller
*
* @category DMS
* @package SeedDMS
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2010-2013 Uwe Steinmann
* @version Release: @package_version@
*/
/**
* Class which does the busines logic for editing the version attributes
*
* @category DMS
* @package SeedDMS
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2010-2025 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_Controller_EditAttributes extends SeedDMS_Controller_Common {
public function run() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$settings = $this->params['settings'];
$document = $this->params['document'];
$version = $this->params['version'];
if(false === $this->callHook('preEditAttributes')) {
if(empty($this->errormsg))
$this->errormsg = 'hook_preEditAttributes_failed';
return null;
}
$result = $this->callHook('editAttributes', $version);
if($result === null) {
$attributes = $this->params['attributes'];
$oldattributes = $version->getAttributes();
if($attributes) {
foreach($attributes as $attrdefid=>$attribute) {
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
if(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
if($attribute) {
switch($attrdef->getType()) {
case SeedDMS_Core_AttributeDefinition::type_date:
if(is_array($attribute))
$attribute = array_map(fn($value): string => date('Y-m-d', makeTsFromDate($value)), $attribute);
else
$attribute = date('Y-m-d', makeTsFromDate($attribute));
break;
case SeedDMS_Core_AttributeDefinition::type_folder:
if(is_array($attribute))
$attribute = array_map(fn($value): object => $dms->getFolder((int) $value), $attribute);
else
$attribute = $dms->getFolder((int) $attribute);
break;
case SeedDMS_Core_AttributeDefinition::type_document:
if(is_array($attribute))
$attribute = array_map(fn($value): object => $dms->getDocument((int) $value), $attribute);
else
$attribute = $dms->getDocument((int) $attribute);
break;
case SeedDMS_Core_AttributeDefinition::type_user:
if(is_array($attribute))
$attribute = array_map(fn($value): object => $dms->getUser((int) $value), $attribute);
else
$attribute = $dms->getUser((int) $attribute);
break;
case SeedDMS_Core_AttributeDefinition::type_group:
if(is_array($attribute))
$attribute = array_map(fn($value): object => $dms->getGroup((int) $value), $attribute);
else
$attribute = $dms->getGroup((int) $attribute);
break;
}
if(!$attrdef->validate($attribute, $version, false)) {
$this->errormsg = getAttributeValidationText($attrdef->getValidationError(), $attrdef->getName(), $attribute);
return false;
}
if(!isset($oldattributes[$attrdefid]) || $attribute != $oldattributes[$attrdefid]->getValue()) {
if(!$version->setAttributeValue($dms->getAttributeDefinition($attrdefid), $attribute)) {
return false;
}
}
} elseif($attrdef->getMinValues() > 0) {
$this->errormsg = array("attr_min_values", array("attrname"=>$attrdef->getName()));
return false;
} elseif(isset($oldattributes[$attrdefid])) {
if(!$version->removeAttribute($dms->getAttributeDefinition($attrdefid)))
return false;
}
} else {
if($ret === false)
return false;
}
}
}
}
/* Do not remove any old attributes if they have not be set by the form
foreach($oldattributes as $attrdefid=>$oldattribute) {
if(!isset($attributes[$attrdefid])) {
if(!$version->removeAttribute($dms->getAttributeDefinition($attrdefid)))
return false;
}
}
*/
} elseif($result === false) {
if(empty($this->errormsg))
$this->errormsg = 'hook_editAttributes_failed';
return false;
}
if(false === $this->callHook('postEditAttributes')) {
}
return true;
}
}

View File

@ -174,14 +174,12 @@ class SeedDMS_Controller_EditDocument extends SeedDMS_Controller_Common {
}
}
}
/* Do not remove any old attributes if they have not be set by the form
foreach($oldattributes as $attrdefid=>$oldattribute) {
if(!isset($attributes[$attrdefid])) {
if(!$document->removeAttribute($dms->getAttributeDefinition($attrdefid)))
return false;
}
}
*/
$sequence = $this->params['sequence'];
if(strcasecmp($sequence, "keep")) {

View File

@ -66,7 +66,7 @@ class SeedDMS_Controller_Login extends SeedDMS_Controller_Common {
if($settings->_enable2FactorAuthentication) {
if($user->getSecret()) {
$tfa = new \RobThree\Auth\TwoFactorAuth(new \RobThree\Auth\Providers\Qr\BaconQrCodeProvider());
$tfa = new \RobThree\Auth\TwoFactorAuth('SeedDMS');
if($tfa->verifyCode($user->getSecret(), $_POST['twofactauth']) !== true) {
$this->setErrorMsg("login_error_text");
return false;
@ -135,7 +135,7 @@ class SeedDMS_Controller_Login extends SeedDMS_Controller_Common {
$dms_session = $_COOKIE["mydms_session"];
if(!$resArr = $session->load($dms_session)) {
/* Turn off http only cookies if jumploader is enabled */
setcookie("mydms_session", $dms_session, time()-3600, $settings->_httpRoot, '', false, true); //delete cookie
setcookie("mydms_session", $dms_session, time()-3600, $settings->_httpRoot, null, false, true); //delete cookie
header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$referuri);
exit;
} else {
@ -154,7 +154,7 @@ class SeedDMS_Controller_Login extends SeedDMS_Controller_Common {
$lifetime = time() + intval($settings->_cookieLifetime);
else
$lifetime = 0;
setcookie("mydms_session", $id, $lifetime, $settings->_httpRoot, '', false, true);
setcookie("mydms_session", $id, $lifetime, $settings->_httpRoot, null, false, true);
}
}

206
doc/README.Converters Normal file
View File

@ -0,0 +1,206 @@
Commands for converting documents
----------------------------------
This file contains commands for converting different document types
into
* text (for fulltext search)
* png (for preview images)
* pdf (for pdf documents)
Such conversions may not necessarily output an excact equivalent of
the input file, but outputs a suitable representation, e.g.
converting an mp3 file into text may output the metadata or even the
lyrics of the song. Converting it into a preview image may result
in a picture of the album cover.
Please note, that when ever a command outputs anything to stderr,
this will considered as a failure of the command. Most command line
programs have a parameter (.e.g. `-q`) to suppress such an output.
If you run php-fpm you may encounter problems with charsets based on
UTF-8. Programms like `catdoc` read LANG from the environment to
set the correct encoding of the output. php-fpm often clears the
environment and programms like `catdoc` will not longer output any
UTF-8 chars. In such a case you may want to set `clear_env=no` in
php-fpm's configuration. On Debian this is done in the file
`/etc/php/<php version>/fpm/pool.d/www.conf`. Search for `clear_env`.
Conversion to text for fulltext search
=======================================
text/plain
text/csv
application/csv
cat '%s'
application/pdf
pdftotext -q -nopgbrk %s - | sed -e 's/ [a-zA-Z0-9.]\{1\} / /g' -e 's/[0-9.]//g'
If pdftotext takes too long on large document you may want to pass parameter
-l to specify the last page to be converted. -q is for suppressing error/warnings
send to stderr
mutool draw -F txt -q -N -o - %s
application/vnd.openxmlformats-officedocument.wordprocessingml.document
docx2txt '%s' -
application/msword
catdoc %s
application/vnd.oasis.opendocument.text
odt2txt %s
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
xlsx2csv -d tab %s
application/vnd.ms-excel
xls2csv -d tab %s
text/html
html2text %s
Many office formats
unoconv -d document -f txt --stdout '%s'
Apache Tika is another option for creating plain text from various document
types. Just use curl to send the document to your tika server and get the
plain text in return.
curl -s -T '%s' http://localhost:9998/tika --header 'Accept: text/plain'
Conversion to pdf for pdf preview
==================================
text/plain
text/csv
application/csv
application/vnd.oasis.opendocument.text
application/msword
application/vnd.wordperfect
text/rtf
unoconv -d document -f pdf --stdout -v '%f' > '%o'
image/png
image/jpg
image/jpeg
convert -density 300 '%f' 'pdf:%o'
image/svg+xml
cairosvg -f pdf -o '%o' '%f'
application/vnd.ms-powerpoint
application/vnd.openxmlformats-officedocument.presentationml.presentation
application/vnd.oasis.opendocument.presentation
unoconv -d presentation -f pdf --stdout -v '%f' > '%o'
application/vnd.ms-excel
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
application/vnd.oasis.opendocument.spreadsheet
unoconv -d spreadsheet -f pdf --stdout -v '%f' > '%o'
message/rfc822
java -jar emailconverter-2.5.3-all.jar '%f' -o '%o'
The emailconverter can be obtained from https://github.com/nickrussler/email-to-pdf-converter
It requires wkhtmltopdf which is part of debian.
text/plain
iconv -c -f utf-8 -t latin1 '%f' | a2ps -1 -q -a1 -R -B -o - - | ps2pdf - -
The parameter `-q` is important because a2ps sends some statistical
data to stderr, which makes SeedDMS believe the command has failed.
application/x-xopp
xournalpp -p "%o" "%f"
Converting from application/x-xopp to pdf only works if the xopp file
does not use a pdf document as a background, because this pdf is not
stored in the xopp fіle.
Conversion to png for preview images
=====================================
If you have problems running convert on PDF documents then read this page
https://askubuntu.com/questions/1081895/trouble-with-batch-conversion-of-png-to-pdf-using-convert
It basically instructs you to comment out the line
<policy domain="coder" rights="none" pattern="PDF" />
in /etc/ImageMagick-6/policy.xml
convert determines the format of the converted image from the extension of
the output filename. SeedDMS usually sets a propper extension when running
the command, but nevertheless it is good practice to explicitly set the output
format by prefixing the output filename with 'png:'. This is of course always
needed if the output goes to stdout.
image/jpg
image/jpeg
image/png
convert -resize %wx '%f' 'png:%o'
image/svg+xml
cairosvg -f png --output-width %w -o '%o' '%f'
text/plain
convert -density 100 -resize %wx 'text:%f[0]' 'png:%o'
application/pdf
gs -dBATCH -dNOPAUSE -sDEVICE=png16m -dPDFFitPage -r72x72 -sOutputFile=- -dFirstPage=1 -dLastPage=1 -q '%f' | convert -resize %wx png:- '%o'
convert -density 100 -resize %wx '%f[0]' 'png:%o'
mutool draw -F png -w %w -q -N -o '%o' '%f' 1
pdftocairo '%f' -png -singlefile -scale-to-x %w -scale-to-y -1 - > '%o'
pdftocairo needs to output to stdout because the output file name passed
to pdftocairo will be suffixed with png
application/postscript
convert -density 100 -resize %wx '%f[0]' 'png:%o'
text/plain
iconv -c -f utf-8 -t latin1 '%f' | a2ps -1 -q -a1 -R -B -o - - | gs -dBATCH -dNOPAUSE -sDEVICE=png16m -dFirstPage=1 -dLastPage=1 -dPDFFitPage -r72x72 -sOutputFile=- -q - | convert -resize %wx png:- 'png:%o'
On Linux systems you will have to set the desired value in /etc/papersize for a2ps
e.g. a4, or letter. Unfortunately, a2ps cannot process utf-8 encoded files. That's
why the input needs to be recoded with iconv or recode.
application/msword
application/vnd.oasis.opendocument.spreadsheet
application/vnd.oasis.opendocument.text
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
application/vnd.ms-excel
application/vnd.openxmlformats-officedocument.wordprocessingml.document
text/rtf
application/vnd.ms-powerpoint
text/csv
application/csv
application/vnd.wordperfect
unoconv -d document -e PageRange=1 -f pdf --stdout -v '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72x72 -sOutputFile=- -dFirstPage=1 -dLastPage=1 -q - | convert -resize %wx png:- 'png:%o'
video/webm
video/mp4
This will take 12th frame of a video and converts into a png. It requires
ffmpeg to be installed.
convert -resize %wx "%f[12]" "png:%o"
You may as well use ffmpeg right away
ffmpeg -i "%f" -ss 00:00:02 -frames:v 1 -loglevel quiet -vf scale=%w:-1 -f apng "%o"
audio/mpeg
sox "%f" -n spectrogram -x 600 -Y 550 -r -l -o - | convert -resize %wx png:- "png:%o"
application/x-xopp
xournalpp -i "%o" --export-png-width=%w "%f"
Converting from application/x-xopp to png only works if the xopp file
does not use a pdf document as a background, because this pdf is not
stored in the xopp fіle.

View File

@ -1,254 +0,0 @@
# Commands for converting documents
SeedDMS has a very sophisticated file conversion process which could
be used to convert any format into any other format, if there is either
a command (on the command line) or a SeedDMS extension with php code
doing the conversion. This could of course use an external service
(e.g. Tika) for doing the conversion. There are already several
extensions for this purpose and SeedDMS provides some buildin
conversions as well. Traditionally, conversion was just used
internally by SeedDMS (and this is still the main purpose), but
this may not be the only use case.
This file only contains commands for converting different document
types into
* text (for fulltext search)
* png (for preview images)
* pdf (for pdf documents)
Most of the required commands can easily be installed on a Linux
server, which is the preferred plattform anyway. Other operating
systems may work as well, but your milage may vary.
The conversion commands can be configured in the settings of SeedDMS.
A conversion may not necessarily output an excact equivalent of
the input file, but outputs a suitable representation, e.g.
converting an mp3 file into text may output the metadata or even the
lyrics of the song. Converting it into a preview image may result
in a picture of the album cover, or a graphical representation
of the spectrum.
Please note, that whenever a command outputs anything to stderr,
this will be considered as a failure of the command. Most command line
programs have a parameter (.e.g. `-q`) to suppress such an output.
If you run php-fpm you may encounter problems with charsets based on
UTF-8. Programms like `catdoc` read LANG from the environment to
set the correct encoding of the output. php-fpm often clears the
environment and programms like `catdoc` will not longer output any
UTF-8 chars. In such a case you may want to set `clear_env=no` in
php-fpm's configuration. On Debian this is done in the file
`/etc/php/<php version>/fpm/pool.d/www.conf`. Search for `clear_env`.
The following sections will list possible conversion commands for
extracting text, creating an image, and converting to pdf.
## Conversion to text for fulltext search
### text/plain, text/csv, application/csv
`cat '%s'`
Unless you run a very old version of SeedDMS, you will never need
this command for converting text files. SeedDMS has this trivial
converter build in.
### application/pdf
`pdftotext -q -nopgbrk %s - | sed -e 's/ [a-zA-Z0-9.]\{1\} / /g' -e 's/[0-9.]//g'`
If pdftotext takes too long on large document, then you may want to
pass parameter `-l` to specify the last page to be converted. `-q` is
for suppressing error/warnings send to stderr
`mutool draw -F txt -q -N -o - %s`
### application/vnd.openxmlformats-officedocument.wordprocessingml.document
`docx2txt '%s' -`
### application/msword
`catdoc %s`
### application/vnd.oasis.opendocument.text
`odt2txt %s`
### application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
`xlsx2csv -d tab %s`
### application/vnd.ms-excel
`xls2csv -d tab %s`
### text/html
`html2text %s`
### Many office formats
Many office formats can be converted with `unoconv`, though this turned
out in the past to sometimes crash or taking a long time.
`unoconv -d document -f txt --stdout '%s'`
Apache Tika is another option for creating plain text from various document
types. Just use `curl` to send the document to your tika server and get the
plain text in return.
`curl -s -T '%s' http://localhost:9998/tika --header 'Accept: text/plain'`
Of course this requires to first install Apache Tika when using the docker
image.
Finally, there is a SeedDMS extension
[unoserver](https://codeberg.org/SeedDMS/unoserver) which is based
on a project also called
[unoserver](https://github.com/unoconv/unoserver) and which is
available as docker image, making it quite easy to setup. Read the
documentation of the extension for more information.
## Conversion to pdf for pdf preview
### text/plain, text/csv, application/csv, application/vnd.oasis.opendocument.text application/msword, application/vnd.wordperfect, text/rtf
`unoconv -d document -f pdf --stdout -v '%f' > '%o'`
### image/png, image/jpg, image/jpeg
`convert -density 300 '%f' 'pdf:%o'`
Actually `convert` can be used for many other image formats. There is
also a SeedDMS extension called
[convert_image](https://codeberg.org/SeedDMS/convert_image) which
embedds the image into a pdf file.
### image/svg+xml
`cairosvg -f pdf -o '%o' '%f'`
### application/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.presentationml.presentation, application/vnd.oasis.opendocument.presentation
`unoconv -d presentation -f pdf --stdout -v '%f' > '%o'`
### application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.oasis.opendocument.spreadsheet
`unoconv -d spreadsheet -f pdf --stdout -v '%f' > '%o'`
### message/rfc822
`java -jar emailconverter-2.5.3-all.jar '%f' -o '%o'`
The emailconverter can be obtained from https://github.com/nickrussler/email-to-pdf-converter
It requires `wkhtmltopdf` which is part of debian.
### text/plain
`iconv -c -f utf-8 -t latin1 '%f' | a2ps -1 -q -a1 -R -B -o - - | ps2pdf - -`
The parameter `-q` is important because a2ps sends some statistical
data to stderr, which makes SeedDMS believe the command has failed.
### application/x-xopp
`xournalpp -p "%o" "%f"`
Converting from application/x-xopp to pdf only works if the xopp file
does not use a pdf document as a background, because this pdf is not
stored in the xopp fіle.
### Many office formats
As already mentioned above, `unoconv` has some disadvantages. It is
recommended to the `unoserver` SeedDMS extension already described
above.
## Conversion to png for preview images
If you have problems running convert on PDF documents then read the page
https://askubuntu.com/questions/1081895/trouble-with-batch-conversion-of-png-to-pdf-using-convert
It basically instructs you to comment out the line
```
<policy domain="coder" rights="none" pattern="PDF" />
```
in `/etc/ImageMagick-6/policy.xml`
`convert` determines the format of the converted image from the extension of
the output filename. SeedDMS usually sets a propper extension when running
the command, but nevertheless it is good practice to explicitly set the output
format by prefixing the output filename with 'png:'. This is of course always
needed if the output goes to stdout.
### image/jpg, image/jpeg, image/png
`convert -resize %wx '%f' 'png:%o'`
### image/svg+xml
`cairosvg -f png --output-width %w -o '%o' '%f'`
### text/plain
`convert -density 100 -resize %wx 'text:%f[0]' 'png:%o'`
### application/pdf
`gs -dBATCH -dNOPAUSE -sDEVICE=png16m -dPDFFitPage -r72x72 -sOutputFile=- -dFirstPage=1 -dLastPage=1 -q '%f' | convert -resize %wx png:- '%o'`
`convert -density 100 -resize %wx '%f[0]' 'png:%o'`
`mutool draw -F png -w %w -q -N -o '%o' '%f' 1`
`pdftocairo '%f' -png -singlefile -scale-to-x %w -scale-to-y -1 - > '%o'`
`pdftocairo` needs to output to stdout because the output file name passed
to pdftocairo will be suffixed with `.png`
### application/postscript
`convert -density 100 -resize %wx '%f[0]' 'png:%o'`
### text/plain
`iconv -c -f utf-8 -t latin1 '%f' | a2ps -1 -q -a1 -R -B -o - - | gs -dBATCH -dNOPAUSE -sDEVICE=png16m -dFirstPage=1 -dLastPage=1 -dPDFFitPage -r72x72 -sOutputFile=- -q - | convert -resize %wx png:- 'png:%o'`
On Linux systems you will have to set the desired value in /etc/papersize for a2ps
e.g. a4, or letter. Unfortunately, a2ps cannot process utf-8 encoded files. That's
why the input needs to be recoded with iconv or recode.
### application/msword, application/vnd.oasis.opendocument.spreadsheet, application/vnd.oasis.opendocument.text, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.wordprocessingml.document, text/rtf, application/vnd.ms-powerpoint, text/csv, application/csv, application/vnd.wordperfect,
`unoconv -d document -e PageRange=1 -f pdf --stdout -v '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72x72 -sOutputFile=- -dFirstPage=1 -dLastPage=1 -q - | convert -resize %wx png:- 'png:%o'`
If you are looking for an easier solution, you should consider to
install the `unoserver` SeedDMS extension which was already described
above.
### video/webm, video/mp4
This will take 12th frame of a video and converts into a png. It requires
ffmpeg to be installed.
`convert -resize %wx "%f[12]" "png:%o"`
You may as well use ffmpeg right away
`ffmpeg -i "%f" -ss 00:00:02 -frames:v 1 -loglevel quiet -vf scale=%w:-1 -f apng "%o"`
### audio/mpeg
`sox "%f" -n spectrogram -x 600 -Y 550 -r -l -o - | convert -resize %wx png:- "png:%o"`
### application/x-xopp
`xournalpp -i "%o" --export-png-width=%w "%f"`
Converting from application/x-xopp to png only works if the xopp file
does not use a pdf document as a background, because this pdf is not
stored in the xopp fіle.

View File

@ -4,7 +4,6 @@ Layout of installation
SeedDMS allows various kinds of installations with very individual layouts
on disc. The proposed layout till version 5.1.6 was as the following:
```
seeddms51x ---+--- data
|
+--- pear
@ -12,31 +11,29 @@ seeddms51x ---+--- data
+--- seeddms-5.1.x
|
+--- www -> seeddms-5.1.x
```
`data` contains all document files, the sqlite database (if used), the full text
'data' contains all document files, the sqlite database (if used), the full text
data, the log files, and the cached preview images.
`pear` contains all third party packages including the four SeedDMS packages SeedDMS_Core,
'pear' contains all PEAR packages including the four SeedDMS packages SeedDMS_Core,
SeedDMS_Lucene, SeedDMS_Preview, SeedDMS_SQLiteFTS.
`seeddms-5.1.x` are the sources of seeddms and 'www' being a link on it.
'seeddms-5.1.x' are the sources of seeddms and 'www' being a link on it.
This layout has disadvantages when updating the source of seeddms, because
the directories `conf` and `ext` had to be moved from `seeddms-5.1.x` to
`seeddms-5.1.(x+1)`. `conf` was also visible over the web unless it was
the directories 'conf' and 'ext' had to be moved from 'seeddms-5.1.x' to
'seeddms-5.1.(x+1)'. 'conf' was also visible over the web unless it was
protected by an .htaccess file. The .htaccess file has been shipped, but it
is far better to keep senѕitive data out of the document root in the first
place.
The new layout mostly retains that structure but uses more soft links to place
the local data outside of `seeddms-5.1.x` which makes updating a lot easier
the local data outside of 'seeddms-5.1.x' which makes updating a lot easier
and moves the configuration out of the document root.
As MS Windows does not support soft links, this change will only apply to Linux/Unix
systems. MS Windows users just skip all the soft links and set seeddms-5.1.x
as the document root. The new layout is the following:
```
seeddms51x ---+--- data --+-- log
| |
| +-- cache
@ -76,12 +73,10 @@ seeddms51x ---+--- data --+-- log
+-- index.php -> ../seeddms/index.php
|
+-- ext
```
In order to convert to this layout you need to do the following in the seeddms51x
directory (replace the 'x' in '5.1.x' with the correct number):
```
ln -s seeddms-5.1.x seeddms
mv www/conf .
mv seeddms-5.1.x/ext www
@ -98,8 +93,3 @@ ln -s ../seeddms/webdav
ln -s ../seeddms/restapi
ln -s ../seeddms/pdfviewer
ln -s ../seeddms/index.php
```
Since version 5.1.42 the layout has changed slightly again. The directory
`pear` which had only a subdirectory `vendor` disappeared and the `vendor` has
move one level up.

View File

@ -1,11 +1,12 @@
# Extensions in SeedDMS
Extensions in SeedDMS
=====================
Since verson 5.0.0 SeedDMS can be extended by extensions. Extensions
can hook up functions into certain operations, e.g.
uploading, removing or displaying a document. They can also be
used to modify some of the internal variables like the list of
translations and they can even replace classes in the core of
SeedDMS and hook up functions into certain operations in the core.
seeddms and hook up functions into certain operations in the core.
All extensions are located in the folder 'ext'. Each extension
has its own folder named by the name of the extension. The central
@ -18,13 +19,12 @@ the extension manager if it was changed.
The integration into SeedDMS is done by hooks, class and file
overloading. SeedDMS manages
a globally available array of hooks (`$GLOBALS['SEEDDMS_HOOKS']`).
This array has the elements `view` and `controller`. All entries
a globally available array of hooks ($GLOBALS['SEEDDMS_HOOKS']).
This array has the elements 'view' and 'controller'. All entries
in those array elements contain instances of self defined classes
containing the hook methods. For setting up the hooks in the view
`viewFolder` the following code is needed.
'viewFolder' the following code is needed.
```
$GLOBALS['SEEDDMS_HOOKS']['view']['viewFolder'][] = new SeedDMS_ExtExample_ViewFolder;
class SeedDMS_ExtExample_ViewFolder {
@ -39,16 +39,15 @@ $GLOBALS['SEEDDMS_HOOKS']['controller']['removeFolder'][] = new SeedDMS_ExtExamp
class SeedDMS_ExtExample_RemoveFolder {
...
};
```
Based on these two variants of adding hooks to the SeedDMS application code,
the SeedDMS core can be extended by implementing the controller hook 'initDMS'
Based on these two variants of adding hooks to the seeddms application code,
the seeddms core can be extended by implementing the controller hook 'initDMS'
which is called right after the class SeedDMS_Core_DMS has been initiated.
Beside hooks and callbacks another way of modifying SeedDMS is given
Beside hooks and callbacks another way of modifying seeddms is given
by overloading the files in the directory 'views' and 'controllers'. Both
directories contain class files with a single class for either running
controller or view code. If an extension provides those file in its
own extension dir, they will be used instead of the files shipped with
SeedDMS.
seeddms.

18
doc/README.Fail2ban Normal file
View File

@ -0,0 +1,18 @@
Adding authentication failure check for fail2ban
=================================================
You will have to use 5.1.10 for this to work.
Add a filter /etc/fail2ban/filter.d/seeddms.conf with the content
[Definition]
failregex = \[error\] -- \(<HOST>\) op.Login login failed
then configure a new jail in /etc/fail2ban/jail.d/seeddms.conf
[seeddms]
enabled = yes
port = http,https
filter = seeddms
logpath = /home/www-data/seeddms-demo/data/log/*.log

View File

@ -1,33 +0,0 @@
Adding authentication failure check for fail2ban
=================================================
Fail2ban is a very mature and sophisticated program to detect attacks on
a service by checking its log file. If such an attack was detected an
action will be executed, which will mostly ban the IP of the attacker
for a configurable amount of time.
You will have to use at least SeedDMS 5.1.10 for this to work.
Add a filter `/etc/fail2ban/filter.d/seeddms.conf` with the content
```
[Definition]
failregex = \[error\] -- \(<HOST>\) op.Login login failed
```
This will tell fail2ban which lines in the log file are considered
to be an incident. Here it is a failed login.
Than configure a new jail in `/etc/fail2ban/jail.d/seeddms.conf`
```
[seeddms]
enabled = yes
port = http,https
filter = seeddms
logpath = /home/www-data/seeddms-demo/data/log/*.log
```
It tells fail2ban which log files shall be analysed, and which filter
has to be applied.

View File

@ -241,8 +241,6 @@ 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.
@ -256,29 +254,6 @@ in your current installation with new versions from the quickstart archive.
contain database updates.
Installing from git
====================
SeedDMS is hosted at https://codeberg.org/SeedDMS
In order to install SeedDMS you need to:
1. Create a directory, e.g. seeddms
`mkdir seeddms`
2. Change into that directory
`cd seeddms`
3. Clone the various SeedDMS repositories
`git clone https://codeberg.org/SeedDMS/seeddms.git`
`git clone -b seeddms-5.1.x https://codeberg.org/SeedDMS/core.git`
`git clone https://codeberg.org/SeedDMS/preview.git`
`git clone https://codeberg.org/SeedDMS/lucene.git`
`git clone https://codeberg.org/SeedDMS/ѕqlitefts.git`
`git clone https://codeberg.org/SeedDMS/http_webdav_server.git`
4. Run composer
`composer update`
5. Create an installable distribution
`vendor/bin/phing -Dversion=$(php -r 'include "inc/inc.Version.php"; echo (new SeedDMS_Version())->version();') package`
THE LONG STORY
================

66
doc/README.Ldap Normal file
View File

@ -0,0 +1,66 @@
Ldap configuration
===================
The configuration for authentication against an ldap server needs to be done
in the `settings.xml` file using a text editor. It cannot be edited from within the
web gui.
SeedDMS supports ldap authentication using an Active Directory (AD) or a
regular ldap server, e.g. openldap
The location of the ldap server is specified in two parameters: `host` and
`port`. `host` can be either a plain hostname or an ldap URI, including the
protocol, the host and optionally the port, e.g. ldap://localhost:389. In case
of an URI the port in the configuration must remain empty.
The authentication itself is a two step process which differs, depending on how
to bind to the server. If the configuration sets 'bindDN' and 'bindPW', those
values will be used for a initial non anonymous bind to the ldap server
otherwise an anonymous bind is executed.
After the initial bind, a ldap search for either 'uid=<username>' (ldap) or
'sAMAccountName=<username>' (AD) below basedn is done. The purpose of this
search is to retrieve a working bindDN which is then used to actually
authenticate the user. In case of an anonymous first bind the search will
likely fail and the bindDN for the second bind will be either
'uid=<username>,<basedn>' (ldap) or '<username>@<accountDomainName>' (AD). If
the search succeeds the bindDN will be taken from the user's data in the ldap
server. This bindDN will be used for a second bind using the users password.
If the second bind succeeds the user could be successfully authenticated.
The data from the ldap server can be used to create an account in SeedDMS
if the user trying to login does not exist yet, but was able to authenticate.
This will only be done if 'authentication->restricted' in the configuration
is set to false. In that case the common name (cn) and email address is taken
from ldap. An already existing account in SeedDMS will be updated with data from
ldap.
Since version 5.1.35 and 6.0.28 the field name of the email address in ldap
can be set with the attribute `mailField`. If it is not set it defaults to `mail`.
Since version 5.1.34 and 6.0.27 the groups of a user stored in the ldap directory
can be synchronised with the groups in SeedDMS. The ldap field storing
the groups can be configured with the attribute `mailField`. This will add
new groups in SeedDMS and aѕsign them to the user.
Examples
---------
Anonymous bind to openldap on localhost, port 389
- type = "ldap"
- baseDN = "ou=users,dc=mycompany,dc=de"
- host = "ldap://localhost"
During authentication as user 'admin' the following steps are executed
1. connect to ldap server at localhost:389
2. do an anonymous bind
3. search for 'uid=admin' below basedn
4.1. if search succeeds use the dn from the user
4.2. if search fails use 'uid=admin,<basedn>' as dn
5. do a non anonymous bind with dn and password entered by user
6. if step 5. succeeds the use is authenticated
If bindDN and bindPW are specified in the configuration, the second step
will be a non anonymous bind.

View File

@ -1,118 +0,0 @@
Ldap configuration
===================
The configuration for authentication against an ldap server needs to be done
in the `settings.xml` file using a text editor. It cannot be edited from within the
web gui.
SeedDMS supports ldap authentication using an Active Directory (AD) or a
regular ldap server, e.g. openldap
The location of the ldap server is specified in two parameters: `host` and
`port`. `host` can be either a plain hostname or an ldap URI, including the
protocol, the host and optionally the port, e.g. `ldap://localhost:389`. In case
of an URI the port in the configuration must remain empty.
The authentication itself is a two step process which differs, depending on how
to bind to the server. If the configuration sets `bindDN` and `bindPW`, those
values will be used for a initial non anonymous bind to the ldap server
otherwise an anonymous bind is executed.
After the initial bind, a ldap search for either `uid=<username>` (ldap) or
`sAMAccountName=<username>` (AD) below basedn is done. The purpose of this
search is to retrieve a working bindDN which is then used to actually
authenticate the user. In case of a successful anonymous first bind but a
failed search (this seems to be the case when connecting to an AD), a second
non anonymous bind is tried. The bindDN for that second bind will be either
`uid=<username>,<basedn>` (ldap) or `<username>@<accountDomainName>` (AD).
If the search after the first anonymous bind succeeds, the bindDN will be
taken from the user's data in the ldap
server. This bindDN will be used for a second bind using the users password.
If the second bind succeeds the user is successfully authenticated.
The data from the ldap server can be used to create or update an account in SeedDMS
if the user trying to login does not exist yet, but was able to authenticate.
This will only be done if 'authentication->restricted' in the configuration
is set to false. In that case the common name (cn) and email address is taken
from ldap. An already existing account in SeedDMS will be updated with data from
ldap.
Since version 5.1.35 and 6.0.28 the field name of the email address in ldap
can be set with the attribute `mailField`. If it is not set it defaults to `mail`.
Since version 5.1.34 and 6.0.27 the groups of a user stored in the ldap directory
can be synchronised with the groups in SeedDMS. The ldap field storing
the groups can be configured with the attribute `mailField`. This will add
new groups in SeedDMS and assign them to the user.
Using email address for authentication
---------------------------------------
Since version 5.1.34 and 6.0.27 the email can be used for authentication
(requires `enableLoginByEmail` to be set in the configuration).
This only works if the search after the first bind succeeds, which is usually
only the case if it is a none anonymous bind.
Notes on connecting to an AD
-----------------------------
The ldap authentication was originally implemented for classic LDAP servers
like openldap. Before doing the actual authentication the user was searched
by combining the user's login name and the configured baseDN. This search was
preceded an anonymous or non anonymous bind (depending on wether bindDN and
bindPWD are set). The only purpose of that search was to retrieve the
distinguished name of the user, which was used in a second non anonymous bind
for authenticating the user. If that search fails or didn't return a record
(which seems to be always the case for an anonymous bind to an AD)
a second non anonymous bind with the user's credentials is tried. That bind
uses a dn which is quite different for classic ldap and AD (see examples
below). The dn for an AD is of the form '<username>@<domain>'. '<domain>' is
the string configured in the parameter `accountDomainName`.
Examples
---------
### Anonymous bind to openldap on localhost, port 389
- type = "ldap"
- baseDN = "ou=users,dc=mycompany,dc=de"
- host = "ldap://localhost"
During authentication as user 'admin' the following steps are executed
1. connect to ldap server at localhost:389
2. do an anonymous bind
3.1 if the bind succeeds, search for `uid=admin` below basedn
3.2 if the bind fails use `uid=admin,<basedn>` as dn and continue with step 5
4.1. if search succeeds use the dn from the user
4.2. if search fails use `uid=admin,<basedn>` as dn
5. do a non anonymous bind with dn and password entered by user
6. if step 5. succeeds the user is authenticated
7. if `restricted` in the settings is *not* set another ldap search for the
user is executed to retrieve the full name, and the email and if
8.1 the user doesn't exist in SeedDMS, the user will be created or
8.2 the user exists in SeedDMS, the use will be updated
If bindDN and bindPW are specified in the configuration, the second step
will be a non anonymous bind.
### Connecting to an AD
- type = "AD"
- baseDN = "ou=users,dc=mycompany,dc=de"
- accountDomainName=mycompany
- host = "ldap://localhost"
During authentication as user 'admin' the following steps are executed
1. connect to AD server at localhost:389
2. do an anonymous bind (which usually succeeds)
3. search for `uid=admin` below basedn (which usually returns an empty record)
4. if search returns no data use `admin@<accountDomainName>` as dn
5. do a non anonymous bind with dn and password entered by user
6. if step 5. succeeds the user is authenticated
7. if `restricted` in the settings is *not* set another ldap search for the
user is executed to retrieve the full name, and the email and if
8.1 the user doesn't exist in SeedDMS, the user will be created or
8.2 the user exists in SeedDMS, the use will be updated

View File

@ -6,7 +6,7 @@ session which is stored in a local file named `cookies.txt`.
The authentication is done with the user `admin`. You may use any other
user as well.
You can pass `-H Authorization: <api key>` instead of `-b cookies.txt`
You may as well pass `-H Authorization: <api key>` instead of `-b cookies.txt`
to `curl` after setting the api key in the configuration of your SeedDMS.
Of course, in that case you will not need the initial call of the `login`
endpoint.
@ -48,16 +48,8 @@ curl --silent -H "Authorization: <api key>" -X GET "${BASEURL}restapi/index.php/
## Notes
Make sure to encode the data properly when using restapi functions which uses
`put`. If you use curl with PHP, then encode the data as show in the following
lines of code:
put. If you use curl with PHP, then encode the data as the following
```
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
```
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
## Bruno
[Bruno](https://www.usebruno.com/) is an application for testing and exploring
Rest APIs. This [git repository](https://codeberg.org/SeedDMS/bruno) contains
the configuration for SeedDMS.

143
doc/README.Ubuntu Normal file
View File

@ -0,0 +1,143 @@
This README was written by Eric Smith
======================================================
Steps that I took to install SeedDMS on Ubuntu 12.10
- a personal account and not an authoritative guide.
======================================================
Download four tar balls from;
http://sourceforge.net/projects/seeddms/files/seeddms-4.0.0-pre5/
seeddms-4.0.0-pre5.tar.gz
SeedDMS_Preview-1.0.0.tgz
SeedDMS_Lucene-1.1.1.tgz
SeedDMS_Core-4.0.0pre5.tgz
Install as follows the pear components:
sudo pear install SeedDMS_Core-4.0.0pre5.tgz
sudo pear install SeedDMS_Preview-1.0.0.tgz
sudo pear install SeedDMS_Lucene-1.1.1.tgz
Download and install the pear Log application:
wget http://download.pear.php.net/package/Log-1.12.7.tgz
sudo pear install Log-1.12.7.tgz
And zend:
sudo pear channel-discover zend.googlecode.com/svn
sudo pear install zend/zend
I installed the following packages, not all of which may be required
and you may require other packages, please check the dependencies on
the README.md for example for full text search, you need pdftotext,
catdoc, xls2csv or scconvert, cat, id3
sudo apt-get install php5-mysql php5-mysqlnd libapache2-mod-php5
sudo apt-get install pdo_mysql php5-gd id3 scconvert
sudo apt-get install php-http-webdav-server
sudo apt-get install zend-framework zend-framework-bin
sudo apt-get install libzend-framework-zendx-php
sudo apt-get install libjs-dojo-core libjs-dojo-dijit libjs-dojo-dojox
sudo apt-get install libzend-framework-php (It kept bitching about Zend so I just kept piling on packages until it worked)
mbstring is already a part of libapache2-mod-php5
pepper:~> show libapache2-mod-php5|grep mbstring
mbstring mhash openssl pcre Phar posix Reflection session shmop SimpleXML
Define three locations:
[1] Some cosy place in yourfile system for the source files to which you
will link
I chose "/opt/seeddms-4.0.0-pre5/"
untar seeddms-4.0.0-pre5.tar.gz into this location
[2] Make a directory and three subdirectories for the data for your site;
I chose to do this under "/opt/dms/seeddms_multisite_test/data"
sudo mkdir -p /opt/dms/seeddms_multisite_test/data/lucene/
sudo mkdir /opt/dms/seeddms_multisite_test/data/staging/
sudo mkdir /opt/dms/seeddms_multisite_test/data/cache/
Give ownership (or write access) to your httpd process to those directories;
sudo chown -cvR www-data /opt/dms/seeddms_multisite_test/data/
[3] Somewhere under your www root, make a directory for the sources of
your site:
These can be of course under different virtual domains.
/var/www/www.mydomain.eu/seeddms_multisite_test
cd /var/www/www.mydomain.eu/seeddms_multisite_test;
sudo ln -s /opt/seeddms-4.0.0-pre5 src (README.md does not include the `src'!)
ln -s src/inc inc
ln -s src/op op
ln -s src/out out
ln -s src/js js
ln -s src/views views
ln -s src/languages languages
ln -s src/styles styles
ln -s src/themes themes
ln -s src/install install
ln -s src/index.php index.php
If need be;
sudo chown -cvR www-data /var/www/www.mydomain.eu/seeddms_multisite_test/
Create Dataabse;
Run the following sql commands to create your db and a user with
appropriate privileges.
mysql> create database seeddms_multisite_test;
mysql> grant all privileges on seeddms_multisite_test.* to seeddms@localhost identified by 'your_passwd';
Point your browser to the location of your instance as in [3] above
and /install
I resorted to a text browser on my server due to failure to access the
db from a remote browser;
pepper:~> elinks www.mydomain.eu/seeddms_multisite_test/install
This is how I filled it in;
SeedDMS: INSTALL
SeedDMS Installation for version 4.0.0
Server settings
Root directory: /opt/seeddms-4.0.0-pre5/_______________________
Http Root: /seeddms_multisite_test/_______________________
Content directory: /opt/dms/seeddms_multisite_test/data___________
Directory for full text index: /opt/dms/seeddms_multisite_test/data/lucene/___
Directory for partial uploads: /opt/dms/seeddms_multisite_test/data/staging/__
Core SeedDMS directory: _______________________________________________
Lucene SeedDMS directory: _______________________________________________
Extra PHP include Path: _______________________________________________
Database settings
Database Type: mysql________________
Server name: localhost____________
Database: seeddms_multisite_tes
Username: seeddms______________
Password: ********_____________
Create database tables: [X]
[ Apply ]
If all is okay (and I hope this happens more quickly for you than for me),
you should be notified accordingly and invited to login to your new site
with credentials admin/admin. (This password is cleverly set to expire
in a couple of days. So do not get a shock like I did when it suddenly
does not work).
-------------------------------------------------------------------------------
To make additional sites;
If you wish to make additional sites, you need to copy the data directories thusly;
sudo cp -avr /opt/dms/seeddms_multisite_test /opt/dms/seeddms_multisite_test_2
And the sources thusly;
sudo cp -avr /var/www/www.mydomain.eu/seeddms_multisite_test /var/www/www.mydomain.eu/seeddms_multisite_test_2
And of course make data directories for this site:
sudo mkdir -p /opt/dms/seeddms_multisite_test_2/data/lucene/
sudo mkdir /opt/dms/seeddms_multisite_test_2/data/staging/
sudo mkdir /opt/dms/seeddms_multisite_test_2/data/cache/
Then create another database as shown above but of course give the db
another name.
Run the install again from the new location.

View File

@ -3,7 +3,7 @@ WebDAV
SeedDMS has support for WebDAV which allows to easily add, delete,
move, copy and modify documents. All operating systems have support
for WebDAV, but the implemtation and their behaviour varys
for WebDAV as well, but the implemtations and their behaviour varys
and consequently you may run into various problems. If this happens
just file a bug report at https://sourceforge.net/projects/seeddms
@ -34,35 +34,27 @@ Configuring davfs2
On Linux it is quite simple to mount the SeedDMS WebDAV server with
davfs2. Just place a line like the following in your /etc/fstab
```
http://seeddms.your-domain.com/webdav/index.php /media/webdav davfs noauto,user,rw,uid=1000,gid=1000
```
and mount it as root with
```
mount /media/webdav davfs
```
You may as well want to configure davfs2 in /etc/davfs2/davfs2.conf by setting
```
[/media/webdav]
use_locks 0
gui_optimize 1
```
and possibly add your login data to `/etc/davfs2/secrets`
and possibly add your login data to /etc/davfs2/secrets
```
/media/webdav admin secret
```
Making applications work with WebDAV
-------------------------------------
Various programms have differnt strategies to save files to disc and
to prevent data lost under all circumstances. Those strategies often don't
prevent data lost under all circumstances. Those strategies often don't
work very well an a WebDAV-Server. The following will list some of those
strategies.
@ -87,25 +79,19 @@ the old document. If you don't want this behaviour, then tell vim
to not create the backup file. You can do that by either passing additional
parameters to vim
```
vi "+set nobackup" "+set nowritebackup" -n test.txt
```
or by setting them in your .vimrc
```
set nobackup
set nowritebackup
set noswapfile
```
If you want to restrict the settings to the directory where the dms
is mounted by webdav, e.g. /media/webdav, you can set an auto command
in `.vimrc`
in .vimrc
```
autocmd BufNewFile,BufRead /media/webdav/* set nobackup nowritebackup noswapfile
```
Creating the backup file in a directory outside of WebDAV doesn't help in
this case, because it still does the file renaming which is turned off by
@ -121,9 +107,7 @@ If webdav access isn't working, this client is probably the best for testing.
Just run
```
cadaver https://<your-domain>/<your-basedir>/webdav/index.php
```
It will ask for the user name and password. Once you are logged in just
type `help` for a list of commands.
@ -131,27 +115,19 @@ type `help` for a list of commands.
SeedDMS stores a lot more properties not covered by the webdav standard.
Those have its own namespace called 'SeedDMS:'. Just type
```
propget <resource>
```
with `resource` being either the name of a folder or document. You will
get a list of all properties stored for this resource. Setting a property
requires to set the namespace first
```
set namespace SeedDMS:
```
Afterwards, you may set a property, e.g. the comment, with
```
propset <resource> comment 'Just a comment'
```
or even delete a property
```
propdel <resource> comment
```

59
doc/README.ocr Normal file
View File

@ -0,0 +1,59 @@
OCR
====
SeedDMS itself has no support for optical character recognition (OCR)
because it does not care about the content of file. Though, external
OCR software can be used to convert an image into text and index it
by the full text search engine.
The following script can be use to convert a scanned image into pdf
with a text layer added. The script actually takes this file to
ran it through pdftotext. It was published in the seeddms forum
https://sourceforge.net/p/seeddms/discussion/general/thread/4ec5973d/
#!/bin/bash
inputpdf=$1
temp_folder=/tmp/seedinput/$(date +"%Y_%m_%d_%H%M%S")/
lockfile=/tmp/seed
protokolldatei=./tesser_syslog
cores=2
mkdir -p $lockfile
while [ -e "$lockfile"/"`basename $0`" ];
do
sleep 5
done
if ( set -o noclobber; echo "locked" > "$lockfile"/"`basename $0`"); then
trap 'rm -f "$lockfile"/"`basename $0`"; echo $(date) " Lockdatei wird geloescht: " $lockfile"/"`basename $0` Aufrufparameter: $* >> $protokolldatei ;rm -r $temp_folder; exit $?' INT TERM KILL EXIT
#das Datum mit dem Scriptnamen in die Protokolldatei schreiben
echo $(date) " Lockdatei erstellt: " $lockfile"/"`basename $0` >> $protokolldatei
else
#Script beenden falls Lockdatei nicht erstellt werden konnte
echo $(date) " Programm wird beendet, Lockdatei konnte nicht erstellt werden: $lockfile"/"`basename $0` Aufrufparameter: $* " >> $protokolldatei
exit 1
fi
mkdir -p $temp_folder
$(pdftotext -raw $1 - 1> $temp_folder''tmp.txt )
pdf_contents=`cat $temp_folder''tmp.txt`
pdf_contents=`echo "$pdf_contents" | tr -dc '[:print:]'`
if [ -z "$pdf_contents" ]; then
convert -density 300 -quality 95 $inputpdf +adjoin $temp_folder''image%03d.jpg
find $temp_folder -name '*.jpg'| parallel --gnu -j $cores tesseract -l deu --psm 6 {} {} pdf
num=`find $temp_folder -name '*.pdf'| wc -l`
if [ "$num" -gt "1" ]; then
pdfunite $temp_folder*.pdf $temp_folder''tmp.pdf
else
mv $temp_folder*.pdf $temp_folder''tmp.pdf
fi
pdftotext $temp_folder''tmp.pdf $temp_folder''tmp.txt
mv $temp_folder''tmp.pdf $1
fi
cat $temp_folder''tmp.txt

View File

@ -1,63 +0,0 @@
OCR
====
SeedDMS itself has no support for optical character recognition (OCR)
because it does not care about the content of file. Though, external
OCR software can be used to convert an image into text and index it
by the full text search engine. From SeedDMS point of view, it would
be sufficient to have a conversion service which converts an image
into text. This can be implemented in any possible way, but most
likely as a SeedDMS extension.
The following script can be use to convert a pdf with scanned images
into a text. The script converts any page into a image, runs it through
tesseract, which creates a pdf again containing a text layer. All those
pdf documents will be united into a single pdf and through `pdftotext` again.
It was published in the SeedDMS forum
https://sourceforge.net/p/seeddms/discussion/general/thread/4ec5973d/
```
#!/bin/bash
inputpdf=$1
temp_folder=/tmp/seedinput/$(date +"%Y_%m_%d_%H%M%S")/
lockfile=/tmp/seed
protokolldatei=./tesser_syslog
cores=2
mkdir -p $lockfile
while [ -e "$lockfile"/"`basename $0`" ];
do
sleep 5
done
if ( set -o noclobber; echo "locked" > "$lockfile"/"`basename $0`"); then
trap 'rm -f "$lockfile"/"`basename $0`"; echo $(date) " Lock file will be deleted: " $lockfile"/"`basename $0` Aufrufparameter: $* >> $protokolldatei ;rm -r $temp_folder; exit $?' INT TERM KILL EXIT
# write date and script name into log file
echo $(date) " Lock file created: " $lockfile"/"`basename $0` >> $protokolldatei
else
# Exit script if lock file could not be created
echo $(date) " Script will exit, because lock file could not be created: $lockfile"/"`basename $0` Aufrufparameter: $* " >> $protokolldatei
exit 1
fi
mkdir -p $temp_folder
$(pdftotext -raw $1 - 1> $temp_folder''tmp.txt )
pdf_contents=`cat $temp_folder''tmp.txt`
pdf_contents=`echo "$pdf_contents" | tr -dc '[:print:]'`
if [ -z "$pdf_contents" ]; then
convert -density 300 -quality 95 $inputpdf +adjoin $temp_folder''image%03d.jpg
find $temp_folder -name '*.jpg'| parallel --gnu -j $cores tesseract -l deu --psm 6 {} {} pdf
num=`find $temp_folder -name '*.pdf'| wc -l`
if [ "$num" -gt "1" ]; then
pdfunite $temp_folder*.pdf $temp_folder''tmp.pdf
else
mv $temp_folder*.pdf $temp_folder''tmp.pdf
fi
pdftotext $temp_folder''tmp.pdf $temp_folder''tmp.txt
mv $temp_folder''tmp.pdf $1
fi
cat $temp_folder''tmp.txt
```

View File

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -12,8 +12,6 @@
* @version Release: @package_version@
*/
use Seeddms\Seeddms\Session;
require_once("inc.ClassSession.php");
require_once("inc.ClassAccessOperation.php");
@ -29,7 +27,7 @@ $isajax = isset($_GET['action']) && ($_GET['action'] != 'show');
if (!isset($_COOKIE["mydms_session"])) {
if($settings->_enableGuestLogin && $settings->_enableGuestAutoLogin) {
$session = new Session($db);
$session = new SeedDMS_Session($db);
if(!$dms_session = $session->create(array('userid'=>$settings->_guestID, 'theme'=>$settings->_theme, 'lang'=>$settings->_language))) {
if(!$isajax)
header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer);
@ -52,7 +50,7 @@ if (!isset($_COOKIE["mydms_session"])) {
$lang = $settings->_language;
$user->setLanguage($lang);
}
$session = new Session($db);
$session = new SeedDMS_Session($db);
if(!$dms_session = $session->create(array('userid'=>$user->getID(), 'theme'=>$theme, 'lang'=>$lang))) {
if(!$isajax)
header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer);
@ -67,7 +65,7 @@ if (!isset($_COOKIE["mydms_session"])) {
} else {
/* Load session */
$dms_session = $_COOKIE["mydms_session"];
$session = new Session($db);
$session = new SeedDMS_Session($db);
if(!$resArr = $session->load($dms_session)) {
setcookie("mydms_session", $dms_session, time()-3600, $settings->_httpRoot); //delete cookie
if(!$isajax)
@ -76,8 +74,6 @@ if (!isset($_COOKIE["mydms_session"])) {
}
}
$translator->setDefaultLanguage($session->getLanguage());
/* Update last access time */
if((int)$resArr['lastAccess']+60 < time())
$session->updateAccess($dms_session);
@ -148,7 +144,7 @@ if (!$user->isAdmin() && $origuser == null) {
* already on the page Setup2Factor.php and no user substiation has occured.
*/
if($settings->_enable2FactorAuthentication && $settings->_guestID != $user->getID() && $settings->_autoLoginUser != $user->getID() && $origuser == null && $user->getSecret() == '') {
if(!in_array(basename($_SERVER['SCRIPT_NAME']), ['out.Setup2Factor.php', 'op.Setup2Factor.php', 'op.Logout.php'])) {
if(basename($_SERVER['SCRIPT_NAME']) != 'out.Setup2Factor.php' && basename($_SERVER['SCRIPT_NAME']) != 'op.Setup2Factor.php') {
header("Location: ../out/out.Setup2Factor.php");
exit;
}

View File

@ -16,6 +16,7 @@ require_once('inc.ClassAuthenticationService.php');
require_once('inc.ClassDbAuthentication.php');
require_once('inc.ClassLdapAuthentication.php');
global $logger;
$authenticator = new SeedDMS_AuthenticationService($logger, $settings);
if(isset($GLOBALS['SEEDDMS_HOOKS']['authentication'])) {

View File

@ -30,18 +30,13 @@
* @link https://www.seeddms.org Main Site
*/
use Seeddms\Seeddms\Session;
/* Middleware for authentication based on session */
class SeedDMS_Auth_Middleware_Session { /* {{{ */
private $container;
private $responsefactory;
public function __construct($container, $responsefactory) {
public function __construct($container) {
$this->container = $container;
$this->responsefactory = $responsefactory;
}
/**
@ -68,9 +63,9 @@ class SeedDMS_Auth_Middleware_Session { /* {{{ */
return $response;
}
$logger->log("Invoke AuthSessionMiddleware for method " . $request->getMethod() . " on '" . $request->getUri()->getPath() . "'", PEAR_LOG_INFO);
// require_once("inc/inc.ClassSession.php");
$session = new Session($dms->getDb());
$logger->log("Invoke middleware for method " . $request->getMethod() . " on '" . $request->getUri()->getPath() . "'", PEAR_LOG_INFO);
require_once("inc/inc.ClassSession.php");
$session = new SeedDMS_Session($dms->getDb());
if (isset($_COOKIE["mydms_session"])) {
$dms_session = $_COOKIE["mydms_session"];
$logger->log("Session key: " . $dms_session, PEAR_LOG_DEBUG);
@ -78,7 +73,6 @@ class SeedDMS_Auth_Middleware_Session { /* {{{ */
/* Delete Cookie */
setcookie("mydms_session", $dms_session, time() - 3600, $settings->_httpRoot);
$logger->log("Session for id '" . $dms_session . "' has gone", PEAR_LOG_ERR);
$response = $this->responsefactory->createResponse();
return $response->withStatus(403);
}
@ -89,7 +83,6 @@ class SeedDMS_Auth_Middleware_Session { /* {{{ */
setcookie("mydms_session", $dms_session, time() - 3600, $settings->_httpRoot);
if ($settings->_enableGuestLogin) {
if (!($userobj = $dms->getUser($settings->_guestID))) {
$response = $this->responsefactory->createResponse();
return $response->withStatus(403);
}
} else {
@ -99,14 +92,12 @@ class SeedDMS_Auth_Middleware_Session { /* {{{ */
if ($userobj->isAdmin()) {
if ($resArr["su"]) {
if (!($userobj = $dms->getUser($resArr["su"]))) {
$response = $this->responsefactory->createResponse();
return $response->withStatus(403);
}
}
}
$dms->setUser($userobj);
} else {
$response = $this->responsefactory->createResponse();
return $response->withStatus(403);
}
$this->container->set('userobj', $userobj);
@ -115,174 +106,3 @@ class SeedDMS_Auth_Middleware_Session { /* {{{ */
return $response;
}
} /* }}} */
/**
* Middleware for authentication based on basic authentication
*
**/
class SeedDMS_Auth_Middleware_Basic { /* {{{ */
private $container;
private $responsefactory;
public function __construct($container, $responsefactory) {
$this->container = $container;
$this->responsefactory = $responsefactory;
}
/**
* Basic authentication middleware invokable class
*
* @param \Psr\Http\Message\ServerRequestInterface $request PSR7 request
* @param \Psr\Http\Message\ResponseInterface $response PSR7 response
* @param callable $next Next middleware
*
* @return \Psr\Http\Message\ResponseInterface
*/
public function __invoke($request, $handler) {
$dms = $this->container->get('dms');
$settings = $this->container->get('config');
$logger = $this->container->get('logger');
$userobj = null;
if ($this->container->has('userobj')) {
$userobj = $this->container->get('userobj');
}
if ($userobj) {
$response = $handler->handle($request);
return $response;
}
$logger->log("Invoke AuthBasicMiddleware for method " . $request->getMethod() . " on '" . $request->getUri()->getPath() . "'", PEAR_LOG_INFO);
$environment = $request->getServerParams();
if(!empty($environment['HTTP_AUTHORIZATION'])) {
$tmp = explode(' ', $environment['HTTP_AUTHORIZATION'], 2);
switch($tmp[0]) {
case 'Basic':
$logger->log("Basic authentication with ".$tmp[0]."=".$tmp[1], PEAR_LOG_INFO);
$authenticator = $this->container->get('authenticator');
$kk = explode(':', base64_decode($tmp[1]));
$userobj = $authenticator->authenticate($kk[0], $kk[1]);
if(!$userobj) {
$logger->log("Login with basic authentication for '".$kk[0]."' failed", PEAR_LOG_ERR);
$response = $this->responsefactory->createResponse();
return $response->withStatus(403);
}
$dms->setUser($userobj);
if($this->container instanceof \Slim\Container)
$this->container['userobj'] = $userobj;
else
$this->container->set('userobj', $userobj);
$logger->log("Login with basic authentication as '".$userobj->getLogin()."' successful", PEAR_LOG_INFO);
break;
}
}
$this->container->set('userobj', $userobj);
if(!$userobj)
$logger->log("Not yet authenticated. Pass on to next middleware", PEAR_LOG_INFO);
else
$logger->log("Authenticated as ".(is_object($userobj) ? $userobj->getLogin() : "annon").". Pass on to next middleware", PEAR_LOG_INFO);
/* Always pass on to the next middleware. If that middleware does
* authentication, then it should first check if 'userobj' in the container
* is already set. The authentication shipped with seeddms restapi does that
* and skips its own authentication, if userobj already exists.
*/
$response = $handler->handle($request);
return $response;
}
} /* }}} */
/**
* Middleware for authentication based on token
*
**/
class SeedDMS_Auth_Middleware_Token { /* {{{ */
private $container;
private $responsefactory;
public function __construct($container, $responsefactory) {
$this->container = $container;
$this->responsefactory = $responsefactory;
}
/**
* Basic authentication middleware invokable class
*
* @param \Psr\Http\Message\ServerRequestInterface $request PSR7 request
* @param \Psr\Http\Message\ResponseInterface $response PSR7 response
* @param callable $next Next middleware
*
* @return \Psr\Http\Message\ResponseInterface
*/
public function __invoke($request, $handler) {
$dms = $this->container->get('dms');
$settings = $this->container->get('config');
$logger = $this->container->get('logger');
$userobj = null;
if ($this->container->has('userobj')) {
$userobj = $this->container->get('userobj');
}
if ($userobj) {
$response = $handler->handle($request);
return $response;
}
$logger->log("Invoke AuthTokenMiddleware for method " . $request->getMethod() . " on '" . $request->getUri()->getPath() . "'", PEAR_LOG_INFO);
$environment = $request->getServerParams();
/* Do not even try to authenticate if HTTP_AUTHORIZATION is empty, contains
* a ' ' (in case of Basic authentication), the api key is not set, the api
* user is not set.
*/
if (!empty($environment['HTTP_AUTHORIZATION']) && strstr($environment['HTTP_AUTHORIZATION'], ' ') === false && !empty($settings->_apiKey) && !empty($settings->_apiUserId)) {
$logger->log("Authorization key: ".$environment['HTTP_AUTHORIZATION'], PEAR_LOG_DEBUG);
if($settings->_apiKey == $environment['HTTP_AUTHORIZATION']) {
if(!($userobj = $dms->getUser($settings->_apiUserId))) {
$response = $this->responsefactory->createResponse();
$response = $response->withHeader('Content-Type', 'application/json');
$response = $response->withStatus(403);
$response->getBody()->write(
(string)json_encode(
['success'=>false, 'message'=>'Invalid user associated with api key', 'data'=>''],
JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR
)
);
return $response;
}
} else {
$response = $this->responsefactory->createResponse();
$response = $response->withHeader('Content-Type', 'application/json');
$response = $response->withStatus(403);
$response->getBody()->write(
(string)json_encode(
['success'=>false, 'message'=>'Wrong api key', 'data'=>''],
JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR
)
);
return $response;
}
$logger->log("Login with apikey as '".$userobj->getLogin()."' successful", PEAR_LOG_INFO);
}
$this->container->set('userobj', $userobj);
if(!$userobj)
$logger->log("Not yet authenticated. Pass on to next middleware", PEAR_LOG_INFO);
else
$logger->log("Authenticated as ".(is_object($userobj) ? $userobj->getLogin() : "annon").". Pass on to next middleware", PEAR_LOG_INFO);
/* Always pass on to the next middleware. If that middleware does
* authentication, then it should first check if 'userobj' in the container
* is already set. The authentication shipped with seeddms restapi does that
* and skips its own authentication, if userobj already exists.
*/
$response = $handler->handle($request);
return $response;
}
} /* }}} */

View File

@ -30,19 +30,14 @@ class Controller {
* @return object an object of a class implementing the view
*/
static function factory($class, $params=array()) { /* {{{ */
foreach(['settings', 'session', 'extmgr', 'request', 'logger', 'notifier', 'fulltextservice', 'translator'] as $vn) {
if(isset($params[$vn]))
${$vn} = $params[$vn];
else
${$vn} = $GLOBALS[$vn] ?? null;
}
global $settings, $session, $extMgr, $request, $logger, $notifier;
if(!$class) {
return null;
}
$classname = "SeedDMS_Controller_".$class;
$filename = '';
foreach($extmgr->getExtensionConfiguration() as $extname=>$extconf) {
foreach($extMgr->getExtensionConfiguration() as $extname=>$extconf) {
$filename = $settings->_rootDir.'ext/'.$extname.'/controllers/class.'.$class.".php";
if(file_exists($filename)) {
break;
@ -66,8 +61,6 @@ class Controller {
$controller->setParam('settings', $settings);
$controller->setParam('logger', $logger);
$controller->setParam('notifier', $notifier);
$controller->setParam('fulltextservice', $fulltextservice);
$controller->setParam('translator', $translator);
return $controller;
}
return null;

View File

@ -285,7 +285,7 @@ class SeedDMS_Controller_Common {
if(is_string($tmpret)) {
$ret = ($ret === null) ? $tmpret : (is_string($ret) ? $ret.$tmpret : array_merge($ret, array($tmpret)));
} elseif(is_array($tmpret)) { // || is_object($tmpret)) {
$ret = ($ret === null) ? $tmpret : (is_string($ret) ? (array($ret) + $tmpret) : ($ret + $tmpret));
$ret = ($ret === null) ? $tmpret : (is_string($ret) ? array_merge(array($ret), $tmpret) : array_merge($ret, $tmpret));
} else
$ret = $tmpret;
}

View File

@ -93,18 +93,6 @@ class SeedDMS_Download_Mgr {
*/
protected $filenames;
/**
* @var bool $includereviewers whether to include reviewers
* @access protected
*/
protected $includereviewers;
/**
* @var bool $includeapprovers whether to include approvers
* @access protected
*/
protected $includeapprovers;
/**
* @var boolean $skipdefaultcols skip default columns, will only export extracols
* @access protected

View File

@ -36,8 +36,6 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
*/
protected $_dms;
protected $_translator;
protected $smtp_server;
protected $smtp_port;
@ -54,9 +52,8 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
protected $debug;
function __construct($dms, $translator, $from_address='', $smtp_server='', $smtp_port='', $smtp_username='', $smtp_password='', $lazy_ssl=true, $force_from=false) { /* {{{ */
function __construct($dms, $from_address='', $smtp_server='', $smtp_port='', $smtp_username='', $smtp_password='', $lazy_ssl=true, $force_from=false) { /* {{{ */
$this->_dms = $dms;
$this->_translator = $translator;
$this->smtp_server = $smtp_server;
$this->smtp_port = $smtp_port;
$this->smtp_user = $smtp_username;
@ -128,38 +125,38 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
$body = '';
if(!isset($params['__skip_header__']) || !$params['__skip_header__']) {
if(!isset($params['__header__']))
$body .= $this->_translator->translate("email_header", $params, null, $lang)."\r\n\r\n";
$body .= getMLText("email_header", $params, "", $lang)."\r\n\r\n";
elseif($params['__header__'])
$body .= $this->_translator->translate($params['__header__'], $params, null, $lang)."\r\n\r\n";
$body .= getMLText($params['__header__'], $params, "", $lang)."\r\n\r\n";
}
if(isset($params['__body__']))
$body .= $params['__body__'];
else
$body .= $this->_translator->translate($messagekey, $params, null, $lang);
$body .= getMLText($messagekey, $params, "", $lang);
if(!isset($params['__skip_footer__']) || !$params['__skip_footer__']) {
if(!isset($params['__footer__']))
$body .= "\r\n\r\n".$this->_translator->translate("email_footer", $params, null, $lang);
$body .= "\r\n\r\n".getMLText("email_footer", $params, "", $lang);
elseif($params['__footer__'])
$body .= "\r\n\r\n".$this->_translator->translate($params['__footer__'], $params, null, $lang);
$body .= "\r\n\r\n".getMLText($params['__footer__'], $params, "", $lang);
}
$bodyhtml = '';
if(isset($params['__body_html__']) || $this->_translator->translate($messagekey.'_html', $params, null, $lang)) {
if(isset($params['__body_html__']) || getMLText($messagekey.'_html', $params, "", $lang)) {
if(!isset($params['__skip_header__']) || !$params['__skip_header__']) {
if(!isset($params['__header_html__']))
$bodyhtml .= $this->_translator->translate("email_header_html", $params, null, $lang)."\r\n\r\n";
$bodyhtml .= getMLText("email_header_html", $params, "", $lang)."\r\n\r\n";
elseif($params['__header_html__'])
$bodyhtml .= $this->_translator->translate($params['__header_html__'], $params, null, $lang)."\r\n\r\n";
$bodyhtml .= getMLText($params['__header_html__'], $params, "", $lang)."\r\n\r\n";
}
if(isset($params['__body_html__']))
$bodyhtml .= $params['__body_html__'];
else
$bodyhtml .= $this->_translator->translate($messagekey.'_html', $params, null, $lang);
$bodyhtml .= getMLText($messagekey.'_html', $params, "", $lang);
if(!isset($params['__skip_footer__']) || !$params['__skip_footer__']) {
if(!isset($params['__footer_html__']))
$bodyhtml .= "\r\n\r\n".$this->_translator->translate("email_footer_html", $params, null, $lang);
$bodyhtml .= "\r\n\r\n".getMLText("email_footer_html", $params, "", $lang);
elseif($params['__footer_html__'])
$bodyhtml .= "\r\n\r\n".$this->_translator->translate($params['__footer_html__'], $params, null, $lang);
$bodyhtml .= "\r\n\r\n".getMLText($params['__footer_html__'], $params, "", $lang);
}
}
@ -209,7 +206,7 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
$headers['Return-Path'] = $returnpath;
$headers['To'] = $to;
$preferences = array("input-charset" => "UTF-8", "output-charset" => "UTF-8", "scheme"=>"Q");
$encoded_subject = iconv_mime_encode("Subject", $this->_translator->translate($subject, $params, null, $lang), $preferences);
$encoded_subject = iconv_mime_encode("Subject", getMLText($subject, $params, null, $lang), $preferences);
$headers['Subject'] = substr($encoded_subject, strlen('Subject: '));
$headers['Date'] = date('r', time());
$headers['MIME-Version'] = "1.0";
@ -242,7 +239,7 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
if (isset($GLOBALS['SEEDDMS_HOOKS']['mailqueue'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['mailqueue'] as $queueService) {
if(method_exists($queueService, 'queueMailJob')) {
$ret = $queueService->queueMailJob($mail_params, $to, $hdrs, $this->_translator->translate($subject, $params, null, $lang), $message);
$ret = $queueService->queueMailJob($mail_params, $to, $hdrs, getMLText($subject, $params, "", $lang), $message);
if($ret !== null)
return $ret;
}

View File

@ -22,20 +22,18 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
namespace Seeddms\Seeddms;
/**
* Base class for extensions
*
* @author Uwe Steinmann <uwe@steinmann.cx>
* @package SeedDMS
*/
class ExtensionBase {
class SeedDMS_ExtBase {
var $settings;
var $dms;
var $logger;
public function __construct(Settings $settings, $dms, $logger) {
public function __construct($settings, $dms, $logger) {
$this->settings = $settings;
$this->dms = $dms;
$this->logger = $logger;

View File

@ -14,10 +14,6 @@
* @version Release: @package_version@
*/
namespace Seeddms\Seeddms;
use Seeddms\Seeddms\Utilities;
/**
* Class to represent an extension manager
*
@ -29,7 +25,7 @@ use Seeddms\Seeddms\Utilities;
* @copyright 2011 Uwe Steinmann
* @version Release: @package_version@
*/
class ExtensionMgr {
class SeedDMS_Extension_Mgr {
/**
* @var string $extdir directory where extensions are located
* @access protected
@ -85,12 +81,6 @@ class ExtensionMgr {
*/
protected $errmsgs;
/**
* @var string[] $warnmsg list of warning message from last operation
* @access protected
*/
protected $warnmsgs;
/*
* Name of json file containg available extension from repository
*/
@ -189,10 +179,6 @@ class ExtensionMgr {
return $this->cachedir."/extensions.php";
} /* }}} */
public function setRepositoryUrl($reposurl) { /* {{{ */
$this->reposurl = $reposurl;
} /* }}} */
/**
* Get the configuration of extensions
*
@ -276,14 +262,14 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
unlink ($destination);
}
$zip = new \ZipArchive();
if (!$zip->open($destination, \ZipArchive::CREATE)) {
$zip = new ZipArchive();
if (!$zip->open($destination, ZIPARCHIVE::CREATE)) {
return false;
}
$source = str_replace('\\', '/', realpath($source));
if (is_dir($source) === true) {
$files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source), \RecursiveIteratorIterator::SELF_FIRST);
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST);
if ($include_dir) {
$arr = explode("/",$source);
@ -332,19 +318,13 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
* @param string $version version of extension (x.y.z)
* @return string name of temporary file with archive
*/
public function createArchive($extname, $version, $dir = null) { /* {{{ */
public function createArchive($extname, $version) { /* {{{ */
if(!is_dir($this->extdir ."/". $extname))
return false;
if ($dir) {
if (!is_dir($dir))
return false;
$tmpfile = $dir."/".$extname."-".$version.".zip";
} else {
$tmpfile = $this->cachedir."/".$extname."-".$version.".zip";
}
$tmpfile = $this->cachedir."/".$extname."-".$version.".zip";
if(!ExtensionMgr::Zip($this->extdir."/".$extname, $tmpfile)) {
if(!SeedDMS_Extension_Mgr::Zip($this->extdir."/".$extname, $tmpfile)) {
return false;
}
// $cmd = "cd ".$this->extdir."/".$extname."; zip -r ".$tmpfile." .";
@ -417,22 +397,17 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
return false;
return self::checkExtensionByName($extname, $extconf, $options);
} /* }}} */
}
/**
* Check configuration of extension
* Check content of extension directory or configuration of extension
*
* This method checks if the configurations of an extension is complete
* and all dependencies specified in the configuration are met.
*
* @param string $extname not used anymore. Was previously use to store
* result of the check into $this->configcache, but this method can be
* used for installed extensions and those in the repository, which makes
* the use of a cache useless.
* @param array $extconf extension configuration to be checked
* @param array $options array with option element 'noconstraints'.
* Set 'noconstraints' to true if constraints to local seeddms
* installation shall not be checked.
* @param string|array $dir full path to extension directory or extension name
* or an array containing the configuration.
* @param array $options array with options elements 'noconstraints' and 'nofiles'.
* Set 'noconstraints' to true if
* constraints to local seeddms installation shall not be checked. Set 'nofiles'
* to true to turn off checking of files
* @return boolean true if check was successful, otherwise false
*/
public function checkExtensionByName($extname, $extconf, $options=array()) { /* {{{ */
@ -441,7 +416,6 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
}
$this->errmsgs = array();
$this->warnmsgs = array();
if(!isset($extconf['constraints']['depends']['seeddms'])) {
$this->errmsgs[] = "Missing dependency on SeedDMS";
@ -458,16 +432,13 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
if(!isset($extconf['author'])) {
$this->errmsgs[] = "Missing author";
}
if(!isset($extconf['changes'])) {
$this->warnmsgs[] = "Missing changes";
}
if(!isset($options['noconstraints']) || $options['noconstraints'] == false) {
if(isset($extconf['constraints']['depends'])) {
foreach($extconf['constraints']['depends'] as $dkey=>$dval) {
switch($dkey) {
case 'seeddms':
$version = new Version;
$version = new SeedDMS_Version;
if(is_array($dval)) {
$fullfill = false;
foreach($dval as $ddval) {
@ -544,13 +515,13 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
$newdir = addDirSep($this->cachedir)."ext.new";
/* First remove a left over from a previous extension */
if(file_exists($newdir)) {
Utilities::rrmdir($newdir);
SeedDMS_Utils::rrmdir($newdir);
}
if(!mkdir($newdir, 0755)) {
$this->errmsgs[] = "Cannot create temp. extension directory";
return false;
}
$zip = new \ZipArchive;
$zip = new ZipArchive;
$res = $zip->open($file);
if ($res === TRUE) {
$zip->extractTo($newdir);
@ -564,7 +535,7 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
/* Check if extension is complete and fullfills the constraints */
if(!self::checkExtensionByDir($newdir)) {
Utilities::rrmdir($newdir);
SeedDMS_Utils::rrmdir($newdir);
return false;
}
@ -575,11 +546,11 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
if(!is_dir($this->extdir)) {
if(!mkdir($this->extdir, 0755)) {
$this->errmsgs[] = "Cannot create extension directory";
Utilities::rrmdir($newdir);
SeedDMS_Utils::rrmdir($newdir);
return false;
}
} elseif(is_dir($this->extdir ."/". $extname)) {
Utilities::rrmdir($this->extdir ."/". $extname);
SeedDMS_Utils::rrmdir($this->extdir ."/". $extname);
}
/* Move the temp. created ext directory to the final location */
/* rename() may fail if dirs are moved from one device to another.
@ -601,15 +572,10 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
* has been copied.
*/
$this->errmsgs[] = "Cannot move temp. extension directory to final destination";
Utilities::rrmdir($this->extdir ."/". $extname);
SeedDMS_Utils::rrmdir($this->extdir ."/". $extname);
return false;
}
if (!$this->createExtensionConf()) {
// $this->errmsgs[] = "Cannot update extension configuration";
// return false;
}
return true;
} /* }}} */
@ -620,7 +586,7 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
* single lines. Each line is either a comment if it starts with an '#'
* or a json encoded array containing the extension configuration.
*
* Run Seeddms\Seeddms\ExtensionMgr::updateExtensionList() to ensure the
* Run SeedDMS_Extension_Mgr::updateExtensionList() to ensure the
* currently cached extension list file is up to date.
*
* @return string[] list of json strings or comments
@ -640,7 +606,7 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
* a list of extension configurations. Only the most recent version
* of an extension will be included.
*
* Run Seeddms\Seeddms\ExtensionMgr::updateExtensionList() to ensure the
* Run SeedDMS_Extension_Mgr::updateExtensionList() to ensure the
* currently cached extension list file is up to date.
*
* @return array[] list of extension configurations
@ -672,7 +638,7 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
* a list of extension configurations. Only those extensions will
* be included which maches the given name.
*
* Run Seeddms\Seeddms\ExtensionMgr::updateExtensionList() to ensure the
* Run SeedDMS_Extension_Mgr::updateExtensionList() to ensure the
* currently cached extension list file is up to date.
*
* @return array[] list of extension configurations
@ -688,16 +654,13 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
}
}
}
uksort($result, function($a, $b){return ExtensionMgr::cmpVersion($b, $a);});
uksort($result, function($a, $b){return SeedDMS_Extension_Mgr::cmpVersion($b, $a);});
return $result;
} /* }}} */
/**
* Import list of extension from repository
*
* Will also update the list in the cache, which is used by getExtensionList()
* and getExtensionListByName().
*
* @param boolean $force force download even if file already exists
*/
public function updateExtensionList($version='', $force=false) { /* {{{ */
@ -735,13 +698,9 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
*/
public function getExtensionFromRepository($file) { /* {{{ */
$content = file_get_contents($this->reposurl."/".$file, false, $this->getStreamContext());
if ($content) {
$tmpfile = tempnam(sys_get_temp_dir(), '');
file_put_contents($tmpfile, $content);
return $tmpfile;
} else {
return false;
}
$tmpfile = tempnam(sys_get_temp_dir(), '');
file_put_contents($tmpfile, $content);
return $tmpfile;
} /* }}} */
/**
@ -764,13 +723,4 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
public function getErrorMsgs() { /* {{{ */
return $this->errmsgs;
} /* }}} */
/**
* Return all warning messages
*
* @return string[]
*/
public function getWarningMsgs() { /* {{{ */
return $this->warnmsgs;
} /* }}} */
}

View File

@ -28,12 +28,12 @@ class SeedDMS_LdapAuthentication extends SeedDMS_Authentication {
var $settings;
protected function addUser($username, $info) { /* {{{ */
protected function addUser($username, $info) {
$mailfield = !empty($this->settings->_ldapMailField) ? $this->settings->_ldapMailField : 'mail';
return $this->dms->addUser($username, null, $info['cn'][0], isset($info[$mailfield]) ? $info[$mailfield][0] : '', $this->settings->_language, $this->settings->_theme, "User was added from LDAP");
} /* }}} */
}
protected function updateUser($user, $info) { /* {{{ */
protected function updateUser($user, $info) {
$mailfield = !empty($this->settings->_ldapMailField) ? $this->settings->_ldapMailField : 'mail';
if(isset($info['cn'][0]) && ($info['cn'][0] != $user->getFullName())) {
$user->setFullName($info['cn'][0]);
@ -41,9 +41,9 @@ class SeedDMS_LdapAuthentication extends SeedDMS_Authentication {
if(isset($info[$mailfield][0]) && ($info[$mailfield][0] != $user->getEmail())) {
$user->setEmail($info[$mailfield][0]);
}
} /* }}} */
}
protected function syncGroups($user, $ldapgroups) { /* {{{ */
protected function syncGroups($user, $ldapgroups) {
$groupnames = [];
$count = 0;
if(isset($ldapgroups['count']))
@ -88,7 +88,7 @@ class SeedDMS_LdapAuthentication extends SeedDMS_Authentication {
}
}
}
} /* }}} */
}
public function __construct($dms, $settings) { /* {{{ */
$this->dms = $dms;
@ -233,7 +233,7 @@ class SeedDMS_LdapAuthentication extends SeedDMS_Authentication {
}
/* Check if user already exists in the database. Return with an error
* only if the sql statements fails, but not if the user wasn't found.
* only if the sql statements fails, but not if no user was found.
* The username may not be the one passed to this function anymore. It
* could have been overwritten by uid (or sAMAccountName) derived from
* the above ldap search.

View File

@ -41,11 +41,6 @@ class SeedDMS_NotificationService {
*/
protected $settings;
/*
* Translator
*/
protected $translator;
/*
* Possible types of receivers
*/
@ -59,12 +54,11 @@ class SeedDMS_NotificationService {
const RECV_REVISOR = 7;
const RECV_RECIPIENT = 8;
public function __construct($logger = null, $settings = null, $translator=null) { /* {{{ */
public function __construct($logger = null, $settings = null) { /* {{{ */
$this->services = array();
$this->errors = array();
$this->logger = $logger;
$this->settings = $settings;
$this->translator = $translator;
} /* }}} */
public function addService($service, $name='') { /* {{{ */
@ -74,10 +68,6 @@ class SeedDMS_NotificationService {
$this->errors[$name] = true;
} /* }}} */
public function getTranslator() { /* {{{ */
return $this->translator;
} /* }}} */
public function getServices() { /* {{{ */
return $this->services;
} /* }}} */
@ -695,64 +685,6 @@ class SeedDMS_NotificationService {
}
} /* }}} */
public function sendChangedVersionAttributesMail($version, $user, $oldattributes) { /* {{{ */
$document = $version->getDocument();
$dms = $document->getDMS();
$folder = $document->getFolder();
$notifyList = $document->getNotifyList();
$newattributes = $version->getAttributes();
if($oldattributes) {
foreach($oldattributes as $attrdefid=>$attribute) {
if(!isset($newattributes[$attrdefid]) || $newattributes[$attrdefid]->getValueAsArray() !== $oldattributes[$attrdefid]->getValueAsArray()) {
$subject = "attribute_changed_email_subject";
$message = "attribute_changed_email_body";
$params = array();
$params['name'] = $document->getName();
$params['version'] = $version->getVersion();
$params['attribute_name'] = $attribute->getAttributeDefinition()->getName();
$params['attribute_old_value'] = $oldattributes[$attrdefid]->getValue();
$params['attribute_new_value'] = isset($newattributes[$attrdefid]) ? $newattributes[$attrdefid]->getValue() : '';
$params['folder_path'] = $folder->getFolderPathPlain();
$params['username'] = $user->getFullName();
$params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
$params['sitename'] = $this->settings->_siteName;
$params['http_root'] = $this->settings->_httpRoot;
$this->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
foreach ($notifyList["groups"] as $grp) {
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
}
}
}
/* Check for new attributes which didn't have a value before */
if($newattributes) {
foreach($newattributes as $attrdefid=>$attribute) {
if(!isset($oldattributes[$attrdefid]) && $attribute) {
$subject = "attribute_changed_email_subject";
$message = "attribute_changed_email_body";
$params = array();
$params['name'] = $document->getName();
$params['version'] = $version->getVersion();
$params['attribute_name'] = $dms->getAttributeDefinition($attrdefid)->getName();
$params['attribute_old_value'] = '';
$params['attribute_new_value'] = $attribute->getValue();
$params['folder_path'] = $folder->getFolderPathPlain();
$params['username'] = $user->getFullName();
$params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
$params['sitename'] = $this->settings->_siteName;
$params['http_root'] = $this->settings->_httpRoot;
$this->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
foreach ($notifyList["groups"] as $grp) {
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
}
}
}
} /* }}} */
public function sendChangedFolderAttributesMail($folder, $user, $oldattributes) { /* {{{ */
$dms = $folder->getDMS();
$notifyList = $folder->getNotifyList();
@ -1356,7 +1288,7 @@ class SeedDMS_NotificationService {
$params['reviewer'] = $reviewer->getFullName();
elseif($reviewer->isType('group'))
$params['reviewer'] = $reviewer->getName();
$params['username'] = $user->getFullName();
$params['username'] = $user->getName();
$params['sitename'] = $this->settings->_siteName;
$params['http_root'] = $this->settings->_httpRoot;
$params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();

View File

@ -15,8 +15,6 @@
* @version Release: @package_version@
*/
namespace Seeddms\Seeddms;
/**
* Class to represent a session
*
@ -31,7 +29,7 @@ namespace Seeddms\Seeddms;
* @copyright 2011 Uwe Steinmann
* @version Release: @package_version@
*/
class Session {
class SeedDMS_Session {
/**
* @var object $db reference to database object. This must be an instance
* of {@link SeedDMS_Core_DatabaseAccess}.
@ -55,7 +53,7 @@ class Session {
* Create a new instance of the session handler
*
* @param object $db object to access the underlying database
* @return object instance of Seeddms\Seeddms\Session
* @return object instance of SeedDMS_Session
*/
function __construct($db) { /* {{{ */
$this->db = $db;
@ -419,8 +417,6 @@ class Session {
}
class_alias('Seeddms\Seeddms\Session', 'SeedDMS_Session');
/**
* Class for managing sessions
*
@ -432,7 +428,7 @@ class_alias('Seeddms\Seeddms\Session', 'SeedDMS_Session');
* @copyright 2014 Uwe Steinmann
* @version Release: @package_version@
*/
class SessionMgr {
class SeedDMS_SessionMgr {
/**
* @var object $db reference to database object. This must be an instance
* of {@link SeedDMS_Core_DatabaseAccess}.
@ -444,7 +440,7 @@ class SessionMgr {
* Create a new instance of the session manager
*
* @param object $db object to access the underlying database
* @return object instance of Seeddms\Seeddms\SessionMgr
* @return object instance of SeedDMS_SessionMgr
*/
function __construct($db) { /* {{{ */
$this->db = $db;
@ -482,7 +478,7 @@ class SessionMgr {
return false;
$sessions = array();
foreach($resArr as $rec) {
$session = new Session($this->db);
$session = new SeedDMS_Session($this->db);
$session->load($rec['id']);
$sessions[] = $session;
}
@ -505,7 +501,7 @@ class SessionMgr {
return false;
$sessions = array();
foreach($resArr as $rec) {
$session = new Session($this->db);
$session = new SeedDMS_Session($this->db);
$session->load($rec['id']);
$sessions[] = $session;
}
@ -527,7 +523,7 @@ class SessionMgr {
return false;
$sessions = array();
foreach($resArr as $rec) {
$session = new Session($this->db);
$session = new SeedDMS_Session($this->db);
$session->load($rec['id']);
$sessions[] = $session;
}
@ -535,5 +531,3 @@ class SessionMgr {
} /* }}} */
}
class_alias('Seeddms\Seeddms\SessionMgr', 'SeedDMS_SessionMgr');

View File

@ -11,12 +11,6 @@
* @version Release: @package_version@
*/
namespace Seeddms\Seeddms;
use SeedDMS_Core_File;
use SeedDMS_Core_DMS;
use SeedDMS_Core_DatabaseAccess;
/**
* Class for reading and writing the configuration file
*
@ -160,10 +154,6 @@ class Settings { /* {{{ */
var $_showSingleSearchHit = true;
// enable/disable use of memcached
var $_enableMemcached = false;
// memcached host
var $_memcachedHost = 'localhost';
// memcached port
var $_memcachedPort = '11211';
// contentOffsetDirTo
var $_contentOffsetDir = "1048576";
// Maximum number of sub-directories per parent directory
@ -209,7 +199,7 @@ class Settings { /* {{{ */
// enable/disable listing logged in user as recipient
var $_enableSelfReceipt = false;
// enable/disable hidden user as recipient
var $_enableHiddenReceipt = false;
var $_enableHiddenReceipt = true;
// enable/disable update of a receipt by the recipient
var $_enableUpdateReceipt = false;
// enable/disable listing administrator as recipient
@ -372,8 +362,6 @@ class Settings { /* {{{ */
var $_previewWidthDetail = 100;
// Preview image width in drop folder list
var $_previewWidthDropFolderList = 100;
// download or view online when clicking on preview image
var $_defaultThumbnailClick = 'download';
// show full preview on document details page
var $_showFullPreview = false;
// convert to pdf for preview on document details page
@ -460,10 +448,7 @@ class Settings { /* {{{ */
// Load config file
if (!defined("SEEDDMS_INSTALL")) {
if(!file_exists($configFilePath)) {
if(php_sapi_name() === 'cli')
echo "You do not seem to have a valid configuration. Set SEEDDMS_CONFIG_FILE to the path of the configuration file.\n";
else
echo "You do not seem to have a valid configuration. Run the <a href=\"install/install.php\">install tool</a> first.";
echo "You do not seem to have a valid configuration. Run the <a href=\"install/install.php\">install tool</a> first.";
exit;
}
}
@ -473,14 +458,17 @@ class Settings { /* {{{ */
echo "Your configuration contains errors.";
exit;
}
// if (!is_null($this->_maxExecutionTime))
// ini_set("max_execution_time", $this->_maxExecutionTime);
} /* }}} */
/**
* Check if the passed parameter equals to 'true', 'on', 'yes' or 'y'
* and returns true, if it does.
* Check if a variable has the string 'true', 'on', 'yes' or 'y'
* and returns true.
*
* @param string $var value
* @return boolean true if $var is 'true', 'on', 'yes' or 'y', otherwise false
* @return true/false
*/
protected static function boolVal($var) { /* {{{ */
$var = strtolower(strval($var));
@ -510,10 +498,10 @@ class Settings { /* {{{ */
} /* }}} */
/**
* Create ';' seperated string from array
* Return ';' seperated string from array
*
* @param array $value
* @return string
*
*/
function arrayToString($value) { /* {{{ */
return implode(";", $value);
@ -523,14 +511,14 @@ class Settings { /* {{{ */
* Return array from ';' seperated string
*
* @param string $value
* @return array
*
*/
function stringToArray($value) { /* {{{ */
return explode(";", $value);
} /* }}} */
/**
* Set $_viewOnlineFileTypes
* set $_viewOnlineFileTypes
*
* @param string $stringValue string value
*
@ -540,7 +528,7 @@ class Settings { /* {{{ */
} /* }}} */
/**
* Get $_viewOnlineFileTypes in a string value
* get $_viewOnlineFileTypes in a string value
*
* @return string value
*
@ -550,7 +538,7 @@ class Settings { /* {{{ */
} /* }}} */
/**
* Set $_editOnlineFileTypes
* set $_editOnlineFileTypes
*
* @param string $stringValue string value
*
@ -560,7 +548,7 @@ class Settings { /* {{{ */
} /* }}} */
/**
* Get $_editOnlineFileTypes in a string value
* get $_editOnlineFileTypes in a string value
*
* @return string value
*
@ -573,7 +561,8 @@ class Settings { /* {{{ */
* Load config file
*
* @param string $configFilePath config file path
* @return boolean true, if loading was successful, otherwise false
*
* @return true/false
*/
public function load($configFilePath) { /* {{{ */
$contents = file_get_contents($configFilePath);
@ -607,7 +596,6 @@ class Settings { /* {{{ */
$this->_previewWidthDetail = intval($tab["previewWidthDetail"]);
if(isset($tab["previewWidthDropFolderList"]))
$this->_previewWidthDropFolderList = intval($tab["previewWidthDropFolderList"]);
$this->_defaultThumbnailClick = strval($tab["defaultThumbnailClick"]);
$this->_showFullPreview = Settings::boolVal($tab["showFullPreview"]);
$this->_convertToPdf = Settings::boolVal($tab["convertToPdf"]);
if(isset($tab["maxItemsPerPage"]))
@ -721,13 +709,9 @@ class Settings { /* {{{ */
$this->_maxUploadSize = strval($tab["maxUploadSize"]);
$this->_enableXsendfile = Settings::boolVal($tab["enableXsendfile"]);
$this->_enableMemcached = Settings::boolVal($tab["enableMemcached"]);
$this->_memcachedHost = strval($tab["memcachedHost"]);
$this->_memcachedPort = strval($tab["memcachedPort"]);
}
// XML Path: /configuration/system/authentication
$node = $xml->xpath('/configuration/system/authentication');
if($node) {
// XML Path: /configuration/system/authentication
$node = $xml->xpath('/configuration/system/authentication');
$tab = $node[0]->attributes();
$this->_enableGuestLogin = Settings::boolVal($tab["enableGuestLogin"]);
$this->_enableGuestAutoLogin = Settings::boolVal($tab["enableGuestAutoLogin"]);
@ -1053,7 +1037,6 @@ class Settings { /* {{{ */
$this->setXMLAttributValue($node, "previewWidthMenuList", $this->_previewWidthMenuList);
$this->setXMLAttributValue($node, "previewWidthDetail", $this->_previewWidthDetail);
$this->setXMLAttributValue($node, "previewWidthDropFolderList", $this->_previewWidthDropFolderList);
$this->setXMLAttributValue($node, "defaultThumbnailClick", $this->_defaultThumbnailClick);
$this->setXMLAttributValue($node, "showFullPreview", $this->_showFullPreview);
$this->setXMLAttributValue($node, "convertToPdf", $this->_convertToPdf);
$this->setXMLAttributValue($node, "maxItemsPerPage", $this->_maxItemsPerPage);
@ -1147,8 +1130,6 @@ class Settings { /* {{{ */
$this->setXMLAttributValue($node, "maxUploadSize", $this->_maxUploadSize);
$this->setXMLAttributValue($node, "enableXsendfile", $this->_enableXsendfile);
$this->setXMLAttributValue($node, "enableMemcached", $this->_enableMemcached);
$this->setXMLAttributValue($node, "memcachedHost", $this->_memcachedHost);
$this->setXMLAttributValue($node, "memcachedPort", $this->_memcachedPort);
// XML Path: /configuration/system/authentication
$node = $this->getXMLNode($xml, '/configuration/system', 'authentication');
@ -1396,7 +1377,7 @@ class Settings { /* {{{ */
// Save
return $xml->asXML($configFilePath);
} /* }}} */
} /* }}} */
/**
* search and return Config File Path
@ -1696,14 +1677,39 @@ class Settings { /* {{{ */
}
if($dsn) {
$connTmp = new PDO($dsn, $this->_dbUser, $this->_dbPass);
$db = new SeedDMS_Core_DatabaseAccess($this->_dbDriver, $this->_dbHostname, $this->_dbUser, $this->_dbPass, $this->_dbDatabase);
if(!$db->connect()) {
$result["dbDatabase"] = array(
"status" => "error",
"type" => "error",
"currentvalue" => '[host, user, database] -> [' . $this->_dbHostname . ',' . $this->_dbUser . ',' . $this->_dbDatabase .']',
"systemerror" => $connTmp->ErrorMsg()
);
/* Check if there wasn't a previous error while searching for
* SeedDMS_Core.
*/
if(!isset($result["coreDir"])) {
/* Instanciate SeedDMS_Core to check version */
if(!empty($this->_coreDir))
require_once($this->_coreDir.'/Core.php');
else
require_once($this->_rootDir.'../pear/vendor/seeddms/core/Core.php');
$tmpcore = new SeedDMS_Core_DMS(null, $this->_contentDir);
$db = new SeedDMS_Core_DatabaseAccess($this->_dbDriver, $this->_dbHostname, $this->_dbUser, $this->_dbPass, $this->_dbDatabase);
if(!$db->connect()) {
$result["dbDatabase"] = array(
"status" => "error",
"type" => "error",
"currentvalue" => '[host, user, database] -> [' . $this->_dbHostname . ',' . $this->_dbUser . ',' . $this->_dbDatabase .']',
"systemerror" => $connTmp->ErrorMsg()
);
} else {
/*
$dms = new SeedDMS_Core_DMS($db, $this->_contentDir.$this->_contentOffsetDir);
if(!$dms->checkVersion()) {
$result["dbVersion"] = array(
"status" => "error",
"type" => "error",
"currentvalue" => $dms->version,
"suggestion" => 'updateDatabase'
);
}
*/
}
$connTmp = null;
}
}
} catch(Exception $e) {
@ -1865,13 +1871,13 @@ class Settings { /* {{{ */
* Check if extension is disabled
*
* @param string $extname name of extension
* @return true if extension is disabled or extension could not be found in configuration
* @return true if extension is disabled
*/
public function extensionIsDisabled($extname) { /* {{{ */
if(array_key_exists($extname, $this->_extensions))
return $this->_extensions[$extname]['__disable__'];
return true;
return false;
} /* }}} */
/**
@ -1915,66 +1921,5 @@ class Settings { /* {{{ */
return min($mus);
} /* }}} */
/**
* Get base url
*
* @return string
*/
public function getBaseUrl() { /* {{{ */
global $_SERVER;
if(!empty($this->_baseUrl))
return $this->_baseUrl;
if(isset($_SERVER['HTTP_X_FORWARDED_HOST']))
$host = $_SERVER['HTTP_X_FORWARDED_HOST'];
else
$host = $_SERVER['HTTP_HOST'];
if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']))
$ssl = $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https';
else
$ssl = (isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0));
return "http".($ssl ? "s" : "")."://".$host;
} /* }}} */
/**
* Get base url with http root folder
*
* @return string
*/
public function getBaseUrlWithRoot() { /* {{{ */
return $this->getBaseUrl().$this->_httpRoot;
} /* }}} */
public function getAvailableLanguages() { /* {{{ */
$languages = array();
$path = $this->_rootDir . "languages/";
$handle = opendir($path);
while ($entry = readdir($handle) )
{
if ($entry == ".." || $entry == ".") {
continue;
} elseif (is_dir($path . $entry)) {
array_push($languages, $entry);
}
}
closedir($handle);
asort($languages);
return $languages;
} /* }}} */
function getLanguages() { /* {{{ */
if($this->_availablelanguages) {
return $this->_availablelanguages;
}
return self::getAvailableLanguages();
} /* }}} */
} /* }}} */
class_alias('Seeddms\Seeddms\Settings', 'SeedDMS_Settings');

View File

@ -1,392 +0,0 @@
<?php
/**
* Translate phrase and do all language handling
*
* @category DMS
* @package SeedDMS
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2025 Uwe Steinmann
* @version Release: @package_version@
*/
namespace Seeddms\Seeddms;
use SeedDMS_Core_AttributeDefinition;
/**
* Class for translation and language handling
*
* @category DMS
* @package SeedDMS
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2025 Uwe Steinmann
* @version Release: @package_version@
*/
class Translator { /* {{{ */
protected $settings;
protected $defaultlang;
protected $lang;
protected $missinglang;
/**
* Constructor
*
* @param string $settings SeedDMS configuration
*/
function __construct($settings=null) { /* {{{ */
$this->settings = $settings;
$this->defaultlang = '';
$this->lang = array();
$this->missinglang = array();
} /* }}} */
function setDefaultLanguage($lang) { /* {{{ */
$this->defaultlang = $lang;
} /* }}} */
public function init() { /* {{{ */
$__languages = $this->settings->getLanguages();
if(!in_array($this->settings->_language, $__languages))
$__languages[] = $this->settings->_language;
foreach($__languages as $_lang) {
if(file_exists($this->settings->_rootDir . "languages/" . $_lang . "/lang.inc")) {
include $this->settings->_rootDir . "languages/" . $_lang . "/lang.inc";
$this->lang[$_lang] = $text;
}
}
} /* }}} */
function addPhrases($lang, &$data) { /* {{{ */
if(isset($this->lang[$lang]))
$this->lang[$lang] = array_merge($this->lang[$lang], $data);
else
$this->lang[$lang] = $data;
} /* }}} */
/**
* Get translation
*
* Returns the translation for a given key. It will replace markers
* in the form [xxx] with those elements from the array $replace.
* A default text can be gіven for the case, that there is no translation
* available. The fourth parameter can override the currently set language
* in the session or the default language from the configuration.
*
* @param string $key key of translation text
* @param array $replace list of values that replace markers in the text
* @param string $defaulttext text used if no translation can be found
* @param string $lang use this language instead of the currently set lang
*/
function translate($key, $replace = array(), $defaulttext = null, $lang="") { /* {{{ */
$trantext = '';
if(!$lang) {
if($this->defaultlang)
$lang = $this->defaultlang;
else
$lang = $this->settings->_language;
}
if(!isset($this->lang[$lang][$key]) || !$this->lang[$lang][$key]) {
if ($defaulttext === null) {
$this->missinglang[$key] = $lang; //$_SERVER['SCRIPT_NAME'];
if(!empty($this->lang[$this->settings->_language][$key])) {
$tmpText = $this->lang[$this->settings->_language][$key];
} else {
$tmpText = '**'.$key.'**';
}
} else
$tmpText = $defaulttext;
} else
$tmpText = $this->lang[$lang][$key];
if (count($replace) == 0)
return $tmpText.$trantext;
$keys = array_keys($replace);
foreach ($keys as $key)
$tmpText = str_replace("[".$key."]", $replace[$key], $tmpText);
return $tmpText;
} /* }}} */
function print($key, $replace = array(), $defaulttext = null, $lang="") { /* {{{ */
print $this->translate($key, $replace, $defaulttext, $lang);
} /* }}} */
function printReviewStatusText($status, $date=0) { /* {{{ */
if (is_null($status)) {
print $this->translate("status_unknown");
}
else {
switch ($status) {
case -2:
print $this->translate("status_reviewer_removed");
break;
case -1:
print $this->translate("status_reviewer_rejected").($date !=0 ? " ".$date : "");
break;
case 0:
print $this->translate("status_not_reviewed");
break;
case 1:
print $this->translate("status_reviewed").($date !=0 ? " ".$date : "");
break;
default:
print $this->translate("status_unknown");
break;
}
}
} /* }}} */
function getReviewStatusText($status, $date=0) { /* {{{ */
if (is_null($status)) {
return $this->translate("status_unknown");
}
else {
switch ($status) {
case -2:
return $this->translate("status_reviewer_removed");
break;
case -1:
return $this->translate("status_reviewer_rejected").($date !=0 ? " ".$date : "");
break;
case 0:
return $this->translate("status_not_reviewed");
break;
case 1:
return $this->translate("status_reviewed").($date !=0 ? " ".$date : "");
break;
default:
return $this->translate("status_unknown");
break;
}
}
} /* }}} */
function printApprovalStatusText($status, $date=0) { /* {{{ */
if (is_null($status)) {
print $this->translate("status_unknown");
}
else {
switch ($status) {
case -2:
print $this->translate("status_approver_removed");
break;
case -1:
print $this->translate("status_approval_rejected").($date !=0 ? " ".$date : "");
break;
case 0:
print $this->translate("status_not_approved");
break;
case 1:
print $this->translate("status_approved").($date !=0 ? " ".$date : "");
break;
default:
print $this->translate("status_unknown");
break;
}
}
} /* }}} */
function getApprovalStatusText($status, $date=0) { /* {{{ */
if (is_null($status)) {
return $this->translate("status_unknown");
}
else {
switch ($status) {
case -2:
return $this->translate("status_approver_removed");
break;
case -1:
return $this->translate("status_approval_rejected").($date !=0 ? " ".$date : "");
break;
case 0:
return $this->translate("status_not_approved");
break;
case 1:
return $this->translate("status_approved").($date !=0 ? " ".$date : "");
break;
default:
return $this->translate("status_unknown");
break;
}
}
} /* }}} */
function printOverallStatusText($status) { /* {{{ */
print getOverallStatusText($status);
} /* }}} */
function getOverallStatusText($status) { /* {{{ */
if (is_null($status)) {
return $this->translate("assumed_released");
}
else {
switch($status) {
case S_IN_WORKFLOW:
return $this->translate("in_workflow");
break;
case S_DRAFT_REV:
return $this->translate("draft_pending_review");
break;
case S_DRAFT_APP:
return $this->translate("draft_pending_approval");
break;
case S_RELEASED:
return $this->translate("released");
break;
case S_REJECTED:
return $this->translate("rejected");
break;
case S_OBSOLETE:
return $this->translate("obsolete");
break;
case S_EXPIRED:
return $this->translate("expired");
break;
case S_IN_REVISION:
return getMLText("in_revision");
break;
case S_DRAFT:
return getMLText("draft");
break;
case S_NEEDS_CORRECTION:
return getMLText("needs_correction");
break;
default:
return $this->translate("status_unknown");
break;
}
}
} /* }}} */
function getAttributeTypeText($attrdef) { /* {{{ */
$t = '';
switch($attrdef->getType()) {
case SeedDMS_Core_AttributeDefinition::type_int:
$t = $this->translate("attrdef_type_int");
break;
case SeedDMS_Core_AttributeDefinition::type_float:
$t = $this->translate("attrdef_type_float");
break;
case SeedDMS_Core_AttributeDefinition::type_string:
$t = $this->translate("attrdef_type_string");
break;
case SeedDMS_Core_AttributeDefinition::type_boolean:
$t = $this->translate("attrdef_type_boolean");
break;
case SeedDMS_Core_AttributeDefinition::type_date:
$t = $this->translate("attrdef_type_date");
break;
case SeedDMS_Core_AttributeDefinition::type_email:
$t = $this->translate("attrdef_type_email");
break;
case SeedDMS_Core_AttributeDefinition::type_url:
$t = $this->translate("attrdef_type_url");
break;
case SeedDMS_Core_AttributeDefinition::type_boolean:
$t = $this->translate("attrdef_type_boolean");
break;
case SeedDMS_Core_AttributeDefinition::type_folder:
$t = $this->translate("attrdef_type_folder");
break;
case SeedDMS_Core_AttributeDefinition::type_document:
$t = $this->translate("attrdef_type_document");
break;
case SeedDMS_Core_AttributeDefinition::type_user:
$t = $this->translate("attrdef_type_user");
break;
case SeedDMS_Core_AttributeDefinition::type_group:
$t = $this->translate("attrdef_type_group");
break;
}
return $t;
} /* }}} */
function getAttributeObjectTypeText($attrdef) { /* {{{ */
$ot = '';
switch($attrdef->getObjType()) {
case SeedDMS_Core_AttributeDefinition::objtype_all:
$ot = $this->translate("all");
break;
case SeedDMS_Core_AttributeDefinition::objtype_folder:
$ot = $this->translate("folder");
break;
case SeedDMS_Core_AttributeDefinition::objtype_document:
$ot = $this->translate("document");
break;
case SeedDMS_Core_AttributeDefinition::objtype_documentcontent:
$ot = $this->translate("documentcontent");
break;
default:
$ot = $this->translate('objtype_unknown');
}
return $ot;
} /* }}} */
function getAttributeValidationText($error, $attrname='', $attrvalue='', $regex='') { /* {{{ */
$arr = getAttributeValidationError($error, $attrname, $attrvalue, $regex);
return $this->translate($arr[0], $arr[1]);
} /* }}} */
function getAttributeValidationError($error, $attrname='', $attrvalue='', $regex='') { /* {{{ */
if(is_object($attrvalue))
$attrvalue = $attrvalue->getId();
switch($error) {
case 14:
return array("attr_not_in_valueset", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 13:
return array("attr_not_a_group", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 12:
return array("attr_not_a_user", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 11:
return array("attr_not_a_folder", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 10:
return array("attr_not_a_document", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 9:
return array("attr_malformed_date", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 8:
return array("attr_malformed_boolean", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 7:
return array("attr_malformed_float", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 6:
return array("attr_malformed_int", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 5:
return array("attr_malformed_email", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 4:
return array("attr_malformed_url", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 3:
return array("attr_no_regex_match", array('attrname'=>$attrname, 'value'=>$attrvalue, 'regex'=>$regex));
break;
case 2:
return array("attr_max_values", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 1:
return array("attr_min_values", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
default:
return array("attr_validation_error", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
}
} /* }}} */
} /* }}} */

View File

@ -46,12 +46,7 @@ class UI extends UI_Default {
* @return object an object of a class implementing the view
*/
static public function factory($theme, $class='', $params=array()) { /* {{{ */
foreach(['settings', 'dms', 'user', 'session', 'extmgr', 'request', 'logger', 'notifier', 'fulltextservice', 'translator'] as $vn) {
if(isset($params[$vn]))
${$vn} = $params[$vn];
else
${$vn} = $GLOBALS[$vn] ?? null;
}
global $settings, $dms, $user, $session, $extMgr, $request, $logger, $notifier, $fulltextservice;
if(!$class) {
$class = 'Bootstrap';
$class = 'Style';
@ -61,9 +56,9 @@ class UI extends UI_Default {
}
/* Collect all decorators */
$decorators = array();
foreach($extmgr->getExtensionConfiguration() as $extname=>$extconf) {
foreach($extMgr->getExtensionConfiguration() as $extname=>$extconf) {
if(!$settings->extensionIsDisabled($extname)) {
if($extmgr->checkExtensionByName($extname, $extconf)) {
if($extMgr->checkExtensionByName($extname, $extconf)) {
if(isset($extconf['decorators'][$class])) {
$filename = $settings->_rootDir.'ext/'.$extname.'/decorators/'.$theme."/".$extconf['decorators'][$class]['file'];
if(file_exists($filename)) {
@ -78,9 +73,9 @@ class UI extends UI_Default {
*/
$filename = '';
$httpbasedir = '';
foreach($extmgr->getExtensionConfiguration() as $extname=>$extconf) {
foreach($extMgr->getExtensionConfiguration() as $extname=>$extconf) {
if(!$settings->extensionIsDisabled($extname)) {
if($extmgr->checkExtensionByName($extname, $extconf)) {
if($extMgr->checkExtensionByName($extname, $extconf)) {
/* Setting the 'views' element in the configuration can be used to
* replace an existing view in views/bootstrap/, e.g. class.ViewFolder.php
* without providing an out/out.ViewFolder.php. In that case $httpbasedir
@ -144,7 +139,6 @@ class UI extends UI_Default {
$view->setParam('logger', $logger);
$view->setParam('notifier', $notifier);
$view->setParam('fulltextservice', $fulltextservice);
$view->setParam('translator', $translator);
// $view->setParam('settings', $settings);
$view->setParam('sitename', $settings->_siteName);
$view->setParam('rootfolderid', $settings->_rootFolderID);

View File

@ -1,95 +0,0 @@
<?php
/**
* Various utility functions
*
* @category DMS
* @package SeedDMS
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2025 Uwe Steinmann
* @version Release: @package_version@
*/
namespace Seeddms\Seeddms;
/**
* Class with various methods
*
* @category DMS
* @package SeedDMS
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2025 Uwe Steinmann
* @version Release: @package_version@
*/
class Utilities { /* {{{ */
/**
* Recursively remove a directory on disc
*
* @param string $dir name of directory
*/
static public function rrmdir($dir) { /* {{{ */
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir."/".$object) == "dir") self::rrmdir($dir."/".$object); else unlink($dir."/".$object);
}
}
reset($objects);
rmdir($dir);
}
} /* }}} */
/**
* 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") { /* {{{ */
$len = strlen($alph)-1;
$s = "";
for ($i = 0; $i != $n; ++$i)
$s .= $alph[mt_rand(0, $len)];
return $s;
} /* }}} */
/**
* Create a real uniqid for cryptographic purposes
*
* @ return string
*/
static public function uniqidReal($lenght = 13) { /* {{{ */
// uniqid gives 13 chars, but you could adjust it to your needs.
if (function_exists("random_bytes")) {
$bytes = random_bytes(ceil($lenght / 2));
} elseif (function_exists("openssl_random_pseudo_bytes")) {
$bytes = openssl_random_pseudo_bytes(ceil($lenght / 2));
} else {
throw new Exception("no cryptographically secure random function available");
}
return substr(bin2hex($bytes), 0, $lenght);
} /* }}} */
/**
* Return nonce for CSP
*
* @return string
*/
static public function createNonce() { /* {{{ */
$length = 16;
$usable = true;
$bytes = openssl_random_pseudo_bytes($length, $usable);
if ($usable === false) {
// weak
// @TODO do something?
}
return base64_encode($bytes);
} /* }}} */
} /* }}} */
class_alias('Seeddms\Seeddms\Utilities', 'SeedDMS_Utils');

View File

@ -213,7 +213,7 @@ class SeedDMS_View_Common {
if(is_string($tmpret)) {
$ret = ($ret === null) ? $tmpret : (is_string($ret) ? $ret.$tmpret : array_merge($ret, array($tmpret)));
} elseif(is_array($tmpret) || is_object($tmpret)) {
$ret = ($ret === null) ? $tmpret : (is_string($ret) ? (array($ret) + $tmpret) : ($ret + $tmpret));
$ret = ($ret === null) ? $tmpret : (is_string($ret) ? array_merge(array($ret), $tmpret) : array_merge($ret, $tmpret));
} else
$ret = $tmpret;
}

View File

@ -56,14 +56,12 @@ if(isset($GLOBALS['SEEDDMS_HOOKS']['initStorage'])) {
$dms = new SeedDMS_Core_DMS($db, $storage ? $storage : $settings->_contentDir.$settings->_contentOffsetDir);
$memcache = null;
if($settings->_enableMemcached && extension_loaded('memcached')) {
$mc = new Memcached('seeddms');
$mc->addServers(array(
array($settings->_memcachedHost ?? 'localhost', $settings->_memcachedPort ?? 11211),
$memcache = new Memcached('seeddms');
$memcache->addServers(array(
array('localhost',11211),
));
$memcache = new \Cache\Adapter\Memcached\MemcachedCachePool($mc);
$dms->setCache($memcache);
$dms->setMemcache($memcache);
}
if(!$settings->_doNotCheckDBVersion && !$dms->checkVersion()) {
@ -93,5 +91,7 @@ require_once('inc/inc.Tasks.php');
require_once("inc.ConversionInit.php");
require_once('inc.FulltextInit.php');
require_once('inc.AuthenticationInit.php');
require_once("inc.ClassNotificationService.php");
require_once("inc.ClassEmailNotify.php");
require_once('inc.Notification.php');

View File

@ -11,37 +11,35 @@
* @version Release: @package_version@
*/
require_once "inc.ClassExtensionMgr.php";
global $logger;
require "inc.ClassExtensionMgr.php";
require_once "inc.ClassSchedulerTaskBase.php";
require_once "inc.ClassExtBase.php";
// Do not set a namespace until all extensions use that namespace
// or set the class name in the conf file to '\xxxx'
//namespace Seeddms\Seeddms;
$extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir, $settings->_repositoryUrl, $settings->_proxyUrl, $settings->_proxyUser, $settings->_proxyPassword);
use Seeddms\Seeddms\ExtensionMgr;
$version = new SeedDMS_Version;
class_alias('Seeddms\Seeddms\ExtensionMgr', 'SeedDMS_Extension_Mgr');
/* Declare an alias as long as it used by extensions */
class_alias('Seeddms\Seeddms\ExtensionBase', 'SeedDMS_ExtBase');
$extmgr = new ExtensionMgr($settings->_rootDir."/ext", $settings->_cacheDir, $settings->_repositoryUrl, $settings->_proxyUrl, $settings->_proxyUser, $settings->_proxyPassword);
foreach($extmgr->getExtensionConfiguration() as $extname=>$extconf) {
if($extconf['disable']) {
$settings->disableExtension($extname);
continue;
}
foreach($extMgr->getExtensionConfiguration() as $extname=>$extconf) {
if(!$settings->extensionIsDisabled($extname)) {
$disabled = false;
if($extmgr->checkExtensionByName($extname, $extconf)) {
$disabled = true;
if($extMgr->checkExtensionByName($extname, $extconf)) {
$disabled = false;
$settings->enableExtension($extname);
} else {
$disabled = true;
$settings->disableExtension($extname);
// echo $extmgr->getErrorMsg();
// echo $extMgr->getErrorMsg();
}
/* check for requirements */
/*
if(!empty($extconf['constraints']['depends']['seeddms'])) {
$t = explode('-', $extconf['constraints']['depends']['seeddms'], 2);
if(SeedDMS_Extension_Mgr::cmpVersion($t[0], $version->version()) > 0 || ($t[1] && SeedDMS_Extension_Mgr::cmpVersion($t[1], $version->version()) < 0))
$disabled = true;
else
$disabled = false;
}
*/
if(!$disabled) {
if(isset($extconf['class']) && isset($extconf['class']['file']) && isset($extconf['class']['name'])) {
$classfile = $settings->_rootDir."/ext/".$extname."/".$extconf['class']['file'];
@ -49,7 +47,7 @@ foreach($extmgr->getExtensionConfiguration() as $extname=>$extconf) {
include($classfile);
$obj = new $extconf['class']['name']($settings, null, $logger);
if(method_exists($obj, 'init'))
$obj->init($extmgr);
$obj->init($extMgr);
}
}
if(isset($extconf['language']['file'])) {
@ -59,15 +57,14 @@ foreach($extmgr->getExtensionConfiguration() as $extname=>$extconf) {
include($langfile);
if(isset($__lang) && $__lang) {
foreach($__lang as $lang=>&$data) {
$translator->addPhrases($lang, $data);
if(isset($GLOBALS['LANG'][$lang]))
$GLOBALS['LANG'][$lang] = array_merge($GLOBALS['LANG'][$lang], $data);
else
$GLOBALS['LANG'][$lang] = $data;
}
}
}
}
}
} else {
// Ensure $settings->_extensions has an entry for the extension, even if
// the extension is disabled already.
$settings->disableExtension($extname);
}
}

View File

@ -18,31 +18,48 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
use Seeddms\Seeddms\Translator;
$translator = new Translator($settings);
$translator->init();
/* All remaining functions in this file are deprecated and should
* not be used anymore. Use instead the equivalent methods in class
* Translator;
*/
function getAvailableLanguages() { /* {{{ */
trigger_error("getAvailableLanguages() is deprecated.", E_USER_DEPRECATED);
foreach(debug_backtrace() as $n) {
trigger_error($n['file'].": Line ".$n['line'], E_USER_DEPRECATED);
$LANG = array();
$MISSING_LANG = array();
$__languages = getLanguages();
if(!in_array($settings->_language, $__languages))
$__languages[] = $settings->_language;
foreach($__languages as $_lang) {
if(file_exists($settings->_rootDir . "languages/" . $_lang . "/lang.inc")) {
include $settings->_rootDir . "languages/" . $_lang . "/lang.inc";
$LANG[$_lang] = $text;
}
}
unset($text);
return $GLOBALS['settings']->getAvailableLanguages();
function getAvailableLanguages() { /* {{{ */
global $settings;
$languages = array();
$path = $settings->_rootDir . "languages/";
$handle = opendir($path);
while ($entry = readdir($handle) )
{
if ($entry == ".." || $entry == ".")
continue;
else if (is_dir($path . $entry))
array_push($languages, $entry);
}
closedir($handle);
asort($languages);
return $languages;
} /* }}} */
function getLanguages() { /* {{{ */
trigger_error("getLanguages() is deprecated.", E_USER_DEPRECATED);
foreach(debug_backtrace() as $n) {
trigger_error($n['file'].": Line ".$n['line'], E_USER_DEPRECATED);
global $settings;
if($settings->_availablelanguages) {
return $settings->_availablelanguages;
}
return $GLOBALS['settings']->getLanguages();
return getAvailableLanguages();
} /* }}} */
/**
@ -60,25 +77,101 @@ function getLanguages() { /* {{{ */
* @param string $lang use this language instead of the currently set lang
*/
function getMLText($key, $replace = array(), $defaulttext = null, $lang="") { /* {{{ */
// trigger_error("getMLText() is deprecated.", E_USER_DEPRECATED);
// foreach(debug_backtrace() as $n) {
// trigger_error($n['file'].": Line ".$n['line'], E_USER_DEPRECATED);
// }
GLOBAL $settings, $LANG, $session, $MISSING_LANG;
return $GLOBALS['translator']->translate($key, $replace, $defaulttext, $lang);
$trantext = '';
if(0 && $settings->_otrance) {
$trantext = '<form style="display: inline-block;" accept-charset="UTF-8" action="http://translate.seeddms.org/connector/index" target="_blank" method="post"><input type="hidden" value="" name="oTranceKeys['.$key.']"><input type="submit" value="submit" class="btn btn-mini"/></form>';
}
if(!$lang) {
if($session)
$lang = $session->getLanguage();
else
$lang = $settings->_language;
}
if(!isset($LANG[$lang][$key]) || !$LANG[$lang][$key]) {
if ($defaulttext === null) {
$MISSING_LANG[$key] = $lang; //$_SERVER['SCRIPT_NAME'];
if(!empty($LANG[$settings->_language][$key])) {
$tmpText = $LANG[$settings->_language][$key];
} else {
$tmpText = '**'.$key.'**';
}
} else
$tmpText = $defaulttext;
} else
$tmpText = $LANG[$lang][$key];
if(0 && $settings->_otrance) {
$_GLOBALS['used_langs'][$key] = $tmpText;
}
if (count($replace) == 0)
return $tmpText.$trantext;
$keys = array_keys($replace);
foreach ($keys as $key)
$tmpText = str_replace("[".$key."]", $replace[$key], $tmpText);
return $tmpText;
} /* }}} */
function printMLText($key, $replace = array(), $defaulttext = null, $lang="") { /* {{{ */
$GLOBALS['translator']->print($key, $replace, $defaulttext, $lang);
function printMLText($key, $replace = array(), $defaulttext = null, $lang="") /* {{{ */
{
print getMLText($key, $replace, $defaulttext, $lang);
}
/* }}} */
function printReviewStatusText($status, $date=0) { /* {{{ */
$GLOBALS['translator']->printReviewStatusText($status, $date);
if (is_null($status)) {
print getMLText("status_unknown");
}
else {
switch ($status) {
case -2:
print getMLText("status_reviewer_removed");
break;
case -1:
print getMLText("status_reviewer_rejected").($date !=0 ? " ".$date : "");
break;
case 0:
print getMLText("status_not_reviewed");
break;
case 1:
print getMLText("status_reviewed").($date !=0 ? " ".$date : "");
break;
default:
print getMLText("status_unknown");
break;
}
}
} /* }}} */
function getReviewStatusText($status, $date=0) { /* {{{ */
return $GLOBALS['translator']->getReviewStatusText($status, $date);
if (is_null($status)) {
return getMLText("status_unknown");
}
else {
switch ($status) {
case -2:
return getMLText("status_reviewer_removed");
break;
case -1:
return getMLText("status_reviewer_rejected").($date !=0 ? " ".$date : "");
break;
case 0:
return getMLText("status_not_reviewed");
break;
case 1:
return getMLText("status_reviewed").($date !=0 ? " ".$date : "");
break;
default:
return getMLText("status_unknown");
break;
}
}
} /* }}} */
function printReceiptStatusText($status, $date=0) { /* {{{ */
@ -144,34 +237,221 @@ function getRevisionStatusText($status, $date=0) { /* {{{ */
} /* }}} */
function printApprovalStatusText($status, $date=0) { /* {{{ */
$GLOBALS['translator']->printApprovalStatusText($status, $date);
if (is_null($status)) {
print getMLText("status_unknown");
}
else {
switch ($status) {
case -2:
print getMLText("status_approver_removed");
break;
case -1:
print getMLText("status_approval_rejected").($date !=0 ? " ".$date : "");
break;
case 0:
print getMLText("status_not_approved");
break;
case 1:
print getMLText("status_approved").($date !=0 ? " ".$date : "");
break;
default:
print getMLText("status_unknown");
break;
}
}
} /* }}} */
function getApprovalStatusText($status, $date=0) { /* {{{ */
return $GLOBALS['translator']->getApprovalStatusText($status, $date);
if (is_null($status)) {
return getMLText("status_unknown");
}
else {
switch ($status) {
case -2:
return getMLText("status_approver_removed");
break;
case -1:
return getMLText("status_approval_rejected").($date !=0 ? " ".$date : "");
break;
case 0:
return getMLText("status_not_approved");
break;
case 1:
return getMLText("status_approved").($date !=0 ? " ".$date : "");
break;
default:
return getMLText("status_unknown");
break;
}
}
} /* }}} */
function printOverallStatusText($status) { /* {{{ */
$GLOBALS['translator']->printOverallStatusText($status);
print getOverallStatusText($status);
} /* }}} */
function getOverallStatusText($status) { /* {{{ */
return $GLOBALS['translator']->getOverallStatusText($status);
if (is_null($status)) {
return getMLText("assumed_released");
}
else {
switch($status) {
case S_IN_WORKFLOW:
return getMLText("in_workflow");
break;
case S_DRAFT_REV:
return getMLText("draft_pending_review");
break;
case S_DRAFT_APP:
return getMLText("draft_pending_approval");
break;
case S_RELEASED:
return getMLText("released");
break;
case S_REJECTED:
return getMLText("rejected");
break;
case S_OBSOLETE:
return getMLText("obsolete");
break;
case S_EXPIRED:
return getMLText("expired");
break;
case S_IN_REVISION:
return getMLText("in_revision");
break;
case S_DRAFT:
return getMLText("draft");
break;
case S_NEEDS_CORRECTION:
return getMLText("needs_correction");
break;
default:
return getMLText("status_unknown");
break;
}
}
} /* }}} */
function getAttributeTypeText($attrdef) { /* {{{ */
return $GLOBALS['translator']->getAttributeTypeText($attrdef);
$t = '';
switch($attrdef->getType()) {
case SeedDMS_Core_AttributeDefinition::type_int:
$t = getMLText("attrdef_type_int");
break;
case SeedDMS_Core_AttributeDefinition::type_float:
$t = getMLText("attrdef_type_float");
break;
case SeedDMS_Core_AttributeDefinition::type_string:
$t = getMLText("attrdef_type_string");
break;
case SeedDMS_Core_AttributeDefinition::type_boolean:
$t = getMLText("attrdef_type_boolean");
break;
case SeedDMS_Core_AttributeDefinition::type_date:
$t = getMLText("attrdef_type_date");
break;
case SeedDMS_Core_AttributeDefinition::type_email:
$t = getMLText("attrdef_type_email");
break;
case SeedDMS_Core_AttributeDefinition::type_url:
$t = getMLText("attrdef_type_url");
break;
case SeedDMS_Core_AttributeDefinition::type_boolean:
$t = getMLText("attrdef_type_boolean");
break;
case SeedDMS_Core_AttributeDefinition::type_folder:
$t = getMLText("attrdef_type_folder");
break;
case SeedDMS_Core_AttributeDefinition::type_document:
$t = getMLText("attrdef_type_document");
break;
case SeedDMS_Core_AttributeDefinition::type_user:
$t = getMLText("attrdef_type_user");
break;
case SeedDMS_Core_AttributeDefinition::type_group:
$t = getMLText("attrdef_type_group");
break;
}
return $t;
} /* }}} */
function getAttributeObjectTypeText($attrdef) { /* {{{ */
return $GLOBALS['translator']->getAttributeObjectTypeText($attrdef);
$ot = '';
switch($attrdef->getObjType()) {
case SeedDMS_Core_AttributeDefinition::objtype_all:
$ot = getMLText("all");
break;
case SeedDMS_Core_AttributeDefinition::objtype_folder:
$ot = getMLText("folder");
break;
case SeedDMS_Core_AttributeDefinition::objtype_document:
$ot = getMLText("document");
break;
case SeedDMS_Core_AttributeDefinition::objtype_documentcontent:
$ot = getMLText("documentcontent");
break;
default:
$ot = getMLText('objtype_unknown');
}
return $ot;
} /* }}} */
function getAttributeValidationText($error, $attrname='', $attrvalue='', $regex='') { /* {{{ */
return $GLOBALS['translator']->getAttributeValidationText($error, $attrname, $attrvalue, $regex);
$arr = getAttributeValidationError($error, $attrname, $attrvalue, $regex);
return getMLText($arr[0], $arr[1]);
} /* }}} */
function getAttributeValidationError($error, $attrname='', $attrvalue='', $regex='') { /* {{{ */
return $GLOBALS['translator']->getAttributeValidationError($error, $attrname, $attrvalue, $regex);
if(is_object($attrvalue))
$attrvalue = $attrvalue->getId();
switch($error) {
case 14:
return array("attr_not_in_valueset", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 13:
return array("attr_not_a_group", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 12:
return array("attr_not_a_user", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 11:
return array("attr_not_a_folder", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 10:
return array("attr_not_a_document", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 9:
return array("attr_malformed_date", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 8:
return array("attr_malformed_boolean", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 7:
return array("attr_malformed_float", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 6:
return array("attr_malformed_int", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 5:
return array("attr_malformed_email", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 4:
return array("attr_malformed_url", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 3:
return array("attr_no_regex_match", array('attrname'=>$attrname, 'value'=>$attrvalue, 'regex'=>$regex));
break;
case 2:
return array("attr_max_values", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 1:
return array("attr_min_values", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
default:
return array("attr_validation_error", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
}
} /* }}} */

View File

@ -21,5 +21,5 @@
require_once("Log.php");
require_once("inc/inc.Utils.php");
$logger = getLogger($settings, '', (int) $settings->_logFileMaxLevel);
$logger = getLogger('', (int) $settings->_logFileMaxLevel);

View File

@ -12,10 +12,8 @@
* @version Release: @package_version@
*/
require_once("inc.ClassEmailNotify.php");
require_once("inc.ClassNotificationService.php");
$notifier = new SeedDMS_NotificationService($logger, $settings, $translator);
global $logger;
$notifier = new SeedDMS_NotificationService($logger, $settings);
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) {
@ -26,7 +24,7 @@ if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
}
if($settings->_enableEmail) {
$notifier->addService(new SeedDMS_EmailNotify($dms, $translator, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword, $settings->_smtpLazySSL, $settings->_smtpForceFrom), 'email');
$notifier->addService(new SeedDMS_EmailNotify($dms, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword, $settings->_smtpLazySSL, $settings->_smtpForceFrom), 'email');
}
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {

View File

@ -18,8 +18,6 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
use Seeddms\Seeddms\Settings;
require_once('inc.ClassSettings.php');
if(defined("SEEDDMS_CONFIG_FILE"))
$settings = new Settings(SEEDDMS_CONFIG_FILE);
@ -62,7 +60,7 @@ if($settings->_dbDriver == 'sqlite' && empty($settings->_dbDatabase)) {
$settings->_dbDatabase = $__datadir."/content.db";
}
ini_set('include_path', $settings->_rootDir.'..'. PATH_SEPARATOR .ini_get('include_path'));
ini_set('include_path', $settings->_rootDir.'pear'. PATH_SEPARATOR .ini_get('include_path'));
if(!empty($settings->_extraPath)) {
ini_set('include_path', $settings->_extraPath. PATH_SEPARATOR .ini_get('include_path'));
}
@ -77,8 +75,12 @@ if(isset($settings->_maxExecutionTime)) {
* relative to it.
*/
ini_set('include_path', $settings->_rootDir. PATH_SEPARATOR .ini_get('include_path'));
/* Add root Dir.'../pear'. Needed because the SeedDMS_Core, etc. are included
* relative to it.
*/
ini_set('include_path', $settings->_rootDir.'../pear'. PATH_SEPARATOR .ini_get('include_path'));
/* composer is installed in vendor directory, but install tool does not need it */
/* composer is installed in pear directory, but install tool does not need it */
if(!defined("SEEDDMS_INSTALL"))
require_once 'vendor/autoload.php';

View File

@ -27,6 +27,8 @@ class SeedDMS_ExpiredDocumentsTask extends SeedDMS_SchedulerTaskBase { /* {{{ */
$tableformathead = " %-10s %5s %-60s";
$tableformathtml = "<tr><td>%s</td><td>%d</td><td>%s</td></tr>";
$tableformatheadhtml = "<tr><th>%s</th><th>%s</th><th>%s</th></tr>";
$body = '';
$bodyhtml = '';
require_once('inc/inc.ClassEmailNotify.php');
$email = new SeedDMS_EmailNotify($dms, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword);
@ -37,8 +39,6 @@ class SeedDMS_ExpiredDocumentsTask extends SeedDMS_SchedulerTaskBase { /* {{{ */
if(!$u->isGuest() && !$u->isDisabled()) {
$docs = $dms->getDocumentsExpired(intval($taskparams['days']), $u);
if (count($docs)>0) {
$body = '';
$bodyhtml = '';
$bodyhtml .= "<table>".PHP_EOL;
$bodyhtml .= sprintf($tableformatheadhtml."\n", getMLText("expires", array(), ""), "ID", getMLText("name", array(), ""));
$body .= sprintf($tableformathead."\n", getMLText("expires", array(), ""), "ID", getMLText("name", array(), ""));
@ -66,8 +66,6 @@ class SeedDMS_ExpiredDocumentsTask extends SeedDMS_SchedulerTaskBase { /* {{{ */
} elseif($taskparams['email']) {
$docs = $dms->getDocumentsExpired(intval($taskparams['days']));
if (count($docs)>0) {
$body = '';
$bodyhtml = '';
$bodyhtml .= "<table>".PHP_EOL;
$bodyhtml .= sprintf($tableformatheadhtml."\n", getMLText("expiration_date", array(), ""), "ID", getMLText("name", array(), ""));
$body .= sprintf($tableformathead."\n", getMLText("expiration_date", array(), ""), "ID", getMLText("name", array(), ""));

View File

@ -86,29 +86,21 @@ function getPeriodOfTime($timestamp) { /* {{{ */
$timestamp = strtotime($timestamp);
$time = time() - $timestamp; // to get the time since that moment
$rel = 'ago';
if ($time < 0) {
$time = -$time;
$rel = 'from_now';
}
$time = ($time < 0) ? -$time : $time;
$time = ($time<1)? 1 : $time;
$tokens = array (
31536000 => 'year',
2592000 => 'month',
604800 => 'week',
86400 => 'day',
3600 => 'hour',
60 => 'minute',
1 => 'second'
31536000 => 'abbr_year',
2592000 => 'abbr_month',
604800 => 'abbr_week',
86400 => 'abbr_day',
3600 => 'abbr_hour',
60 => 'abbr_minute',
1 => 'abbr_second'
);
if($time == 0)
return getMLText('now');
foreach ($tokens as $unit => $text) {
if ($time < $unit) continue;
$numberOfUnits = floor($time / $unit);
return getMLText($text.($numberOfUnits > 1 ? 's' : '').'_'.$rel, ['num'=>$numberOfUnits]);
return $numberOfUnits.' '.(($numberOfUnits>1) ? getMLText($text):getMLText($text));
}
} /* }}} */
@ -119,7 +111,7 @@ function getPeriodOfTime($timestamp) { /* {{{ */
* @return integer/boolean unix timestamp or false in case of an error
*/
function makeTsFromDate($date) { /* {{{ */
return $date ? strtotime($date) : false;
return strtotime($date);
} /* }}} */
/*
@ -470,31 +462,10 @@ function getFilenameByDocname($content) { /* {{{ */
return mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $filename);
} /* }}} */
function getStreamContext($proxyurl, $proxyuser, $proxypass) { /* {{{ */
if(!$proxyurl)
return null;
$url = parse_url($proxyurl);
$opts = [
$url['scheme'] => [
'proxy' => 'tcp://'.$url['host'].($url['port'] ? ':'.$url['port'] : ''),
'request_fulluri' => true,
]
];
if($proxyuser && $proxypass) {
$auth = base64_encode($proxyurl.':'.$this->proxypass);
$opts[$url['scheme']] = [
'header' => [
'Proxy-Authorization: Basic '.$auth
]
];
}
function getLogger($prefix='', $mask=PEAR_LOG_INFO) { /* {{{ */
global $settings;
$context = stream_context_create($opts);
return $context;
} /* }}} */
function getLogger($settings, $prefix='', $mask=PEAR_LOG_INFO) { /* {{{ */
if(!empty($settings->_logFileEnable)) {
if($settings->_logFileEnable) {
if ($settings->_logFileRotation=="h") $logname=date("YmdH", time());
else if ($settings->_logFileRotation=="d") $logname=date("Ymd", time());
else $logname=date("Ym", time());
@ -650,7 +621,7 @@ function checkFormKey($formid='', $method='POST') { /* {{{ */
* quota is reached. Negative values indicate a disk usage above quota.
*/
function checkQuota($user) { /* {{{ */
global $settings;
global $settings, $dms;
/* check if quota is turn off system wide */
if($settings->_quota == 0)
@ -772,7 +743,6 @@ function get_extension($mimetype) { /* {{{ */
case 'video/webm': return '.webm';
case 'application/zip': return '.zip';
case 'application/x-gzip': return '.gz';
case 'application/x-xz': return '.xz';
case 'application/x-rar': return '.rar';
case 'application/x-7z-compressed': return '.7z';
case 'application/x-compressed-tar': return '.tgz';
@ -1025,6 +995,39 @@ function resolveTask($task) { /* {{{ */
return $task;
} /* }}} */
/**
* Return nonce for CSP
*
* @return string
*/
function createNonce() { /* {{{ */
$length = 16;
$usable = true;
$bytes = openssl_random_pseudo_bytes($length, $usable);
if ($usable === false) {
// weak
// @TODO do something?
}
return base64_encode($bytes);
} /* }}} */
/**
* Create a real uniqid for cryptographic purposes
*
* @ return string
*/
function uniqidReal($lenght = 13) {
// uniqid gives 13 chars, but you could adjust it to your needs.
if (function_exists("random_bytes")) {
$bytes = random_bytes(ceil($lenght / 2));
} elseif (function_exists("openssl_random_pseudo_bytes")) {
$bytes = openssl_random_pseudo_bytes(ceil($lenght / 2));
} else {
throw new Exception("no cryptographically secure random function available");
}
return substr(bin2hex($bytes), 0, $lenght);
}
/**
* Compare function for sorting users by login
*
@ -1147,9 +1150,9 @@ function getMandatoryReviewers($folder, $document, $user) { /* {{{ */
foreach($revg as $gid) {
if($g = $dms->getGroup($gid)) {
if($document)
$accessmode = $document->getGroupAccessMode($g);
$accessmode = $document->getGroupAccessMode($u);
else
$accessmode = $folder->getGroupAccessMode($g);
$accessmode = $folder->getGroupAccessMode($u);
if($accessmode < M_READ || !$g->getUsers())
$reviewers["ng"][] = $g->getId();
else
@ -1244,9 +1247,9 @@ function getMandatoryApprovers($folder, $document, $user) { /* {{{ */
foreach($appg as $gid) {
if($g = $dms->getGroup($gid)) {
if($document)
$accessmode = $document->getGroupAccessMode($g);
$accessmode = $document->getGroupAccessMode($u);
else
$accessmode = $folder->getGroupAccessMode($g);
$accessmode = $folder->getGroupAccessMode($u);
if($accessmode < M_READ || !$g->getUsers())
$approvers["ng"][] = $g->getId();
else
@ -1257,7 +1260,33 @@ function getMandatoryApprovers($folder, $document, $user) { /* {{{ */
return $approvers;
} /* }}} */
require_once "inc/inc.ClassUtilities.php";
/**
* Class with various utility methods
*
* This class will sooner or later comprise the functions above
*
*/
class SeedDMS_Utils { /* {{{ */
/**
* Recursively remove a directory on disc
*
* @param string $dir name of directory
*/
static public function rrmdir($dir) { /* {{{ */
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir."/".$object) == "dir") self::rrmdir($dir."/".$object); else unlink($dir."/".$object);
}
}
reset($objects);
rmdir($dir);
}
} /* }}} */
} /* }}} */
/**
* Class for creating encrypted api keys
@ -1403,8 +1432,6 @@ class SeedDMS_Search { /* {{{ */
public $searchparams;
protected $total;
protected $dcount;
protected $fcount;
@ -1417,10 +1444,6 @@ class SeedDMS_Search { /* {{{ */
protected $searchTime;
protected $facets;
protected $stats;
public function __construct($dms, $user, $fulltextservice, $settings) {
$this->dms = $dms;
$this->user = $user;
@ -1429,7 +1452,6 @@ class SeedDMS_Search { /* {{{ */
$this->searchparams = [];
$this->dcount = 0;
$this->fcount = 0;
$this->total = 0;
$this->totalPages = 0;
$this->entries = array();
$this->terms = array();
@ -1857,17 +1879,16 @@ class SeedDMS_Search { /* {{{ */
$attributes = array();
foreach($attributes as $attrdefid=>$attribute) {
$attrdef = $this->dms->getAttributeDefinition($attrdefid);
if($attribute) {
if($attrdef = $this->dms->getAttributeDefinition($attrdefid)) {
if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) {
if(is_array($attribute)) {
if(!empty($attributes[$attrdefid]['from']))
$attributes[$attrdefid]['from'] = date('Y-m-d', makeTsFromDate($attribute['from']));
if(!empty($attributes[$attrdefid]['to']))
$attributes[$attrdefid]['to'] = date('Y-m-d', makeTsFromDate($attribute['to']));
} else {
$attributes[$attrdefid] = date('Y-m-d', makeTsFromDate($attribute));
}
if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) {
if(is_array($attribute)) {
if(!empty($attributes[$attrdefid]['from']))
$attributes[$attrdefid]['from'] = date('Y-m-d', makeTsFromDate($attribute['from']));
if(!empty($attributes[$attrdefid]['to']))
$attributes[$attrdefid]['to'] = date('Y-m-d', makeTsFromDate($attribute['to']));
} else {
$attributes[$attrdefid] = date('Y-m-d', makeTsFromDate($attribute));
}
}
}

View File

@ -18,11 +18,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
namespace Seeddms\Seeddms;
class SeedDMS_Version { /* {{{ */
class Version { /* {{{ */
const _number = "6.0.36";
const _number = "6.0.33";
const _string = "SeedDMS";
function __construct() {
@ -49,7 +47,7 @@ class Version { /* {{{ */
function banner() { /* {{{ */
return self::_string .", ". self::_number;
} /* }}} */
}
/**
* Compare two version
@ -86,4 +84,3 @@ class Version { /* {{{ */
} /* }}} */
class_alias('Seeddms\Seeddms\Version', 'SeedDMS_Version');

View File

@ -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");
@ -59,37 +59,38 @@ if (true) {
$container->set('fulltextservice', $fulltextservice);
$container->set('notifier', $notifier);
$container->set('authenticator', $authenticator);
$container->set('translator', $translator);
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
$hookObj->addRoute(array('dms'=>$dms, 'app'=>$app, 'settings'=>$settings, 'conversionmgr'=>$conversionmgr, 'authenticator'=>$authenticator, 'fulltextservice'=>$fulltextservice, 'logger'=>$logger, 'notifier'=>$notifier, 'translator'=>$translator));
$hookObj->addRoute(array('dms'=>$dms, 'app'=>$app, 'settings'=>$settings, 'conversionmgr'=>$conversionmgr, 'authenticator'=>$authenticator, 'fulltextservice'=>$fulltextservice, 'logger'=>$logger));
}
}
}
/* 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"));
?>
<html>

View File

@ -5,7 +5,7 @@ define("SEEDDMS_INSTALL", "on");
define("SEEDDMS_VERSION", $ver->version());
include("../inc/inc.Settings.php");
$settings = new Seeddms\Seeddms\Settings();
$settings = new Settings();
$rootDir = realpath ("..");
if(file_exists($rootDir.'/../www'))
$rootDir = realpath($rootDir.'/..').'/www';

View File

@ -69,7 +69,7 @@ define("SEEDDMS_VERSION", $ver->version());
require_once('../inc/inc.ClassSettings.php');
$configDir = Seeddms\Seeddms\Settings::getConfigDir();
$configDir = Settings::getConfigDir();
/**
* Check if ENABLE_INSTALL_TOOL exists in config dir
@ -92,7 +92,8 @@ if (!file_exists($configDir."/settings.xml")) {
}
// Set folders settings
$settings = new Seeddms\Seeddms\Settings($configDir."/settings.xml");
$settings = new Settings();
$settings->load($configDir."/settings.xml");
$rootDir = realpath ("..");
$installPath = realpath ("install.php");

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -29,9 +29,6 @@ require_once("../inc/inc.ClassUI.php");
require_once("../inc/inc.ClassController.php");
require_once("../inc/inc.Notification.php");
use Seeddms\Seeddms\Session;
use Seeddms\Seeddms\Utilities;
require_once("../inc/inc.ClassSession.php");
require_once("../inc/inc.ClassPasswordStrength.php");
require_once("../inc/inc.ClassPasswordHistoryManager.php");
@ -39,7 +36,7 @@ require_once("../inc/inc.ClassPasswordHistoryManager.php");
/* Load session */
if (isset($_COOKIE["mydms_session"])) {
$dms_session = $_COOKIE["mydms_session"];
$session = new Session($db);
$session = new SeedDMS_Session($db);
if(!$resArr = $session->load($dms_session)) {
header('Content-Type: application/json');
echo json_encode(array('error'=>1));
@ -106,12 +103,6 @@ switch($command) {
}
break; /* }}} */
case 'randomstring': /* {{{ */
$len = $_REQUEST["len"] ?? 16;
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'string'=>Utilities::makeRandomString($len)));
break; /* }}} */
case 'sessioninfo': /* {{{ */
if($user) {
header('Content-Type: application/json');
@ -306,7 +297,7 @@ switch($command) {
case 'testmail': /* {{{ */
if($user && $user->isAdmin()) {
if($user->getEmail()) {
$emailobj = new SeedDMS_EmailNotify($dms, $translator, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword, $settings->_smtpLazySSL, $settings->_smtpForceFrom);
$emailobj = new SeedDMS_EmailNotify($dms, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword, $settings->_smtpLazySSL, $settings->_smtpForceFrom);
$emailobj->setDebug(true);
$params = array();
$params['url'] = getBaseUrl().$settings->_httpRoot;
@ -358,7 +349,7 @@ switch($command) {
$notifier->sendMovedFolderMail($mfolder, $user, $oldFolder);
}
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_folder_moved'), 'data'=>''));
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_move_folder'), 'data'=>''));
add_log_line("move folder ".$mfolder->getId()." to ".$folder->getId());
} else {
header('Content-Type: application/json');
@ -404,7 +395,7 @@ switch($command) {
$notifier->sendMovedDocumentMail($mdocument, $user, $oldFolder);
}
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_moved'), 'data'=>''));
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_move_document'), 'data'=>''));
add_log_line("move document ".$mdocument->getId()." to folder ".$folder->getId());
} else {
header('Content-Type: application/json');
@ -447,7 +438,7 @@ switch($command) {
if($targetdoc->addContent($versions[0]->getComment(), $versions[0]->getUser(), $dms->contentDir . $versions[0]->getPath(), $versions[0]->getOriginalFileName(), $versions[0]->getFileType(), $versions[0]->getMimeType())) { //, $reviewers=array(), $approvers=array(), $version=0, $attributes=array(), $workflow=null) {
if($mdocument->remove()) {
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_content_transfered'), 'data'=>''));
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_transfer_content'), 'data'=>''));
add_log_line("transfer content of document ".$mdocument->getId()." to document ".$targetdoc->getId());
} else {
header('Content-Type: application/json');
@ -700,52 +691,6 @@ switch($command) {
}
break; /* }}} */
case 'setoriginalname': /* {{{ */
if($user && $user->isAdmin()) {
if(checkFormKey('setoriginalname')) {
$content = $dms->getDocumentContent($_REQUEST['contentid']);
if($content) {
$document = $content->getDocument();
if ($document->getAccessMode($user) >= M_READWRITE) {
$oldname = $content->getOriginalFileName();
$newname = trim($_REQUEST['name']);
if ($oldname != $newname) {
if (!$content->setOriginalFilename($newname)) {
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>'Error setting original file name', 'data'=>''));
} else {
$fileType = pathinfo($newname, PATHINFO_EXTENSION);
$content->setFileType($fileType);
if($fulltextservice && ($index = $fulltextservice->Indexer())) {
$lucenesearch = $fulltextservice->Search();
if($hit = $lucenesearch->getDocument($document->getId())) {
$index->reindexDocument($hit->id);
$index->commit();
}
}
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_orig_filename_changed'), 'data'=>''));
add_log_line("set original filename '".$_REQUEST['name']."' of document ".$document->getId().":".$content->getVersion());
}
} else {
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_orig_filename_unchanged'), 'data'=>''));
}
} else {
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>getMLText('access_denied'), 'data'=>''));
}
} else {
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_doc_id'), 'data'=>''));
}
} else {
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_request_token'), 'data'=>''));
}
}
break; /* }}} */
case 'setmimetype': /* {{{ */
if($user && $user->isAdmin()) {
if(checkFormKey('setmimetype', 'GET')) {
@ -800,217 +745,6 @@ switch($command) {
}
break; /* }}} */
case 'uploadremotedocument': /* {{{ */
if($user) {
if(checkFormKey('')) {
if (!isset($_POST["folderid"]) || !is_numeric($_POST["folderid"]) || intval($_POST["folderid"])<1) {
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>getMLText("invalid_folder_id")));
exit;
}
$folderid = $_POST["folderid"];
$folder = $dms->getFolder($folderid);
if (!is_object($folder)) {
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>getMLText("invalid_folder_id")));
exit;
}
if ($folder->getAccessMode($user, 'addDocument') < M_READWRITE) {
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>getMLText("access_denied")));
exit;
}
if($settings->_quota > 0) {
$remain = checkQuota($user);
if ($remain < 0) {
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>getMLText("quota_exceeded", array('bytes'=>SeedDMS_Core_File::format_filesize(abs($remain))))));
exit;
}
}
$fullfile = tempnam(sys_get_temp_dir(), '');
$fp = fopen($fullfile, 'w');
set_time_limit(0); // unlimited max execution time
$headers = [];
$options = array(
CURLOPT_FILE => $fp,
CURLOPT_TIMEOUT => 120,
CURLOPT_URL => $_POST['remoteurl'],
CURLOPT_HEADER => false,
CURLOPT_FOLLOWLOCATION => true,
);
$options[CURLOPT_HEADERFUNCTION] = function($curl, $header) use (&$headers) {
$len = strlen($header);
$header = explode(':', $header, 2);
if (count($header) < 2) // ignore invalid headers
return $len;
$headers[strtolower(trim($header[0]))][] = trim($header[1]);
return $len;
};
if($settings->_proxyUrl) {
$options[CURLOPT_PROXY] = $settings->_proxyUrl;
if($settings->_proxyUser) {
$options[CURLOPT_PROXYUSERPWD] = $settings->_proxyUser.':'.$settings->_proxyPassword;
}
}
$ch = curl_init();
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
curl_close($ch);
fclose($fp);
$userfiletmp = $fullfile;
$userfilename = basename(urldecode($_POST['remoteurl']));
if (preg_match('/Content-Disposition:.*?filename="(.+?)"/', $headers['content-disposition'][0], $matches)) {
$userfilename = $matches[1];
}
$userfiletype = $headers['content-type'][0];
$fileType = ".".pathinfo($userfilename, PATHINFO_EXTENSION);
if($fileType == ".") {
$fileType = ".".SeedDMS_Core_File::fileExtension($userfiletype);
$userfilename .= ".".SeedDMS_Core_File::fileExtension($userfiletype);
}
//$finfo = finfo_open(FILEINFO_MIME_TYPE);
//finfo_file($finfo, $fullfile);
if (!empty($_POST["name"]))
$name = $_POST["name"];
else
$name = utf8_basename($userfilename);
/* Check if name already exists in the folder */
if(!$settings->_enableDuplicateDocNames) {
if($folder->hasDocumentByName($name)) {
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>getMLText("document_duplicate_name")));
exit;
}
}
if(isset($_POST["attributes"]))
$attributes = $_POST["attributes"];
else
$attributes = array();
if(isset($_POST["comment"]))
$comment = trim($_POST["comment"]);
else
$comment = '';
// Get the list of reviewers and approvers for this document.
$reviewers = array();
$approvers = array();
$reviewers["i"] = array();
$reviewers["g"] = array();
$approvers["i"] = array();
$approvers["g"] = array();
$workflow = null;
if($settings->_workflowMode == 'traditional' || $settings->_workflowMode == 'traditional_only_approval') {
// add mandatory reviewers/approvers
if($settings->_workflowMode == 'traditional') {
$mreviewers = getMandatoryReviewers($folder, null, $user);
if($mreviewers['i'])
$reviewers['i'] = array_merge($reviewers['i'], $mreviewers['i']);
if($mreviewers['g'])
$reviewers['g'] = array_merge($reviewers['g'], $mreviewers['g']);
}
$mapprovers = getMandatoryApprovers($folder, null, $user);
if($mapprovers['i'])
$approvers['i'] = array_merge($approvers['i'], $mapprovers['i']);
if($mapprovers['g'])
$approvers['g'] = array_merge($approvers['g'], $mapprovers['g']);
} elseif($settings->_workflowMode == 'advanced') {
$workflow = $user->getMandatoryWorkflow();
}
$expires = false;
if($settings->_presetExpirationDate) {
$expires = strtotime($settings->_presetExpirationDate);
}
$keywords = isset($_POST["keywords"]) ? trim($_POST["keywords"]) : '';
$categories = isset($_POST["categories"]) ? $_POST["categories"] : null;
$cats = array();
if($categories) {
foreach($categories as $catid) {
if($cat = $dms->getDocumentCategory($catid))
$cats[] = $cat;
}
}
$controller = Controller::factory('AddDocument', array('dms'=>$dms, 'user'=>$user));
$controller->setParam('documentsource', 'upload');
$controller->setParam('folder', $folder);
$controller->setParam('fulltextservice', $fulltextservice);
$controller->setParam('name', $name);
$controller->setParam('comment', $comment);
$controller->setParam('expires', $expires);
$controller->setParam('keywords', $keywords);
$controller->setParam('categories', $cats);
$controller->setParam('owner', $user);
$controller->setParam('userfiletmp', $userfiletmp);
$controller->setParam('userfilename', $userfilename);
$controller->setParam('filetype', $fileType);
$controller->setParam('userfiletype', $userfiletype);
$minmax = $folder->getDocumentsMinMax();
$deviation = rand(10, 1000)/10;
if($settings->_defaultDocPosition == 'start')
$controller->setParam('sequence', $minmax['min'] - $deviation);
else
$controller->setParam('sequence', $minmax['max'] + $deviation);
$controller->setParam('reviewers', $reviewers);
$controller->setParam('approvers', $approvers);
$controller->setParam('reqversion', 1);
$controller->setParam('versioncomment', '');
$controller->setParam('attributes', $attributes);
$controller->setParam('attributesversion', array());
$controller->setParam('workflow', $workflow);
$controller->setParam('notificationgroups', array());
$controller->setParam('notificationusers', array());
$controller->setParam('maxsizeforfulltext', $settings->_maxSizeForFullText);
$controller->setParam('defaultaccessdocs', $settings->_defaultAccessDocs);
if(!$document = $controller()) {
$err = $controller->getErrorMsg();
if(is_string($err))
$errmsg = getMLText($err);
elseif(is_array($err)) {
$errmsg = getMLText($err[0], $err[1]);
} else {
$errmsg = $err;
}
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>$errmsg));
exit;
} else {
// Send notification to subscribers of folder.
if($notifier) {
$notifier->sendNewDocumentMail($document, $user);
}
}
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_updated'), 'data'=>$document->getID()));
add_log_line("updated document ".$document->getId());
} else {
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_request_token'), 'data'=>''));
}
}
break; /* }}} */
case 'uploaddocument': /* {{{ */
if($user) {
if(checkFormKey('')) {

View File

@ -148,7 +148,7 @@ if ($action == "setowner") {
$notifier->sendChangedDocumentOwnerMail($document, $user, $oldowner);
}
if($oldowner->getID() != $newowner->getID()) {
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_owner_set')));
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_setowner')));
}
}
@ -179,19 +179,21 @@ else if ($action == "setdefault") {
if($notifier) {
$notifier->sendChangedDocumentAccessMail($document, $user);
}
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_access_deleted')));
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_delete_access')));
} elseif($action == "addaccess") {
if($notifier) {
$notifier->sendChangedDocumentAccessMail($document, $user);
}
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_access_added')));
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_add_access')));
} elseif($action == "editaccess") {
if($notifier) {
$notifier->sendChangedDocumentAccessMail($document, $user);
}
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_access_edited')));
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_edit_access')));
}
add_log_line("");
header("Location:../out/out.DocumentAccess.php?documentid=".$documentid);
?>

View File

@ -27,12 +27,8 @@ include("../inc/inc.Init.php");
include("../inc/inc.Extension.php");
include("../inc/inc.DBInit.php");
include("../inc/inc.ClassUI.php");
include("../inc/inc.ClassController.php");
include("../inc/inc.Authentication.php");
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$controller = Controller::factory($tmp[1], array('dms'=>$dms, 'user'=>$user));
/* Check if the form data comes from a trusted request */
if(!checkFormKey('editattributes')) {
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_request_token"))),getMLText("invalid_request_token"));
@ -55,6 +51,7 @@ if (!is_object($document)) {
}
$folder = $document->getFolder();
$docPathHTML = getFolderPathHTML($folder, true). " / <a href=\"../out/out.ViewDocument.php?documentid=".$documentid."\">".$document->getName()."</a>";
if ($document->getAccessMode($user, 'editDocumentContentAttributes') < M_READWRITE) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
@ -76,25 +73,120 @@ foreach($version->getAttributes() as $ai=>$aa)
$oldattributes[$ai] = clone $aa;
$attributes = $_POST["attributes"];
$controller->setParam('document', $document);
$controller->setParam('version', $version);
$controller->setParam('attributes', $attributes);
if(!$controller()) {
$err = $controller->getErrorMsg();
if(is_string($err))
$errmsg = getMLText($err);
elseif(is_array($err)) {
$errmsg = getMLText($err[0], $err[1]);
} else {
$errmsg = $err;
if($attributes) {
foreach($attributes as $attrdefid=>$attribute) {
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
if($attribute) {
switch($attrdef->getType()) {
case SeedDMS_Core_AttributeDefinition::type_date:
if(is_array($attribute))
$attribute = array_map(fn($value): string => date('Y-m-d', makeTsFromDate($value)), $attribute);
else
$attribute = date('Y-m-d', makeTsFromDate($attribute));
break;
case SeedDMS_Core_AttributeDefinition::type_folder:
if(is_array($attribute))
$attribute = array_map(fn($value): object => $dms->getFolder((int) $value), $attribute);
else
$attribute = $dms->getFolder((int) $attribute);
break;
case SeedDMS_Core_AttributeDefinition::type_document:
if(is_array($attribute))
$attribute = array_map(fn($value): object => $dms->getDocument((int) $value), $attribute);
else
$attribute = $dms->getDocument((int) $attribute);
break;
case SeedDMS_Core_AttributeDefinition::type_user:
if(is_array($attribute))
$attribute = array_map(fn($value): object => $dms->getUser((int) $value), $attribute);
else
$attribute = $dms->getUser((int) $attribute);
break;
case SeedDMS_Core_AttributeDefinition::type_group:
if(is_array($attribute))
$attribute = array_map(fn($value): object => $dms->getGroup((int) $value), $attribute);
else
$attribute = $dms->getGroup((int) $attribute);
break;
}
if(!$attrdef->validate($attribute, $version, false)) {
$errmsg = getAttributeValidationText($attrdef->getValidationError(), $attrdef->getName(), $attribute);
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())), $errmsg);
}
if(!isset($oldattributes[$attrdefid]) || $attribute != $oldattributes[$attrdefid]->getValue()) {
if(!$version->setAttributeValue($dms->getAttributeDefinition($attrdefid), $attribute)) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
}
}
} elseif($attrdef->getMinValues() > 0) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("attr_min_values", array("attrname"=>$attrdef->getName())));
} elseif(isset($oldattributes[$attrdefid])) {
if(!$version->removeAttribute($dms->getAttributeDefinition($attrdefid)))
UI::exitError(getMLText("document_title", array("documentname" => $folder->getName())),getMLText("error_occured"));
}
}
}
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())), $errmsg);
}
if($notifier) {
$notifier->sendChangedVersionAttributesMail($version, $user, $oldattributes);
$newattributes = $version->getAttributes();
if($oldattributes) {
foreach($oldattributes as $attrdefid=>$attribute) {
if(!isset($newattributes[$attrdefid]) || $newattributes[$attrdefid]->getValueAsArray() !== $oldattributes[$attrdefid]->getValueAsArray()) {
if($notifier) {
$notifyList = $document->getNotifyList();
$subject = "attribute_changed_email_subject";
$message = "attribute_changed_email_body";
$params = array();
$params['name'] = $document->getName();
$params['version'] = $version->getVersion();
$params['attribute_name'] = $attribute->getAttributeDefinition()->getName();
$params['attribute_old_value'] = $oldattributes[$attrdefid]->getValue();
$params['attribute_new_value'] = isset($newattributes[$attrdefid]) ? $newattributes[$attrdefid]->getValue() : '';
$params['folder_path'] = $folder->getFolderPathPlain();
$params['username'] = $user->getFullName();
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
$notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
foreach ($notifyList["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
}
}
}
}
/* Check for new attributes which didn't have a value before */
if($newattributes) {
foreach($newattributes as $attrdefid=>$attribute) {
if(!isset($oldattributes[$attrdefid]) && $attribute) {
if($notifier) {
$notifyList = $document->getNotifyList();
$subject = "attribute_changed_email_subject";
$message = "attribute_changed_email_body";
$params = array();
$params['name'] = $document->getName();
$params['version'] = '';
$params['attribute_name'] = $dms->getAttributeDefinition($attrdefid)->getName();
$params['attribute_old_value'] = '';
$params['attribute_new_value'] = $attribute->getValue();
$params['folder_path'] = $folder->getFolderPathPlain();
$params['username'] = $user->getFullName();
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
$notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
foreach ($notifyList["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
}
}
}
}
add_log_line("?documentid=".$documentid);
header("Location:../out/out.DocumentVersionDetail.php?documentid=".$documentid."&version=".$versionid);
?>

View File

@ -53,6 +53,7 @@ if (!is_object($document)) {
}
$folder = $document->getFolder();
$docPathHTML = getFolderPathHTML($folder, true). " / <a href=\"../out/out.ViewDocument.php?documentid=".$documentid."\">".$document->getName()."</a>";
if ($document->getAccessMode($user, 'editDocument') < M_READWRITE) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
@ -128,6 +129,7 @@ $oldexpires = $document->getExpires();
$oldattributes = array();
foreach($document->getAttributes() as $ai=>$aa)
$oldattributes[$ai] = clone $aa;
//$oldattributes = $document->getAttributes();
$controller->setParam('fulltextservice', $fulltextservice);
$controller->setParam('document', $document);

View File

@ -56,8 +56,8 @@ if ($action == "download") { /* {{{ */
if (!file_exists($settings->_rootDir.'/ext/'.$extname) ) {
UI::exitError(getMLText("admin_tools"),getMLText("missing_extension"));
}
// $extmgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir);
$controller->setParam('extmgr', $extmgr);
// $extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir);
$controller->setParam('extmgr', $extMgr);
$controller->setParam('extname', $extname);
if (!$controller()) {
echo json_encode(array('success'=>false, 'msg'=>'Could not download extension'));
@ -65,11 +65,11 @@ if ($action == "download") { /* {{{ */
add_log_line();
} /* }}} */
elseif ($action == "refresh") { /* {{{ */
// $extmgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir);
$extmgr->createExtensionConf();
$controller->setParam('extmgr', $extmgr);
// $extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir);
$extMgr->createExtensionConf();
$controller->setParam('extmgr', $extMgr);
if (!$controller()) {
UI::exitError(getMLText("admin_tools"),$extmgr->getErrorMsg());
UI::exitError(getMLText("admin_tools"),$extMgr->getErrorMsg());
}
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_extension_refresh')));
add_log_line();
@ -79,7 +79,7 @@ elseif ($action == "upload") { /* {{{ */
if(!$settings->_enableExtensionImport) {
UI::exitError(getMLText("admin_tools"),getMLText("extension_mgr_upload_disabled"));
}
if(!$extmgr->isWritableExtDir()) {
if(!$extMgr->isWritableExtDir()) {
UI::exitError(getMLText("admin_tools"),getMLText("extension_mgr_no_upload"));
}
if($_FILES['userfile']['error']) {
@ -88,8 +88,8 @@ elseif ($action == "upload") { /* {{{ */
if(!in_array($_FILES['userfile']['type'], array('application/zip', 'application/x-zip-compressed'))) {
UI::exitError(getMLText("admin_tools"),getMLText("extension_mgr_no_zipfile"));
}
// $extmgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir);
$controller->setParam('extmgr', $extmgr);
// $extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir);
$controller->setParam('extmgr', $extMgr);
$controller->setParam('file', $_FILES['userfile']['tmp_name']);
if (!$controller()) {
UI::exitError(getMLText("admin_tools"),$controller->getErrorMsg());
@ -105,7 +105,7 @@ elseif ($action == "import") { /* {{{ */
if(!$_POST['url']) {
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
}
$file = $extmgr->getExtensionFromRepository($_POST['url']);
$file = $extMgr->getExtensionFromRepository($_POST['url']);
/*
$reposurl = $settings->_repositoryUrl;
$content = file_get_contents($reposurl."/".$_POST['url']);
@ -113,8 +113,8 @@ elseif ($action == "import") { /* {{{ */
file_put_contents($file, $content);
*/
// $extmgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir);
$controller->setParam('extmgr', $extmgr);
// $extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir);
$controller->setParam('extmgr', $extMgr);
$controller->setParam('file', $file);
$controller->setParam('action', 'upload');
if (!$controller()) {
@ -128,7 +128,7 @@ elseif ($action == "import") { /* {{{ */
} /* }}} */
elseif ($action == "getlist") { /* {{{ */
$v = new SeedDMS_Version();
$controller->setParam('extmgr', $extmgr);
$controller->setParam('extmgr', $extMgr);
$controller->setParam('forceupdate', (isset($_POST['forceupdate']) && $_POST['forceupdate']) ? true : false);
$controller->setParam('version', $v->version());
if (!$controller()) {
@ -147,7 +147,7 @@ elseif ($action == "toggle") { /* {{{ */
if (!file_exists($settings->_rootDir.'/ext/'.$extname) ) {
UI::exitError(getMLText("admin_tools"),getMLText("missing_extension"));
}
$controller->setParam('extmgr', $extmgr);
$controller->setParam('extmgr', $extMgr);
$controller->setParam('extname', $extname);
if (!$controller()) {
echo json_encode(array('success'=>false, 'msg'=>getMLText('extinsion_toggle_error')));
@ -155,13 +155,12 @@ elseif ($action == "toggle") { /* {{{ */
if($settings->extensionIsDisabled($extname))
echo json_encode(array('success'=>true, 'msg'=>getMLText('extension_is_off_now')));
else {
$ret = $extmgr->migrate($extname, $settings, $dms, $logger);
$ret = $extMgr->migrate($extname, $settings, $dms, $logger);
if($ret !== null) {
if($ret === true) {
if($ret === true)
echo json_encode(array('success'=>true, 'msg'=>getMLText('extension_migration_success')));
} else {
echo json_encode(array('success'=>false, 'msg'=>getMLText('extension_migration_error')));
}
else
echo json_encode(array('success'=>true, 'msg'=>getMLText('extension_migration_error')));
} else {
echo json_encode(array('success'=>true, 'msg'=>getMLText('extension_is_on_now')));
}

View File

@ -125,7 +125,7 @@ if ($action == "setowner") {
// Send notification to subscribers.
$notifier->sendChangedFolderOwnerMail($folder, $user, $oldOwner);
}
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_owner_set')));
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_setowner')));
} else {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("set_owner_error"));
}
@ -194,7 +194,7 @@ else if ($action == "editaccess") {
// Send notification to subscribers.
$notifier->sendChangedFolderAccessMail($folder, $user);
}
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_access_edited')));
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_edit_access')));
}
}
@ -211,7 +211,7 @@ else if ($action == "delaccess") {
// Send notification to subscribers.
$notifier->sendChangedFolderAccessMail($folder, $user);
}
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_access_deleted')));
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_delete_access')));
}
// Add new permission -----------------------------------------------------
@ -227,9 +227,11 @@ else if ($action == "addaccess") {
// Send notification to subscribers.
$notifier->sendChangedFolderAccessMail($folder, $user);
}
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_access_added')));
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_add_access')));
}
add_log_line();
header("Location:../out/out.FolderAccess.php?folderid=".$folderid);
?>

View File

@ -18,8 +18,6 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
use Seeddms\Seeddms\Session;
include("../inc/inc.Settings.php");
include("../inc/inc.Utils.php");
include("../inc/inc.LogInit.php");
@ -65,11 +63,11 @@ if(isset($_POST['pwd'])) {
}
$lang = '';
if(isset($_REQUEST["lang"]) && strlen($_REQUEST["lang"])>0 && is_numeric(array_search($_REQUEST["lang"],$settings->getLanguages())) ) {
if(isset($_REQUEST["lang"]) && strlen($_REQUEST["lang"])>0 && is_numeric(array_search($_REQUEST["lang"],getLanguages())) ) {
$lang = (string) $_REQUEST["lang"];
}
$session = new Session($db);
$session = new SeedDMS_Session($db);
// TODO: by the PHP manual: The superglobals $_GET and $_REQUEST are already decoded.
// Using urldecode() on an element in $_GET or $_REQUEST could have unexpected and dangerous results.

View File

@ -29,8 +29,6 @@ include("../inc/inc.ClassController.php");
include("../inc/inc.DBInit.php");
include("../inc/inc.Authentication.php");
use Seeddms\Seeddms\Session;
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$controller = Controller::factory($tmp[1], array('dms'=>$dms, 'user'=>$user));
@ -38,7 +36,7 @@ $controller = Controller::factory($tmp[1], array('dms'=>$dms, 'user'=>$user));
if(isset($_COOKIE['mydms_session'])) {
$dms_session = $_COOKIE["mydms_session"];
$session = new Session($db);
$session = new SeedDMS_Session($db);
$session->load($dms_session);
// If setting the user id to 0 worked, it would be a way to logout a

View File

@ -94,8 +94,8 @@ if ($document->setFolder($targetFolder)) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
}
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_document_moved')));
add_log_line();
header("Location:../out/out.ViewDocument.php?documentid=".$documentid);
?>

View File

@ -92,8 +92,7 @@ if ($folder->setParent($targetFolder)) {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("error_occured"));
}
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_folder_moved')));
add_log_line();
header("Location:../out/out.ViewFolder.php?folderid=".$folderid."&showtree=".$_GET["showtree"]);
?>

Some files were not shown because too many files have changed in this diff Show More