mirror of
https://git.code.sf.net/p/seeddms/code
synced 2026-01-17 14:56:43 +00:00
Compare commits
316 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e033e886bf | ||
|
|
11943c0da9 | ||
|
|
c5f260df74 | ||
|
|
73eba5331d | ||
|
|
a6899c574c | ||
|
|
73cb39beca | ||
|
|
55c6a9492a | ||
|
|
7c53c1aae4 | ||
|
|
5949c4ed35 | ||
|
|
c5eac169ec | ||
|
|
84511a7eda | ||
|
|
042bdb311f | ||
|
|
9c05a0ee3a | ||
|
|
8dd7909267 | ||
|
|
2db5c33fa6 | ||
|
|
be71795fc5 | ||
|
|
dfc80b823e | ||
|
|
594d2796f3 | ||
|
|
282df2a886 | ||
|
|
621bcab7b5 | ||
|
|
e5724e449a | ||
|
|
5db0744bf6 | ||
|
|
a4937e3502 | ||
|
|
ac22269120 | ||
|
|
62145c2f4e | ||
|
|
a8e0ace046 | ||
|
|
af30928a61 | ||
|
|
a3ed4ef7bb | ||
|
|
117b65c6c0 | ||
|
|
9d7310f4eb | ||
|
|
75a2f0c9b5 | ||
|
|
a05196b876 | ||
|
|
fc8afd1b5c | ||
|
|
8b33ffe27a | ||
|
|
789b2cc5f9 | ||
|
|
b57653ac72 | ||
|
|
c6a11d6fab | ||
|
|
0177eaf769 | ||
|
|
71921d228b | ||
|
|
dbd3c87f17 | ||
|
|
c07654194c | ||
|
|
085d706b6b | ||
|
|
39ec0618c7 | ||
|
|
722f816734 | ||
|
|
4f83063e12 | ||
|
|
e7e2fde718 | ||
|
|
7dfd511a1d | ||
|
|
580fa92393 | ||
|
|
3bedbd48a8 | ||
|
|
9bff901c29 | ||
|
|
5cf859becf | ||
|
|
6b40e9103a | ||
|
|
d8812eebd7 | ||
|
|
bc03490049 | ||
|
|
b647e6e000 | ||
|
|
4e236cf896 | ||
|
|
ac7128b8d3 | ||
|
|
32351d6179 | ||
|
|
2f968f90e0 | ||
|
|
3d9bdb02a0 | ||
|
|
85979e7899 | ||
|
|
1443fcbe60 | ||
|
|
c304085c94 | ||
|
|
e7e14325b3 | ||
|
|
929a2acd25 | ||
|
|
886a5eaf62 | ||
|
|
fec5875f07 | ||
|
|
8b60aea55d | ||
|
|
239586ed87 | ||
|
|
b81fb224d5 | ||
|
|
6ca4c785c1 | ||
|
|
c0a6cb5d34 | ||
|
|
851d338d4a | ||
|
|
a8c3650725 | ||
|
|
3efcf064f2 | ||
|
|
4be5afcef8 | ||
|
|
f83a43671b | ||
|
|
25dd7873c9 | ||
|
|
b7bd251bc6 | ||
|
|
e105c85b22 | ||
|
|
0d23b65271 | ||
|
|
220b633e4c | ||
|
|
2d963a3c6f | ||
|
|
7414443acb | ||
|
|
65dfe07a16 | ||
|
|
c8dba88814 | ||
|
|
6d69af7d4e | ||
|
|
83d08d1acc | ||
|
|
f6b3081c5b | ||
|
|
41e7c6eb93 | ||
|
|
a4307a4a2c | ||
|
|
b42fdb44c6 | ||
|
|
bf28ffa215 | ||
|
|
73e266bab7 | ||
|
|
cb3d5b6379 | ||
|
|
d2574c8caa | ||
|
|
0446009024 | ||
|
|
8b67c33fa7 | ||
|
|
7c9ef030d6 | ||
|
|
994fe49e6d | ||
|
|
799b870f9a | ||
|
|
98cb3b042d | ||
|
|
565eedbe96 | ||
|
|
399bf4d383 | ||
|
|
1bd8f9fcea | ||
|
|
d042fd3588 | ||
|
|
028ed5d5a3 | ||
|
|
62a8f12ed2 | ||
|
|
3c72b1f00c | ||
|
|
55e6ce1b9b | ||
|
|
03df65af05 | ||
|
|
7c696d4f71 | ||
|
|
6adab624db | ||
|
|
9874f9889d | ||
|
|
992fb5c85e | ||
|
|
d67b6eae2f | ||
|
|
f2ed3b7453 | ||
|
|
1bd49eab96 | ||
|
|
3ac7bf6ae4 | ||
|
|
4935fb3c9e | ||
|
|
c86bd865c2 | ||
|
|
00360800c3 | ||
|
|
de35433091 | ||
|
|
d4265e65f8 | ||
|
|
bee91325ca | ||
|
|
bc1fb05a41 | ||
|
|
7384d1db4a | ||
|
|
de1a87380b | ||
|
|
767235f0f5 | ||
|
|
b4ced679d0 | ||
|
|
a976d0bd22 | ||
|
|
73ee5781dd | ||
|
|
cc34c42f73 | ||
|
|
8a6db445c5 | ||
|
|
caa0e3f139 | ||
|
|
5db84c0564 | ||
|
|
e755423534 | ||
|
|
8e06a17f62 | ||
|
|
1b40717192 | ||
|
|
c649d9e495 | ||
|
|
7a1729e0c8 | ||
|
|
0e1da1a730 | ||
|
|
afd6a8b7f0 | ||
|
|
9ac6bca75f | ||
|
|
ef49a43644 | ||
|
|
9275fc1e05 | ||
|
|
b6bdae551c | ||
|
|
d15c65f137 | ||
|
|
c32fe1be80 | ||
|
|
6db475692a | ||
|
|
66ab0f25d3 | ||
|
|
46e927621c | ||
|
|
afbb891bd5 | ||
|
|
e175858235 | ||
|
|
2f668328fa | ||
|
|
d73a89c616 | ||
|
|
6e06bec195 | ||
|
|
d0379f2c91 | ||
|
|
027acbfd3b | ||
|
|
a77519cfd6 | ||
|
|
6a85f7c3f9 | ||
|
|
9a8477bf34 | ||
|
|
30e4e6391a | ||
|
|
893507cc8f | ||
|
|
5c009910b1 | ||
|
|
a4aa705fac | ||
|
|
c188f65112 | ||
|
|
effd6d0f5d | ||
|
|
8094b65a1e | ||
|
|
d4a7dc888b | ||
|
|
bd0c70def8 | ||
|
|
a29536f4c2 | ||
|
|
17e73dd494 | ||
|
|
fc8d01df6b | ||
|
|
ed36b88a09 | ||
|
|
00e6a22dbd | ||
|
|
7e2803da25 | ||
|
|
5a25b7cd3a | ||
|
|
93cdce72ac | ||
|
|
73db1e87c9 | ||
|
|
f88acd0ebd | ||
|
|
3365760c87 | ||
|
|
3782e71ae6 | ||
|
|
917ba91d95 | ||
|
|
eb2f4d6206 | ||
|
|
db70d2e432 | ||
|
|
edbf6b60da | ||
|
|
69b82fde4b | ||
|
|
c6d3b70799 | ||
|
|
19eb2db195 | ||
|
|
ebdc85d510 | ||
|
|
9df13922e9 | ||
|
|
8043388109 | ||
|
|
fc2e6e217c | ||
|
|
13fd205b55 | ||
|
|
8b4b12a7e8 | ||
|
|
d1fc54d1b3 | ||
|
|
8540d591cd | ||
|
|
64e2f3d338 | ||
|
|
5eda99d5ea | ||
|
|
6e3330c670 | ||
|
|
0ac2b76bb6 | ||
|
|
072a8206e0 | ||
|
|
73facda205 | ||
|
|
cb73547ca8 | ||
|
|
81fc17a812 | ||
|
|
8b80df9519 | ||
|
|
d1cbda90e2 | ||
|
|
cb41ef76d0 | ||
|
|
42ba5f93df | ||
|
|
5c7a16a112 | ||
|
|
5aa17d92df | ||
|
|
c142e68c5f | ||
|
|
8c55c64b40 | ||
|
|
8e95df660b | ||
|
|
83eeecc6cf | ||
|
|
e0519e5a9b | ||
|
|
81866bc0f7 | ||
|
|
9f47d1a86d | ||
|
|
fde6216cdb | ||
|
|
7d723fdf6a | ||
|
|
2523aa8e45 | ||
|
|
d88ec8a118 | ||
|
|
237aa79140 | ||
|
|
f6cded950b | ||
|
|
4173cc8be5 | ||
|
|
72efa6cd47 | ||
|
|
e11e563e6c | ||
|
|
1f4e3de21b | ||
|
|
e1f1fcacad | ||
|
|
752cedfd07 | ||
|
|
0e45cd2e3e | ||
|
|
a409e38973 | ||
|
|
7fdd0431c1 | ||
|
|
975d1de703 | ||
|
|
d2f64ea0e1 | ||
|
|
20d1927026 | ||
|
|
36a6f05353 | ||
|
|
78e70dcee2 | ||
|
|
eb38d82b79 | ||
|
|
0bc371dce8 | ||
|
|
39e72af272 | ||
|
|
e46ac30ed5 | ||
|
|
5def2b7e74 | ||
|
|
d18121d79a | ||
|
|
ac2164708f | ||
|
|
8cdd8f9375 | ||
|
|
b01b67d923 | ||
|
|
389562169d | ||
|
|
bab0afb947 | ||
|
|
683ccbeb07 | ||
|
|
795c6aa1ca | ||
|
|
33d4861ce3 | ||
|
|
bef3b62f5a | ||
|
|
3d73dc8279 | ||
|
|
047a29e26c | ||
|
|
749d598a0a | ||
|
|
8b562f05b9 | ||
|
|
306fc83840 | ||
|
|
8ab80bd42c | ||
|
|
5fd15ecec3 | ||
|
|
5c9c02f5f2 | ||
|
|
9dc430e94d | ||
|
|
b9de849ab8 | ||
|
|
25fd07a945 | ||
|
|
61f4dfca4b | ||
|
|
7d81f5b0f8 | ||
|
|
c25f0a32be | ||
|
|
49a243d92e | ||
|
|
181dd2c3ff | ||
|
|
4bba138184 | ||
|
|
feaed7b49d | ||
|
|
a194b7bc5b | ||
|
|
0c2f3c651a | ||
|
|
01f210ad43 | ||
|
|
59fedbbcc0 | ||
|
|
b6dae52f35 | ||
|
|
bc5ae5c74e | ||
|
|
e823d918e8 | ||
|
|
d47b8f8adf | ||
|
|
46594fa3bc | ||
|
|
5dfd280ec5 | ||
|
|
f20f4d2ae2 | ||
|
|
2e38c8fb92 | ||
|
|
c16a9692a3 | ||
|
|
ae8b383def | ||
|
|
698c82b806 | ||
|
|
29d6ece06a | ||
|
|
83ea0e0db9 | ||
|
|
ee50953d11 | ||
|
|
cf2bb2b4c3 | ||
|
|
5bce2fa6fd | ||
|
|
5c717cf6ba | ||
|
|
04df883582 | ||
|
|
ae635fba1a | ||
|
|
00a5f59bc3 | ||
|
|
593c6f5f95 | ||
|
|
30880c0539 | ||
|
|
f969669356 | ||
|
|
45eda343d9 | ||
|
|
82d24098aa | ||
|
|
911684f37f | ||
|
|
bdde3f6ff5 | ||
|
|
f3181967b9 | ||
|
|
398a05ba47 | ||
|
|
3c9b51c152 | ||
|
|
4330c7fc7b | ||
|
|
938b417bfc | ||
|
|
f95ebce720 | ||
|
|
ac29815974 | ||
|
|
a74f5d9668 | ||
|
|
aa5524ec41 | ||
|
|
c8ac16cec3 | ||
|
|
c21465f373 | ||
|
|
7edd4fa0b9 | ||
|
|
1296ce3104 |
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,4 +1,6 @@
|
|||
*.tar.gz
|
||||
SeedDMS_*/*.tgz
|
||||
ext/*
|
||||
vendor
|
||||
webapp/*
|
||||
www/ext
|
||||
|
|
|
|||
57
CHANGELOG
57
CHANGELOG
|
|
@ -1,3 +1,60 @@
|
|||
--------------------------------------------------------------------------------
|
||||
Changes in version 5.1.44
|
||||
--------------------------------------------------------------------------------
|
||||
- fix php error in install tool
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
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
|
||||
--------------------------------------------------------------------------------
|
||||
|
|
|
|||
30
Gruntfile.js
30
Gruntfile.js
|
|
@ -221,6 +221,36 @@ 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: [
|
||||
|
|
|
|||
22
Makefile
22
Makefile
|
|
@ -6,7 +6,11 @@ NODISTFILES=utils/importmail.php utils/seedddms-importmail utils/remote-email-up
|
|||
|
||||
PHPDOC=~/Downloads/phpDocumentor.phar
|
||||
|
||||
dist:
|
||||
INSTALL_PATH=/home/www-data/seeddms-test
|
||||
|
||||
all: dist
|
||||
|
||||
olddist:
|
||||
mkdir -p tmp/seeddms-$(VERSION)
|
||||
cp -a $(SRC) tmp/seeddms-$(VERSION)
|
||||
mkdir -p tmp/seeddms-$(VERSION)/views
|
||||
|
|
@ -23,8 +27,20 @@ dist:
|
|||
(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:
|
||||
php7.4 vendor/bin/phing -Dversion=$(VERSION) package
|
||||
php 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
|
||||
|
||||
unittest:
|
||||
vendor/bin/phing -Dversion=$(VERSION) phpunitfast
|
||||
|
|
@ -95,4 +111,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
|
||||
.PHONY: doc webdav webapp repository changelog install
|
||||
|
|
|
|||
52
README.md
Normal file
52
README.md
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
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
2
TODO
|
|
@ -1,3 +1,5 @@
|
|||
!!! This is hopelessly outdated !!!
|
||||
|
||||
This list is hopelessly outdated, but some of the issues are
|
||||
still worth to be implemented!
|
||||
|
||||
|
|
|
|||
372
build.xml
372
build.xml
|
|
@ -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,9 +16,13 @@
|
|||
<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="composer_version" value="2.8.5" />
|
||||
<property name="composer_extra_params" value="" />
|
||||
<property name="composer_env" value="" />
|
||||
<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="mink_driver" value="chrome" />
|
||||
<property name="snooze_multiplier" value="1" />
|
||||
|
||||
|
|
@ -35,44 +39,43 @@
|
|||
<include name="webdav/**" />
|
||||
<include name="install/**" />
|
||||
<include name="restapi/**" />
|
||||
<include name="pdfviewer/**" />
|
||||
<include name="index.php" />
|
||||
<include name="www/index.php" />
|
||||
<include name="CHANGELOG" />
|
||||
<include name=".htaccess" />
|
||||
<include name="www/.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 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 > ${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>
|
||||
<!-- 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 > ${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>
|
||||
|
||||
<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 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>
|
||||
|
||||
<!-- PHPUnit -->
|
||||
<target name="phpunitfast" description="Run tests">
|
||||
<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}/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}/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>
|
||||
|
|
@ -80,10 +83,16 @@
|
|||
<httpget url="https://getcomposer.org/download/${composer_version}/composer.phar" sslVerifyPeer="false" dir="${srcdir}" />
|
||||
</then>
|
||||
</if>
|
||||
</else>
|
||||
</if>
|
||||
<echo message="Installing dependencies..." />
|
||||
<exec command="${composer_env} php ${srcdir}/composer.phar install ${composer_extra_params}" passthru="true" checkreturn="true" />
|
||||
</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>
|
||||
</target>
|
||||
|
||||
<target name="dist" description="build SeedDMS tar archive">
|
||||
|
|
@ -92,11 +101,29 @@
|
|||
<then><fail msg="Pass version as property 'version'" /></then>
|
||||
</if>
|
||||
|
||||
<echo msg="This is ${shortversion}" />
|
||||
<echo msg="This is ${version}" />
|
||||
|
||||
<delete file="./seeddms-${version}.tar.gz" failonerror="false" />
|
||||
<tar destfile="./seeddms-${version}.tar.gz" prefix="seeddms-${version}" compression="gzip">
|
||||
<fileset refid="distfiles" />
|
||||
<!-- 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>
|
||||
</tar>
|
||||
</target>
|
||||
|
||||
|
|
@ -107,6 +134,9 @@
|
|||
</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\..*" />
|
||||
|
|
@ -114,103 +144,231 @@
|
|||
<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" />
|
||||
<delete dir="${builddir}/packages" includeemptydirs="true" failonerror="false" />
|
||||
<mkdir dir="${builddir}/packages" />
|
||||
<delete dir="${builddir}/export" includeemptydirs="true" failonerror="false" />
|
||||
<mkdir dir="${builddir}/export" />
|
||||
<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 command="echo 'Signature: 8a477f597d28d172789f06886806bc55' > ${builddir}/export/${shortversion}/data/cache/CACHEDIR.TAG" />
|
||||
<exec command="echo '# This file is a cache directory tag created by seeddms.' >> ${builddir}/export/${shortversion}/data/cache/CACHEDIR.TAG" />
|
||||
<exec command="echo '# For information about cache directory tags, see: http://www.brynosaurus.com/cachedir/' >> ${builddir}/export/${shortversion}/data/cache/CACHEDIR.TAG" />
|
||||
<exec executable="echo" passthru="true" checkreturn="true">
|
||||
<arg line="'Signature: 8a477f597d28d172789f06886806bc55' > ${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.' >> ${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/' >> ${builddir}/export/${shortversion}/data/cache/CACHEDIR.TAG" />
|
||||
</exec>
|
||||
<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" />
|
||||
<mkdir dir="${builddir}/export/${shortversion}/seeddms-${version}" />
|
||||
<if>
|
||||
<matches string="${mode}" pattern="^development" />
|
||||
<then></then>
|
||||
<else>
|
||||
<mkdir dir="${builddir}/export/${shortversion}/seeddms-${version}" />
|
||||
</else>
|
||||
</if>
|
||||
|
||||
<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" />
|
||||
<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} && ln -s seeddms-${version} seeddms" />
|
||||
<exec command="cd ${builddir}/export/${shortversion}/www && ln -s ../seeddms/op" />
|
||||
<exec command="cd ${builddir}/export/${shortversion}/www && ln -s ../seeddms/out" />
|
||||
<exec command="cd ${builddir}/export/${shortversion}/www && ln -s ../seeddms/inc" />
|
||||
<exec command="cd ${builddir}/export/${shortversion}/www && ln -s ../seeddms/controllers" />
|
||||
<exec command="cd ${builddir}/export/${shortversion}/www && ln -s ../seeddms/languages" />
|
||||
<exec command="cd ${builddir}/export/${shortversion}/www && ln -s ../seeddms/views" />
|
||||
<exec command="cd ${builddir}/export/${shortversion}/www && ln -s ../seeddms/restapi" />
|
||||
<exec command="cd ${builddir}/export/${shortversion}/www && ln -s ../seeddms/styles" />
|
||||
<exec command="cd ${builddir}/export/${shortversion}/www && ln -s ../seeddms/pdfviewer" />
|
||||
<exec command="cd ${builddir}/export/${shortversion}/www && ln -s ../seeddms/install" />
|
||||
<exec command="cd ${builddir}/export/${shortversion}/www && ln -s ../seeddms/webdav" />
|
||||
<exec command="cd ${builddir}/export/${shortversion}/www && ln -s ../seeddms/index.php" />
|
||||
<exec command="cd ${builddir}/export/${shortversion}/www && ln -s ../seeddms/.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>
|
||||
|
||||
<exec command="cat ${srcdir}/install/create_tables-sqlite3.sql | sqlite3 ${builddir}/export/${shortversion}/data/content.db" />
|
||||
<!-- 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>
|
||||
|
||||
<!-- 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" />
|
||||
<!-- 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>
|
||||
<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>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,44 @@
|
|||
{
|
||||
"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": {
|
||||
"robthree/twofactorauth": "^1.5",
|
||||
"pear/http_request2": "^2",
|
||||
"robthree/twofactorauth": "^3.0",
|
||||
"php-mime-mail-parser/php-mime-mail-parser": "*",
|
||||
"slim/slim": "^4.0",
|
||||
"guzzlehttp/psr7": "*",
|
||||
"erusev/parsedown": "*",
|
||||
|
|
@ -23,14 +56,24 @@
|
|||
"dragonmantank/cron-expression": "^3.1",
|
||||
"alecrabbit/php-console-colour": "*",
|
||||
"zf1/zend-search-lucene": "*",
|
||||
"symfony/http-foundation": "^5.4",
|
||||
"php-di/php-di": "^6.4",
|
||||
"symfony/http-foundation": "^7",
|
||||
"php-di/php-di": "^7",
|
||||
"hfig/mapi": "*",
|
||||
"slim/psr7": "^1.7",
|
||||
"seeddms/core": "dev-master",
|
||||
"chillerlan/php-qrcode": "^5.0",
|
||||
"bacon/bacon-qr-code": "^3.0",
|
||||
"seeddms/core": "dev-__CORE_BRANCH__",
|
||||
"seeddms/lucene": "dev-master",
|
||||
"seeddms/preview": "dev-master",
|
||||
"seeddms/sqlitefts": "dev-master",
|
||||
"seeddms/http_webdav_server": "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"
|
||||
|
|
@ -71,5 +114,19 @@
|
|||
"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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
146
composer.json
Normal file
146
composer.json
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
{
|
||||
"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-5.1.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
|
||||
}
|
||||
}
|
||||
}
|
||||
27
conf/apache.virtualhost.template
Normal file
27
conf/apache.virtualhost.template
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<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>
|
||||
|
|
@ -23,8 +23,6 @@
|
|||
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'];
|
||||
|
||||
|
|
|
|||
123
controllers/class.EditAttributes.php
Normal file
123
controllers/class.EditAttributes.php
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
||||
|
|
@ -174,12 +174,14 @@ 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")) {
|
||||
|
|
|
|||
|
|
@ -125,7 +125,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, null, false, true); //delete cookie
|
||||
setcookie("mydms_session", $dms_session, time()-3600, $settings->_httpRoot, '', false, true); //delete cookie
|
||||
header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$referuri);
|
||||
exit;
|
||||
} else {
|
||||
|
|
@ -144,7 +144,7 @@ class SeedDMS_Controller_Login extends SeedDMS_Controller_Common {
|
|||
$lifetime = time() + intval($settings->_cookieLifetime);
|
||||
else
|
||||
$lifetime = 0;
|
||||
setcookie("mydms_session", $id, $lifetime, $settings->_httpRoot, null, false, true);
|
||||
setcookie("mydms_session", $id, $lifetime, $settings->_httpRoot, '', false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,206 +0,0 @@
|
|||
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.
|
||||
254
doc/README.Converters.md
Normal file
254
doc/README.Converters.md
Normal file
|
|
@ -0,0 +1,254 @@
|
|||
# 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.
|
||||
|
|
@ -4,6 +4,7 @@ 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
|
||||
|
|
@ -11,29 +12,31 @@ 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 PEAR packages including the four SeedDMS packages SeedDMS_Core,
|
||||
`pear` contains all third party 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
|
||||
|
|
@ -73,10 +76,12 @@ 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
|
||||
|
|
@ -93,3 +98,8 @@ 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.
|
||||
|
|
@ -1,12 +1,11 @@
|
|||
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
|
||||
|
|
@ -19,12 +18,13 @@ 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,15 +39,16 @@ $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.
|
||||
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
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
|
||||
33
doc/README.Fail2ban.md
Normal file
33
doc/README.Fail2ban.md
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
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.
|
||||
|
|
@ -241,6 +241,8 @@ in your current installation with new versions from the quickstart archive.
|
|||
3. copy the directory `pear` from the unpacked archive into your current
|
||||
installation, replacing the existing directory. Make a backup of `pear` before
|
||||
the replacement if you want to ensure to be able to go back to your old version.
|
||||
Since version 5.1.42 and 6.0.35 of SeeDMS the directory `pear` was replaced
|
||||
by `vendor`, which was previously a ѕubdirectory of `pear`.
|
||||
4. you may compare your `conf/settings.xml` file with the shipped version
|
||||
`conf/settings.xml.template` for new parameters. If you don't do it, the next
|
||||
time you save the configuration the default values will be used.
|
||||
|
|
@ -254,6 +256,29 @@ 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
|
||||
================
|
||||
|
||||
|
|
|
|||
|
|
@ -1,66 +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 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.
|
||||
|
||||
118
doc/README.Ldap.md
Normal file
118
doc/README.Ldap.md
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
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
|
||||
|
||||
|
|
@ -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 may as well pass `-H Authorization: <api key>` instead of `-b cookies.txt`
|
||||
You can 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,8 +48,16 @@ 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 the following
|
||||
`put`. If you use curl with PHP, then encode the data as show in the following
|
||||
lines of code:
|
||||
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -1,143 +0,0 @@
|
|||
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.
|
||||
|
|
@ -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 as well, but the implemtations and their behaviour varys
|
||||
for WebDAV, but the implemtation 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,27 +34,35 @@ 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
|
||||
prevent data lost under all circumstances. Those strategies often don't
|
||||
to 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.
|
||||
|
||||
|
|
@ -79,19 +87,25 @@ 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
|
||||
|
|
@ -107,7 +121,9 @@ 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.
|
||||
|
|
@ -115,19 +131,27 @@ 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
|
||||
```
|
||||
|
||||
|
|
@ -1,59 +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.
|
||||
|
||||
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
|
||||
63
doc/README.ocr.md
Normal file
63
doc/README.ocr.md
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
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
|
||||
```
|
||||
|
|
@ -12,6 +12,8 @@
|
|||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
use Seeddms\Seeddms\Session;
|
||||
|
||||
require_once("inc.ClassSession.php");
|
||||
require_once("inc.ClassAccessOperation.php");
|
||||
|
||||
|
|
@ -23,7 +25,7 @@ if (!strncmp("/op", $refer, 3)) {
|
|||
}
|
||||
if (!isset($_COOKIE["mydms_session"])) {
|
||||
if($settings->_enableGuestLogin && $settings->_enableGuestAutoLogin) {
|
||||
$session = new SeedDMS_Session($db);
|
||||
$session = new Session($db);
|
||||
if(!$dms_session = $session->create(array('userid'=>$settings->_guestID, 'theme'=>$settings->_theme, 'lang'=>$settings->_language))) {
|
||||
header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer);
|
||||
exit;
|
||||
|
|
@ -44,7 +46,7 @@ if (!isset($_COOKIE["mydms_session"])) {
|
|||
$lang = $settings->_language;
|
||||
$user->setLanguage($lang);
|
||||
}
|
||||
$session = new SeedDMS_Session($db);
|
||||
$session = new Session($db);
|
||||
if(!$dms_session = $session->create(array('userid'=>$user->getID(), 'theme'=>$theme, 'lang'=>$lang))) {
|
||||
header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer);
|
||||
exit;
|
||||
|
|
@ -57,7 +59,7 @@ if (!isset($_COOKIE["mydms_session"])) {
|
|||
} else {
|
||||
/* Load session */
|
||||
$dms_session = $_COOKIE["mydms_session"];
|
||||
$session = new SeedDMS_Session($db);
|
||||
$session = new Session($db);
|
||||
if(!$resArr = $session->load($dms_session)) {
|
||||
setcookie("mydms_session", $dms_session, time()-3600, $settings->_httpRoot); //delete cookie
|
||||
header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer);
|
||||
|
|
@ -65,6 +67,8 @@ if (!isset($_COOKIE["mydms_session"])) {
|
|||
}
|
||||
}
|
||||
|
||||
$translator->setDefaultLanguage($session->getLanguage());
|
||||
|
||||
/* Update last access time */
|
||||
if((int)$resArr['lastAccess']+60 < time())
|
||||
$session->updateAccess($dms_session);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ 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'])) {
|
||||
|
|
|
|||
|
|
@ -30,13 +30,18 @@
|
|||
* @link https://www.seeddms.org Main Site
|
||||
*/
|
||||
|
||||
use Seeddms\Seeddms\Session;
|
||||
|
||||
/* Middleware for authentication based on session */
|
||||
class SeedDMS_Auth_Middleware_Session { /* {{{ */
|
||||
|
||||
private $container;
|
||||
|
||||
public function __construct($container) {
|
||||
private $responsefactory;
|
||||
|
||||
public function __construct($container, $responsefactory) {
|
||||
$this->container = $container;
|
||||
$this->responsefactory = $responsefactory;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -63,9 +68,9 @@ class SeedDMS_Auth_Middleware_Session { /* {{{ */
|
|||
return $response;
|
||||
}
|
||||
|
||||
$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());
|
||||
$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());
|
||||
if (isset($_COOKIE["mydms_session"])) {
|
||||
$dms_session = $_COOKIE["mydms_session"];
|
||||
$logger->log("Session key: " . $dms_session, PEAR_LOG_DEBUG);
|
||||
|
|
@ -73,6 +78,7 @@ 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);
|
||||
}
|
||||
|
||||
|
|
@ -83,6 +89,7 @@ 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 {
|
||||
|
|
@ -92,12 +99,14 @@ 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);
|
||||
|
|
@ -106,3 +115,174 @@ 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;
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
|
|
|
|||
|
|
@ -30,14 +30,19 @@ class Controller {
|
|||
* @return object an object of a class implementing the view
|
||||
*/
|
||||
static function factory($class, $params=array()) { /* {{{ */
|
||||
global $settings, $session, $extMgr, $request, $logger, $notifier;
|
||||
foreach(['settings', 'session', 'extmgr', 'request', 'logger', 'notifier', 'fulltextservice', 'translator'] as $vn) {
|
||||
if(isset($params[$vn]))
|
||||
${$vn} = $params[$vn];
|
||||
else
|
||||
${$vn} = $GLOBALS[$vn] ?? null;
|
||||
}
|
||||
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;
|
||||
|
|
@ -60,6 +65,8 @@ 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;
|
||||
|
|
|
|||
|
|
@ -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_merge(array($ret), $tmpret) : array_merge($ret, $tmpret));
|
||||
$ret = ($ret === null) ? $tmpret : (is_string($ret) ? (array($ret) + $tmpret) : ($ret + $tmpret));
|
||||
} else
|
||||
$ret = $tmpret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,18 @@ 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
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
|
|||
*/
|
||||
protected $_dms;
|
||||
|
||||
protected $_translator;
|
||||
|
||||
protected $smtp_server;
|
||||
|
||||
protected $smtp_port;
|
||||
|
|
@ -52,8 +54,9 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
|
|||
|
||||
protected $debug;
|
||||
|
||||
function __construct($dms, $from_address='', $smtp_server='', $smtp_port='', $smtp_username='', $smtp_password='', $lazy_ssl=true, $force_from=false) { /* {{{ */
|
||||
function __construct($dms, $translator, $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;
|
||||
|
|
@ -126,38 +129,38 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
|
|||
$body = '';
|
||||
if(!isset($params['__skip_header__']) || !$params['__skip_header__']) {
|
||||
if(!isset($params['__header__']))
|
||||
$body .= getMLText("email_header", $params, "", $lang)."\r\n\r\n";
|
||||
$body .= $this->_translator->translate("email_header", $params, null, $lang)."\r\n\r\n";
|
||||
elseif($params['__header__'])
|
||||
$body .= getMLText($params['__header__'], $params, "", $lang)."\r\n\r\n";
|
||||
$body .= $this->_translator->translate($params['__header__'], $params, null, $lang)."\r\n\r\n";
|
||||
}
|
||||
if(isset($params['__body__']))
|
||||
$body .= $params['__body__'];
|
||||
else
|
||||
$body .= getMLText($messagekey, $params, "", $lang);
|
||||
$body .= $this->_translator->translate($messagekey, $params, null, $lang);
|
||||
if(!isset($params['__skip_footer__']) || !$params['__skip_footer__']) {
|
||||
if(!isset($params['__footer__']))
|
||||
$body .= "\r\n\r\n".getMLText("email_footer", $params, "", $lang);
|
||||
$body .= "\r\n\r\n".$this->_translator->translate("email_footer", $params, null, $lang);
|
||||
elseif($params['__footer__'])
|
||||
$body .= "\r\n\r\n".getMLText($params['__footer__'], $params, "", $lang);
|
||||
$body .= "\r\n\r\n".$this->_translator->translate($params['__footer__'], $params, null, $lang);
|
||||
}
|
||||
|
||||
$bodyhtml = '';
|
||||
if(isset($params['__body_html__']) || getMLText($messagekey.'_html', $params, "", $lang)) {
|
||||
if(isset($params['__body_html__']) || $this->_translator->translate($messagekey.'_html', $params, null, $lang)) {
|
||||
if(!isset($params['__skip_header__']) || !$params['__skip_header__']) {
|
||||
if(!isset($params['__header_html__']))
|
||||
$bodyhtml .= getMLText("email_header_html", $params, "", $lang)."\r\n\r\n";
|
||||
$bodyhtml .= $this->_translator->translate("email_header_html", $params, null, $lang)."\r\n\r\n";
|
||||
elseif($params['__header_html__'])
|
||||
$bodyhtml .= getMLText($params['__header_html__'], $params, "", $lang)."\r\n\r\n";
|
||||
$bodyhtml .= $this->_translator->translate($params['__header_html__'], $params, null, $lang)."\r\n\r\n";
|
||||
}
|
||||
if(isset($params['__body_html__']))
|
||||
$bodyhtml .= $params['__body_html__'];
|
||||
else
|
||||
$bodyhtml .= getMLText($messagekey.'_html', $params, "", $lang);
|
||||
$bodyhtml .= $this->_translator->translate($messagekey.'_html', $params, null, $lang);
|
||||
if(!isset($params['__skip_footer__']) || !$params['__skip_footer__']) {
|
||||
if(!isset($params['__footer_html__']))
|
||||
$bodyhtml .= "\r\n\r\n".getMLText("email_footer_html", $params, "", $lang);
|
||||
$bodyhtml .= "\r\n\r\n".$this->_translator->translate("email_footer_html", $params, null, $lang);
|
||||
elseif($params['__footer_html__'])
|
||||
$bodyhtml .= "\r\n\r\n".getMLText($params['__footer_html__'], $params, "", $lang);
|
||||
$bodyhtml .= "\r\n\r\n".$this->_translator->translate($params['__footer_html__'], $params, null, $lang);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -207,7 +210,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", getMLText($subject, $params, null, $lang), $preferences);
|
||||
$encoded_subject = iconv_mime_encode("Subject", $this->_translator->translate($subject, $params, null, $lang), $preferences);
|
||||
$headers['Subject'] = substr($encoded_subject, strlen('Subject: '));
|
||||
$headers['Date'] = date('r', time());
|
||||
$headers['MIME-Version'] = "1.0";
|
||||
|
|
@ -240,7 +243,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, getMLText($subject, $params, "", $lang), $message);
|
||||
$ret = $queueService->queueMailJob($mail_params, $to, $hdrs, $this->_translator->translate($subject, $params, null, $lang), $message);
|
||||
if($ret !== null)
|
||||
return $ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,18 +22,20 @@
|
|||
* 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 SeedDMS_ExtBase {
|
||||
class ExtensionBase {
|
||||
var $settings;
|
||||
var $dms;
|
||||
var $logger;
|
||||
|
||||
public function __construct($settings, $dms, $logger) {
|
||||
public function __construct(Settings $settings, $dms, $logger) {
|
||||
$this->settings = $settings;
|
||||
$this->dms = $dms;
|
||||
$this->logger = $logger;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@
|
|||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
namespace Seeddms\Seeddms;
|
||||
|
||||
use Seeddms\Seeddms\Utilities;
|
||||
|
||||
/**
|
||||
* Class to represent an extension manager
|
||||
*
|
||||
|
|
@ -25,7 +29,7 @@
|
|||
* @copyright 2011 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class SeedDMS_Extension_Mgr {
|
||||
class ExtensionMgr {
|
||||
/**
|
||||
* @var string $extdir directory where extensions are located
|
||||
* @access protected
|
||||
|
|
@ -81,6 +85,12 @@ class SeedDMS_Extension_Mgr {
|
|||
*/
|
||||
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
|
||||
*/
|
||||
|
|
@ -175,6 +185,10 @@ class SeedDMS_Extension_Mgr {
|
|||
return $this->cachedir."/extensions.php";
|
||||
} /* }}} */
|
||||
|
||||
public function setRepositoryUrl($reposurl) { /* {{{ */
|
||||
$this->reposurl = $reposurl;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Get the configuration of extensions
|
||||
*
|
||||
|
|
@ -258,14 +272,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);
|
||||
|
|
@ -314,13 +328,19 @@ $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) { /* {{{ */
|
||||
public function createArchive($extname, $version, $dir = null) { /* {{{ */
|
||||
if(!is_dir($this->extdir ."/". $extname))
|
||||
return false;
|
||||
|
||||
$tmpfile = $this->cachedir."/".$extname."-".$version.".zip";
|
||||
if ($dir) {
|
||||
if (!is_dir($dir))
|
||||
return false;
|
||||
$tmpfile = $dir."/".$extname."-".$version.".zip";
|
||||
} else {
|
||||
$tmpfile = $this->cachedir."/".$extname."-".$version.".zip";
|
||||
}
|
||||
|
||||
if(!SeedDMS_Extension_Mgr::Zip($this->extdir."/".$extname, $tmpfile)) {
|
||||
if(!ExtensionMgr::Zip($this->extdir."/".$extname, $tmpfile)) {
|
||||
return false;
|
||||
}
|
||||
// $cmd = "cd ".$this->extdir."/".$extname."; zip -r ".$tmpfile." .";
|
||||
|
|
@ -393,17 +413,22 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
|
|||
return false;
|
||||
|
||||
return self::checkExtensionByName($extname, $extconf, $options);
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Check content of extension directory or configuration of extension
|
||||
* Check configuration of extension
|
||||
*
|
||||
* @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
|
||||
* 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.
|
||||
* @return boolean true if check was successful, otherwise false
|
||||
*/
|
||||
public function checkExtensionByName($extname, $extconf, $options=array()) { /* {{{ */
|
||||
|
|
@ -412,6 +437,7 @@ $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";
|
||||
|
|
@ -428,13 +454,16 @@ $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 SeedDMS_Version;
|
||||
$version = new Version;
|
||||
if(is_array($dval)) {
|
||||
$fullfill = false;
|
||||
foreach($dval as $ddval) {
|
||||
|
|
@ -511,13 +540,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)) {
|
||||
SeedDMS_Utils::rrmdir($newdir);
|
||||
Utilities::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);
|
||||
|
|
@ -531,7 +560,7 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
|
|||
|
||||
/* Check if extension is complete and fullfills the constraints */
|
||||
if(!self::checkExtensionByDir($newdir)) {
|
||||
SeedDMS_Utils::rrmdir($newdir);
|
||||
Utilities::rrmdir($newdir);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -542,11 +571,11 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
|
|||
if(!is_dir($this->extdir)) {
|
||||
if(!mkdir($this->extdir, 0755)) {
|
||||
$this->errmsgs[] = "Cannot create extension directory";
|
||||
SeedDMS_Utils::rrmdir($newdir);
|
||||
Utilities::rrmdir($newdir);
|
||||
return false;
|
||||
}
|
||||
} elseif(is_dir($this->extdir ."/". $extname)) {
|
||||
SeedDMS_Utils::rrmdir($this->extdir ."/". $extname);
|
||||
Utilities::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.
|
||||
|
|
@ -568,10 +597,15 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
|
|||
* has been copied.
|
||||
*/
|
||||
$this->errmsgs[] = "Cannot move temp. extension directory to final destination";
|
||||
SeedDMS_Utils::rrmdir($this->extdir ."/". $extname);
|
||||
Utilities::rrmdir($this->extdir ."/". $extname);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$this->createExtensionConf()) {
|
||||
// $this->errmsgs[] = "Cannot update extension configuration";
|
||||
// return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} /* }}} */
|
||||
|
||||
|
|
@ -582,7 +616,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_Extension_Mgr::updateExtensionList() to ensure the
|
||||
* Run Seeddms\Seeddms\ExtensionMgr::updateExtensionList() to ensure the
|
||||
* currently cached extension list file is up to date.
|
||||
*
|
||||
* @return string[] list of json strings or comments
|
||||
|
|
@ -602,7 +636,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_Extension_Mgr::updateExtensionList() to ensure the
|
||||
* Run Seeddms\Seeddms\ExtensionMgr::updateExtensionList() to ensure the
|
||||
* currently cached extension list file is up to date.
|
||||
*
|
||||
* @return array[] list of extension configurations
|
||||
|
|
@ -633,7 +667,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_Extension_Mgr::updateExtensionList() to ensure the
|
||||
* Run Seeddms\Seeddms\ExtensionMgr::updateExtensionList() to ensure the
|
||||
* currently cached extension list file is up to date.
|
||||
*
|
||||
* @return array[] list of extension configurations
|
||||
|
|
@ -649,13 +683,16 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
|
|||
}
|
||||
}
|
||||
}
|
||||
uksort($result, function($a, $b){return SeedDMS_Extension_Mgr::cmpVersion($b, $a);});
|
||||
uksort($result, function($a, $b){return ExtensionMgr::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) { /* {{{ */
|
||||
|
|
@ -693,9 +730,13 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
|
|||
*/
|
||||
public function getExtensionFromRepository($file) { /* {{{ */
|
||||
$content = file_get_contents($this->reposurl."/".$file, false, $this->getStreamContext());
|
||||
$tmpfile = tempnam(sys_get_temp_dir(), '');
|
||||
file_put_contents($tmpfile, $content);
|
||||
return $tmpfile;
|
||||
if ($content) {
|
||||
$tmpfile = tempnam(sys_get_temp_dir(), '');
|
||||
file_put_contents($tmpfile, $content);
|
||||
return $tmpfile;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
|
|
@ -718,4 +759,13 @@ $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;
|
||||
} /* }}} */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 no user was found.
|
||||
* only if the sql statements fails, but not if the user wasn't 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.
|
||||
|
|
|
|||
|
|
@ -41,6 +41,11 @@ class SeedDMS_NotificationService {
|
|||
*/
|
||||
protected $settings;
|
||||
|
||||
/*
|
||||
* Translator
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
/*
|
||||
* Possible types of receivers
|
||||
*/
|
||||
|
|
@ -52,11 +57,12 @@ class SeedDMS_NotificationService {
|
|||
const RECV_WORKFLOW = 5;
|
||||
const RECV_UPLOADER = 6;
|
||||
|
||||
public function __construct($logger = null, $settings = null) { /* {{{ */
|
||||
public function __construct($logger = null, $settings = null, $translator=null) { /* {{{ */
|
||||
$this->services = array();
|
||||
$this->errors = array();
|
||||
$this->logger = $logger;
|
||||
$this->settings = $settings;
|
||||
$this->translator = $translator;
|
||||
} /* }}} */
|
||||
|
||||
public function addService($service, $name='') { /* {{{ */
|
||||
|
|
@ -66,6 +72,10 @@ class SeedDMS_NotificationService {
|
|||
$this->errors[$name] = true;
|
||||
} /* }}} */
|
||||
|
||||
public function getTranslator() { /* {{{ */
|
||||
return $this->translator;
|
||||
} /* }}} */
|
||||
|
||||
public function getServices() { /* {{{ */
|
||||
return $this->services;
|
||||
} /* }}} */
|
||||
|
|
@ -683,6 +693,64 @@ 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();
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@
|
|||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
namespace Seeddms\Seeddms;
|
||||
|
||||
/**
|
||||
* Class to represent a session
|
||||
*
|
||||
|
|
@ -29,7 +31,7 @@
|
|||
* @copyright 2011 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class SeedDMS_Session {
|
||||
class Session {
|
||||
/**
|
||||
* @var object $db reference to database object. This must be an instance
|
||||
* of {@link SeedDMS_Core_DatabaseAccess}.
|
||||
|
|
@ -53,7 +55,7 @@ class SeedDMS_Session {
|
|||
* Create a new instance of the session handler
|
||||
*
|
||||
* @param object $db object to access the underlying database
|
||||
* @return object instance of SeedDMS_Session
|
||||
* @return object instance of Seeddms\Seeddms\Session
|
||||
*/
|
||||
function __construct($db) { /* {{{ */
|
||||
$this->db = $db;
|
||||
|
|
@ -417,6 +419,8 @@ class SeedDMS_Session {
|
|||
|
||||
}
|
||||
|
||||
class_alias('Seeddms\Seeddms\Session', 'SeedDMS_Session');
|
||||
|
||||
/**
|
||||
* Class for managing sessions
|
||||
*
|
||||
|
|
@ -428,7 +432,7 @@ class SeedDMS_Session {
|
|||
* @copyright 2014 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class SeedDMS_SessionMgr {
|
||||
class SessionMgr {
|
||||
/**
|
||||
* @var object $db reference to database object. This must be an instance
|
||||
* of {@link SeedDMS_Core_DatabaseAccess}.
|
||||
|
|
@ -440,7 +444,7 @@ class SeedDMS_SessionMgr {
|
|||
* Create a new instance of the session manager
|
||||
*
|
||||
* @param object $db object to access the underlying database
|
||||
* @return object instance of SeedDMS_SessionMgr
|
||||
* @return object instance of Seeddms\Seeddms\SessionMgr
|
||||
*/
|
||||
function __construct($db) { /* {{{ */
|
||||
$this->db = $db;
|
||||
|
|
@ -478,7 +482,7 @@ class SeedDMS_SessionMgr {
|
|||
return false;
|
||||
$sessions = array();
|
||||
foreach($resArr as $rec) {
|
||||
$session = new SeedDMS_Session($this->db);
|
||||
$session = new Session($this->db);
|
||||
$session->load($rec['id']);
|
||||
$sessions[] = $session;
|
||||
}
|
||||
|
|
@ -501,7 +505,7 @@ class SeedDMS_SessionMgr {
|
|||
return false;
|
||||
$sessions = array();
|
||||
foreach($resArr as $rec) {
|
||||
$session = new SeedDMS_Session($this->db);
|
||||
$session = new Session($this->db);
|
||||
$session->load($rec['id']);
|
||||
$sessions[] = $session;
|
||||
}
|
||||
|
|
@ -523,7 +527,7 @@ class SeedDMS_SessionMgr {
|
|||
return false;
|
||||
$sessions = array();
|
||||
foreach($resArr as $rec) {
|
||||
$session = new SeedDMS_Session($this->db);
|
||||
$session = new Session($this->db);
|
||||
$session->load($rec['id']);
|
||||
$sessions[] = $session;
|
||||
}
|
||||
|
|
@ -531,3 +535,5 @@ class SeedDMS_SessionMgr {
|
|||
|
||||
} /* }}} */
|
||||
}
|
||||
|
||||
class_alias('Seeddms\Seeddms\SessionMgr', 'SeedDMS_SessionMgr');
|
||||
|
|
|
|||
|
|
@ -11,6 +11,12 @@
|
|||
* @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
|
||||
*
|
||||
|
|
@ -146,6 +152,10 @@ 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
|
||||
|
|
@ -320,6 +330,8 @@ 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
|
||||
|
|
@ -406,7 +418,10 @@ class Settings { /* {{{ */
|
|||
// Load config file
|
||||
if (!defined("SEEDDMS_INSTALL")) {
|
||||
if(!file_exists($configFilePath)) {
|
||||
echo "You do not seem to have a valid configuration. Run the <a href=\"install/install.php\">install tool</a> first.";
|
||||
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.";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
|
@ -416,17 +431,14 @@ class Settings { /* {{{ */
|
|||
echo "Your configuration contains errors.";
|
||||
exit;
|
||||
}
|
||||
|
||||
// if (!is_null($this->_maxExecutionTime))
|
||||
// ini_set("max_execution_time", $this->_maxExecutionTime);
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Check if a variable has the string 'true', 'on', 'yes' or 'y'
|
||||
* and returns true.
|
||||
* Check if the passed parameter equals to 'true', 'on', 'yes' or 'y'
|
||||
* and returns true, if it does.
|
||||
*
|
||||
* @param string $var value
|
||||
* @return true/false
|
||||
* @return boolean true if $var is 'true', 'on', 'yes' or 'y', otherwise false
|
||||
*/
|
||||
protected static function boolVal($var) { /* {{{ */
|
||||
$var = strtolower(strval($var));
|
||||
|
|
@ -444,10 +456,10 @@ class Settings { /* {{{ */
|
|||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Return ';' seperated string from array
|
||||
* Create ';' seperated string from array
|
||||
*
|
||||
* @param array $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function arrayToString($value) { /* {{{ */
|
||||
return implode(";", $value);
|
||||
|
|
@ -457,14 +469,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
|
||||
*
|
||||
|
|
@ -474,7 +486,7 @@ class Settings { /* {{{ */
|
|||
} /* }}} */
|
||||
|
||||
/**
|
||||
* get $_viewOnlineFileTypes in a string value
|
||||
* Get $_viewOnlineFileTypes in a string value
|
||||
*
|
||||
* @return string value
|
||||
*
|
||||
|
|
@ -484,7 +496,7 @@ class Settings { /* {{{ */
|
|||
} /* }}} */
|
||||
|
||||
/**
|
||||
* set $_editOnlineFileTypes
|
||||
* Set $_editOnlineFileTypes
|
||||
*
|
||||
* @param string $stringValue string value
|
||||
*
|
||||
|
|
@ -494,7 +506,7 @@ class Settings { /* {{{ */
|
|||
} /* }}} */
|
||||
|
||||
/**
|
||||
* get $_editOnlineFileTypes in a string value
|
||||
* Get $_editOnlineFileTypes in a string value
|
||||
*
|
||||
* @return string value
|
||||
*
|
||||
|
|
@ -507,8 +519,7 @@ class Settings { /* {{{ */
|
|||
* Load config file
|
||||
*
|
||||
* @param string $configFilePath config file path
|
||||
*
|
||||
* @return true/false
|
||||
* @return boolean true, if loading was successful, otherwise false
|
||||
*/
|
||||
public function load($configFilePath) { /* {{{ */
|
||||
$contents = file_get_contents($configFilePath);
|
||||
|
|
@ -542,6 +553,7 @@ 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"]))
|
||||
|
|
@ -650,6 +662,8 @@ 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
|
||||
|
|
@ -963,6 +977,7 @@ 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);
|
||||
|
|
@ -1051,6 +1066,8 @@ 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');
|
||||
|
|
@ -1283,7 +1300,7 @@ class Settings { /* {{{ */
|
|||
|
||||
// Save
|
||||
return $xml->asXML($configFilePath);
|
||||
} /* }}} */
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* search and return Config File Path
|
||||
|
|
@ -1583,39 +1600,14 @@ class Settings { /* {{{ */
|
|||
}
|
||||
if($dsn) {
|
||||
$connTmp = new PDO($dsn, $this->_dbUser, $this->_dbPass);
|
||||
/* 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;
|
||||
$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()
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch(Exception $e) {
|
||||
|
|
@ -1777,13 +1769,13 @@ class Settings { /* {{{ */
|
|||
* Check if extension is disabled
|
||||
*
|
||||
* @param string $extname name of extension
|
||||
* @return true if extension is disabled
|
||||
* @return true if extension is disabled or extension could not be found in configuration
|
||||
*/
|
||||
public function extensionIsDisabled($extname) { /* {{{ */
|
||||
if(array_key_exists($extname, $this->_extensions))
|
||||
return $this->_extensions[$extname]['__disable__'];
|
||||
|
||||
return false;
|
||||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
|
|
@ -1827,5 +1819,66 @@ 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');
|
||||
|
|
|
|||
383
inc/inc.ClassTranslator.php
Normal file
383
inc/inc.ClassTranslator.php
Normal file
|
|
@ -0,0 +1,383 @@
|
|||
<?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;
|
||||
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;
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
} /* }}} */
|
||||
|
|
@ -45,7 +45,12 @@ class UI extends UI_Default {
|
|||
* @return object an object of a class implementing the view
|
||||
*/
|
||||
static public function factory($theme, $class='', $params=array()) { /* {{{ */
|
||||
global $settings, $session, $extMgr, $request, $logger, $notifier, $fulltextservice;
|
||||
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;
|
||||
}
|
||||
if(!$class) {
|
||||
$class = 'Bootstrap';
|
||||
$class = 'Style';
|
||||
|
|
@ -55,9 +60,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)) {
|
||||
|
|
@ -72,9 +77,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
|
||||
|
|
@ -137,6 +142,7 @@ 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);
|
||||
|
|
|
|||
95
inc/inc.ClassUtilities.php
Normal file
95
inc/inc.ClassUtilities.php
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
<?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');
|
||||
|
|
@ -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_merge(array($ret), $tmpret) : array_merge($ret, $tmpret));
|
||||
$ret = ($ret === null) ? $tmpret : (is_string($ret) ? (array($ret) + $tmpret) : ($ret + $tmpret));
|
||||
} else
|
||||
$ret = $tmpret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,12 +56,14 @@ 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')) {
|
||||
$memcache = new Memcached('seeddms');
|
||||
$memcache->addServers(array(
|
||||
array('localhost',11211),
|
||||
$mc = new Memcached('seeddms');
|
||||
$mc->addServers(array(
|
||||
array($settings->_memcachedHost ?? 'localhost', $settings->_memcachedPort ?? 11211),
|
||||
));
|
||||
$dms->setMemcache($memcache);
|
||||
$memcache = new \Cache\Adapter\Memcached\MemcachedCachePool($mc);
|
||||
$dms->setCache($memcache);
|
||||
}
|
||||
|
||||
if(!$settings->_doNotCheckDBVersion && !$dms->checkVersion()) {
|
||||
|
|
@ -90,7 +92,5 @@ if(isset($GLOBALS['SEEDDMS_HOOKS']['initDMS'])) {
|
|||
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');
|
||||
|
||||
|
|
|
|||
|
|
@ -11,34 +11,36 @@
|
|||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
global $logger;
|
||||
|
||||
require "inc.ClassExtensionMgr.php";
|
||||
require_once "inc.ClassExtensionMgr.php";
|
||||
require_once "inc.ClassExtBase.php";
|
||||
|
||||
$extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir, $settings->_repositoryUrl, $settings->_proxyUrl, $settings->_proxyUser, $settings->_proxyPassword);
|
||||
// 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;
|
||||
|
||||
$version = new SeedDMS_Version;
|
||||
use Seeddms\Seeddms\ExtensionMgr;
|
||||
|
||||
foreach($extMgr->getExtensionConfiguration() as $extname=>$extconf) {
|
||||
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;
|
||||
}
|
||||
if(!$settings->extensionIsDisabled($extname)) {
|
||||
$disabled = true;
|
||||
if($extMgr->checkExtensionByName($extname, $extconf)) {
|
||||
$disabled = false;
|
||||
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'];
|
||||
|
|
@ -46,7 +48,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'])) {
|
||||
|
|
@ -56,14 +58,15 @@ foreach($extMgr->getExtensionConfiguration() as $extname=>$extconf) {
|
|||
include($langfile);
|
||||
if(isset($__lang) && $__lang) {
|
||||
foreach($__lang as $lang=>&$data) {
|
||||
if(isset($GLOBALS['LANG'][$lang]))
|
||||
$GLOBALS['LANG'][$lang] = array_merge($GLOBALS['LANG'][$lang], $data);
|
||||
else
|
||||
$GLOBALS['LANG'][$lang] = $data;
|
||||
$translator->addPhrases($lang, $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Ensure $settings->_extensions has an entry for the extension, even if
|
||||
// the extension is disabled already.
|
||||
$settings->disableExtension($extname);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,48 +18,31 @@
|
|||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$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);
|
||||
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() { /* {{{ */
|
||||
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);
|
||||
trigger_error("getAvailableLanguages() is deprecated.", E_USER_DEPRECATED);
|
||||
foreach(debug_backtrace() as $n) {
|
||||
trigger_error($n['file'].": Line ".$n['line'], E_USER_DEPRECATED);
|
||||
}
|
||||
closedir($handle);
|
||||
|
||||
asort($languages);
|
||||
return $languages;
|
||||
return $GLOBALS['settings']->getAvailableLanguages();
|
||||
} /* }}} */
|
||||
|
||||
function getLanguages() { /* {{{ */
|
||||
global $settings;
|
||||
|
||||
if($settings->_availablelanguages) {
|
||||
return $settings->_availablelanguages;
|
||||
trigger_error("getLanguages() is deprecated.", E_USER_DEPRECATED);
|
||||
foreach(debug_backtrace() as $n) {
|
||||
trigger_error($n['file'].": Line ".$n['line'], E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
return getAvailableLanguages();
|
||||
return $GLOBALS['settings']->getLanguages();
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
|
|
@ -77,310 +60,56 @@ function getLanguages() { /* {{{ */
|
|||
* @param string $lang use this language instead of the currently set lang
|
||||
*/
|
||||
function getMLText($key, $replace = array(), $defaulttext = null, $lang="") { /* {{{ */
|
||||
GLOBAL $settings, $LANG, $session, $MISSING_LANG;
|
||||
// trigger_error("getMLText() is deprecated.", E_USER_DEPRECATED);
|
||||
// foreach(debug_backtrace() as $n) {
|
||||
// trigger_error($n['file'].": Line ".$n['line'], E_USER_DEPRECATED);
|
||||
// }
|
||||
|
||||
$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;
|
||||
return $GLOBALS['translator']->translate($key, $replace, $defaulttext, $lang);
|
||||
} /* }}} */
|
||||
|
||||
function printMLText($key, $replace = array(), $defaulttext = null, $lang="") /* {{{ */
|
||||
{
|
||||
print getMLText($key, $replace, $defaulttext, $lang);
|
||||
function printMLText($key, $replace = array(), $defaulttext = null, $lang="") { /* {{{ */
|
||||
$GLOBALS['translator']->print($key, $replace, $defaulttext, $lang);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
function printReviewStatusText($status, $date=0) { /* {{{ */
|
||||
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;
|
||||
}
|
||||
}
|
||||
$GLOBALS['translator']->printReviewStatusText($status, $date);
|
||||
} /* }}} */
|
||||
|
||||
function getReviewStatusText($status, $date=0) { /* {{{ */
|
||||
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;
|
||||
}
|
||||
}
|
||||
return $GLOBALS['translator']->getReviewStatusText($status, $date);
|
||||
} /* }}} */
|
||||
|
||||
function printApprovalStatusText($status, $date=0) { /* {{{ */
|
||||
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;
|
||||
}
|
||||
}
|
||||
$GLOBALS['translator']->printApprovalStatusText($status, $date);
|
||||
} /* }}} */
|
||||
|
||||
function getApprovalStatusText($status, $date=0) { /* {{{ */
|
||||
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;
|
||||
}
|
||||
}
|
||||
return $GLOBALS['translator']->getApprovalStatusText($status, $date);
|
||||
} /* }}} */
|
||||
|
||||
function printOverallStatusText($status) { /* {{{ */
|
||||
print getOverallStatusText($status);
|
||||
$GLOBALS['translator']->printOverallStatusText($status);
|
||||
} /* }}} */
|
||||
|
||||
function 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;
|
||||
default:
|
||||
return getMLText("status_unknown");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $GLOBALS['translator']->getOverallStatusText($status);
|
||||
} /* }}} */
|
||||
|
||||
function 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;
|
||||
return $GLOBALS['translator']->getAttributeTypeText($attrdef);
|
||||
} /* }}} */
|
||||
|
||||
function 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;
|
||||
return $GLOBALS['translator']->getAttributeObjectTypeText($attrdef);
|
||||
} /* }}} */
|
||||
|
||||
function getAttributeValidationText($error, $attrname='', $attrvalue='', $regex='') { /* {{{ */
|
||||
$arr = getAttributeValidationError($error, $attrname, $attrvalue, $regex);
|
||||
|
||||
return getMLText($arr[0], $arr[1]);
|
||||
return $GLOBALS['translator']->getAttributeValidationText($error, $attrname, $attrvalue, $regex);
|
||||
} /* }}} */
|
||||
|
||||
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;
|
||||
}
|
||||
return $GLOBALS['translator']->getAttributeValidationError($error, $attrname, $attrvalue, $regex);
|
||||
} /* }}} */
|
||||
|
||||
|
|
|
|||
|
|
@ -21,5 +21,5 @@
|
|||
require_once("Log.php");
|
||||
require_once("inc/inc.Utils.php");
|
||||
|
||||
$logger = getLogger('', (int) $settings->_logFileMaxLevel);
|
||||
$logger = getLogger($settings, '', (int) $settings->_logFileMaxLevel);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,10 @@
|
|||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
global $logger;
|
||||
$notifier = new SeedDMS_NotificationService($logger, $settings);
|
||||
require_once("inc.ClassEmailNotify.php");
|
||||
require_once("inc.ClassNotificationService.php");
|
||||
|
||||
$notifier = new SeedDMS_NotificationService($logger, $settings, $translator);
|
||||
|
||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
|
||||
foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) {
|
||||
|
|
@ -24,7 +26,7 @@ if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
|
|||
}
|
||||
|
||||
if($settings->_enableEmail) {
|
||||
$notifier->addService(new SeedDMS_EmailNotify($dms, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword, $settings->_smtpLazySSL, $settings->_smtpForceFrom), 'email');
|
||||
$notifier->addService(new SeedDMS_EmailNotify($dms, $translator, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword, $settings->_smtpLazySSL, $settings->_smtpForceFrom), 'email');
|
||||
}
|
||||
|
||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
// 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);
|
||||
|
|
@ -60,7 +62,7 @@ if($settings->_dbDriver == 'sqlite' && empty($settings->_dbDatabase)) {
|
|||
$settings->_dbDatabase = $__datadir."/content.db";
|
||||
}
|
||||
|
||||
ini_set('include_path', $settings->_rootDir.'pear'. PATH_SEPARATOR .ini_get('include_path'));
|
||||
ini_set('include_path', $settings->_rootDir.'..'. PATH_SEPARATOR .ini_get('include_path'));
|
||||
if(!empty($settings->_extraPath)) {
|
||||
ini_set('include_path', $settings->_extraPath. PATH_SEPARATOR .ini_get('include_path'));
|
||||
}
|
||||
|
|
@ -75,13 +77,7 @@ 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 pear directory, but install tool does not need it */
|
||||
if(!defined("SEEDDMS_INSTALL"))
|
||||
require_once 'vendor/autoload.php';
|
||||
require_once 'vendor/autoload.php';
|
||||
|
||||
require_once "inc.Version.php";
|
||||
|
|
|
|||
|
|
@ -86,21 +86,29 @@ function getPeriodOfTime($timestamp) { /* {{{ */
|
|||
$timestamp = strtotime($timestamp);
|
||||
|
||||
$time = time() - $timestamp; // to get the time since that moment
|
||||
$time = ($time<1)? 1 : $time;
|
||||
$rel = 'ago';
|
||||
if ($time < 0) {
|
||||
$time = -$time;
|
||||
$rel = 'from_now';
|
||||
}
|
||||
$time = ($time < 0) ? -$time : $time;
|
||||
$tokens = array (
|
||||
31536000 => 'abbr_year',
|
||||
2592000 => 'abbr_month',
|
||||
604800 => 'abbr_week',
|
||||
86400 => 'abbr_day',
|
||||
3600 => 'abbr_hour',
|
||||
60 => 'abbr_minute',
|
||||
1 => 'abbr_second'
|
||||
31536000 => 'year',
|
||||
2592000 => 'month',
|
||||
604800 => 'week',
|
||||
86400 => 'day',
|
||||
3600 => 'hour',
|
||||
60 => 'minute',
|
||||
1 => 'second'
|
||||
);
|
||||
|
||||
if($time == 0)
|
||||
return getMLText('now');
|
||||
|
||||
foreach ($tokens as $unit => $text) {
|
||||
if ($time < $unit) continue;
|
||||
$numberOfUnits = floor($time / $unit);
|
||||
return $numberOfUnits.' '.(($numberOfUnits>1) ? getMLText($text):getMLText($text));
|
||||
return getMLText($text.($numberOfUnits > 1 ? 's' : '').'_'.$rel, ['num'=>$numberOfUnits]);
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
|
|
@ -111,7 +119,7 @@ function getPeriodOfTime($timestamp) { /* {{{ */
|
|||
* @return integer/boolean unix timestamp or false in case of an error
|
||||
*/
|
||||
function makeTsFromDate($date) { /* {{{ */
|
||||
return strtotime($date);
|
||||
return $date ? strtotime($date) : false;
|
||||
} /* }}} */
|
||||
|
||||
/*
|
||||
|
|
@ -462,10 +470,31 @@ function getFilenameByDocname($content) { /* {{{ */
|
|||
return mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $filename);
|
||||
} /* }}} */
|
||||
|
||||
function getLogger($prefix='', $mask=PEAR_LOG_INFO) { /* {{{ */
|
||||
global $settings;
|
||||
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
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
if($settings->_logFileEnable) {
|
||||
$context = stream_context_create($opts);
|
||||
return $context;
|
||||
} /* }}} */
|
||||
|
||||
function getLogger($settings, $prefix='', $mask=PEAR_LOG_INFO) { /* {{{ */
|
||||
if(!empty($settings->_logFileEnable)) {
|
||||
if ($settings->_logFileRotation=="h") $logname=date("YmdH", time());
|
||||
else if ($settings->_logFileRotation=="d") $logname=date("Ymd", time());
|
||||
else $logname=date("Ym", time());
|
||||
|
|
@ -621,7 +650,7 @@ function checkFormKey($formid='', $method='POST') { /* {{{ */
|
|||
* quota is reached. Negative values indicate a disk usage above quota.
|
||||
*/
|
||||
function checkQuota($user) { /* {{{ */
|
||||
global $settings, $dms;
|
||||
global $settings;
|
||||
|
||||
/* check if quota is turn off system wide */
|
||||
if($settings->_quota == 0)
|
||||
|
|
@ -743,6 +772,7 @@ 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';
|
||||
|
|
@ -970,39 +1000,6 @@ function seed_pass_verify($password, $hash) { /* {{{ */
|
|||
return $hash === md5($password);
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
|
@ -1125,9 +1122,9 @@ function getMandatoryReviewers($folder, $document, $user) { /* {{{ */
|
|||
foreach($revg as $gid) {
|
||||
if($g = $dms->getGroup($gid)) {
|
||||
if($document)
|
||||
$accessmode = $document->getGroupAccessMode($u);
|
||||
$accessmode = $document->getGroupAccessMode($g);
|
||||
else
|
||||
$accessmode = $folder->getGroupAccessMode($u);
|
||||
$accessmode = $folder->getGroupAccessMode($g);
|
||||
if($accessmode < M_READ || !$g->getUsers())
|
||||
$reviewers["ng"][] = $g->getId();
|
||||
else
|
||||
|
|
@ -1222,9 +1219,9 @@ function getMandatoryApprovers($folder, $document, $user) { /* {{{ */
|
|||
foreach($appg as $gid) {
|
||||
if($g = $dms->getGroup($gid)) {
|
||||
if($document)
|
||||
$accessmode = $document->getGroupAccessMode($u);
|
||||
$accessmode = $document->getGroupAccessMode($g);
|
||||
else
|
||||
$accessmode = $folder->getGroupAccessMode($u);
|
||||
$accessmode = $folder->getGroupAccessMode($g);
|
||||
if($accessmode < M_READ || !$g->getUsers())
|
||||
$approvers["ng"][] = $g->getId();
|
||||
else
|
||||
|
|
@ -1235,33 +1232,7 @@ function getMandatoryApprovers($folder, $document, $user) { /* {{{ */
|
|||
return $approvers;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
} /* }}} */
|
||||
require_once "inc/inc.ClassUtilities.php";
|
||||
|
||||
/**
|
||||
* Class for creating encrypted api keys
|
||||
|
|
@ -1407,6 +1378,8 @@ class SeedDMS_Search { /* {{{ */
|
|||
|
||||
public $searchparams;
|
||||
|
||||
protected $total;
|
||||
|
||||
protected $dcount;
|
||||
|
||||
protected $fcount;
|
||||
|
|
@ -1419,6 +1392,10 @@ class SeedDMS_Search { /* {{{ */
|
|||
|
||||
protected $searchTime;
|
||||
|
||||
protected $facets;
|
||||
|
||||
protected $stats;
|
||||
|
||||
public function __construct($dms, $user, $fulltextservice, $settings) {
|
||||
$this->dms = $dms;
|
||||
$this->user = $user;
|
||||
|
|
@ -1427,6 +1404,7 @@ class SeedDMS_Search { /* {{{ */
|
|||
$this->searchparams = [];
|
||||
$this->dcount = 0;
|
||||
$this->fcount = 0;
|
||||
$this->total = 0;
|
||||
$this->totalPages = 0;
|
||||
$this->entries = array();
|
||||
$this->terms = array();
|
||||
|
|
@ -1821,16 +1799,17 @@ class SeedDMS_Search { /* {{{ */
|
|||
$attributes = array();
|
||||
|
||||
foreach($attributes as $attrdefid=>$attribute) {
|
||||
$attrdef = $this->dms->getAttributeDefinition($attrdefid);
|
||||
if($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));
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,9 +18,11 @@
|
|||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
class SeedDMS_Version { /* {{{ */
|
||||
namespace Seeddms\Seeddms;
|
||||
|
||||
const _number = "5.1.40";
|
||||
class Version { /* {{{ */
|
||||
|
||||
const _number = "5.1.44";
|
||||
const _string = "SeedDMS";
|
||||
|
||||
function __construct() {
|
||||
|
|
@ -47,7 +49,7 @@ class SeedDMS_Version { /* {{{ */
|
|||
|
||||
function banner() { /* {{{ */
|
||||
return self::_string .", ". self::_number;
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Compare two version
|
||||
|
|
@ -84,3 +86,4 @@ class SeedDMS_Version { /* {{{ */
|
|||
|
||||
} /* }}} */
|
||||
|
||||
class_alias('Seeddms\Seeddms\Version', 'SeedDMS_Version');
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ define("SEEDDMS_INSTALL", "on");
|
|||
define("SEEDDMS_VERSION", $ver->version());
|
||||
|
||||
include("../inc/inc.Settings.php");
|
||||
$settings = new Settings();
|
||||
$settings = new Seeddms\Seeddms\Settings();
|
||||
$rootDir = realpath ("..");
|
||||
if(file_exists($rootDir.'/../www'))
|
||||
$rootDir = realpath($rootDir.'/..').'/www';
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ function fileExistsInIncludePath($file) { /* {{{ */
|
|||
/**
|
||||
* Load default settings + set
|
||||
*/
|
||||
require_once '../vendor/autoload.php';
|
||||
require_once('../inc/inc.Version.php');
|
||||
$ver = new SeedDMS_Version();
|
||||
define("SEEDDMS_INSTALL", "on");
|
||||
|
|
@ -69,7 +70,7 @@ define("SEEDDMS_VERSION", $ver->version());
|
|||
|
||||
require_once('../inc/inc.ClassSettings.php');
|
||||
|
||||
$configDir = Settings::getConfigDir();
|
||||
$configDir = Seeddms\Seeddms\Settings::getConfigDir();
|
||||
|
||||
/**
|
||||
* Check if ENABLE_INSTALL_TOOL exists in config dir
|
||||
|
|
@ -92,8 +93,7 @@ if (!file_exists($configDir."/settings.xml")) {
|
|||
}
|
||||
|
||||
// Set folders settings
|
||||
$settings = new Settings();
|
||||
$settings->load($configDir."/settings.xml");
|
||||
$settings = new Seeddms\Seeddms\Settings($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
276
op/op.Ajax.php
276
op/op.Ajax.php
|
|
@ -29,6 +29,9 @@ 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");
|
||||
|
|
@ -36,7 +39,7 @@ require_once("../inc/inc.ClassPasswordHistoryManager.php");
|
|||
/* Load session */
|
||||
if (isset($_COOKIE["mydms_session"])) {
|
||||
$dms_session = $_COOKIE["mydms_session"];
|
||||
$session = new SeedDMS_Session($db);
|
||||
$session = new Session($db);
|
||||
if(!$resArr = $session->load($dms_session)) {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('error'=>1));
|
||||
|
|
@ -98,6 +101,12 @@ 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');
|
||||
|
|
@ -290,7 +299,7 @@ switch($command) {
|
|||
case 'testmail': /* {{{ */
|
||||
if($user && $user->isAdmin()) {
|
||||
if($user->getEmail()) {
|
||||
$emailobj = new SeedDMS_EmailNotify($dms, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword, $settings->_smtpLazySSL, $settings->_smtpForceFrom);
|
||||
$emailobj = new SeedDMS_EmailNotify($dms, $translator, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword, $settings->_smtpLazySSL, $settings->_smtpForceFrom);
|
||||
$emailobj->setDebug(true);
|
||||
$params = array();
|
||||
$params['url'] = getBaseUrl().$settings->_httpRoot;
|
||||
|
|
@ -342,7 +351,7 @@ switch($command) {
|
|||
$notifier->sendMovedFolderMail($mfolder, $user, $oldFolder);
|
||||
}
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_move_folder'), 'data'=>''));
|
||||
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_folder_moved'), 'data'=>''));
|
||||
add_log_line("move folder ".$mfolder->getId()." to ".$folder->getId());
|
||||
} else {
|
||||
header('Content-Type: application/json');
|
||||
|
|
@ -388,7 +397,7 @@ switch($command) {
|
|||
$notifier->sendMovedDocumentMail($mdocument, $user, $oldFolder);
|
||||
}
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_move_document'), 'data'=>''));
|
||||
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_moved'), 'data'=>''));
|
||||
add_log_line("move document ".$mdocument->getId()." to folder ".$folder->getId());
|
||||
} else {
|
||||
header('Content-Type: application/json');
|
||||
|
|
@ -431,7 +440,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_transfer_content'), 'data'=>''));
|
||||
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_content_transfered'), 'data'=>''));
|
||||
add_log_line("transfer content of document ".$mdocument->getId()." to document ".$targetdoc->getId());
|
||||
} else {
|
||||
header('Content-Type: application/json');
|
||||
|
|
@ -684,6 +693,52 @@ 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')) {
|
||||
|
|
@ -738,6 +793,217 @@ 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('')) {
|
||||
|
|
|
|||
|
|
@ -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_setowner')));
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_owner_set')));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -179,21 +179,19 @@ else if ($action == "setdefault") {
|
|||
if($notifier) {
|
||||
$notifier->sendChangedDocumentAccessMail($document, $user);
|
||||
}
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_delete_access')));
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_access_deleted')));
|
||||
} elseif($action == "addaccess") {
|
||||
if($notifier) {
|
||||
$notifier->sendChangedDocumentAccessMail($document, $user);
|
||||
}
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_add_access')));
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_access_added')));
|
||||
} elseif($action == "editaccess") {
|
||||
if($notifier) {
|
||||
$notifier->sendChangedDocumentAccessMail($document, $user);
|
||||
}
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_edit_access')));
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_access_edited')));
|
||||
}
|
||||
|
||||
add_log_line("");
|
||||
|
||||
header("Location:../out/out.DocumentAccess.php?documentid=".$documentid);
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -27,8 +27,12 @@ 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"));
|
||||
|
|
@ -46,7 +50,6 @@ 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"));
|
||||
|
|
@ -68,120 +71,25 @@ foreach($version->getAttributes() as $ai=>$aa)
|
|||
$oldattributes[$ai] = clone $aa;
|
||||
|
||||
$attributes = $_POST["attributes"];
|
||||
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"));
|
||||
}
|
||||
}
|
||||
$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;
|
||||
}
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())), $errmsg);
|
||||
}
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if($notifier) {
|
||||
$notifier->sendChangedVersionAttributesMail($version, $user, $oldattributes);
|
||||
}
|
||||
|
||||
add_log_line("?documentid=".$documentid);
|
||||
|
||||
header("Location:../out/out.DocumentVersionDetail.php?documentid=".$documentid."&version=".$versionid);
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ 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"));
|
||||
|
|
@ -125,7 +124,6 @@ $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);
|
||||
|
|
|
|||
|
|
@ -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,12 +155,13 @@ 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'=>true, 'msg'=>getMLText('extension_migration_error')));
|
||||
} else {
|
||||
echo json_encode(array('success'=>false, 'msg'=>getMLText('extension_migration_error')));
|
||||
}
|
||||
} else {
|
||||
echo json_encode(array('success'=>true, 'msg'=>getMLText('extension_is_on_now')));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ if ($action == "setowner") {
|
|||
// Send notification to subscribers.
|
||||
$notifier->sendChangedFolderOwnerMail($folder, $user, $oldOwner);
|
||||
}
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_setowner')));
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_owner_set')));
|
||||
} 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_edit_access')));
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_access_edited')));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -211,7 +211,7 @@ else if ($action == "delaccess") {
|
|||
// Send notification to subscribers.
|
||||
$notifier->sendChangedFolderAccessMail($folder, $user);
|
||||
}
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_delete_access')));
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_access_deleted')));
|
||||
}
|
||||
|
||||
// Add new permission -----------------------------------------------------
|
||||
|
|
@ -227,11 +227,9 @@ else if ($action == "addaccess") {
|
|||
// Send notification to subscribers.
|
||||
$notifier->sendChangedFolderAccessMail($folder, $user);
|
||||
}
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_add_access')));
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_access_added')));
|
||||
}
|
||||
|
||||
add_log_line();
|
||||
|
||||
header("Location:../out/out.FolderAccess.php?folderid=".$folderid);
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
// 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");
|
||||
|
|
@ -63,11 +65,11 @@ if(isset($_POST['pwd'])) {
|
|||
}
|
||||
|
||||
$lang = '';
|
||||
if(isset($_REQUEST["lang"]) && strlen($_REQUEST["lang"])>0 && is_numeric(array_search($_REQUEST["lang"],getLanguages())) ) {
|
||||
if(isset($_REQUEST["lang"]) && strlen($_REQUEST["lang"])>0 && is_numeric(array_search($_REQUEST["lang"],$settings->getLanguages())) ) {
|
||||
$lang = (string) $_REQUEST["lang"];
|
||||
}
|
||||
|
||||
$session = new SeedDMS_Session($db);
|
||||
$session = new 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.
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ 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));
|
||||
|
||||
|
|
@ -36,7 +38,7 @@ $controller = Controller::factory($tmp[1], array('dms'=>$dms, 'user'=>$user));
|
|||
if(isset($_COOKIE['mydms_session'])) {
|
||||
$dms_session = $_COOKIE["mydms_session"];
|
||||
|
||||
$session = new SeedDMS_Session($db);
|
||||
$session = new Session($db);
|
||||
$session->load($dms_session);
|
||||
|
||||
// If setting the user id to 0 worked, it would be a way to logout a
|
||||
|
|
|
|||
|
|
@ -89,8 +89,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);
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -87,7 +87,8 @@ if ($folder->setParent($targetFolder)) {
|
|||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("error_occured"));
|
||||
}
|
||||
|
||||
add_log_line();
|
||||
header("Location:../out/out.ViewFolder.php?folderid=".$folderid."&showtree=".$_GET["showtree"]);
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_folder_moved')));
|
||||
|
||||
?>
|
||||
add_log_line();
|
||||
|
||||
header("Location:../out/out.ViewFolder.php?folderid=".$folderid."&showtree=".$_GET["showtree"]);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ if (empty($email) || empty($login)) {
|
|||
$user = $dms->getUserByLogin($login, $email);
|
||||
if($user) {
|
||||
if($hash = $dms->createPasswordRequest($user)) {
|
||||
$emailobj = new SeedDMS_EmailNotify($dms, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword);
|
||||
$emailobj = new SeedDMS_EmailNotify($dms, $translator, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword);
|
||||
$subject = "password_forgotten_email_subject";
|
||||
$message = "password_forgotten_email_body";
|
||||
$params = array();
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ if ($action == "saveSettings")
|
|||
setIntValue('previewWidthMenuList');
|
||||
setIntValue('previewWidthDropFolderList');
|
||||
setIntValue('previewWidthDetail');
|
||||
setStrValue('defaultThumbnailClick');
|
||||
setBoolValue('showFullPreview');
|
||||
setBoolValue('convertToPdf');
|
||||
setIntValue('maxItemsPerPage');
|
||||
|
|
@ -182,12 +183,15 @@ if ($action == "saveSettings")
|
|||
setDirValue("proxyPassword");
|
||||
setBoolValue("logFileEnable");
|
||||
setIntValue("logFileMaxLevel");
|
||||
setIntValue("logFileRestApiMaxLevel");
|
||||
setStrValue("logFileRotation");
|
||||
setBoolValue("enableLargeFileUpload");
|
||||
setStrValue("partitionSize"); // TODO: check if valid value, e.g. 1M or 5K
|
||||
setStrValue("maxUploadSize"); // TODO: check if valid value, e.g. 1M or 5K
|
||||
setBoolValue("enableXsendfile");
|
||||
setBoolValue("enableMemcached");
|
||||
setStrValue("memcachedHost");
|
||||
setStrValue("memcachedPort");
|
||||
|
||||
// SETTINGS - SYSTEM - AUTHENTICATION
|
||||
setBoolValue("enableGuestLogin");
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ if ($notifier){
|
|||
$notifier->sendTransferDocumentMail($document, $user, $oldowner);
|
||||
}
|
||||
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_transfer_document')));
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_document_transfered')));
|
||||
|
||||
add_log_line("?documentid=".$documentid);
|
||||
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ else if ($action == "transferobjects") {
|
|||
|
||||
add_log_line(".php&action=transferobjects&userid=".$userid);
|
||||
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_transfer_objects')));
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_objects_transfered')));
|
||||
// }
|
||||
}
|
||||
|
||||
|
|
@ -346,10 +346,7 @@ else if ($action == "edituser") {
|
|||
|
||||
$login = $_POST["login"];
|
||||
$pwd = $_POST["pwd"];
|
||||
if(isset($_POST['clearpwd']) && $_POST['clearpwd'])
|
||||
$clearpwd = 1;
|
||||
else
|
||||
$clearpwd = 0;
|
||||
$clearpwd = (isset($_POST['clearpwd']) && $_POST['clearpwd']) ? true : false;
|
||||
if(isset($_POST["pwdexpiration"]))
|
||||
$pwdexpiration = $_POST["pwdexpiration"];
|
||||
else
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ require_once("inc/inc.ClassUI.php");
|
|||
|
||||
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
|
||||
$accessop = new SeedDMS_AccessOperation($dms, null, $user, $settings);
|
||||
|
||||
$folder = null;
|
||||
if (isset($_GET["folderid"]) && is_numeric($_GET["folderid"])) {
|
||||
|
|
@ -42,6 +43,7 @@ if (isset($_GET["folderid"]) && is_numeric($_GET["folderid"])) {
|
|||
|
||||
|
||||
if($view) {
|
||||
$view->setParam('accessobject', $accessop);
|
||||
$view->setParam('folder', $folder);
|
||||
$view->setParam('conversionmgr', $conversionmgr);
|
||||
$view->setParam('previewWidthList', $settings->_previewWidthList);
|
||||
|
|
|
|||
100
out/out.EditMarkdown.php
Normal file
100
out/out.EditMarkdown.php
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
<?php
|
||||
// MyDMS. Document Management System
|
||||
// Copyright (C) 2002-2005 Markus Westphal
|
||||
// Copyright (C) 2006-2008 Malcolm Cowe
|
||||
// Copyright (C) 2010-2016 Uwe Steinmann
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
if(!isset($settings))
|
||||
require_once("../inc/inc.Settings.php");
|
||||
require_once("inc/inc.Utils.php");
|
||||
require_once("inc/inc.LogInit.php");
|
||||
require_once("inc/inc.Language.php");
|
||||
require_once("inc/inc.Init.php");
|
||||
require_once("inc/inc.Extension.php");
|
||||
require_once("inc/inc.DBInit.php");
|
||||
require_once("inc/inc.ClassUI.php");
|
||||
require_once("inc/inc.Authentication.php");
|
||||
|
||||
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
|
||||
|
||||
$documentid = $_GET["documentid"];
|
||||
if (!isset($documentid) || !is_numeric($documentid) || intval($documentid)<1) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
|
||||
}
|
||||
|
||||
$document = $dms->getDocument($documentid);
|
||||
|
||||
if (!is_object($document)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
|
||||
}
|
||||
|
||||
if ($document->getAccessMode($user) < M_READWRITE) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
if(isset($_GET["version"])) {
|
||||
$version = $_GET["version"];
|
||||
|
||||
if (!is_numeric($version)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
|
||||
}
|
||||
|
||||
$content = $document->getContentByVersion($version);
|
||||
$lc = $document->getLatestContent();
|
||||
|
||||
} else {
|
||||
$version = 0;
|
||||
$content = $document->getLatestContent();
|
||||
$lc = $document->getLatestContent();
|
||||
}
|
||||
|
||||
if (!is_object($content)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
|
||||
}
|
||||
|
||||
/* Only the latest version may be edited */
|
||||
if($content->getVersion() != $lc->getVersion()) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
|
||||
}
|
||||
|
||||
/*
|
||||
if (!isset($settings->_editOnlineFileTypes) || !is_array($settings->_editOnlineFileTypes) || !in_array(strtolower($content->getFileType()), $settings->_editOnlineFileTypes)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
|
||||
}
|
||||
*/
|
||||
|
||||
/* Create object for checking access to certain operations */
|
||||
$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings);
|
||||
if(!$accessop->mayEditVersion($version)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
$folder = $document->getFolder();
|
||||
|
||||
if($view) {
|
||||
$view->setParam('document', $document);
|
||||
$view->setParam('version', $content);
|
||||
$view->setParam('folder', $folder);
|
||||
$view->setParam('accessobject', $accessop);
|
||||
$view->setParam('cachedir', $settings->_cacheDir);
|
||||
$view->setParam('previewWidthList', $settings->_previewWidthList);
|
||||
$view->setParam('previewWidthDetail', $settings->_previewWidthDetail);
|
||||
$view->setParam('timeout', $settings->_cmdTimeout);
|
||||
$view($_GET);
|
||||
exit;
|
||||
}
|
||||
|
|
@ -34,10 +34,7 @@ if (!$user->isAdmin()) {
|
|||
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
$reposurl = $settings->_repositoryUrl;
|
||||
|
||||
$v = new SeedDMS_Version;
|
||||
$extmgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir, $reposurl);
|
||||
if(isset($_GET['currenttab']))
|
||||
$currenttab = $_GET['currenttab'];
|
||||
else
|
||||
|
|
@ -55,7 +52,6 @@ if($view) {
|
|||
$view->setParam('extmgr', $extmgr);
|
||||
$view->setParam('currenttab', $currenttab);
|
||||
$view->setParam('extname', $extname);
|
||||
$view->setParam('reposurl', $reposurl);
|
||||
$view($_GET);
|
||||
exit;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,8 +39,14 @@ if (!$user->isAdmin()) {
|
|||
|
||||
$v = new SeedDMS_Version;
|
||||
$versions = array();
|
||||
|
||||
if($settings->_proxyUrl)
|
||||
$context = getStreamContext($settings->_proxyUrl, $settings->_proxyUser, $settings->_proxyPassword);
|
||||
else
|
||||
$context = null;
|
||||
|
||||
if(@ini_get('allow_url_fopen') == '1') {
|
||||
$lines = @file('http://www.seeddms.org/latest?version='.$v->version(), FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES);
|
||||
$lines = @file('http://www.seeddms.org/latest?version='.$v->version(), FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES, $context);
|
||||
if($lines) {
|
||||
foreach($lines as $line) {
|
||||
$versions[] = explode(':', $line);
|
||||
|
|
@ -48,9 +54,6 @@ if(@ini_get('allow_url_fopen') == '1') {
|
|||
}
|
||||
}
|
||||
|
||||
$reposurl = $settings->_repositoryUrl;
|
||||
$extmgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir, $reposurl);
|
||||
|
||||
if($view) {
|
||||
$view->setParam('version', $v);
|
||||
$view->setParam('availversions', $versions);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user