Compare commits

..

316 Commits

Author SHA1 Message Date
Uwe Steinmann
e033e886bf add changes in 5.1.44 2025-12-17 08:25:40 +01:00
Uwe Steinmann
11943c0da9 include vendor/autoload.php 2025-12-17 08:24:37 +01:00
Uwe Steinmann
c5f260df74 always include vendor/autoload.php (was not included in install mode) 2025-12-17 08:24:06 +01:00
Uwe Steinmann
73eba5331d start new version 5.1.44 2025-12-16 11:46:59 +01:00
Uwe Steinmann
a6899c574c add some { and } 2025-12-10 12:56:27 +01:00
Uwe Steinmann
73cb39beca add js for addon with refresh symbol (temp. solution) 2025-12-10 06:46:20 +01:00
Uwe Steinmann
55c6a9492a do not remove custom attributes which were not set when editing attributes 2025-12-09 19:29:48 +01:00
Uwe Steinmann
7c53c1aae4 require symfony/http-client 2025-12-09 12:15:14 +01:00
Uwe Steinmann
5949c4ed35 add command to return a random string 2025-12-09 12:14:38 +01:00
Uwe Steinmann
c5eac169ec use password field for encryption key 2025-12-09 12:14:09 +01:00
Uwe Steinmann
84511a7eda use help-cursor for all labels of config vars 2025-12-05 09:54:10 +01:00
Uwe Steinmann
042bdb311f show help-cursor when moving mouse over label of config var 2025-12-05 09:43:08 +01:00
Uwe Steinmann
9c05a0ee3a use pdfviewer only if extension is enabled 2025-12-04 18:29:48 +01:00
Uwe Steinmann
8dd7909267 use complete to file loaded by pdf viewer 2025-12-04 18:16:44 +01:00
Uwe Steinmann
2db5c33fa6 remove empty option when allow-empty is set 2025-12-04 10:40:42 +01:00
Uwe Steinmann
be71795fc5 - fix formatting of date input fields 2025-12-03 16:41:57 +01:00
Uwe Steinmann
dfc80b823e simplify code 2025-12-03 07:43:21 +01:00
Uwe Steinmann
594d2796f3 use new input addon to make password visible 2025-12-03 07:42:49 +01:00
Uwe Steinmann
282df2a886 fix error msg when migration of extension fails 2025-12-02 21:18:26 +01:00
Uwe Steinmann
621bcab7b5 add more changes of 5.1.43 2025-12-02 13:55:36 +01:00
Uwe Steinmann
e5724e449a add addon to all password fields to make password visible 2025-12-02 13:55:05 +01:00
Uwe Steinmann
5db0744bf6 use addon for button to make password visible 2025-12-02 13:54:08 +01:00
Uwe Steinmann
a4937e3502 add button to make password visible 2025-12-02 13:52:45 +01:00
Uwe Steinmann
ac22269120 add button to password fields for toggling visibility 2025-12-02 13:52:03 +01:00
Uwe Steinmann
62145c2f4e lots of drag&drop improvements 2025-12-01 14:11:38 +01:00
Uwe Steinmann
a8e0ace046 if filename does not have an extension, get it from the mimetype 2025-12-01 14:11:03 +01:00
Uwe Steinmann
af30928a61 add change for 5.1.43 2025-11-30 15:53:25 +01:00
Uwe Steinmann
a3ed4ef7bb require symfony/process 2025-11-30 15:12:12 +01:00
Uwe Steinmann
117b65c6c0 add support for uploading a file by its url when it is dropped 2025-11-30 15:11:26 +01:00
Uwe Steinmann
9d7310f4eb add command 'uploadremotedocument' 2025-11-30 15:10:54 +01:00
Uwe Steinmann
75a2f0c9b5 use table sorter 2025-11-25 15:35:50 +01:00
Uwe Steinmann
a05196b876 install tablesort 2025-11-25 15:35:30 +01:00
Uwe Steinmann
fc8afd1b5c check if attribute value is not null 2025-11-24 19:56:24 +01:00
Uwe Steinmann
8b33ffe27a do not init a second transloter object 2025-11-24 17:21:39 +01:00
Uwe Steinmann
789b2cc5f9 add changes of 5.1.43 2025-11-24 10:22:12 +01:00
Uwe Steinmann
b57653ac72 no longer support backup archives 2025-11-24 10:21:20 +01:00
Uwe Steinmann
c6a11d6fab minor corrections, new phrases 2025-11-24 10:19:26 +01:00
Uwe Steinmann
0177eaf769 add changes for 5.1.43 2025-11-23 08:27:47 +01:00
Uwe Steinmann
71921d228b output error msg as type 'error' not 'success' 2025-11-23 08:26:42 +01:00
Uwe Steinmann
dbd3c87f17 fix function getAttributeValidationError() 2025-11-22 12:48:42 +01:00
Uwe Steinmann
c07654194c changes fro 5.1.43 2025-11-21 14:49:46 +01:00
Uwe Steinmann
085d706b6b put titles of extensions into bold type face 2025-11-21 14:49:11 +01:00
Uwe Steinmann
39ec0618c7 use table layout 2025-11-21 13:30:45 +01:00
Uwe Steinmann
722f816734 add changes of 5.1.43 2025-11-21 11:58:10 +01:00
Uwe Steinmann
4f83063e12 just color the first column of a table row 2025-11-21 11:56:07 +01:00
Uwe Steinmann
e7e2fde718 add check for missing 'changes' in conf.php, add warnings 2025-11-21 11:55:27 +01:00
Uwe Steinmann
7dfd511a1d add league/commonmark and twig/twig 2025-11-21 11:54:56 +01:00
Uwe Steinmann
580fa92393 set the original file name will other adjust the file type 2025-11-19 20:31:24 +01:00
Uwe Steinmann
3bedbd48a8 copy some missing files of editor.md 2025-11-18 15:49:33 +01:00
Uwe Steinmann
9bff901c29 add changes for 5.1.43 2025-11-18 14:19:17 +01:00
Uwe Steinmann
5cf859becf use editor.md for editing online 2025-11-18 14:17:40 +01:00
Uwe Steinmann
6b40e9103a add javascript based editor (only bootstrap4 theme) 2025-11-18 14:17:16 +01:00
Uwe Steinmann
d8812eebd7 install editor.md 2025-11-18 14:16:06 +01:00
Uwe Steinmann
bc03490049 ensure user has write access on cache, because the extensions' config will be updated 2025-11-17 20:09:13 +01:00
Uwe Steinmann
b647e6e000 running hooks can be prevented by setting env var SEEDDMS_NO_EXTENSION_HOOKS 2025-11-17 15:36:13 +01:00
Uwe Steinmann
4e236cf896 include inc.ClassExtensionMgr.php and inc.ClassExtBase.php because the console tool needs them 2025-11-17 15:35:31 +01:00
Uwe Steinmann
ac7128b8d3 only check if config is writeable if a change is required 2025-11-17 14:27:59 +01:00
Uwe Steinmann
32351d6179 move classes into namespace Seeddms\Seeddms, add aliases for previous class names 2025-11-17 14:25:58 +01:00
Uwe Steinmann
2f968f90e0 add ClassExtensionMgr and ClassExtBase to classmap 2025-11-17 14:24:30 +01:00
Uwe Steinmann
3d9bdb02a0 create extension configuration after updating an extension 2025-11-17 07:06:45 +01:00
Uwe Steinmann
85979e7899 add better command help 2025-11-17 07:06:27 +01:00
Uwe Steinmann
1443fcbe60 include inc.Extension.php 2025-11-16 20:08:13 +01:00
Uwe Steinmann
c304085c94 fix makeRandomString() 2025-11-16 19:37:46 +01:00
Uwe Steinmann
e7e14325b3 run 'composer dump -o' 2025-11-16 17:21:27 +01:00
Uwe Steinmann
929a2acd25 output number in updatable, installable extensions, code cleanup 2025-11-16 17:14:41 +01:00
Uwe Steinmann
886a5eaf62 check if cache is writable 2025-11-16 17:14:16 +01:00
Uwe Steinmann
fec5875f07 new command to update from repository 2025-11-16 15:50:49 +01:00
Uwe Steinmann
8b60aea55d check if $extconfs[$extname] exists 2025-11-16 15:50:22 +01:00
Uwe Steinmann
239586ed87 fix output of message 2025-11-15 21:22:45 +01:00
Uwe Steinmann
b81fb224d5 better documentation of updateExtensionList() 2025-11-15 20:43:41 +01:00
Uwe Steinmann
6ca4c785c1 fix comparision of versions 2025-11-15 13:45:29 +01:00
Uwe Steinmann
c0a6cb5d34 add new commands to download and list extensions from/in repository 2025-11-15 11:29:17 +01:00
Uwe Steinmann
851d338d4a tag text of question 2025-11-15 11:28:33 +01:00
Uwe Steinmann
a8c3650725 check if downloading a file from the repository succeeded 2025-11-15 11:27:38 +01:00
Uwe Steinmann
3efcf064f2 better documentation of checkExtensionByName() 2025-11-15 11:27:06 +01:00
Uwe Steinmann
4be5afcef8 add method setRepositoryUrl() 2025-11-15 11:26:31 +01:00
Uwe Steinmann
f83a43671b get file name from option 2025-11-14 16:55:17 +01:00
Uwe Steinmann
25dd7873c9 use new Seeddms\Seeddms\Utilities 2025-11-14 16:54:58 +01:00
Uwe Steinmann
b7bd251bc6 no need to write configuration file 2025-11-14 16:23:24 +01:00
Uwe Steinmann
e105c85b22 check for configuration in its regular place 2025-11-14 16:16:33 +01:00
Uwe Steinmann
0d23b65271 update copyright year 2025-11-14 15:07:25 +01:00
Uwe Steinmann
220b633e4c use new class Utilities 2025-11-14 15:07:10 +01:00
Uwe Steinmann
2d963a3c6f use some functions into class Utitilities 2025-11-14 15:06:30 +01:00
Uwe Steinmann
7414443acb nicer formating for better readability 2025-11-14 15:05:42 +01:00
Uwe Steinmann
65dfe07a16 add changes for 5.1.43 2025-11-14 12:07:03 +01:00
Uwe Steinmann
c8dba88814 use propper namespace for classes 2025-11-14 12:03:08 +01:00
Uwe Steinmann
6d69af7d4e add class alias to make old extensions work 2025-11-14 11:06:53 +01:00
Uwe Steinmann
83d08d1acc move class into namespace Seeddms\Seeddms 2025-11-14 11:06:25 +01:00
Uwe Steinmann
f6b3081c5b move class SeedDMS_Extension_Mgr into namespace Seeddms\Seeddms 2025-11-14 11:05:14 +01:00
Uwe Steinmann
41e7c6eb93 do not use same variable for list of ext configurations and single configuration 2025-11-14 10:33:12 +01:00
Uwe Steinmann
a4307a4a2c add new command for checking extensions 2025-11-14 10:32:45 +01:00
Uwe Steinmann
b42fdb44c6 set include_path instead using an absolute path to include autoload.php.
This works in the devel enviroment and the installed SeedDMS
2025-11-14 09:29:51 +01:00
Uwe Steinmann
bf28ffa215 rename SeedDMS_Session and SeedDMS_SessionMgr into \Seeddms\Seeddms\... 2025-11-13 22:21:07 +01:00
Uwe Steinmann
73e266bab7 add command to upload extension 2025-11-13 22:20:16 +01:00
Uwe Steinmann
cb3d5b6379 and changes for 5.1.43 2025-11-13 18:58:22 +01:00
Uwe Steinmann
d2574c8caa fix typo 2025-11-13 18:58:10 +01:00
Uwe Steinmann
0446009024 render stats as table 2025-11-13 18:57:46 +01:00
Uwe Steinmann
8b67c33fa7 fix description and help text 2025-11-13 18:57:22 +01:00
Uwe Steinmann
7c9ef030d6 ask before clearing the cache 2025-11-13 18:56:08 +01:00
Uwe Steinmann
994fe49e6d about comment about deprecated functions 2025-11-13 18:55:49 +01:00
Uwe Steinmann
799b870f9a use table helper 2025-11-13 17:58:48 +01:00
Uwe Steinmann
98cb3b042d various updates 2025-11-13 14:01:37 +01:00
Uwe Steinmann
565eedbe96 add new command line interface 2025-11-13 13:57:03 +01:00
Uwe Steinmann
399bf4d383 add config for phpcs 2025-11-13 13:40:38 +01:00
Uwe Steinmann
1bd8f9fcea new optional parameter $dir for method createArchive() 2025-11-13 12:19:03 +01:00
Uwe Steinmann
d042fd3588 set icon for copying to clipboard to green after click 2025-11-12 17:01:30 +01:00
Uwe Steinmann
028ed5d5a3 add select for saving text to clipboard 2025-11-12 16:48:24 +01:00
Uwe Steinmann
62a8f12ed2 include Log.php, because the defines are needed in ClassSettings 2025-11-12 15:00:33 +01:00
Uwe Steinmann
3c72b1f00c allow string as button for in menu 2025-11-08 19:42:11 +01:00
Uwe Steinmann
55e6ce1b9b call $settings->getLanguages() instead of the global function 2025-11-08 16:34:58 +01:00
Uwe Steinmann
03df65af05 getAvailableLanguages() is now a method of Settings itself 2025-11-08 16:26:17 +01:00
Uwe Steinmann
7c696d4f71 all files in classmap are in seeddms/inc 2025-11-08 16:19:54 +01:00
Uwe Steinmann
6adab624db create link to seeddms, before running composer 2025-11-08 16:19:28 +01:00
Uwe Steinmann
9874f9889d global var $extMgr is now named $extmgr 2025-11-03 18:49:46 +01:00
Uwe Steinmann
992fb5c85e move includes 2025-11-02 19:58:57 +01:00
Uwe Steinmann
d67b6eae2f pass notifier and translator to hook addRoute() 2025-11-02 19:57:57 +01:00
Uwe Steinmann
f2ed3b7453 add more file to classmap 2025-10-30 11:48:16 +01:00
Uwe Steinmann
1bd49eab96 not need to define $logger global 2025-10-30 11:47:25 +01:00
Uwe Steinmann
3ac7bf6ae4 $dms and $user is not needed in run() 2025-10-30 11:46:56 +01:00
Uwe Steinmann
4935fb3c9e pass null instead of "" as default text to translate() 2025-10-29 16:50:50 +01:00
Uwe Steinmann
c86bd865c2 show some deprecation messages 2025-10-29 15:51:32 +01:00
Uwe Steinmann
00360800c3 getLanguages() is now a method of class Settings 2025-10-29 15:50:59 +01:00
Uwe Steinmann
de35433091 show path of configuration file 2025-10-29 15:49:20 +01:00
Uwe Steinmann
d4265e65f8 getAvailableLanguages() is now a method of Settings 2025-10-29 15:48:43 +01:00
Uwe Steinmann
bee91325ca $extMgr is now called $extmgr 2025-10-29 15:48:07 +01:00
Uwe Steinmann
bc1fb05a41 include inc/inc.Language.php 2025-10-29 15:47:34 +01:00
Uwe Steinmann
7384d1db4a pass translator ot constructor of SeedDMS_EmailNotify 2025-10-29 15:45:54 +01:00
Uwe Steinmann
de1a87380b $extMgr is no called $extMgr 2025-10-29 15:45:15 +01:00
Uwe Steinmann
767235f0f5 pass translator to notification service and services 2025-10-29 15:44:44 +01:00
Uwe Steinmann
b4ced679d0 move getAvailableLanguages() and getLanguages() into Settings 2025-10-29 15:43:54 +01:00
Uwe Steinmann
a976d0bd22 move getAvailableLanguages() and getLanguages() from translator 2025-10-29 15:43:10 +01:00
Uwe Steinmann
73ee5781dd show a different error msg when php_sapi == cli 2025-10-29 15:41:16 +01:00
Uwe Steinmann
cc34c42f73 pass translator to constructor 2025-10-29 15:40:35 +01:00
Uwe Steinmann
8a6db445c5 pass translator to notification service 2025-10-29 15:39:48 +01:00
Uwe Steinmann
caa0e3f139 add translation service to container 2025-10-29 11:09:04 +01:00
Uwe Steinmann
5db84c0564 get dms and user from params in factory() 2025-10-29 07:50:09 +01:00
Uwe Steinmann
e755423534 add autoload section and symfony/console 2025-10-28 21:38:46 +01:00
Uwe Steinmann
8e06a17f62 add translation phrases from extension 2025-10-28 21:38:12 +01:00
Uwe Steinmann
1b40717192 pass translator to view and controller 2025-10-28 21:37:33 +01:00
Uwe Steinmann
c649d9e495 set default language in translator from session 2025-10-28 21:36:56 +01:00
Uwe Steinmann
7a1729e0c8 move all translation methods into class 2025-10-28 21:35:17 +01:00
Uwe Steinmann
0e1da1a730 allow 'onclick' attribute in showMenuwithButton() 2025-10-28 19:30:29 +01:00
Uwe Steinmann
afd6a8b7f0 class Settings has been moved into namespace Seeddms\Seeddms 2025-10-28 15:48:52 +01:00
Uwe Steinmann
9ac6bca75f class Settings has been moved into namespace Seeddms\Seeddms 2025-10-28 15:48:10 +01:00
Uwe Steinmann
ef49a43644 no need for 'global $logger' 2025-10-28 15:47:20 +01:00
Uwe Steinmann
9275fc1e05 no need for 'global $logger' 2025-10-28 15:46:50 +01:00
Uwe Steinmann
b6bdae551c rename $extMgr to $extmgr, all global vars can be passed to factory 2025-10-28 15:44:51 +01:00
Uwe Steinmann
d15c65f137 new methods getBaseUrl() and getBaseUrlWithRoot() 2025-10-28 15:41:59 +01:00
Uwe Steinmann
c32fe1be80 pass $settings as first parameter of getLogger() 2025-10-28 15:40:20 +01:00
Uwe Steinmann
6db475692a new token based middleware 2025-10-24 14:00:42 +02:00
Uwe Steinmann
66ab0f25d3 pass response factory to SessionAuth Middleware 2025-10-24 13:59:59 +02:00
Uwe Steinmann
46e927621c add changes of 5.1.43 2025-10-24 12:58:03 +02:00
Uwe Steinmann
afbb891bd5 add changes of 5.1.43 2025-10-24 12:57:03 +02:00
Uwe Steinmann
e175858235 add groups and categories to 'statstotal' 2025-10-24 12:55:35 +02:00
Uwe Steinmann
2f668328fa add middleware for basic authentication 2025-10-24 12:51:10 +02:00
Uwe Steinmann
d73a89c616 do not treat Basic authentication as a token, but just skip it 2025-10-24 12:50:49 +02:00
Uwe Steinmann
6e06bec195 start new version 5.1.43 2025-10-23 21:00:22 +02:00
Uwe Steinmann
d0379f2c91 add file extension .md 2025-10-23 19:06:50 +02:00
Uwe Steinmann
027acbfd3b better formatting 2025-10-23 19:06:27 +02:00
Uwe Steinmann
a77519cfd6 note about layout changes in 5.1.42 2025-10-23 18:48:29 +02:00
Uwe Steinmann
6a85f7c3f9 add file extension .md 2025-10-23 17:45:12 +02:00
Uwe Steinmann
9a8477bf34 improve formatting 2025-10-23 17:44:48 +02:00
Uwe Steinmann
30e4e6391a complete outdated 2025-10-23 17:38:55 +02:00
Uwe Steinmann
893507cc8f add more changes of 5.1.42 2025-10-23 17:36:56 +02:00
Uwe Steinmann
5c009910b1 add file extension .md 2025-10-23 17:33:34 +02:00
Uwe Steinmann
a4aa705fac explain and improve script 2025-10-23 17:33:03 +02:00
Uwe Steinmann
c188f65112 add file extension .md 2025-10-23 16:15:41 +02:00
Uwe Steinmann
effd6d0f5d add section about bruno, some formatting 2025-10-23 16:14:14 +02:00
Uwe Steinmann
8094b65a1e fix links to external pages 2025-10-23 16:05:19 +02:00
Uwe Steinmann
d4a7dc888b add file extension .md 2025-10-23 16:04:56 +02:00
Uwe Steinmann
bd0c70def8 better formating, more information 2025-10-23 16:04:28 +02:00
Uwe Steinmann
a29536f4c2 add file extension .md 2025-10-23 15:50:46 +02:00
Uwe Steinmann
17e73dd494 fix formatting 2025-10-23 15:50:20 +02:00
Uwe Steinmann
fc8d01df6b more formating fixes, additional information 2025-10-23 15:44:21 +02:00
Uwe Steinmann
ed36b88a09 fix formatting 2025-10-23 13:50:18 +02:00
Uwe Steinmann
00e6a22dbd many more formatting fixex 2025-10-23 13:37:52 +02:00
Uwe Steinmann
7e2803da25 fix some formating 2025-10-23 13:15:53 +02:00
Uwe Steinmann
5a25b7cd3a add file extension .md 2025-10-23 12:56:47 +02:00
Uwe Steinmann
93cdce72ac fix path to include inc.Core.php 2025-10-23 07:16:56 +02:00
Uwe Steinmann
73db1e87c9 add changes for 5.1.42 2025-10-22 17:08:04 +02:00
Uwe Steinmann
f88acd0ebd use php-cache instead of memcached 2025-10-22 16:14:49 +02:00
Uwe Steinmann
3365760c87 add extra plugin to merge composer-local.json 2025-10-22 10:21:49 +02:00
Uwe Steinmann
3782e71ae6 add method makeRandomString() 2025-10-20 12:42:31 +02:00
Uwe Steinmann
917ba91d95 do not load content of modal box from href url, if href is not set 2025-10-20 12:41:52 +02:00
Uwe Steinmann
eb2f4d6206 add video/mpeg to list of mimetypes having a preview 2025-10-17 14:06:50 +02:00
Uwe Steinmann
db70d2e432 note about removal of dir pear in favour of vendor 2025-10-17 14:06:07 +02:00
Uwe Steinmann
edbf6b60da add script 'phpcs' 2025-10-16 15:30:46 +02:00
Uwe Steinmann
69b82fde4b fix code formating 2025-10-16 15:30:35 +02:00
Uwe Steinmann
c6d3b70799 update some packages 2025-10-16 10:48:35 +02:00
Uwe Steinmann
19eb2db195 update some packages 2025-10-16 10:48:18 +02:00
Uwe Steinmann
ebdc85d510 update some packages 2025-10-16 10:36:22 +02:00
Uwe Steinmann
9df13922e9 require unrestricted access on document/folder for deletion by rest api 2025-10-13 11:08:51 +02:00
Uwe Steinmann
8043388109 add changes for 5.1.42 2025-10-11 06:20:56 +02:00
Uwe Steinmann
fc2e6e217c fix folder parameter to hook 'folderRowAction' 2025-10-11 06:19:19 +02:00
Uwe Steinmann
13fd205b55 some new phrases 2025-10-09 08:57:15 +02:00
Uwe Steinmann
8b4b12a7e8 sync with composer.json 2025-10-09 08:46:33 +02:00
Uwe Steinmann
d1fc54d1b3 add missing column to table headers 2025-10-09 08:28:39 +02:00
Uwe Steinmann
8540d591cd save logFileRestApiMaxLevel 2025-10-08 14:34:12 +02:00
Uwe Steinmann
64e2f3d338 add missing dependencies 2025-10-07 20:04:47 +02:00
Uwe Steinmann
5eda99d5ea more changes in 5.1.42 2025-10-07 10:55:36 +02:00
Uwe Steinmann
6e3330c670 new endpoints to change folder name and comment 2025-10-06 11:45:54 +02:00
Uwe Steinmann
0ac2b76bb6 fix second parameter of getAccessMode() 2025-10-06 11:45:28 +02:00
Uwe Steinmann
072a8206e0 much better implementation of getPeriodOfTime() 2025-10-06 11:44:33 +02:00
Uwe Steinmann
73facda205 init $memcache 2025-10-02 12:37:04 +02:00
Uwe Steinmann
cb73547ca8 add translations for memcached host and port settings 2025-10-02 09:18:51 +02:00
Uwe Steinmann
81fc17a812 memcached port and host can be configured 2025-10-02 09:17:42 +02:00
Uwe Steinmann
8b80df9519 set explixit file list for target 'dist', because using distfiles causes errors 2025-10-01 10:26:34 +02:00
Uwe Steinmann
d1cbda90e2 require pear/archive_tar 2025-10-01 10:26:11 +02:00
Uwe Steinmann
cb41ef76d0 various new translations for 2-fact authentication 2025-10-01 10:02:43 +02:00
Uwe Steinmann
42ba5f93df use latest version of hfig/mapi 2025-09-30 08:04:34 +02:00
Uwe Steinmann
5c7a16a112 set background of drag&drop area when entering 2025-09-30 08:04:08 +02:00
Uwe Steinmann
5aa17d92df take out old chosen.[css|js] 2025-09-25 14:52:23 +02:00
Uwe Steinmann
c142e68c5f fix indenting of lines 2025-09-25 10:31:39 +02:00
Uwe Steinmann
8c55c64b40 add update task 2025-09-25 10:31:23 +02:00
Uwe Steinmann
8e95df660b change same keys of translated phrases 2025-09-25 07:54:42 +02:00
Uwe Steinmann
83eeecc6cf fix typos 2025-09-24 16:50:08 +02:00
Uwe Steinmann
e0519e5a9b fix typos 2025-09-24 16:46:53 +02:00
Uwe Steinmann
81866bc0f7 check if pdfviewer is available, do not show messages of composer 2025-09-24 16:44:11 +02:00
Uwe Steinmann
9f47d1a86d new location of .htaccess 2025-09-24 16:26:26 +02:00
Uwe Steinmann
fde6216cdb .htaccess is now in www 2025-09-24 16:21:57 +02:00
Uwe Steinmann
7d723fdf6a .htaccess must be in www 2025-09-24 15:54:45 +02:00
Uwe Steinmann
2523aa8e45 use pdfviewer from new extension 'pdfviewer' 2025-09-24 15:01:13 +02:00
Uwe Steinmann
d88ec8a118 make a extension disabled if it's disabled in conf.php 2025-09-24 14:59:50 +02:00
Uwe Steinmann
237aa79140 extensionIsDisabled() returns true if extension isn't installed 2025-09-24 14:57:16 +02:00
Uwe Steinmann
f6cded950b install pdfviewer as an extension 2025-09-24 14:56:37 +02:00
Uwe Steinmann
4173cc8be5 allow .mjs and .ftl below ext/*/res (pdfviewer needs it) 2025-09-24 14:55:43 +02:00
Uwe Steinmann
72efa6cd47 add install target 2025-09-23 18:13:41 +02:00
Uwe Steinmann
e11e563e6c ignore more files 2025-09-23 18:12:58 +02:00
Uwe Steinmann
1f4e3de21b template for apache virtual host configuration 2025-09-23 18:12:35 +02:00
Uwe Steinmann
e1f1fcacad more formatting 2025-09-22 10:55:03 +02:00
Uwe Steinmann
752cedfd07 better formatting 2025-09-22 10:53:16 +02:00
Uwe Steinmann
0e45cd2e3e some more details 2025-09-22 10:50:09 +02:00
Uwe Steinmann
a409e38973 set upper limit of 1000 if everything shall be shown 2025-09-22 10:41:29 +02:00
Uwe Steinmann
7fdd0431c1 set pageNumber to all in export mode 2025-09-22 10:41:15 +02:00
Uwe Steinmann
975d1de703 declare class variables 2025-09-22 10:37:51 +02:00
Uwe Steinmann
d2f64ea0e1 initial README.md 2025-09-21 20:32:07 +02:00
Uwe Steinmann
20d1927026 new target quickstart-dev 2025-09-21 20:31:50 +02:00
Uwe Steinmann
36a6f05353 new section on installation from git 2025-09-21 20:31:28 +02:00
Uwe Steinmann
78e70dcee2 create a development version with softlinks to the git repositories 2025-09-21 20:29:16 +02:00
Uwe Steinmann
eb38d82b79 create export dir 2025-09-21 20:28:53 +02:00
Uwe Steinmann
0bc371dce8 set dir when running composer 2025-09-21 20:28:35 +02:00
Uwe Steinmann
39e72af272 use placeholder for branch of seeddms/core 2025-09-21 14:31:29 +02:00
Uwe Steinmann
e46ac30ed5 update to phing 3 2025-09-21 14:31:11 +02:00
Uwe Steinmann
5def2b7e74 update exec command 2025-09-21 14:30:47 +02:00
Uwe Steinmann
d18121d79a set minor, major and subminor version, output them 2025-09-21 14:30:29 +02:00
Uwe Steinmann
ac2164708f set proper path to seeddms repositories in composer-dist.json 2025-09-21 11:48:32 +02:00
Uwe Steinmann
8cdd8f9375 use seeddms/core[dev-seeddms-5.1.x] 2025-09-21 11:32:30 +02:00
Uwe Steinmann
b01b67d923 assume other repositories as siblings of this dir 2025-09-21 11:29:08 +02:00
Uwe Steinmann
389562169d get rid of old code 2025-09-20 22:14:57 +02:00
Uwe Steinmann
bab0afb947 add pear/http-request2 2025-09-20 22:05:05 +02:00
Uwe Steinmann
683ccbeb07 add composer-merge-plugin 2025-09-20 22:01:31 +02:00
Uwe Steinmann
795c6aa1ca add missing composer.json 2025-09-20 21:50:15 +02:00
Uwe Steinmann
33d4861ce3 add bacon/bacon-qr-code 2025-09-20 21:48:32 +02:00
Uwe Steinmann
bef3b62f5a get rid of pear directory 2025-09-20 21:48:07 +02:00
Uwe Steinmann
3d73dc8279 add new dist target based on phing 2025-09-20 21:47:37 +02:00
Uwe Steinmann
047a29e26c move ext and index.php into www 2025-09-20 19:48:49 +02:00
Uwe Steinmann
749d598a0a add warning, that this file is outdated 2025-09-20 19:36:32 +02:00
Uwe Steinmann
8b562f05b9 fix deprecated warning 2025-09-10 18:17:53 +02:00
Uwe Steinmann
306fc83840 fix parameters of setcookie 2025-09-10 16:38:21 +02:00
Uwe Steinmann
8ab80bd42c remove unused variables and old code 2025-09-10 14:27:02 +02:00
Uwe Steinmann
5fd15ecec3 makeTsFromDate() can handle null 2025-09-10 10:21:22 +02:00
Uwe Steinmann
5c9c02f5f2 add fold marks 2025-09-06 13:41:41 +02:00
Uwe Steinmann
9dc430e94d add changes for 5.1.42 2025-09-05 08:07:28 +02:00
Uwe Steinmann
b9de849ab8 use ExtensionMgr created in inc.Extension.php, use proxy settings 2025-09-03 11:45:56 +02:00
Uwe Steinmann
25fd07a945 use ExtensionMgr created in inc.Extension.php 2025-09-03 11:45:16 +02:00
Uwe Steinmann
61f4dfca4b add missing fold mark 2025-09-03 11:44:31 +02:00
Uwe Steinmann
7d81f5b0f8 add method getStreamContext() 2025-09-03 11:43:57 +02:00
Uwe Steinmann
c25f0a32be no longer use php7.4 2025-07-31 11:07:13 +02:00
Uwe Steinmann
49a243d92e start new version 5.1.42 2025-07-31 11:03:59 +02:00
Uwe Steinmann
181dd2c3ff output some more data (orig filename, document id, document name) 2025-07-30 19:12:18 +02:00
Uwe Steinmann
4bba138184 add missing phrases 2025-07-30 17:36:47 +02:00
Uwe Steinmann
feaed7b49d declare class variable $stats 2025-07-30 14:33:18 +02:00
Uwe Steinmann
a194b7bc5b declare class variables 2025-07-30 14:27:54 +02:00
Uwe Steinmann
0c2f3c651a declare class variables 2025-07-30 14:27:37 +02:00
Uwe Steinmann
01f210ad43 check if user has a pwd expiration before outputing it 2025-07-30 14:27:12 +02:00
Uwe Steinmann
59fedbbcc0 fix typo, add new phrases 2025-07-30 09:43:48 +02:00
Uwe Steinmann
b6dae52f35 check orig filename only if admin 2025-07-30 09:03:13 +02:00
Uwe Steinmann
bc5ae5c74e more changes of 5.1.41 2025-07-30 08:55:19 +02:00
Uwe Steinmann
e823d918e8 add new phrases 2025-07-30 08:21:47 +02:00
Uwe Steinmann
d47b8f8adf add changes for 5.1.41 2025-07-29 21:21:44 +02:00
Uwe Steinmann
46594fa3bc allow to edit original filename 2025-07-29 21:21:05 +02:00
Uwe Steinmann
5dfd280ec5 add code for setting original filename 2025-07-29 21:18:33 +02:00
Uwe Steinmann
f20f4d2ae2 add method printInlineEditOriginalName() 2025-07-29 21:17:35 +02:00
Uwe Steinmann
2e38c8fb92 add command 'setoriginalname' 2025-07-29 21:17:04 +02:00
Uwe Steinmann
c16a9692a3 add translation for 2_fact_auth_qrcode 2025-07-25 09:51:33 +02:00
Uwe Steinmann
ae8b383def fix potential XSS attack in many fields of settings 2025-07-24 20:43:29 +02:00
Uwe Steinmann
698c82b806 add more changes of 5.1.41 2025-07-24 09:30:28 +02:00
Uwe Steinmann
29d6ece06a fix typo 2025-07-24 09:17:03 +02:00
Uwe Steinmann
83ea0e0db9 add changes for 5.1.41 2025-07-24 09:16:09 +02:00
Uwe Steinmann
ee50953d11 fix list of related documents when hook documentListItem() is implemented 2025-07-24 09:15:18 +02:00
Uwe Steinmann
cf2bb2b4c3 more documentation for method documentListRow() 2025-07-24 09:13:59 +02:00
Uwe Steinmann
5bce2fa6fd move code into controller 2025-07-23 22:53:27 +02:00
Uwe Steinmann
5c717cf6ba remove old code 2025-07-23 22:52:23 +02:00
Uwe Steinmann
04df883582 add changes for 5.1.41 2025-07-23 20:09:30 +02:00
Uwe Steinmann
ae635fba1a fix setting path to document below title 2025-07-23 20:08:21 +02:00
Uwe Steinmann
00a5f59bc3 check if attr definition exists when building a search query 2025-07-23 20:07:35 +02:00
Uwe Steinmann
593c6f5f95 check if attr definition exists when building a search query from an url 2025-07-23 20:06:34 +02:00
Uwe Steinmann
30880c0539 move sending notification into sendChangedVersionAttributesMail() 2025-07-23 20:05:57 +02:00
Uwe Steinmann
f969669356 no php warning if company of author isn't set in conf.php 2025-07-18 16:50:32 +02:00
Uwe Steinmann
45eda343d9 fix typo 2025-07-18 10:14:31 +02:00
Uwe Steinmann
82d24098aa better formating, more info for AD 2025-07-18 10:14:12 +02:00
Uwe Steinmann
911684f37f add changes for 5.1.41 2025-07-17 18:34:14 +02:00
Uwe Steinmann
bdde3f6ff5 fix getting access rights in getMandatoryReviewers() 2025-07-15 11:50:43 +02:00
Uwe Steinmann
f3181967b9 fix getting access rights in getMandatoryApprovers() 2025-07-15 11:43:45 +02:00
Uwe Steinmann
398a05ba47 break works if orig filename is too long 2025-07-07 19:53:41 +02:00
Uwe Steinmann
3c9b51c152 show number of reviewers/approvers how has done their work 2025-07-02 16:32:25 +02:00
Uwe Steinmann
4330c7fc7b add methods to show number of reviewers/approvers all ready done their work 2025-07-02 16:31:45 +02:00
Uwe Steinmann
938b417bfc add missing translations 2025-07-02 16:30:49 +02:00
Uwe Steinmann
f95ebce720 add extension for application/x-xz 2025-06-27 09:25:35 +02:00
Uwe Steinmann
ac29815974 replace array_merge by '+' when combining returned array of hooks 2025-06-25 12:58:37 +02:00
Uwe Steinmann
a74f5d9668 get options before output of select tag 2025-06-25 12:57:49 +02:00
Uwe Steinmann
aa5524ec41 export options can be get by hook 2025-06-17 07:48:13 +02:00
Uwe Steinmann
c8ac16cec3 add changes of 5.1.41 2025-05-24 16:11:54 +02:00
Uwe Steinmann
c21465f373 major update 2025-05-24 07:17:29 +02:00
Uwe Steinmann
7edd4fa0b9 action can be set when clicking on a thumbnail 2025-05-23 12:26:34 +02:00
Uwe Steinmann
1296ce3104 new version 5.1.41 2025-05-23 12:25:58 +02:00
403 changed files with 18766 additions and 27902 deletions

2
.gitignore vendored
View File

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

356
CHANGELOG
View File

@ -1,325 +1,59 @@
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 6.0.33 Changes in version 5.1.44
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- merge changes up to 5.1.40 - fix php error in install tool
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 6.0.32 Changes in version 5.1.43
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- merge changes up to 5.1.39 - add Slim middleware for Basic authentication (can be used by extensions)
- fix setting attributes (user, group, document, folder) when checking in - rest api endpoint 'statstotal' returns number of groups and categories
a new document version - add new command line program utils/console
- validate setting revision date - 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 6.0.31 Changes in version 5.1.42
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- merge changes up to 5.1.38 - use proxy when getting latest version
- fix various restapi endpoints which hadn't been updated to slim4 - 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 6.0.30 Changes in version 5.1.41
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- merge changes up to 5.1.37 - action when clicking on a thumbnail can be set (download or view online)
- receipt comment can be disabled - major update of polish translation
- send request receipt notification only when document is released - 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
Changes in version 6.0.29 - move EditAttributes into controller and add various hooks (like EditDocument)
-------------------------------------------------------------------------------- - move sending notification mail when attributes are changed into
- merge changes up to 5.1.36 Notification Service
- fix regression in FolderNotify - more documentation on configuring LDAP
- collect output controller/view hooks with '+' instead of array_merge()
-------------------------------------------------------------------------------- - add hook 'searchExportOptions'
Changes in version 6.0.28 - show how many users have to review/approve a document and how many did
-------------------------------------------------------------------------------- already (in menu task list and document list)
- merge changes up to 5.1.35 - 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 6.0.27
--------------------------------------------------------------------------------
- merge changes up to 5.1.34
- Document/folder check distinguishes between documents which cannot be
receiped/revised because of access rights or the recipient/revisor being
disabled.
- fix creating user via rest api
- checkout info does not depend on whether the logged in user was substituted
- add new endpoints for managing roles by rest api
- add transmittals in menu
- add legacy access check for controllers
--------------------------------------------------------------------------------
Changes in version 6.0.26
--------------------------------------------------------------------------------
- merge changes up to 5.1.33
- add task to import files from drop folder
- add substitution of users in bootstrap4 theme
--------------------------------------------------------------------------------
Changes in version 6.0.25
--------------------------------------------------------------------------------
- merge changes up to 5.1.32
- status log can be turned on with advanced access control
- scheduler has more condensed layout
--------------------------------------------------------------------------------
Changes in version 6.0.24
--------------------------------------------------------------------------------
- add task to send list of recent changes by email
- merge changes up to 5.1.31
--------------------------------------------------------------------------------
Changes in version 6.0.23
--------------------------------------------------------------------------------
- fix setting recipients and revisors
- check in of a document is allowed for the user having done the check out
or those users with unlimited access rights on the document
- merge changes up to 5.1.30
--------------------------------------------------------------------------------
Changes in version 6.0.22
--------------------------------------------------------------------------------
- merge changes up to 5.1.29
--------------------------------------------------------------------------------
Changes in version 6.0.21
--------------------------------------------------------------------------------
- merge changes up to 5.1.28
- add new check for documents with identical sequence numbers in a folder
--------------------------------------------------------------------------------
Changes in version 6.0.20
--------------------------------------------------------------------------------
- merge changes up to 5.1.27
- fix triggering workflow (Closes: #542)
- create original file name from new document name when uploading document
from the library folder. Used to be the original file name
--------------------------------------------------------------------------------
Changes in version 6.0.19
--------------------------------------------------------------------------------
- merge changes up to 5.1.26
- fix deletion of tasks when using bootstrap4 theme
- fix deletion of documents when clicking on icon in document list (my documents)
--------------------------------------------------------------------------------
Changes in version 6.0.18
--------------------------------------------------------------------------------
- finish op/op.Cron.php, returns json
- merge changes up to 5.1.25
- fix sending trigger workflow notification (Closes: #522)
- fix updating und deleting items in document lists
- call hook 'filenameDownloadItem' in search export and transmittal download
- fix possible xss attack in UsrMgr (CVE-2022-28479)
--------------------------------------------------------------------------------
Changes in version 6.0.17
--------------------------------------------------------------------------------
- merge changes up to 5.1.24
- send notification when a receiption of a document was submitted
--------------------------------------------------------------------------------
Changes in version 6.0.16
--------------------------------------------------------------------------------
- cancel checkout needs confirmation
- add input field to filter list of recipients if more then 10
- add task for creating missing preview images
- no longer use old PHPExcel classes, use PhpOffice\PhpSpreadsheet\Spreadsheet
instead
--------------------------------------------------------------------------------
Changes in version 6.0.15
--------------------------------------------------------------------------------
- merge changes up to 5.1.22
- add a new task for checking the checksum of all document versions
- add searching for revision date
- list of open tasks will no longer contain expired documents but MyDocuments
page still list them
- fixed downloading approval file (Closes: #503)
- regular users can no longer set owner of document while uploading
--------------------------------------------------------------------------------
Changes in version 6.0.14
--------------------------------------------------------------------------------
- show debug menu only if debug mode is on
- merge changes up to 5.1.21
- document links can be added by regular users again
- add list of checked out documents to tasks
- issue a warning when removing a document which is checked out
- checked out can be discarded if it was changed
--------------------------------------------------------------------------------
Changes in version 6.0.13
--------------------------------------------------------------------------------
- merge changes up to 5.1.20
- create download file for transmittal in system tmp (Closes: #478)
- sync source code of checkin with update document
--------------------------------------------------------------------------------
Changes in version 6.0.12
--------------------------------------------------------------------------------
- merge changes up to 5.1.19
- fix various errors concerning workflows
- show menu tasks even if not admin (Closes: #485)
--------------------------------------------------------------------------------
Changes in version 6.0.11
--------------------------------------------------------------------------------
- merge changes up to 5.1.18
- fix access restriction for roles (content of documents was visible even if the
role and status didn't allow it)
- fix missing Content-Type in UserList (Closes: #480)
--------------------------------------------------------------------------------
Changes in version 6.0.10
--------------------------------------------------------------------------------
- merge changes up to 5.1.17
- fix list of previous document versions (Closes: #471)
- fix uploading files with fine uploader (Closes: #472)
- clear revision date when all revisors have been deleted
- improve scheduler task management, tasks can be deleted, fix setting parameters
- add op.Cron.php for running all scheduled tasks
--------------------------------------------------------------------------------
Changes in version 6.0.9
--------------------------------------------------------------------------------
- merge changes up to 5.1.16
- fix removal of roles (Closes: #465)
- fix password forgotten process
- fix setting role of new user and retrieving role of existing user
- processes of users can be deleted again, instead of only transfered to
another user
- fix export of search results, headers of excel file can be translated
- fix arcordeon for folder filters on search page
- fix upload from dropfolder
- fix adding new calendar event
--------------------------------------------------------------------------------
Changes in version 6.0.8
--------------------------------------------------------------------------------
- merge changes up to 5.1.15
- fix syntax error in op/op.EditComment.php
- fix use of private variable in op/op.SetRecipients.php and op/op.SetRevisors.php
- fix triggering a transition in advanced workflow mode
--------------------------------------------------------------------------------
Changes in version 6.0.7
--------------------------------------------------------------------------------
- fix editing of document attachments
- make receipt summary look like approval/review summary
- merge changes up to 5.1.14
- do not show the updating user in a revision workflow if the status is 0
this is misleading because the user starting the revision workflow is the one
first accessing the document
- rejection of document receipts are turned off by default, but can be turned
on in the settings
- documents in DocumentChooser are sorted by name
- instead of just removing a user from all processes it can be replaced by a new user
--------------------------------------------------------------------------------
Changes in version 6.0.6
--------------------------------------------------------------------------------
- fix setting attributes when checking in a new document version
- setting a document revision to 'needs correction' will no longer set the
documents status to 'needѕ correction' if this was turned off in the settings
- a document will not leave draft status when setting the approver/reviewer
without setting a reviewer/approver
- tasks to be counted in menu can be configured
- add number of documents which need correction to menu
- minor 2 factor auth. fixes when initially setting the secret
- remove ѕome unneeded code from AddDocument which just caused php warnings
- do not set the uploader of new documents to owner if the owner is different from
the uploader
- add scheduler
- add hook showVersionComment in out.ViewDocument.php
- Various minor corrections of database tables tblWorkflowLog and
tblWorkflowDocumentContent
- merge changes up to 5.1.7
--------------------------------------------------------------------------------
Changes in version 6.0.5
--------------------------------------------------------------------------------
- sync form for updating document by upload and checkin
- add list of documents which need correction on MyDocuments page
--------------------------------------------------------------------------------
Changes in version 6.0.4
--------------------------------------------------------------------------------
- merge changes up to 5.1.5
--------------------------------------------------------------------------------
Changes in version 6.0.3
--------------------------------------------------------------------------------
- add list of documents without a receiver on MyDocuments page
- propperly calculate number of documents for each value of value set in attribute mgr
- output of progress bar for reception of a document can be controlled by access list
- recipientof a document version can be set when uploading the file
- fix export of search and display of 2nd, 3rd, ... search page
- speed up creation of document lists if reception progress bar is shown
- status of rejected documents can be overriden
- do not add users from group as recipients if they are the uploader or reviewer
of a document
- add list of documents without a receiver, list of drafts, and list of absolete
documents on MyDocuments page
- add callback onCheckAccessDocument to SeedDMS_Core_Document
- add new document status 'needs correction', revised documents which do not pass
will no longer be in status 'rejected' but 'needs correction'
- better error handling when indexing documents fails
- apache xsendfile module is used for downloading documents when installed
- add view access check for ApprovalSummary, ReviewSummary, ReceiptSummary,
WorkflowSummary, DocumentAccess, GroupView, UsrView, WorkflowSummary
- filter out reviewers and uploader of a document version when setting recipients
by user group
--------------------------------------------------------------------------------
Changes in version 6.0.2
--------------------------------------------------------------------------------
- check if user has access on document and is not disabled if set as
receiver, revisor
- check if group has members if set as reviewer, approver, receiver, revisor
- fix bug in notification of approver after successful review
- add document check for docs in revision and missing access rights of revisor
- add document check for docs requiring receptions but user lacks access right
- fix Acl manager when using pgsql
- list all open tasks of user in user info of user manager
- owner of document may see review/approval/receipt/revision log
- fix sending mails to reviewer/approvers after check in
- downloading of review/approval files works again
- optimizing retrieval of open tasks
- do not show user which has been removed from a process except for admins
- show scheduled revisions in calendar
- merge changes up to 5.1.5
--------------------------------------------------------------------------------
Changes in version 6.0.1
--------------------------------------------------------------------------------
- call hook 'rawcontent' when downloading transmittal list or search content
- speed up list of locked documents on MyDocuments page
- sql queries and execution times can be written to file in database layer
--------------------------------------------------------------------------------
Changes in version 6.0.0
--------------------------------------------------------------------------------
- merge changes up to 5.0.10
- filter documents by status 'draft' on search page
- list of documents to look at now contains documents in revision
- add list of documents waiting for reception on MyDocuments page
- group document lists on MyDocuments page into three sections
- show progressbar and comments for reception of document in documentlist
- restructure page for document/folder check, add check for missing access
on documents by recipient or revisor
- overhaul revision workflow, add hook after revision workflow was finished
- add two factor authentication based on google authenticator
- set timeout for ajax call 'mytasks' from 200ms to 1000ms
- use a similar layout for document list on the ViewDocument page
- add RSS feed of timeline
- put more operations under access control
- add receipent list for documents
- add revision of documents
- add substitute user command for regular users
- add access controll list for many functions
- add document list which can be exported as an archive
- search results can be exported
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 5.1.40 Changes in version 5.1.40

View File

@ -221,6 +221,36 @@ module.exports = function (grunt) {
], ],
dest: bootstrapDir + '/jquery-lazy', dest: bootstrapDir + '/jquery-lazy',
flatten: true 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, expand: true,
src: [ src: [

View File

@ -6,7 +6,11 @@ NODISTFILES=utils/importmail.php utils/seedddms-importmail utils/remote-email-up
PHPDOC=~/Downloads/phpDocumentor.phar PHPDOC=~/Downloads/phpDocumentor.phar
dist: INSTALL_PATH=/home/www-data/seeddms-test
all: dist
olddist:
mkdir -p tmp/seeddms-$(VERSION) mkdir -p tmp/seeddms-$(VERSION)
cp -a $(SRC) tmp/seeddms-$(VERSION) cp -a $(SRC) tmp/seeddms-$(VERSION)
mkdir -p tmp/seeddms-$(VERSION)/views 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)) (cd tmp; tar --exclude=.svn --exclude=.gitignore -czvf ../seeddms-$(VERSION).tar.gz seeddms-$(VERSION))
rm -rf tmp rm -rf tmp
dist:
php vendor/bin/phing -Dversion=$(VERSION) dist
quickstart: 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: unittest:
vendor/bin/phing -Dversion=$(VERSION) phpunitfast vendor/bin/phing -Dversion=$(VERSION) phpunitfast
@ -95,4 +111,4 @@ PKGFILE=SeedDMS_Core/package.xml
changelog: 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' @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
View 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
View File

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

288
build.xml
View File

@ -16,6 +16,10 @@
<propertyregex property="shortversion" subject="${version} kk" pattern="([56])\.([0-9]).*" replace="seeddms$1$2x" override="true"/> <propertyregex property="shortversion" subject="${version} kk" pattern="([56])\.([0-9]).*" replace="seeddms$1$2x" override="true"/>
<property name="majorversion" value="${version}" /> <property name="majorversion" value="${version}" />
<propertyregex property="majorversion" subject="${version}" pattern="([56])\..*" replace="$1" override="true"/> <propertyregex property="majorversion" subject="${version}" pattern="([56])\..*" replace="$1" override="true"/>
<property name="minorversion" value="${version}" />
<propertyregex property="minorversion" subject="${version}" pattern="[56]\.([0-9])\..*" replace="$1" override="true"/>
<property name="subminorversion" value="${version}" />
<propertyregex property="subminorversion" subject="${version}" pattern="[56]\.[0-9]\.(.*)" replace="$1" override="true"/>
<property name="composer_version" value="2.8.5" /> <property name="composer_version" value="2.8.5" />
<property name="composer_extra_params" value="" /> <property name="composer_extra_params" value="" />
<property name="composer_env" value="" /> <property name="composer_env" value="" />
@ -35,10 +39,9 @@
<include name="webdav/**" /> <include name="webdav/**" />
<include name="install/**" /> <include name="install/**" />
<include name="restapi/**" /> <include name="restapi/**" />
<include name="pdfviewer/**" /> <include name="www/index.php" />
<include name="index.php" />
<include name="CHANGELOG" /> <include name="CHANGELOG" />
<include name=".htaccess" /> <include name="www/.htaccess" />
<include name="LICENSE" /> <include name="LICENSE" />
</fileset> </fileset>
@ -48,22 +51,22 @@
<!-- PHP CodeSniffer --> <!-- PHP CodeSniffer -->
<target name="phpcbf"> <target name="phpcbf">
<exec command="${srcdir}/vendor/bin/phpcbf --standard=${srcdir}/phpcs.xml" escape="false" passthru="true" checkreturn="true" /> <exec executable="bash" line="${srcdir}/vendor/bin/phpcbf --standard=${srcdir}/phpcs.xml" escape="false" passthru="true" checkreturn="true" />
</target> </target>
<target name="phpcs"> <target name="phpcs">
<exec command="${srcdir}/vendor/bin/phpcs --standard=${srcdir}/phpcs.xml --report=checkstyle &gt; ${builddir}/reports/checkstyle.xml" escape="false" /> <exec executable="bash" line="${srcdir}/vendor/bin/phpcs --standard=${srcdir}/phpcs.xml --report=checkstyle &gt; ${builddir}/reports/checkstyle.xml" escape="false" />
</target> </target>
<target name="phpcs-console"> <target name="phpcs-console">
<exec command="${srcdir}/vendor/bin/phpcs --standard=${srcdir}/phpcs.xml" escape="false" passthru="true" checkreturn="true" /> <exec executable="bash" line="${srcdir}/vendor/bin/phpcs --standard=${srcdir}/phpcs.xml" escape="false" passthru="true" checkreturn="true" />
</target> </target>
<target name="php-cs-fixer-dryrun"> <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" /> <exec executable="bash" line="${srcdir}/vendor/bin/php-cs-fixer fix --dry-run -vvv --diff ${srcdir}/inc" passthru="true" escape="false" checkreturn="true" />
</target> </target>
<!-- PHPUnit --> <!-- PHPUnit -->
<target name="phpunitfast" description="Run tests"> <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" / --> <!-- 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>
@ -83,7 +86,13 @@
</else> </else>
</if> </if>
<echo message="Installing dependencies..." /> <echo message="Installing dependencies..." />
<exec command="${composer_env} php ${srcdir}/composer.phar install ${composer_extra_params}" passthru="true" checkreturn="true" /> <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>
<target name="dist" description="build SeedDMS tar archive"> <target name="dist" description="build SeedDMS tar archive">
@ -92,11 +101,29 @@
<then><fail msg="Pass version as property 'version'" /></then> <then><fail msg="Pass version as property 'version'" /></then>
</if> </if>
<echo msg="This is ${shortversion}" /> <echo msg="This is ${version}" />
<delete file="./seeddms-${version}.tar.gz" failonerror="false" /> <delete file="./seeddms-${version}.tar.gz" failonerror="false" />
<tar destfile="./seeddms-${version}.tar.gz" prefix="seeddms-${version}" compression="gzip"> <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> </tar>
</target> </target>
@ -107,6 +134,9 @@
</if> </if>
<echo msg="This is ${shortversion}" /> <echo msg="This is ${shortversion}" />
<echo msg="Major version ${majorversion}" />
<echo msg="Minor version ${minorversion}" />
<echo msg="Subminor version ${subminorversion}" />
<if> <if>
<matches string="${version}" pattern="^6\.0\..*" /> <matches string="${version}" pattern="^6\.0\..*" />
@ -117,22 +147,34 @@
<delete dir="${builddir}/packages" includeemptydirs="true" failonerror="false" /> <delete dir="${builddir}/packages" includeemptydirs="true" failonerror="false" />
<mkdir dir="${builddir}/packages" /> <mkdir dir="${builddir}/packages" />
<delete dir="${builddir}/export" includeemptydirs="true" failonerror="false" /> <delete dir="${builddir}/export" includeemptydirs="true" failonerror="false" />
<mkdir dir="${builddir}/export" />
<mkdir dir="${builddir}/export/${shortversion}" /> <mkdir dir="${builddir}/export/${shortversion}" />
<mkdir dir="${builddir}/export/${shortversion}/conf" /> <mkdir dir="${builddir}/export/${shortversion}/conf" />
<mkdir dir="${builddir}/export/${shortversion}/data" /> <mkdir dir="${builddir}/export/${shortversion}/data" />
<mkdir dir="${builddir}/export/${shortversion}/data/1048576" /> <mkdir dir="${builddir}/export/${shortversion}/data/1048576" />
<mkdir dir="${builddir}/export/${shortversion}/data/log" /> <mkdir dir="${builddir}/export/${shortversion}/data/log" />
<mkdir dir="${builddir}/export/${shortversion}/data/cache" /> <mkdir dir="${builddir}/export/${shortversion}/data/cache" />
<exec command="echo 'Signature: 8a477f597d28d172789f06886806bc55' &gt; ${builddir}/export/${shortversion}/data/cache/CACHEDIR.TAG" /> <exec executable="echo" passthru="true" checkreturn="true">
<exec command="echo '# This file is a cache directory tag created by seeddms.' &gt;&gt; ${builddir}/export/${shortversion}/data/cache/CACHEDIR.TAG" /> <arg line="'Signature: 8a477f597d28d172789f06886806bc55' &gt; ${builddir}/export/${shortversion}/data/cache/CACHEDIR.TAG" />
<exec command="echo '# For information about cache directory tags, see: http://www.brynosaurus.com/cachedir/' &gt;&gt; ${builddir}/export/${shortversion}/data/cache/CACHEDIR.TAG" /> </exec>
<exec executable="echo" passthru="true" checkreturn="true">
<arg line="'# This file is a cache directory tag created by seeddms.' &gt;&gt; ${builddir}/export/${shortversion}/data/cache/CACHEDIR.TAG" />
</exec>
<exec executable="echo" passthru="true" checkreturn="true">
<arg line="echo '# For information about cache directory tags, see: http://www.brynosaurus.com/cachedir/' &gt;&gt; ${builddir}/export/${shortversion}/data/cache/CACHEDIR.TAG" />
</exec>
<mkdir dir="${builddir}/export/${shortversion}/data/backup" /> <mkdir dir="${builddir}/export/${shortversion}/data/backup" />
<mkdir dir="${builddir}/export/${shortversion}/data/lucene" /> <mkdir dir="${builddir}/export/${shortversion}/data/lucene" />
<mkdir dir="${builddir}/export/${shortversion}/data/staging" /> <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" />
<mkdir dir="${builddir}/export/${shortversion}/www/ext" /> <mkdir dir="${builddir}/export/${shortversion}/www/ext" />
<if>
<matches string="${mode}" pattern="^development" />
<then></then>
<else>
<mkdir dir="${builddir}/export/${shortversion}/seeddms-${version}" /> <mkdir dir="${builddir}/export/${shortversion}/seeddms-${version}" />
</else>
</if>
<copy file="${srcdir}/conf/settings.xml.template" tofile="${builddir}/export/${shortversion}/conf/settings.xml"> <copy file="${srcdir}/conf/settings.xml.template" tofile="${builddir}/export/${shortversion}/conf/settings.xml">
<filterchain> <filterchain>
@ -147,70 +189,186 @@
</filterchain> </filterchain>
</copy> </copy>
<copy file="${srcdir}/conf/.htaccess" tofile="${builddir}/export/${shortversion}/conf/.htaccess" /> <copy file="${srcdir}/conf/.htaccess" tofile="${builddir}/export/${shortversion}/conf/.htaccess" />
<if>
<matches string="${mode}" pattern="^development" />
<then>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}">
<arg line="-s ${srcdir} seeddms" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/op" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/out" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/inc" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/controllers" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/languages" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/views" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/restapi" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/styles" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/install" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/webdav" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/www/index.php" />
</exec>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<arg line="-s ${srcdir}/www/.htaccess" />
</exec>
</then>
<else>
<copy todir="${builddir}/export/${shortversion}/seeddms-${version}"> <copy todir="${builddir}/export/${shortversion}/seeddms-${version}">
<fileset refid="distfiles" /> <fileset refid="distfiles" />
</copy> </copy>
<copy todir="${builddir}/export/${shortversion}/pear/vendor">
<fileset dir="${srcdir}/vendor" defaultexcludes="false" />
</copy>
<copy todir="${builddir}/export/${shortversion}/www/ext/example"> <copy todir="${builddir}/export/${shortversion}/www/ext/example">
<fileset dir="${srcdir}/ext/example" defaultexcludes="false" /> <fileset dir="${srcdir}/www/ext/example" defaultexcludes="false" />
</copy> </copy>
<!-- copy todir="${builddir}/export/${shortversion}/pear/SeedDMS"> <if>
<fileset dir="SeedDMS_Core"> <available file="${srcdir}/www/ext/pdfviewer/conf.php"/>
<include name="Core/**" /> <then>
<include name="Core.php" /> <copy todir="${builddir}/export/${shortversion}/www/ext/pdfviewer">
</fileset> <fileset dir="${srcdir}/www/ext/pdfviewer/" expandsymboliclinks="true" defaultexcludes="false">
<fileset dir="SeedDMS_Preview"> <include name="**/*" />
<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> </fileset>
</copy> </copy>
<copy todir="${builddir}/export/${shortversion}/pear/HTTP/WebDAV"> </then>
<fileset dir="../seeddms-ext/http_webdav_server"> <else>
<include name="Tools/**" /> <echo level="warning" message="I didn't find the extension 'pdfviewer'. You need to install it manually." />
</fileset> </else>
</copy --> </if>
<copy tofile="${builddir}/export/${shortversion}/pear/composer.json" file="composer-dist.json"> <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> </copy>
<exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}">
<arg line="-s seeddms-${version} seeddms" />
</exec>
<phingcall target="composer"> <phingcall target="composer">
<property name="composer_extra_params" value="--working-dir=${builddir}/export/${shortversion}/pear/" /> <property name="composer_extra_params" value="--working-dir=${builddir}/export/${shortversion}/" />
<property name="composer_envv" value="COMPOSER=${srcdir}/composer-dist.json" /> <property name="composer_envv" value="COMPOSER=${srcdir}/composer-dist.json" />
</phingcall> </phingcall>
<exec command="cd ${builddir}/export/${shortversion} &amp;&amp; ln -s seeddms-${version} seeddms" /> <exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/op" /> <arg line="-s ../seeddms/op" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/out" /> </exec>
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/inc" /> <exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/controllers" /> <arg line="-s ../seeddms/out" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/languages" /> </exec>
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/views" /> <exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/restapi" /> <arg line="-s ../seeddms/inc" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/styles" /> </exec>
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/pdfviewer" /> <exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/install" /> <arg line="-s ../seeddms/controllers" />
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/webdav" /> </exec>
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/index.php" /> <exec executable="ln" passthru="true" dir="${builddir}/export/${shortversion}/www">
<exec command="cd ${builddir}/export/${shortversion}/www &amp;&amp; ln -s ../seeddms/.htaccess" /> <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 --> <!-- build the standard tar.gz archive -->
<echo message="Building .tar.gz...." /> <echo message="Building .tar.gz ..." />
<exec command="cd ${builddir}/export ; tar czf ${builddir}/packages/seeddms-quickstart-${version}.tar.gz ${shortversion}" checkreturn="true" /> <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" /> <echo message="Built in ${builddir}/packages/seeddms-quickstart-${version}.tar.gz" />
</target> </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> </project>

View File

@ -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": { "config": {
"platform": { "platform": {
"php": "8.2" "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": { "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", "slim/slim": "^4.0",
"guzzlehttp/psr7": "*", "guzzlehttp/psr7": "*",
"erusev/parsedown": "*", "erusev/parsedown": "*",
@ -22,16 +55,25 @@
"pear/db": "*", "pear/db": "*",
"dragonmantank/cron-expression": "^3.1", "dragonmantank/cron-expression": "^3.1",
"alecrabbit/php-console-colour": "*", "alecrabbit/php-console-colour": "*",
"dragonmantank/cron-expression": "^3",
"zf1/zend-search-lucene": "*", "zf1/zend-search-lucene": "*",
"symfony/http-foundation": "^5.4", "symfony/http-foundation": "^7",
"php-di/php-di": "^6.4", "php-di/php-di": "^7",
"hfig/mapi": "*",
"slim/psr7": "^1.7", "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/lucene": "dev-master",
"seeddms/preview": "dev-master", "seeddms/preview": "dev-master",
"seeddms/sqlitefts": "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": { "require-dev": {
"composer/composer": "dev-main" "composer/composer": "dev-main"
@ -72,5 +114,19 @@
"symlink": false "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
View 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
}
}
}

View 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>

View File

@ -296,7 +296,7 @@
updateNotifyTime = "86400" updateNotifyTime = "86400"
extraPath = "" extraPath = ""
maxExecutionTime = "30" maxExecutionTime = "30"
cmdTimeout = "10" cmdTimeout = "1"
/> />
<!-- <!--
- enableNotificationAppRev: set to true if reviewers and approvers shall be informed about a pending review/approval - enableNotificationAppRev: set to true if reviewers and approvers shall be informed about a pending review/approval

View File

@ -52,7 +52,6 @@ class SeedDMS_Controller_AddDocument extends SeedDMS_Controller_Common {
$sequence = $this->getParam('sequence'); $sequence = $this->getParam('sequence');
$reviewers = $this->getParam('reviewers'); $reviewers = $this->getParam('reviewers');
$approvers = $this->getParam('approvers'); $approvers = $this->getParam('approvers');
$recipients = $this->getParam('recipients');
$reqversion = $this->getParam('reqversion'); $reqversion = $this->getParam('reqversion');
$version_comment = $this->getParam('versioncomment'); $version_comment = $this->getParam('versioncomment');
$attributes = $this->getParam('attributes'); $attributes = $this->getParam('attributes');
@ -161,7 +160,6 @@ class SeedDMS_Controller_AddDocument extends SeedDMS_Controller_Common {
$workflow = $this->getParam('workflow'); $workflow = $this->getParam('workflow');
$notificationgroups = $this->getParam('notificationgroups'); $notificationgroups = $this->getParam('notificationgroups');
$notificationusers = $this->getParam('notificationusers'); $notificationusers = $this->getParam('notificationusers');
$initialdocumentstatus = $this->getParam('initialdocumentstatus');
$maxsizeforfulltext = $this->getParam('maxsizeforfulltext'); $maxsizeforfulltext = $this->getParam('maxsizeforfulltext');
$defaultaccessdocs = $this->getParam('defaultaccessdocs'); $defaultaccessdocs = $this->getParam('defaultaccessdocs');
@ -172,7 +170,7 @@ class SeedDMS_Controller_AddDocument extends SeedDMS_Controller_Common {
$cats, $userfiletmp, utf8_basename($userfilename), $cats, $userfiletmp, utf8_basename($userfilename),
$filetype, $userfiletype, $sequence, $filetype, $userfiletype, $sequence,
$reviewers, $approvers, $reqversion, $reviewers, $approvers, $reqversion,
$version_comment, $attributes, $attributes_version, $workflow, $initialdocumentstatus); $version_comment, $attributes, $attributes_version, $workflow);
if (is_bool($res) && !$res) { if (is_bool($res) && !$res) {
$this->errormsg = "error_occured"; $this->errormsg = "error_occured";
@ -189,24 +187,6 @@ class SeedDMS_Controller_AddDocument extends SeedDMS_Controller_Common {
} }
} }
$lc = $document->getLatestContent();
if($recipients) {
if($recipients['i']) {
foreach($recipients['i'] as $uid) {
if($u = $dms->getUser($uid)) {
$res = $lc->addIndRecipient($u, $user);
}
}
}
if($recipients['g']) {
foreach($recipients['g'] as $gid) {
if($g = $dms->getGroup($gid)) {
$res = $lc->addGrpRecipient($g, $user);
}
}
}
}
/* Add a default notification for the owner of the document */ /* Add a default notification for the owner of the document */
if($settings->_enableOwnerNotification) { if($settings->_enableOwnerNotification) {
$res = $document->addNotify($owner->getID(), true); $res = $document->addNotify($owner->getID(), true);

View File

@ -40,11 +40,6 @@ class SeedDMS_Controller_ApproveDocument extends SeedDMS_Controller_Common {
$this->oldstatus = $overallStatus['status']; $this->oldstatus = $overallStatus['status'];
$this->newstatus = $this->oldstatus; $this->newstatus = $this->oldstatus;
if(!$this->callHook('preApproveDocument', $content)) {
}
$result = $this->callHook('approveDocument', $content);
if($result === null) {
if ($approvaltype == "ind") { if ($approvaltype == "ind") {
$approvalLogID = $content->setApprovalByInd($user, $user, $approvalstatus, $approvalcomment, $approvalfile); $approvalLogID = $content->setApprovalByInd($user, $user, $approvalstatus, $approvalcomment, $approvalfile);
} elseif ($approvaltype == "grp") { } elseif ($approvaltype == "grp") {
@ -57,10 +52,7 @@ class SeedDMS_Controller_ApproveDocument extends SeedDMS_Controller_Common {
$this->errormsg = "approval_update_failed"; $this->errormsg = "approval_update_failed";
return false; return false;
} }
}
$result = $this->callHook('approveUpdateDocumentStatus', $content);
if($result === null) {
if($approvalstatus == -1) { if($approvalstatus == -1) {
$this->newstatus = S_REJECTED; $this->newstatus = S_REJECTED;
if($content->setStatus(S_REJECTED, $approvalcomment, $user)) { if($content->setStatus(S_REJECTED, $approvalcomment, $user)) {
@ -104,12 +96,6 @@ class SeedDMS_Controller_ApproveDocument extends SeedDMS_Controller_Common {
} }
} }
} }
}
if(!$this->callHook('postApproveDocument', $content)) {
}
return true; return true;
} /* }}} */ } /* }}} */
} }

View File

@ -1,114 +0,0 @@
<?php
/**
* Implementation of CheckInDocument controller
*
* @category DMS
* @package SeedDMS
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2010-2024 Uwe Steinmann
* @version Release: @package_version@
*/
/**
* Class which does the busines logic for downloading a document
*
* @category DMS
* @package SeedDMS
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2010-2024 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_Controller_CheckInDocument extends SeedDMS_Controller_Common {
public function run() { /* {{{ */
$name = $this->getParam('name');
$comment = $this->getParam('comment');
/* Call preCheckInDocument early, because it might need to modify some
* of the parameters.
*/
if(false === $this->callHook('preCheckInDocument', $this->params['document'])) {
if(empty($this->errormsg))
$this->errormsg = 'hook_preCheckInDocument_failed';
return null;
}
$comment = $this->getParam('comment');
$dms = $this->params['dms'];
$user = $this->params['user'];
$document = $this->params['document'];
$settings = $this->params['settings'];
$fulltextservice = $this->params['fulltextservice'];
$folder = $this->params['folder'];
$userfiletmp = $this->getParam('userfiletmp');
$userfilename = $this->getParam('userfilename');
$filetype = $this->getParam('filetype');
$userfiletype = $this->getParam('userfiletype');
$reviewers = $this->getParam('reviewers');
$approvers = $this->getParam('approvers');
$recipients = $this->getParam('recipients');
$reqversion = $this->getParam('reqversion');
$comment = $this->getParam('comment');
$attributes = $this->getParam('attributes');
$workflow = $this->getParam('workflow');
$maxsizeforfulltext = $this->getParam('maxsizeforfulltext');
$initialdocumentstatus = $this->getParam('initialdocumentstatus');
$content = $this->callHook('checkinDocument');
if($content === null) {
if($contentResult=$document->checkIn($comment, $user, $reviewers, $approvers, $version=0, $attributes, $workflow, $initialdocumentstatus)) {
if ($this->hasParam('expires')) {
if($document->setExpires($this->getParam('expires'))) {
} else {
}
}
if(!empty($recipients['i'])) {
foreach($recipients['i'] as $uid) {
if($u = $dms->getUser($uid)) {
$res = $contentResult->getContent()->addIndRecipient($u, $user);
}
}
}
if(!empty($recipients['g'])) {
foreach($recipients['g'] as $gid) {
if($g = $dms->getGroup($gid)) {
$res = $contentResult->getContent()->addGrpRecipient($g, $user);
}
}
}
$content = $contentResult->getContent();
} else {
$this->errormsg = 'error_checkin_document';
$result = false;
}
} elseif($result === false) {
if(empty($this->errormsg))
$this->errormsg = 'hook_checkinDocument_failed';
return false;
}
if($fulltextservice && ($index = $fulltextservice->Indexer()) && $content) {
$idoc = $fulltextservice->IndexedDocument($document);
if(false !== $this->callHook('preIndexDocument', $document, $idoc)) {
$lucenesearch = $fulltextservice->Search();
if($hit = $lucenesearch->getDocument((int) $document->getId())) {
$index->delete($hit->id);
}
$index->addDocument($idoc);
$index->commit();
}
}
if(false === $this->callHook('postCheckInDocument', $document, $content)) {
}
return $content;
} /* }}} */
}

View File

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

View File

@ -1,108 +0,0 @@
<?php
/**
* Implementation of Cron controller
*
* @category DMS
* @package SeedDMS
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2010-2020 Uwe Steinmann
* @version Release: @package_version@
*/
/**
* Class which does the busines logic for the regular cron job
*
* @category DMS
* @package SeedDMS
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2010-2020 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_Controller_Cron extends SeedDMS_Controller_Common {
public function run() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$settings = $this->params['settings'];
$logger = $this->params['logger'];
$mode = $this->params['mode'];
$seltask = $this->params['task'];
$db = $dms->getDb();
$scheduler = new SeedDMS_Scheduler($db);
$tasks = $scheduler->getTasks();
$jsonarr = [];
foreach($tasks as $task) {
if($seltask && $seltask != $task->getExtension()."::".$task->getTask())
continue;
if(isset($GLOBALS['SEEDDMS_SCHEDULER']['tasks'][$task->getExtension()]) && is_object($taskobj = resolveTask($GLOBALS['SEEDDMS_SCHEDULER']['tasks'][$task->getExtension()][$task->getTask()]))) {
$arr = array(
'extension'=>$task->getExtension(),
'name'=>$task->getTask(),
'mode'=>$mode,
'disabled' => (bool) $task->getDisabled(),
'isdue' => $task->isDue(),
);
switch($mode) {
case "run":
case "dryrun":
if(method_exists($taskobj, 'execute')) {
if(!$task->getDisabled() && $task->isDue()) {
if($mode == 'run') {
/* Schedule the next run right away to prevent a second execution
* of the task when the cron job of the scheduler is called before
* the last run was finished. The task itself can still be scheduled
* to fast, but this is up to the admin of seeddms.
*/
$task->updateLastNextRun();
if($taskobj->execute($task)) {
add_log_line("Execution of task ".$task->getExtension()."::".$task->getTask()." successful.");
$arr['success'] = true;
} else {
add_log_line("Execution of task ".$task->getExtension()."::".$task->getTask()." failed, task has been disabled.", PEAR_LOG_ERR);
$arr['success'] = false;
$task->setDisabled(1);
}
} elseif($mode == 'dryrun') {
$arr['success'] = true;
}
}
}
break;
case "check":
$arr['error'] = false;
if(!method_exists($taskobj, 'execute')) {
$arr['error'] = true;
$arr['messages'][] = 'Missing method execute()';
}
if(get_parent_class($taskobj) != 'SeedDMS_SchedulerTaskBase') {
$arr['error'] = true;
$arr['error'][] = "Wrong parent class";
}
break;
case "list":
default:
header("Content-Type: application/json");
$arr['nextrun']=$task->getNextRun();
$arr['frequency']=$task->getFrequency();
$arr['params']=array();
if($params = $task->getParameter()) {
foreach($params as $key=>$value) {
$p = $taskobj->getAdditionalParamByName($key);
$arr['params'][$key] = ($p['type'] == 'password') ? '*******' : $value;
}
}
break;
}
$jsonarr[] = $arr;
}
}
echo json_encode($jsonarr);
return true;
} /* }}} */
}

View File

@ -22,8 +22,13 @@
*/ */
class SeedDMS_Controller_Download extends SeedDMS_Controller_Common { class SeedDMS_Controller_Download extends SeedDMS_Controller_Common {
public function version() { /* {{{ */ public function run() {
$dms = $this->params['dms']; $dms = $this->params['dms'];
$type = $this->params['type'];
switch($type) {
case "version":
if(empty($this->params['content'])) {
$version = $this->params['version']; $version = $this->params['version'];
$document = $this->params['document']; $document = $this->params['document'];
if($version < 1) { if($version < 1) {
@ -43,6 +48,9 @@ class SeedDMS_Controller_Download extends SeedDMS_Controller_Common {
* expect the content in the controller * expect the content in the controller
*/ */
$this->params['content'] = $content; $this->params['content'] = $content;
} else {
$content = $this->params['content'];
}
if(null === $this->callHook('version')) { if(null === $this->callHook('version')) {
if(file_exists($dms->contentDir . $content->getPath())) { if(file_exists($dms->contentDir . $content->getPath())) {
header("Content-Transfer-Encoding: binary"); header("Content-Transfer-Encoding: binary");
@ -52,162 +60,11 @@ class SeedDMS_Controller_Download extends SeedDMS_Controller_Common {
header("Cache-Control: must-revalidate"); header("Cache-Control: must-revalidate");
header("ETag: ".$content->getChecksum()); header("ETag: ".$content->getChecksum());
sendFile($dms->contentDir . $content->getPath()); sendFile($dms->contentDir.$content->getPath());
} }
} }
return true;
} /* }}} */
public function file() { /* {{{ */
$dms = $this->params['dms'];
$file = $this->params['file'];
if(null === $this->callHook('file')) {
if(file_exists($dms->contentDir . $file->getPath())) {
header("Content-Transfer-Encoding: binary");
header("Content-Disposition: attachment; filename=\"" . $file->getOriginalFileName() . "\"");
header("Content-Type: " . $file->getMimeType());
header("Cache-Control: must-revalidate");
sendFile($dms->contentDir . $file->getPath());
}
}
return true;
} /* }}} */
public function archive() { /* {{{ */
$dms = $this->params['dms'];
$filename = $this->params['file'];
$basedir = $this->params['basedir'];
if(null === $this->callHook('archive')) {
if(file_exists($basedir . $filename)) {
header('Content-Description: File Transfer');
header("Content-Type: application/zip");
header("Content-Transfer-Encoding: binary");
$efilename = rawurlencode($filename);
header("Content-Disposition: attachment; filename=\"" .$efilename . "\"; filename*=UTF-8''".$efilename);
header("Cache-Control: public");
sendFile($basedir .$filename );
}
}
return true;
} /* }}} */
public function log() { /* {{{ */
$dms = $this->params['dms'];
$filename = $this->params['file'];
$basedir = $this->params['basedir'];
if(null === $this->callHook('log')) {
if(file_exists($basedir . $filename)) {
header("Content-Type: text/plain; name=\"" . $filename . "\"");
header("Content-Transfer-Encoding: binary");
$efilename = rawurlencode($filename);
header("Content-Disposition: attachment; filename=\"" .$efilename . "\"; filename*=UTF-8''".$efilename);
header("Cache-Control: must-revalidate");
sendFile($basedir.$filename);
}
}
return true;
} /* }}} */
public function sqldump() { /* {{{ */
$dms = $this->params['dms'];
$filename = $this->params['file'];
$basedir = $this->params['basedir'];
if(null === $this->callHook('sqldump')) {
if(file_exists($basedir . $filename)) {
header("Content-Type: application/zip");
header("Content-Transfer-Encoding: binary");
$efilename = rawurlencode($filename);
header("Content-Disposition: attachment; filename=\"" .$efilename . "\"; filename*=UTF-8''".$efilename);
header("Cache-Control: must-revalidate");
sendFile($basedir.$filename);
}
}
return true;
} /* }}} */
public function approval() { /* {{{ */
$dms = $this->params['dms'];
$document = $this->params['document'];
$logid = $this->params['approvelogid'];
$filename = $dms->contentDir . $document->getDir().'a'.$logid;
if (!file_exists($filename) ) {
$this->error = 1;
return false;
}
if(null === $this->callHook('approval')) {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mimetype = finfo_file($finfo, $filename);
header("Content-Type: ".$mimetype);
header("Content-Transfer-Encoding: binary");
header("Content-Disposition: attachment; filename=\"approval-" . $document->getID()."-".(int) $_GET['approvelogid'] . get_extension($mimetype) . "\"");
header("Cache-Control: must-revalidate");
sendFile($filename);
}
return true;
} /* }}} */
public function review() { /* {{{ */
$dms = $this->params['dms'];
$document = $this->params['document'];
$logid = $this->params['reviewlogid'];
$filename = $dms->contentDir . $document->getDir().'r'.$logid;
if (!file_exists($filename) ) {
$this->error = 1;
return false;
}
if(null === $this->callHook('review')) {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mimetype = finfo_file($finfo, $filename);
header("Content-Type: ".$mimetype);
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($filename ));
header("Content-Disposition: attachment; filename=\"review-" . $document->getID()."-".(int) $_GET['reviewlogid'] . get_extension($mimetype) . "\"");
header("Cache-Control: must-revalidate");
sendFile($filename);
}
return true;
} /* }}} */
public function run() { /* {{{ */
$dms = $this->params['dms'];
$type = $this->params['type'];
switch($type) {
case "version":
return $this->version();
break;
case "file":
return $this->file();
break;
case "archive":
return $this->archive();
break;
case "log":
return $this->log();
break;
case "sqldump":
return $this->sqldump();
break;
case "approval":
return $this->approval();
break;
case "review":
return $this->review();
break; break;
} }
} /* }}} */ return true;
}
} }

View 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;
}
}

View File

@ -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) { foreach($oldattributes as $attrdefid=>$oldattribute) {
if(!isset($attributes[$attrdefid])) { if(!isset($attributes[$attrdefid])) {
if(!$document->removeAttribute($dms->getAttributeDefinition($attrdefid))) if(!$document->removeAttribute($dms->getAttributeDefinition($attrdefid)))
return false; return false;
} }
} }
*/
$sequence = $this->params['sequence']; $sequence = $this->params['sequence'];
if(strcasecmp($sequence, "keep")) { if(strcasecmp($sequence, "keep")) {

View File

@ -64,16 +64,6 @@ class SeedDMS_Controller_Login extends SeedDMS_Controller_Common {
return false; return false;
} }
if($settings->_enable2FactorAuthentication) {
if($user->getSecret()) {
$tfa = new \RobThree\Auth\TwoFactorAuth('SeedDMS');
if($tfa->verifyCode($user->getSecret(), $_POST['twofactauth']) !== true) {
$this->setErrorMsg("login_error_text");
return false;
}
}
}
/* Run any additional checks which may prevent login */ /* Run any additional checks which may prevent login */
if(false === $this->callHook('restrictLogin', $user)) { if(false === $this->callHook('restrictLogin', $user)) {
if(empty($this->errormsg)) if(empty($this->errormsg))
@ -135,7 +125,7 @@ class SeedDMS_Controller_Login extends SeedDMS_Controller_Common {
$dms_session = $_COOKIE["mydms_session"]; $dms_session = $_COOKIE["mydms_session"];
if(!$resArr = $session->load($dms_session)) { if(!$resArr = $session->load($dms_session)) {
/* Turn off http only cookies if jumploader is enabled */ /* 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); header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$referuri);
exit; exit;
} else { } else {
@ -154,7 +144,7 @@ class SeedDMS_Controller_Login extends SeedDMS_Controller_Common {
$lifetime = time() + intval($settings->_cookieLifetime); $lifetime = time() + intval($settings->_cookieLifetime);
else else
$lifetime = 0; $lifetime = 0;
setcookie("mydms_session", $id, $lifetime, $settings->_httpRoot, null, false, true); setcookie("mydms_session", $id, $lifetime, $settings->_httpRoot, '', false, true);
} }
} }

View File

@ -1,67 +0,0 @@
<?php
/**
* Implementation of ReceiptDocument 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 downloading a document
*
* @category DMS
* @package SeedDMS
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2010-2013 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_Controller_ReceiptDocument extends SeedDMS_Controller_Common {
public function run() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$settings = $this->params['settings'];
$document = $this->params['document'];
$content = $this->params['content'];
$receiptstatus = $this->params['receiptstatus'];
$receipttype = $this->params['receipttype'];
$group = $this->params['group'];
$comment = $this->params['comment'];
/* Get the document id and name before removing the document */
$docname = $document->getName();
$documentid = $document->getID();
if(!$this->callHook('preReceiptDocument', $content)) {
}
$result = $this->callHook('receiptDocument', $content);
if($result === null) {
if ($receipttype == "ind") {
if(0 > $content->setReceiptByInd($user, $user, $receiptstatus, $comment)) {
$this->error = 1;
$this->errormsg = "receipt_update_failed";
return false;
}
} elseif ($receipttype == "grp") {
if(0 > $content->setReceiptByGrp($group, $user, $receiptstatus, $comment)) {
$this->error = 1;
$this->errormsg = "receipt_update_failed";
return false;
}
}
}
if(!$this->callHook('postReceiptDocument', $content)) {
}
return true;
}
}

View File

@ -36,11 +36,6 @@ class SeedDMS_Controller_ReviewDocument extends SeedDMS_Controller_Common {
$this->oldstatus = $overallStatus['status']; $this->oldstatus = $overallStatus['status'];
$this->newstatus = $this->oldstatus; $this->newstatus = $this->oldstatus;
if(!$this->callHook('preReviewDocument', $content)) {
}
$result = $this->callHook('reviewDocument', $content);
if($result === null) {
if ($reviewtype == "ind") { if ($reviewtype == "ind") {
$reviewLogID = $content->setReviewByInd($user, $user, $reviewstatus, $reviewcomment, $reviewfile); $reviewLogID = $content->setReviewByInd($user, $user, $reviewstatus, $reviewcomment, $reviewfile);
} elseif($reviewtype == "grp") { } elseif($reviewtype == "grp") {
@ -53,10 +48,7 @@ class SeedDMS_Controller_ReviewDocument extends SeedDMS_Controller_Common {
$this->errormsg = "review_update_failed"; $this->errormsg = "review_update_failed";
return false; return false;
} }
}
$result = $this->callHook('reviewUpdateDocumentStatus', $content);
if($result === null) {
if($reviewstatus == -1) { if($reviewstatus == -1) {
$this->newstatus = S_REJECTED; $this->newstatus = S_REJECTED;
if($content->setStatus(S_REJECTED, $reviewcomment, $user)) { if($content->setStatus(S_REJECTED, $reviewcomment, $user)) {
@ -121,11 +113,6 @@ class SeedDMS_Controller_ReviewDocument extends SeedDMS_Controller_Common {
} }
} }
} }
}
if(!$this->callHook('postReviewDocument', $content)) {
}
return true; return true;
} /* }}} */ } /* }}} */
} }

View File

@ -1,143 +0,0 @@
<?php
/**
* Implementation of ReviseDocument 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 downloading a document
*
* @category DMS
* @package SeedDMS
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2010-2013 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_Controller_ReviseDocument extends SeedDMS_Controller_Common {
public $oldstatus;
public $newstatus;
public function run() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$settings = $this->params['settings'];
$document = $this->params['document'];
$content = $this->params['content'];
$revisionstatus = $this->params['revisionstatus'];
$revisiontype = $this->params['revisiontype'];
$group = $this->params['group'];
$comment = $this->params['comment'];
$overallStatus = $content->getStatus();
$this->oldstatus = $overallStatus['status'];
$this->newstatus = $this->oldstatus;
/* if set to true, a single reject will reject the doc. If set to false
* all revisions will be collected first and afterwards the doc is rejected
* if one has rejected it. So in the very end the doc is rejected, but
* doc remainѕ in S_IN_REVISION until all have revised the doc
*/
$onevotereject = $this->params['onevotereject'];
/* Get the document id and name before removing the document */
$docname = $document->getName();
$documentid = $document->getID();
if(!$this->callHook('preReviseDocument', $content)) {
}
$result = $this->callHook('reviseDocument', $content);
if($result === null) {
if ($revisiontype == "ind") {
if(0 > $content->setRevision($user, $user, $revisionstatus, $comment)) {
$this->error = 1;
$this->errormsg = "revision_update_failed";
return false;
}
} elseif ($revisiontype == "grp") {
if(0 > $content->setRevision($group, $user, $revisionstatus, $comment)) {
$this->error = 1;
$this->errormsg = $ll."revision_update_failed";
return false;
}
}
}
/* Check to see if the overall status for the document version needs to be
* updated.
*/
$result = $this->callHook('reviseUpdateDocumentStatus', $content);
if($result === null) {
if ($onevotereject && $revisionstatus == -1){
$this->newstatus = S_NEEDS_CORRECTION;
if(!$content->setStatus(S_NEEDS_CORRECTION,$comment,$user)) {
$this->error = 1;
$this->errormsg = "revision_update_failed";
return false;
}
} else {
$docRevisionStatus = $content->getRevisionStatus();
if (is_bool($docRevisionStatus) && !$docRevisionStatus) {
$this->error = 1;
$this->errormsg = "cannot_retrieve_revision_snapshot";
return false;
}
$revisionok = 0;
$revisionnotok = 0;
$revisionTotal = 0;
foreach ($docRevisionStatus as $drstat) {
if ($drstat["status"] == 1) {
$revisionok++;
}
if ($drstat["status"] == -1) {
$revisionnotok++;
}
if ($drstat["status"] != -2) {
$revisionTotal++;
}
}
// If all revisions have been done and there are no rejections,
// then release the document. If all revisions have been done but some
// of them were rejections then documents needs correction.
// Otherwise put it back into revision workflow
if ($revisionok == $revisionTotal) {
$this->newstatus=S_RELEASED;
if ($content->finishRevision($user, $this->newstatus, 'Finished revision workflow', getMLText("automatic_status_update"))) {
if(!$this->callHook('finishReviseDocument', $content)) {
}
}
} elseif (($revisionok + $revisionnotok) == $revisionTotal) {
$this->newstatus=S_NEEDS_CORRECTION;
// if ($content->finishRevision($user, $this->newstatus, 'Finished revision workflow', getMLText("automatic_status_update"))) {
if(!$content->setStatus($this->newstatus,$comment,$user)) {
$this->error = 1;
$this->errormsg = "revision_update_failed";
return false;
}
} else {
$this->newstatus=S_IN_REVISION;
if(!$content->setStatus($this->newstatus,$comment,$user)) {
$this->error = 1;
$this->errormsg = "revision_update_failed";
return false;
}
}
}
}
if(!$this->callHook('postReviseDocument', $content)) {
}
return true;
}
}

View File

@ -1,56 +0,0 @@
<?php
/**
* Implementation of Role manager 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 role manager
*
* @category DMS
* @package SeedDMS
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2010-2013 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_Controller_RoleMgr extends SeedDMS_Controller_Common {
public function run() {
}
public function addrole() {
$dms = $this->params['dms'];
$name = $this->params['name'];
$role = $this->params['role'];
return($dms->addRole($name, $role));
}
public function removerole() {
$roleobj = $this->params['roleobj'];
return $roleobj->remove();
}
public function editrole() {
$dms = $this->params['dms'];
$name = $this->params['name'];
$role = $this->params['role'];
$roleobj = $this->params['roleobj'];
$noaccess = $this->params['noaccess'];
if ($roleobj->getName() != $name)
$roleobj->setName($name);
if ($roleobj->getRole() != $role)
$roleobj->setRole($role);
$roleobj->setNoAccess($noaccess);
return true;
}
}

View File

@ -1,68 +0,0 @@
<?php
/**
* Implementation of Transmittal Download 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 downloading a transmittal
*
* @category DMS
* @package SeedDMS
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2010-2013 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_Controller_TransmittalDownload extends SeedDMS_Controller_Common {
public function run() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$transmittal = $this->params['transmittal'];
$items = $transmittal->getItems();
if($items) {
include("../inc/inc.ClassDownloadMgr.php");
$downmgr = new SeedDMS_Download_Mgr();
if($extraheader = $this->callHook('extraDownloadHeader'))
$downmgr->addHeader($extraheader);
foreach($items as $item) {
$content = $item->getContent();
$document = $content->getDocument();
if ($document->getAccessMode($user) >= M_READ) {
$extracols = $this->callHook('extraDownloadColumns', $document);
$filename = $this->callHook('filenameDownloadItem', $content);
if($rawcontent = $this->callHook('rawcontent', $content)) {
$downmgr->addItem($content, $extracols, $rawcontent, $filename);
} else
$downmgr->addItem($content, $extracols, null, $filename);
}
}
$filename = tempnam(sys_get_temp_dir(), 'transmittal-download-');
if($filename) {
if($downmgr->createArchive($filename)) {
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($filename));
header("Content-Disposition: attachment; filename=\"export-" .date('Y-m-d') . ".zip\"");
header("Content-Type: application/zip");
header("Cache-Control: must-revalidate");
readfile($filename);
} else {
}
unlink($filename);
}
exit;
}
}
}

View File

@ -48,18 +48,16 @@ class SeedDMS_Controller_UpdateDocument extends SeedDMS_Controller_Common {
$userfiletype = $this->getParam('userfiletype'); $userfiletype = $this->getParam('userfiletype');
$reviewers = $this->getParam('reviewers'); $reviewers = $this->getParam('reviewers');
$approvers = $this->getParam('approvers'); $approvers = $this->getParam('approvers');
$recipients = $this->getParam('recipients');
$reqversion = $this->getParam('reqversion'); $reqversion = $this->getParam('reqversion');
$comment = $this->getParam('comment'); $comment = $this->getParam('comment');
$attributes = $this->getParam('attributes'); $attributes = $this->getParam('attributes');
$workflow = $this->getParam('workflow'); $workflow = $this->getParam('workflow');
$maxsizeforfulltext = $this->getParam('maxsizeforfulltext'); $maxsizeforfulltext = $this->getParam('maxsizeforfulltext');
$initialdocumentstatus = $this->getParam('initialdocumentstatus');
$content = $this->callHook('updateDocument'); $content = $this->callHook('updateDocument');
if($content === null) { if($content === null) {
$filesize = SeedDMS_Core_File::fileSize($userfiletmp); $filesize = SeedDMS_Core_File::fileSize($userfiletmp);
if($contentResult=$document->addContent($comment, $user, $userfiletmp, utf8_basename($userfilename), $filetype, $userfiletype, $reviewers, $approvers, 0, $attributes, $workflow, $initialdocumentstatus)) { if($contentResult=$document->addContent($comment, $user, $userfiletmp, utf8_basename($userfilename), $filetype, $userfiletype, $reviewers, $approvers, 0, $attributes, $workflow)) {
if ($this->hasParam('expires')) { if ($this->hasParam('expires')) {
if($document->setExpires($this->getParam('expires'))) { if($document->setExpires($this->getParam('expires'))) {
@ -67,21 +65,6 @@ class SeedDMS_Controller_UpdateDocument extends SeedDMS_Controller_Common {
} }
} }
if(!empty($recipients['i'])) {
foreach($recipients['i'] as $uid) {
if($u = $dms->getUser($uid)) {
$res = $contentResult->getContent()->addIndRecipient($u, $user);
}
}
}
if(!empty($recipients['g'])) {
foreach($recipients['g'] as $gid) {
if($g = $dms->getGroup($gid)) {
$res = $contentResult->getContent()->addGrpRecipient($g, $user);
}
}
}
$content = $contentResult->getContent(); $content = $contentResult->getContent();
} else { } else {
$this->errormsg = 'error_update_document'; $this->errormsg = 'error_update_document';

View File

@ -1,3 +1,3 @@
#!/bin/sh #!/bin/sh
# This command retrieves the strings that need to be translated # This command retrieves the strings that need to be translated
sgrep -o "%r\n" '"getMLText(\"" __ "\""' */*.php views/bootstrap/*.php |sort|uniq -c sgrep -o "%r\n" '"getMLText(\"" __ "\""' */*.php|sort|uniq -c

View File

@ -1,7 +1,7 @@
<?php <?php
/* Determine all languages keys used in the php files */ /* Determine all languages keys used in the php files */
$output = array(); $output = array();
if(exec('sgrep -o "%r\n" \'"tMLText(\"" __ "\""\' */*.php views/bootstrap/*.php|sort|uniq -c', $output)) { if(exec('sgrep -o "%r\n" \'"tMLText(\"" __ "\""\' */*.php|sort|uniq -c', $output)) {
$allkeys = array(); $allkeys = array();
foreach($output as $line) { foreach($output as $line) {
$data = explode(' ', trim($line)); $data = explode(' ', trim($line));
@ -9,9 +9,8 @@ if(exec('sgrep -o "%r\n" \'"tMLText(\"" __ "\""\' */*.php views/bootstrap/*.php|
} }
} }
$languages = array('ar_EG', 'bg_BG', 'ca_ES', 'cs_CZ', 'de_DE', 'en_GB', 'es_ES', 'fr_FR', 'hu_HU', 'it_IT', 'nl_NL', 'pl_PL', 'pt_BR', 'ro_RO', 'ru_RU', 'sk_SK', 'sv_SE', 'tr_TR', 'zh_CN', 'zh_TW');
/* Reading languages */ /* Reading languages */
foreach($languages as $lang) { foreach(array('en_GB', 'de_DE', 'it_IT', 'sk_SK', 'cs_CZ') as $lang) {
include('languages/'.$lang.'/lang.inc'); include('languages/'.$lang.'/lang.inc');
ksort($text); ksort($text);
$langarr[$lang] = $text; $langarr[$lang] = $text;
@ -21,7 +20,7 @@ foreach($languages as $lang) {
echo "List of missing keys\n"; echo "List of missing keys\n";
echo "-----------------------------\n"; echo "-----------------------------\n";
foreach(array_keys($allkeys) as $key) { foreach(array_keys($allkeys) as $key) {
foreach($languages as $lang) { foreach(array('en_GB', 'de_DE', 'it_IT', 'sk_SK', 'cs_CZ') as $lang) {
if(!isset($langarr[$lang][$key])) { if(!isset($langarr[$lang][$key])) {
echo "Missing key '".$key."' in language ".$lang."\n"; echo "Missing key '".$key."' in language ".$lang."\n";
} }
@ -32,7 +31,7 @@ echo "\n";
/* Check for phrases not used anymore */ /* Check for phrases not used anymore */
echo "List of superflous keys\n"; echo "List of superflous keys\n";
echo "-----------------------------\n"; echo "-----------------------------\n";
foreach($languages as $lang) { foreach(array('en_GB', 'de_DE', 'it_IT', 'sk_SK', 'cs_CZ') as $lang) {
$n = 0; $n = 0;
foreach($langarr[$lang] as $key=>$value) { foreach($langarr[$lang] as $key=>$value) {
if(!isset($allkeys[$key])) { if(!isset($allkeys[$key])) {

View File

@ -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
View 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.

View File

@ -4,6 +4,7 @@ Layout of installation
SeedDMS allows various kinds of installations with very individual layouts SeedDMS allows various kinds of installations with very individual layouts
on disc. The proposed layout till version 5.1.6 was as the following: on disc. The proposed layout till version 5.1.6 was as the following:
```
seeddms51x ---+--- data seeddms51x ---+--- data
| |
+--- pear +--- pear
@ -11,29 +12,31 @@ seeddms51x ---+--- data
+--- seeddms-5.1.x +--- seeddms-5.1.x
| |
+--- www -> 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. 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_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 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 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 `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 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 is far better to keep senѕitive data out of the document root in the first
place. place.
The new layout mostly retains that structure but uses more soft links to 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. 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 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 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: as the document root. The new layout is the following:
```
seeddms51x ---+--- data --+-- log seeddms51x ---+--- data --+-- log
| | | |
| +-- cache | +-- cache
@ -73,10 +76,12 @@ seeddms51x ---+--- data --+-- log
+-- index.php -> ../seeddms/index.php +-- index.php -> ../seeddms/index.php
| |
+-- ext +-- ext
```
In order to convert to this layout you need to do the following in the seeddms51x 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): directory (replace the 'x' in '5.1.x' with the correct number):
```
ln -s seeddms-5.1.x seeddms ln -s seeddms-5.1.x seeddms
mv www/conf . mv www/conf .
mv seeddms-5.1.x/ext www mv seeddms-5.1.x/ext www
@ -93,3 +98,8 @@ ln -s ../seeddms/webdav
ln -s ../seeddms/restapi ln -s ../seeddms/restapi
ln -s ../seeddms/pdfviewer ln -s ../seeddms/pdfviewer
ln -s ../seeddms/index.php ln -s ../seeddms/index.php
```
Since version 5.1.42 the layout has changed slightly again. The directory
`pear` which had only a subdirectory `vendor` disappeared and the `vendor` has
move one level up.

View File

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

View File

@ -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
View 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.

View File

@ -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 3. copy the directory `pear` from the unpacked archive into your current
installation, replacing the existing directory. Make a backup of `pear` before 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. 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 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 `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. 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. 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 THE LONG STORY
================ ================

View File

@ -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
View 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

View File

@ -126,28 +126,3 @@ op/op.TriggerWorkflow.php
op/op.UpdateDocument.php op/op.UpdateDocument.php
* document was updated * document was updated
subscribers of the document subscribers of the document
op/op.ReceiptDocument.php
* document was received
subscribers of the document
op/op.ReviseDocument.php
* document was revised
subscribers of the document
op/op.SetRevisors.php
* Revisors were added/deleted
subscribers of the document
uploader of version
revisor
op/op.ReceiptDocument.php
* document was receipt
subscribers of the document
op/op.SetRecipients.php
* Recipients were added/deleted
subscribers of the document
uploader of version
recipient

View File

@ -6,7 +6,7 @@ session which is stored in a local file named `cookies.txt`.
The authentication is done with the user `admin`. You may use any other The authentication is done with the user `admin`. You may use any other
user as well. 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. 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` Of course, in that case you will not need the initial call of the `login`
endpoint. endpoint.
@ -48,8 +48,16 @@ curl --silent -H "Authorization: <api key>" -X GET "${BASEURL}restapi/index.php/
## Notes ## Notes
Make sure to encode the data properly when using restapi functions which uses 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.

View File

@ -1,26 +0,0 @@
Scheduler
==========
The scheduler in SeedDMS manages frequently run tasks. It is very similar
to regular unix cron jobs. A task in SeedDMS is an instanciation of a task
class which itself is defined by an extension or SeedDMS itself.
SeedDMS has some predefined classes e.g. core::expireddocs.
In order for tasks to be runnalbe, a user `cli_scheduler` must exists in
SeedDMS.
All tasks are executed by a single cronjob in the directory `utils`
> */5 * * * * /home/www-data/seeddms60x/seeddms/utils/seeddms-schedulercli --mode=run
Please keep in mind, that the php interpreter used for the cronjob may be
different from the php interpreter used für the web application. Hence, two
different php.ini files might be used. php and the php extensions may differ as
well. This can cause some extensions to be disabled and consequently some task
classes are not defined.
`utils/seeddms-schedulercli` can also be run on the command line. If you
do that, run it with the same system user used for the web server. On Debian
this is www-data. Hence run it like
sudo -u www-data utils/seeddms-schedulercli --mode=list

View File

@ -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.

View File

@ -3,7 +3,7 @@ WebDAV
SeedDMS has support for WebDAV which allows to easily add, delete, SeedDMS has support for WebDAV which allows to easily add, delete,
move, copy and modify documents. All operating systems have support 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 and consequently you may run into various problems. If this happens
just file a bug report at https://sourceforge.net/projects/seeddms 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 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 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 http://seeddms.your-domain.com/webdav/index.php /media/webdav davfs noauto,user,rw,uid=1000,gid=1000
```
and mount it as root with and mount it as root with
```
mount /media/webdav davfs mount /media/webdav davfs
```
You may as well want to configure davfs2 in /etc/davfs2/davfs2.conf by setting You may as well want to configure davfs2 in /etc/davfs2/davfs2.conf by setting
```
[/media/webdav] [/media/webdav]
use_locks 0 use_locks 0
gui_optimize 1 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 /media/webdav admin secret
```
Making applications work with WebDAV Making applications work with WebDAV
------------------------------------- -------------------------------------
Various programms have differnt strategies to save files to disc and 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 work very well an a WebDAV-Server. The following will list some of those
strategies. 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 to not create the backup file. You can do that by either passing additional
parameters to vim parameters to vim
```
vi "+set nobackup" "+set nowritebackup" -n test.txt vi "+set nobackup" "+set nowritebackup" -n test.txt
```
or by setting them in your .vimrc or by setting them in your .vimrc
```
set nobackup set nobackup
set nowritebackup set nowritebackup
set noswapfile set noswapfile
```
If you want to restrict the settings to the directory where the dms 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 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 autocmd BufNewFile,BufRead /media/webdav/* set nobackup nowritebackup noswapfile
```
Creating the backup file in a directory outside of WebDAV doesn't help in 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 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 Just run
```
cadaver https://<your-domain>/<your-basedir>/webdav/index.php cadaver https://<your-domain>/<your-basedir>/webdav/index.php
```
It will ask for the user name and password. Once you are logged in just It will ask for the user name and password. Once you are logged in just
type `help` for a list of commands. 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. SeedDMS stores a lot more properties not covered by the webdav standard.
Those have its own namespace called 'SeedDMS:'. Just type Those have its own namespace called 'SeedDMS:'. Just type
```
propget <resource> propget <resource>
```
with `resource` being either the name of a folder or document. You will 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 get a list of all properties stored for this resource. Setting a property
requires to set the namespace first requires to set the namespace first
```
set namespace SeedDMS: set namespace SeedDMS:
```
Afterwards, you may set a property, e.g. the comment, with Afterwards, you may set a property, e.g. the comment, with
```
propset <resource> comment 'Just a comment' propset <resource> comment 'Just a comment'
```
or even delete a property or even delete a property
```
propdel <resource> comment propdel <resource> comment
```

View File

@ -1,42 +0,0 @@
Running the scheduler
======================
Since version 6 of SeedDMS a scheduler is implemented which runs
scheduled tasks. Such tasks must be implemented in an extension
and can be scheduled by the administrator within the user interface.
In order to check frequently for tasks ready to run, a system cron job
must be installed. On Linux this can be done by adding the following line
to the crontab
*/5 * * * * /var/www/seeddms60x/seeddms/utils/seeddms-schedulercli --mode=run
(Of course you need to change the path to `seeddms-schedulercli`)
This will install a cronjob running every 5 minutes. `seeddms-schedulercli` will check
for tasks ready to run and execute them in that case. You can decrease the time between
two calls of the cronjob, but keep in mind that seeddms tasks may take longer and
are being started again before the previous task has been ended.
If the configuration file of SeedDMS is not found, its path can be passed
on the command, though this should not be needed in a regular installation
obeying the directory structure of the quickstart archive.
*/5 * * * * /var/www/seeddms60x/seeddms/utils/seeddms-schedulercli --config /var/www/seeddms60x/seeddms/conf/settings.xml --mode=run
For testing purposes it may be usefull to run `seeddms-schedulercli` in list mode.
seeddms-schedulercli --mode=list
This will just list all tasks and its scheduled exection time. Tasks ready to run,
because its scheduled execution time is already in the past will be marked with
a `*`. Tasks which are disabled will be marked with a `-`.
Executing `seeddms-schedulercli` in `dryrun` mode will behave just like in `run` mode
but instead of running the task it will just issue a line.
Instead of running utils/seeddms-schedulercli you may as well access
op/op.Cron.php which also runs all scheduled tasks. On Linux you do this
by setting up a cronjob like
*/5 * * * * wget -q -O - "http://<your domain>/op/op.Cron.php"

View File

@ -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
View 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
```

View File

@ -1,9 +0,0 @@
<?php
$__lang['de_DE'] = array(
'folder_contents' => 'Dies war mal "Ordner enthält". Wurde von sample Extension geändert.',
'task_example_example_email' => 'Email',
);
$__lang['en_GB'] = array(
'folder_contents' => 'This used to be "Folder contents". Was changed by sample Extension.',
'task_example_example_email' => 'Email',
);

View File

@ -12,6 +12,8 @@
* @version Release: @package_version@ * @version Release: @package_version@
*/ */
use Seeddms\Seeddms\Session;
require_once("inc.ClassSession.php"); require_once("inc.ClassSession.php");
require_once("inc.ClassAccessOperation.php"); require_once("inc.ClassAccessOperation.php");
@ -21,22 +23,16 @@ if (!strncmp("/op", $refer, 3)) {
} else { } else {
$refer = urlencode($refer); $refer = urlencode($refer);
} }
/* Check if this is a ajax call. In that case do not redirect to any page */
$isajax = isset($_GET['action']) && ($_GET['action'] != 'show');
if (!isset($_COOKIE["mydms_session"])) { if (!isset($_COOKIE["mydms_session"])) {
if($settings->_enableGuestLogin && $settings->_enableGuestAutoLogin) { 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))) { if(!$dms_session = $session->create(array('userid'=>$settings->_guestID, 'theme'=>$settings->_theme, 'lang'=>$settings->_language))) {
if(!$isajax)
header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer); header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer);
exit; exit;
} }
$resArr = $session->load($dms_session); $resArr = $session->load($dms_session);
} elseif($settings->_autoLoginUser) { } elseif($settings->_autoLoginUser) {
if(!($user = $dms->getUser($settings->_autoLoginUser))/* || !$user->isGuest()*/) { if(!($user = $dms->getUser($settings->_autoLoginUser))/* || !$user->isGuest()*/) {
if(!$isajax)
header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer); header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer);
exit; exit;
} }
@ -50,30 +46,29 @@ if (!isset($_COOKIE["mydms_session"])) {
$lang = $settings->_language; $lang = $settings->_language;
$user->setLanguage($lang); $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))) { if(!$dms_session = $session->create(array('userid'=>$user->getID(), 'theme'=>$theme, 'lang'=>$lang))) {
if(!$isajax)
header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer); header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer);
exit; exit;
} }
$resArr = $session->load($dms_session); $resArr = $session->load($dms_session);
} else { } else {
if(!$isajax)
header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer); header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer);
exit; exit;
} }
} else { } else {
/* Load session */ /* Load session */
$dms_session = $_COOKIE["mydms_session"]; $dms_session = $_COOKIE["mydms_session"];
$session = new SeedDMS_Session($db); $session = new Session($db);
if(!$resArr = $session->load($dms_session)) { if(!$resArr = $session->load($dms_session)) {
setcookie("mydms_session", $dms_session, time()-3600, $settings->_httpRoot); //delete cookie setcookie("mydms_session", $dms_session, time()-3600, $settings->_httpRoot); //delete cookie
if(!$isajax)
header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer); header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer);
exit; exit;
} }
} }
$translator->setDefaultLanguage($session->getLanguage());
/* Update last access time */ /* Update last access time */
if((int)$resArr['lastAccess']+60 < time()) if((int)$resArr['lastAccess']+60 < time())
$session->updateAccess($dms_session); $session->updateAccess($dms_session);
@ -82,16 +77,13 @@ if((int)$resArr['lastAccess']+60 < time())
$user = $dms->getUser($resArr["userID"]); $user = $dms->getUser($resArr["userID"]);
if (!is_object($user)) { if (!is_object($user)) {
setcookie("mydms_session", $dms_session, time()-3600, $settings->_httpRoot); //delete cookie setcookie("mydms_session", $dms_session, time()-3600, $settings->_httpRoot); //delete cookie
if(!$isajax)
header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer); header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer);
exit; exit;
} }
$origuser = null; if($user->isAdmin()) {
if($resArr["su"] && $su = $dms->getUser($resArr["su"])) { if($resArr["su"]) {
if($user->isAdmin() || $user->maySwitchToUser($su)) { $user = $dms->getUser($resArr["su"]);
$origuser = $user;
$user = $su;
} else { } else {
// $session->resetSu(); // $session->resetSu();
} }
@ -104,8 +96,6 @@ if($settings->_useHomeAsRootFolder && !$user->isAdmin() && $user->getHomeFolder(
$dms->checkWithinRootDir = true; $dms->checkWithinRootDir = true;
$dms->setRootFolderID($user->getHomeFolder()); $dms->setRootFolderID($user->getHomeFolder());
} }
$role = $user->getRole();
$dms->noReadForStatus = $role->getNoAccess();
/* Include additional language file for view /* Include additional language file for view
* This file must set $LANG[xx][] * This file must set $LANG[xx][]
@ -114,17 +104,13 @@ if(file_exists($settings->_rootDir . "view/".$theme."/languages/" . $lang . "/la
include $settings->_rootDir . "view/".$theme."/languages/" . $lang . "/lang.inc"; include $settings->_rootDir . "view/".$theme."/languages/" . $lang . "/lang.inc";
} }
/* if this is a ajax call, then exit early as the rest of the script is irrelevant */
if($isajax)
return;
/* Check if password needs to be changed because it expired. If it needs /* Check if password needs to be changed because it expired. If it needs
* to be changed redirect to out/out.ForcePasswordChange.php. Do this * to be changed redirect to out/out.ForcePasswordChange.php. Do this
* check only if password expiration is turned on, we are not on the * check only if password expiration is turned on, we are not on the
* page to change the password or the page that changes the password, the * page to change the password or the page that changes the password, the
* current user is not admin, and no user substitution has occured. */ * current user is not admin, and no user substitution has occured. */
if (!$user->isAdmin() && $origuser == null) { if (!$user->isAdmin() && !$resArr['su']) {
if($settings->_passwordExpiration > 0) { if($settings->_passwordExpiration > 0) {
if(basename($_SERVER['SCRIPT_NAME']) != 'out.ForcePasswordChange.php' && basename($_SERVER['SCRIPT_NAME']) != 'op.EditUserData.php' && basename($_SERVER['SCRIPT_NAME']) != 'op.Logout.php') { if(basename($_SERVER['SCRIPT_NAME']) != 'out.ForcePasswordChange.php' && basename($_SERVER['SCRIPT_NAME']) != 'op.EditUserData.php' && basename($_SERVER['SCRIPT_NAME']) != 'op.Logout.php') {
$pwdexp = $user->getPwdExpiration(); $pwdexp = $user->getPwdExpiration();
@ -139,17 +125,6 @@ if (!$user->isAdmin() && $origuser == null) {
} }
} }
/* Check if secret is set for 2-factor authentication. Redirect to Setup2Factor.php
* if secret is not set and 2-factor authentication is turned on. Also check if
* already on the page Setup2Factor.php and no user substiation has occured.
*/
if($settings->_enable2FactorAuthentication && $settings->_guestID != $user->getID() && $settings->_autoLoginUser != $user->getID() && $origuser == null && $user->getSecret() == '') {
if(basename($_SERVER['SCRIPT_NAME']) != 'out.Setup2Factor.php' && basename($_SERVER['SCRIPT_NAME']) != 'op.Setup2Factor.php') {
header("Location: ../out/out.Setup2Factor.php");
exit;
}
}
/* Update cookie lifetime */ /* Update cookie lifetime */
if($settings->_cookieLifetime) { if($settings->_cookieLifetime) {
$lifetime = time() + intval($settings->_cookieLifetime); $lifetime = time() + intval($settings->_cookieLifetime);

View File

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

View File

@ -1,41 +0,0 @@
<?php
/**
* Do authentication of users and session management
*
* @category DMS
* @package SeedDMS
* @license GPL 2
* @version @version@
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2002-2005 Markus Westphal,
* 2006-2008 Malcolm Cowe, 2010 Uwe Steinmann
* @version Release: @package_version@
*/
require_once("inc.Utils.php");
require_once("inc.ClassNotificationService.php");
require_once("inc.ClassEmailNotify.php");
require_once("inc.ClassSession.php");
require_once("inc.ClassAccessOperation.php");
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="'.$settings->_siteName.'"');
header('HTTP/1.0 401 Unauthorized');
echo getMLText('cancel_basic_authentication');
exit;
} else {
if(!($user = $authenticator->authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']))) {
header('WWW-Authenticate: Basic realm="'.$settings->_siteName.'"');
header('HTTP/1.0 401 Unauthorized');
echo getMLText('cancel_basic_authentication');
exit;
}
}
/* Clear login failures if login was successful */
$user->clearLoginFailures();
$dms->setUser($user);
require_once('inc/inc.Notification.php');

View File

@ -11,8 +11,6 @@
* @version Release: @package_version@ * @version Release: @package_version@
*/ */
require_once "inc.ClassAcl.php";
/** /**
* Class to check certain access restrictions * Class to check certain access restrictions
* *
@ -29,32 +27,33 @@ class SeedDMS_AccessOperation {
*/ */
private $dms; private $dms;
/**
* @var object $obj object being accessed
* @access protected
*/
private $obj;
/** /**
* @var object $user user requesting the access * @var object $user user requesting the access
* @access protected * @access protected
*/ */
protected $user; private $user;
/** /**
* @var object $settings SeedDMS Settings * @var object $settings SeedDMS Settings
* @access protected * @access protected
*/ */
protected $settings; private $settings;
/** /**
* @var object $aro access request object for caching * @var array $legacy_access list of objects with access
* @access protected
*/
private $_aro;
/**
* @var array $legacy_access list of objects with access use for view and controller
* @access protected * @access protected
*/ */
private $legacy_access; private $legacy_access;
function __construct($dms, $user, $settings) { /* {{{ */ function __construct($dms, $obj, $user, $settings) { /* {{{ */
$this->dms = $dms; $this->dms = $dms;
$this->obj = $obj;
$this->user = $user; $this->user = $user;
$this->settings = $settings; $this->settings = $settings;
$this->legacy_access['guest'] = array( $this->legacy_access['guest'] = array(
@ -81,7 +80,6 @@ class SeedDMS_AccessOperation {
'CategoryChooser', 'CategoryChooser',
'ChangePassword', 'ChangePassword',
'CheckInDocument', 'CheckInDocument',
'CheckOutDocument',
'Clipboard', 'Clipboard',
'Dashboard', 'Dashboard',
'DocumentAccess', 'DocumentAccess',
@ -165,15 +163,15 @@ class SeedDMS_AccessOperation {
* document may delete versions. The admin may even delete a version * document may delete versions. The admin may even delete a version
* even if is disallowed in the settings. * even if is disallowed in the settings.
*/ */
function mayEditVersion($document, $vno=0) { /* {{{ */ function mayEditVersion($vno=0) { /* {{{ */
if($document->isType('document')) { if($this->obj->isType('document')) {
if($vno) if($vno)
$version = $document->getContentByVersion($vno); $version = $this->obj->getContentByVersion($vno);
else else
$version = $document->getLatestContent(); $version = $this->obj->getLatestContent();
if (!isset($this->settings->_editOnlineFileTypes) || !is_array($this->settings->_editOnlineFileTypes) || (!in_array(strtolower($version->getFileType()), $this->settings->_editOnlineFileTypes) && !in_array(strtolower($version->getMimeType()), $this->settings->_editOnlineFileTypes))) if (!isset($this->settings->_editOnlineFileTypes) || !is_array($this->settings->_editOnlineFileTypes) || (!in_array(strtolower($version->getFileType()), $this->settings->_editOnlineFileTypes) && !in_array(strtolower($version->getMimeType()), $this->settings->_editOnlineFileTypes)))
return false; return false;
if ($document->getAccessMode($this->user) == M_ALL || $this->user->isAdmin()) { if ($this->obj->getAccessMode($this->user) == M_ALL || $this->user->isAdmin()) {
return true; return true;
} }
} }
@ -189,10 +187,10 @@ class SeedDMS_AccessOperation {
* document may delete versions. The admin may even delete a version * document may delete versions. The admin may even delete a version
* even if is disallowed in the settings. * even if is disallowed in the settings.
*/ */
function mayRemoveVersion($document) { /* {{{ */ function mayRemoveVersion() { /* {{{ */
if($document->isType('document')) { if($this->obj->isType('document')) {
$versions = $document->getContent(); $versions = $this->obj->getContent();
if ((($this->settings->_enableVersionDeletion && ($document->getAccessMode($this->user, 'removeVersion') == M_ALL)) || $this->user->isAdmin() ) && (count($versions) > 1)) { if ((($this->settings->_enableVersionDeletion && ($this->obj->getAccessMode($this->user, 'removeVersion') == M_ALL)) || $this->user->isAdmin() ) && (count($versions) > 1)) {
return true; return true;
} }
} }
@ -209,11 +207,11 @@ class SeedDMS_AccessOperation {
* The admin may even modify the status * The admin may even modify the status
* even if is disallowed in the settings. * even if is disallowed in the settings.
*/ */
function mayOverrideStatus($document) { /* {{{ */ function mayOverwriteStatus() { /* {{{ */
if($document->isType('document')) { if($this->obj->isType('document')) {
if($latestContent = $document->getLatestContent()) { if($latestContent = $this->obj->getLatestContent()) {
$status = $latestContent->getStatus(); $status = $latestContent->getStatus();
if ((($this->settings->_enableVersionModification && ($document->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && ($status["status"]==S_DRAFT || $status["status"]==S_RELEASED || $status["status"]==S_REJECTED || $status["status"]==S_OBSOLETE || $status["status"]==S_NEEDS_CORRECTION)) { if ((($this->settings->_enableVersionModification && ($this->obj->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && ($status["status"]==S_RELEASED || $status["status"]==S_OBSOLETE )) {
return true; return true;
} }
} }
@ -228,13 +226,12 @@ class SeedDMS_AccessOperation {
* reviewers/approvers is only allowed if version modification is turned on * reviewers/approvers is only allowed if version modification is turned on
* in the settings and the document has not been reviewed/approved by any * in the settings and the document has not been reviewed/approved by any
* user/group already. * user/group already.
* The admin may even set reviewers/approvers after the review/approval * The admin may even set reviewers/approvers if is disallowed in the
* process has been started, but only if _allowChangeRevAppInProcess * settings.
* explicitly allows it.
*/ */
function maySetReviewersApprovers($document) { /* {{{ */ function maySetReviewersApprovers() { /* {{{ */
if($document->isType('document')) { if($this->obj->isType('document')) {
if($latestContent = $document->getLatestContent()) { if($latestContent = $this->obj->getLatestContent()) {
$status = $latestContent->getStatus(); $status = $latestContent->getStatus();
$reviewstatus = $latestContent->getReviewStatus(); $reviewstatus = $latestContent->getReviewStatus();
$hasreview = false; $hasreview = false;
@ -248,49 +245,7 @@ class SeedDMS_AccessOperation {
if($r['status'] == 1 || $r['status'] == -1) if($r['status'] == 1 || $r['status'] == -1)
$hasapproval = true; $hasapproval = true;
} }
if ((($this->settings->_enableVersionModification && ($document->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && (($status["status"]==S_DRAFT_REV && (!$hasreview || ($this->user->isAdmin() && $this->settings->_allowChangeRevAppInProcess))) || ($status["status"]==S_DRAFT_APP && ((!$hasreview && !$hasapproval) || ($this->user->isAdmin() && $this->settings->_allowChangeRevAppInProcess))) || $status["status"]==S_DRAFT)) { if ((($this->settings->_enableVersionModification && ($this->obj->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && (($status["status"]==S_DRAFT_REV && !$hasreview) || ($status["status"]==S_DRAFT_APP && !$hasreview && !$hasapproval))) {
return true;
}
}
}
return false;
} /* }}} */
/**
* Check if recipients may be edited
*
* This check can only be done for documents. Setting the document
* recipients is only allowed if version modification is turned on
* in the settings. The
* admin may even set recipients if is disallowed in the
* settings.
*/
function maySetRecipients($document) { /* {{{ */
if($document->isType('document')) {
if($latestContent = $document->getLatestContent()) {
$status = $latestContent->getStatus();
if (($this->settings->_enableVersionModification && ($document->getAccessMode($this->user) >= M_READWRITE)) || $this->user->isAdmin()) {
return true;
}
}
}
return false;
} /* }}} */
/**
* Check if revisors may be edited
*
* This check can only be done for documents. Setting the document
* revisors is only allowed if version modification is turned on
* in the settings. The
* admin may even set revisors if is disallowed in the
* settings.
*/
function maySetRevisors($document) { /* {{{ */
if($document->isType('document')) {
if($latestContent = $document->getLatestContent()) {
$status = $latestContent->getStatus();
if ((($this->settings->_enableVersionModification && ($document->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && ($status["status"]==S_RELEASED || $status["status"]==S_IN_REVISION)) {
return true; return true;
} }
} }
@ -307,12 +262,12 @@ class SeedDMS_AccessOperation {
* admin may even set the workflow if is disallowed in the * admin may even set the workflow if is disallowed in the
* settings. * settings.
*/ */
function maySetWorkflow($document) { /* {{{ */ function maySetWorkflow() { /* {{{ */
if($document->isType('document')) { if($this->obj->isType('document')) {
if($latestContent = $document->getLatestContent()) { if($latestContent = $this->obj->getLatestContent()) {
$workflow = $latestContent->getWorkflow(); $workflow = $latestContent->getWorkflow();
$workflowstate = $latestContent->getWorkflowState(); $workflowstate = $latestContent->getWorkflowState();
if ((($this->settings->_enableVersionModification && ($document->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && (!$workflow || ($workflowstate && ($workflow->getInitState()->getID() == $workflowstate->getID())))) { if ((($this->settings->_enableVersionModification && ($this->obj->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && (!$workflow || ($workflowstate && ($workflow->getInitState()->getID() == $workflowstate->getID())))) {
return true; return true;
} }
} }
@ -326,11 +281,11 @@ class SeedDMS_AccessOperation {
* This check can only be done for documents. Setting the documents * This check can only be done for documents. Setting the documents
* expiration date is only allowed if the document has not been obsoleted. * expiration date is only allowed if the document has not been obsoleted.
*/ */
function maySetExpires($document) { /* {{{ */ function maySetExpires() { /* {{{ */
if($document->isType('document')) { if($this->obj->isType('document')) {
if($latestContent = $document->getLatestContent()) { if($latestContent = $this->obj->getLatestContent()) {
$status = $latestContent->getStatus(); $status = $latestContent->getStatus();
if ((($document->getAccessMode($this->user) >= M_READWRITE) || $this->user->isAdmin()) && ($status["status"]!=S_OBSOLETE)) { if ((($this->obj->getAccessMode($this->user) == M_ALL) || $this->user->isAdmin()) && ($status["status"]!=S_OBSOLETE)) {
return true; return true;
} }
} }
@ -347,17 +302,17 @@ class SeedDMS_AccessOperation {
* The admin may set the comment even if is * The admin may set the comment even if is
* disallowed in the settings. * disallowed in the settings.
*/ */
function mayEditComment($document) { /* {{{ */ function mayEditComment() { /* {{{ */
if($document->isType('document')) { if($this->obj->isType('document')) {
if($document->getAccessMode($this->user) < M_READWRITE) if($this->obj->getAccessMode($this->user) < M_READWRITE)
return false; return false;
if($document->isLocked()) { if($this->obj->isLocked()) {
$lockingUser = $document->getLockingUser(); $lockingUser = $this->obj->getLockingUser();
if (($lockingUser->getID() != $this->user->getID()) && ($document->getAccessMode($this->user) != M_ALL)) { if (($lockingUser->getID() != $this->user->getID()) && ($this->obj->getAccessMode($this->user) != M_ALL)) {
return false; return false;
} }
} }
if($latestContent = $document->getLatestContent()) { if($latestContent = $this->obj->getLatestContent()) {
$status = $latestContent->getStatus(); $status = $latestContent->getStatus();
if (($this->settings->_enableVersionModification || $this->user->isAdmin()) && !in_array($status["status"], array(S_OBSOLETE, S_EXPIRED))) { if (($this->settings->_enableVersionModification || $this->user->isAdmin()) && !in_array($status["status"], array(S_OBSOLETE, S_EXPIRED))) {
return true; return true;
@ -375,15 +330,15 @@ class SeedDMS_AccessOperation {
* the settings or the document is still in an approval/review * the settings or the document is still in an approval/review
* or intial workflow step. * or intial workflow step.
*/ */
function mayEditAttributes($document) { /* {{{ */ function mayEditAttributes() { /* {{{ */
if($document->isType('document')) { if($this->obj->isType('document')) {
if($latestContent = $document->getLatestContent()) { if($latestContent = $this->obj->getLatestContent()) {
$status = $latestContent->getStatus(); $status = $latestContent->getStatus();
$workflow = $latestContent->getWorkflow(); $workflow = $latestContent->getWorkflow();
$workflowstate = $latestContent->getWorkflowState(); $workflowstate = $latestContent->getWorkflowState();
if($document->getAccessMode($this->user) < M_READWRITE) if($this->obj->getAccessMode($this->user) < M_READWRITE)
return false; return false;
if ($this->settings->_enableVersionModification || in_array($status["status"], array(S_DRAFT_REV, S_DRAFT_APP, S_IN_REVISION)) || ($workflow && $workflowstate && $workflow->getInitState()->getID() == $workflowstate->getID())) { if ($this->settings->_enableVersionModification || in_array($status["status"], array(S_DRAFT_REV, S_DRAFT_APP)) || ($workflow && $workflowstate && $workflow->getInitState()->getID() == $workflowstate->getID())) {
return true; return true;
} }
} }
@ -398,11 +353,11 @@ class SeedDMS_AccessOperation {
* review. There are other requirements which are not taken into * review. There are other requirements which are not taken into
* account here. * account here.
*/ */
function mayReview($document) { /* {{{ */ function mayReview() { /* {{{ */
if($document->isType('document')) { if($this->obj->isType('document')) {
if($latestContent = $document->getLatestContent()) { if($latestContent = $this->obj->getLatestContent()) {
$status = $latestContent->getStatus(); $status = $latestContent->getStatus();
if ($document->getAccessMode($this->user) >= M_READ && $status["status"]==S_DRAFT_REV) { if ($status["status"]==S_DRAFT_REV) {
return true; return true;
} }
} }
@ -416,24 +371,9 @@ class SeedDMS_AccessOperation {
* A review may only be updated by the user who originaly addedd the * A review may only be updated by the user who originaly addedd the
* review and if it is allowed in the settings * review and if it is allowed in the settings
*/ */
function mayUpdateReview($document, $updateUser) { /* {{{ */ function mayUpdateReview($updateUser) { /* {{{ */
if($document->isType('document')) { if($this->obj->isType('document')) {
if($this->settings->_enableUpdateRevApp && ($updateUser == $this->user) && $document->getAccessMode($this->user) >= M_READ && !$document->hasExpired()) { if($this->settings->_enableUpdateRevApp && ($updateUser == $this->user) && !$this->obj->hasExpired()) {
return true;
}
}
return false;
} /* }}} */
/**
* Check if a approval maybe edited
*
* An approval may only be updated by the user who originaly addedd the
* approval and if it is allowed in the settings
*/
function mayUpdateApproval($document, $updateUser) { /* {{{ */
if($document->isType('document')) {
if($this->settings->_enableUpdateRevApp && ($updateUser == $this->user) && $document->getAccessMode($this->user) >= M_READ && !$document->hasExpired()) {
return true; return true;
} }
} }
@ -449,11 +389,11 @@ class SeedDMS_AccessOperation {
* There are other requirements which are not taken into * There are other requirements which are not taken into
* account here. * account here.
*/ */
function mayApprove($document) { /* {{{ */ function mayApprove() { /* {{{ */
if($document->isType('document')) { if($this->obj->isType('document')) {
if($latestContent = $document->getLatestContent()) { if($latestContent = $this->obj->getLatestContent()) {
$status = $latestContent->getStatus(); $status = $latestContent->getStatus();
if ($document->getAccessMode($this->user) >= M_READ && $status["status"]==S_DRAFT_APP) { if ($status["status"]==S_DRAFT_APP) {
return true; return true;
} }
} }
@ -462,70 +402,14 @@ class SeedDMS_AccessOperation {
} /* }}} */ } /* }}} */
/** /**
* Check if document content may be receipted * Check if a approval maybe edited
* *
* Reviewing a document content is only allowed if the document was not * An approval may only be updated by the user who originaly addedd the
* obsoleted. There are other requirements which are not taken into * approval and if it is allowed in the settings
* account here.
*/ */
function mayReceipt($document) { /* {{{ */ function mayUpdateApproval($updateUser) { /* {{{ */
if($document->isType('document')) { if($this->obj->isType('document')) {
if($latestContent = $document->getLatestContent()) { if($this->settings->_enableUpdateRevApp && ($updateUser == $this->user) && !$this->obj->hasExpired()) {
$status = $latestContent->getStatus();
if ($document->getAccessMode($this->user) >= M_READ && $status["status"]==S_RELEASED) {
return true;
}
}
}
return false;
} /* }}} */
/**
* Check if a review maybe edited
*
* A review may only be updated by the user who originaly addedd the
* review and if it is allowed in the settings
*/
function mayUpdateReceipt($document, $updateUser) { /* {{{ */
if($document->isType('document')) {
if($this->settings->_enableUpdateReceipt && ($updateUser == $this->user) && $document->getAccessMode($this->user) >= M_READ && !$document->hasExpired()) {
return true;
}
}
return false;
} /* }}} */
/**
* Check if document content may be revised
*
* Revising a document content is only allowed if the document was not
* obsoleted. There may be other requirements which are not taken into
* account here.
*/
function mayRevise($document) { /* {{{ */
if($document->isType('document')) {
if($latestContent = $document->getLatestContent()) {
$status = $latestContent->getStatus();
if ($document->getAccessMode($this->user) >= M_READ && $status["status"]!=S_OBSOLETE) {
return true;
}
}
}
return false;
} /* }}} */
/**
* Check if document content may be checked in
*
*
*/
function mayCheckIn($document) { /* {{{ */
if($document->isType('document')) {
$checkoutinfo = $document->getCheckOutInfo();
if(!$checkoutinfo)
return false;
$info = $checkoutinfo[0];
if($this->user->getID() == $info['userID'] || $document->getAccessMode($this->user) == M_ALL) {
return true; return true;
} }
} }
@ -564,44 +448,11 @@ class SeedDMS_AccessOperation {
return false; return false;
} /* }}} */ } /* }}} */
protected function check_controller_legacy_access($controller, $get=array()) { /* {{{ */
if($this->user->isAdmin())
return true;
if(is_string($controller)) {
$scripts = array($controller);
} elseif(is_array($controller)) {
$scripts = $controller;
} elseif(is_subclass_of($controller, 'SeedDMS_Controller_Common')) {
$scripts = array($controller->getParam('class'));
} else {
return false;
}
if($this->user->isGuest()) {
$user_allowed = $this->legacy_access['guest'];
} else {
$user_allowed = $this->legacy_access['user'];
}
if(array_intersect($scripts, $user_allowed))
return true;
return false;
} /* }}} */
/** /**
* Check for access permission on view * Check for access permission on view
* *
* If the parameter $view is an array then each element is considered the * This function will always return true because it was added to smooth
* name of a view and true will be returned if one of them is accessible. * migration from 5.1.x to 6.0.x
* Whether access is allowed also depends on the currently logged in user
* stored in the view object. If the user is an admin the access
* on a view must be explicitly disallowed. For regular users the access
* must be explicitly allowed.
*
* If advanced access control is turn off, this function will always return
* true for admins and false for other users.
* *
* @param mixed $view Instanz of view, name of view or array of view names * @param mixed $view Instanz of view, name of view or array of view names
* @param string $get query parameters possible containing the element 'action' * @param string $get query parameters possible containing the element 'action'
@ -609,79 +460,20 @@ class SeedDMS_AccessOperation {
* no specific access right is set, otherwise false * no specific access right is set, otherwise false
*/ */
function check_view_access($view, $get=array()) { /* {{{ */ function check_view_access($view, $get=array()) { /* {{{ */
if(!$this->settings->_advancedAcl) {
return $this->check_view_legacy_access($view, $get); return $this->check_view_legacy_access($view, $get);
}
if(is_string($view)) {
$scripts = array($view);
} elseif(is_array($view)) {
$scripts = $view;
} elseif(is_subclass_of($view, 'SeedDMS_View_Common')) {
$scripts = array($view->getParam('class'));
} else {
return false;
}
$scope = 'Views';
$action = (isset($get['action']) && $get['action']) ? $get['action'] : 'show';
$acl = new SeedDMS_Acl($this->dms);
if(!$this->_aro)
$this->_aro = SeedDMS_Aro::getInstance($this->user->getRole(), $this->dms);
foreach($scripts as $script) {
$aco = SeedDMS_Aco::getInstance($scope.'/'.$script.'/'.$action, $this->dms);
$ll = $acl->check($this->_aro, $aco);
if($ll === 1 && !$this->user->isAdmin() || $ll !== -1 && $this->user->isAdmin())
return true;
}
return false;
} /* }}} */ } /* }}} */
/** /**
* Check for access permission on controller * Check for access permission on controller
* *
* If the parameter $controller is an array then each element is considered the * This function will always return true because it was added to smooth
* name of a controller and true will be returned if one is accesible. * migration from 5.1.x to 6.0.x
* If advanced access controll is turn off, this function will return false
* for guest users and true otherwise.
* *
* @param mixed $controller Instanz of controller, name of controller or array of controller names * @param mixed $controller Instanz of controller, name of controller or array of controller names
* @param string $get query parameters * @param string $get query parameters
* @return boolean true if access is allowed otherwise false * @return boolean true if access is allowed otherwise false
*/ */
function check_controller_access($controller, $get=array()) { /* {{{ */ function check_controller_access($controller, $get=array()) { /* {{{ */
if(!$this->settings->_advancedAcl) {
return $this->check_controller_legacy_access($controller, $get);
/*
if($this->user->isGuest())
return false;
elseif($this->user->isAdmin())
return true; return true;
else {
if($controller == 'AddDocument' && isset($get['action']) && $get['action'] == 'setOwner')
return false;
return true;
}
*/
}
if(is_string($controller)) {
$scripts = array($controller);
} elseif(is_array($controller)) {
$scripts = $controller;
} elseif(is_subclass_of($controller, 'SeedDMS_Controller_Common')) {
$scripts = array($controller->getParam('class'));
} else {
return false;
}
$scope = 'Controllers';
$action = (isset($get['action']) && $get['action']) ? $get['action'] : 'run';
$acl = new SeedDMS_Acl($this->dms);
if(!$this->_aro)
$this->_aro = SeedDMS_Aro::getInstance($this->user->getRole(), $this->dms);
foreach($scripts as $script) {
$aco = SeedDMS_Aco::getInstance($scope.'/'.$script.'/'.$action, $this->dms);
$ll = $acl->check($this->_aro, $aco);
if($ll === 1 && !$this->user->isAdmin() || $ll !== -1 && $this->user->isAdmin())
return true;
}
return false;
} /* }}} */ } /* }}} */
} }

View File

@ -1,390 +0,0 @@
<?php
/**
* Implementation of a access control list.
*
* SeedDMS uses access control list for setting permission,
* on various operations.
*
* @category DMS
* @package SeedDMS
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright 2016 Uwe Steinmann
* @version Release: @package_version@
*/
/**
* Class to represent an access request object
*
* This class provides a model for access request objects.
*
* @category DMS
* @package SeedDMS
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright 2016 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_Acl { /* {{{ */
/**
* @var object $dms reference to dms object.
* @access public
*/
public $_dms;
/**
* Create a new instance of an acl
*
* @param object $dms object of dms
* @return object instance of SeedDMS_Acl
*/
public function __construct($dms) { /* {{{ */
$this->_dms = $dms;
} /* }}} */
/**
* Check if Aro has access on Aco
*
* @param object $aro access request object
* @param object $aco access control object
* @return integer/boolean -1 if access is explictly denied, 1 if access
* is explictly allow, 0 if no access restrictions exists, false if
* an error occured.
*/
public function check($aro, $aco) { /* {{{ */
$db = $this->_dms->getDB();
while($aco) {
$acoid = $aco->getID();
$queryStr = "SELECT * FROM `tblArosAcos` WHERE `aro`=".$aro->getID()." AND `aco`=".$acoid;
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && $resArr === false)
return false;
if (count($resArr) == 1)
return((int) $resArr[0]['read']);
$aco = $aco->getParent();
}
return 0;
} /* }}} */
public function toggle($aro, $aco) { /* {{{ */
$db = $this->_dms->getDB();
$queryStr = "SELECT * FROM `tblArosAcos` WHERE `aro`=".$aro->getID()." AND `aco`=".$aco->getID();
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && $resArr === false)
return false;
if (count($resArr) != 1)
return false;
$resArr = $resArr[0];
$newperm = $resArr['read'] == 1 ? -1 : 1;
$queryStr = "UPDATE `tblArosAcos` SET `read`=".$newperm." WHERE `aro`=".$aro->getID()." AND `aco`=".$aco->getID();
if (!$db->getResult($queryStr))
return false;
return true;
} /* }}} */
public function add($aro, $aco, $perm=-1) { /* {{{ */
$db = $this->_dms->getDB();
$queryStr = "SELECT * FROM `tblArosAcos` WHERE `aro`=".$aro->getID()." AND `aco`=".$aco->getID();
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && $resArr === false)
return false;
if (count($resArr) == 1) {
$resArr = $resArr[0];
$newperm = $resArr['read'] == 1 ? -1 : 1;
$queryStr = "UPDATE `tblArosAcos` SET `read`=".$newperm." WHERE `aro`=".$aro->getID()." AND `aco`=".$aco->getID();
if (!$db->getResult($queryStr))
return false;
} else {
$queryStr = "INSERT INTO `tblArosAcos` (`aro`, `aco`, `read`) VALUES (".$aro->getID().", ".$aco->getID().", ".$perm.")";
if (!$db->getResult($queryStr))
return false;
}
return true;
} /* }}} */
public function remove($aro, $aco) { /* {{{ */
$db = $this->_dms->getDB();
$queryStr = "DELETE FROM `tblArosAcos` WHERE `aro`=".$aro->getID()." AND `aco`=".$aco->getID();
if (!$db->getResult($queryStr))
return false;
return true;
} /* }}} */
} /* }}} */
/**
* Class to represent an access request/controll object
*
* This class provides a model for access request/controll objects.
*
* @category DMS
* @package SeedDMS
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright 2016 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_AroAco { /* {{{ */
/**
* @var object $dms reference to dms object.
* @access protected
*/
public $_dms;
/**
* @var integer id of access request object
*/
protected $_id;
/**
* @var integer id of parent of access request object
*/
protected $_parent;
/**
* @var string alias of access request object
*/
protected $_alias;
/**
* @var object object of access request object
*/
protected $_object;
/**
* Create a new instance of an aro
*
* @param object $dms object of dms
* @return object instance of SeedDMS_Aco
*/
function __construct($dms, $id, $parent, $object, $alias) { /* {{{ */
$this->_dms = $dms;
$this->_id = $id;
$this->_parent = $parent;
$this->_object = $object;
$this->_alias = $alias;
} /* }}} */
public function setDMS($dms) { /* {{{ */
$this->_dms = $dms;
} /* }}} */
public function getDMS() { /* {{{ */
return($this->_dms);
} /* }}} */
public function getID() { /* {{{ */
return $this->_id;
} /* }}} */
public function getAlias() { /* {{{ */
return $this->_alias;
} /* }}} */
public function getObject() { /* {{{ */
return $this->_object;
} /* }}} */
} /* }}} */
/**
* Class to represent an access request object
*
* This class provides a model for access request objects.
*
* @category DMS
* @package SeedDMS
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright 2016 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_Aro extends SeedDMS_AroAco { /* {{{ */
/**
* Create a new instance of an aro
*
* @param object $dms object to access the underlying database
* @return object instance of SeedDMS_Aro
*/
public static function getInstance($id, $dms) { /* {{{ */
$db = $dms->getDB();
if(is_int($id)) {
$queryStr = "SELECT * FROM `tblAros` WHERE `id` = " . (int) $id;
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && $resArr === false)
return null;
if (count($resArr) != 1)
return null;
$resArr = $resArr[0];
} elseif(is_object($id)) {
if($dms->getClassname('role') == get_class($id)) {
$model = 'Role';
$queryStr = "SELECT * FROM `tblAros` WHERE `model`=".$db->qstr($model)." AND `foreignid`=".$id->getID();
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && $resArr === false)
return null;
if (count($resArr) == 0) {
$queryStr = "INSERT INTO `tblAros` (`parent`, `model`, `foreignid`) VALUES (0, ".$db->qstr($model).", ".$id->getID().")";
if (!$db->getResult($queryStr))
return null;
$id = $db->getInsertID();
$queryStr = "SELECT * FROM `tblAros` WHERE `id` = " . $id;
$resArr = $db->getResultArray($queryStr);
}
$resArr = $resArr[0];
} else {
return null;
}
}
if($resArr['model'] == 'Role') {
$classname = $dms->getClassname('role');
$object = $classname::getInstance($resArr['foreignid'], $dms);
} else {
$object = null;
}
$aro = new SeedDMS_Aro($dms, $resArr["id"], $resArr['parent'], $object, $resArr['alias']);
$aro->setDMS($dms);
return $aro;
} /* }}} */
} /* }}} */
/**
* Class to represent an access control object
*
* This class provides a model for access control objects.
*
* @category DMS
* @package SeedDMS
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright 2016 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_Aco extends SeedDMS_AroAco{ /* {{{ */
/**
* Create a new instance of an aco
*
* @param object $dms object to access the underlying database
* @return object instance of SeedDMS_Aco
*/
public static function getInstance($id, $dms) { /* {{{ */
$db = $dms->getDB();
if(is_int($id)) {
$queryStr = "SELECT * FROM `tblAcos` WHERE `id` = " . (int) $id;
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && $resArr === false)
return null;
if (count($resArr) == 0) {
return null;
}
$resArr = $resArr[0];
} elseif(is_string($id)) {
$tmp = explode('/', $id);
$parentid = 0;
foreach($tmp as $part) {
$queryStr = "SELECT * FROM `tblAcos` WHERE `alias` = " . $db->qstr($part);
// if($parentid)
$queryStr .= " AND parent=".$parentid;
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && $resArr === false)
return null;
if (count($resArr) == 0) {
$queryStr = "INSERT INTO `tblAcos` (`parent`, `alias`, `model`) VALUES (".$parentid.",".$db->qstr($part).", '')";
if (!$db->getResult($queryStr))
return null;
$id = $db->getInsertID();
$queryStr = "SELECT * FROM `tblAcos` WHERE `id` = " . $id;
$resArr = $db->getResultArray($queryStr);
}
$parentid = (int) $resArr[0]['id'];
}
$resArr = $resArr[0];
}
if($resArr['model'] == 'Document') {
$classname = $dms->getClassname('document');
$object = $classname::getInstance($resArr['foreignid'], $dms);
} elseif($resArr['model'] == 'Folder') {
$classname = $dms->getClassname('focument');
$object = $classname::getInstance($resArr['foreignid'], $dms);
} else {
$object = null;
}
$aco = new SeedDMS_Aco($dms, $resArr["id"], $resArr['parent'], $object, $resArr['alias']);
$aco->setDMS($dms);
return $aco;
} /* }}} */
public function getChildren() { /* {{{ */
$dms = $this->getDMS();
$db = $dms->getDB();
$queryStr = "SELECT * FROM `tblAcos` WHERE `parent` = ".$this->_id." ORDER BY `alias`";
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && $resArr === false)
return null;
if (count($resArr) == 0)
return null;
$acos = array();
foreach($resArr as $row) {
$aco = new SeedDMS_Aco($dms, $row["id"], $row['parent'], null, $row['alias']);
$aco->setDMS($dms);
$acos[] = $aco;
}
return $acos;
} /* }}} */
public function getPermission($aro) { /* {{{ */
if(!$aro)
return 0;
$dms = $this->getDMS();
$db = $dms->getDB();
$queryStr = "SELECT * FROM `tblArosAcos` WHERE `aro`=".$aro->getID()." AND `aco`=".$this->_id;
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && $resArr === false)
return false;
if (count($resArr) != 1)
return 0;
return (int) $resArr[0]['read'];
} /* }}} */
public static function getRoot($dms) { /* {{{ */
$db = $dms->getDB();
$queryStr = "SELECT * FROM `tblAcos` WHERE `parent` = 0 ORDER BY `alias`";
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && $resArr === false)
return null;
$acos = array();
foreach($resArr as $row) {
$aco = new SeedDMS_Aco($dms, $row["id"], $row['parent'], null, $row['alias']);
$aco->setDMS($dms);
$acos[] = $aco;
}
return $acos;
} /* }}} */
public function getParent() { /* {{{ */
$dms = $this->getDMS();
$db = $dms->getDB();
$queryStr = "SELECT * FROM `tblAcos` WHERE `id` = ".$this->_parent;
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && $resArr === false)
return null;
if (count($resArr) != 1)
return null;
$row = $resArr[0];
$aco = new SeedDMS_Aco($dms, $row["id"], $row['parent'], null, $row['alias']);
$aco->setDMS($dms);
return $aco;
} /* }}} */
} /* }}} */

View File

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

View File

@ -30,14 +30,19 @@ class Controller {
* @return object an object of a class implementing the view * @return object an object of a class implementing the view
*/ */
static function factory($class, $params=array()) { /* {{{ */ 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) { if(!$class) {
return null; return null;
} }
$classname = "SeedDMS_Controller_".$class; $classname = "SeedDMS_Controller_".$class;
$filename = ''; $filename = '';
foreach($extMgr->getExtensionConfiguration() as $extname=>$extconf) { foreach($extmgr->getExtensionConfiguration() as $extname=>$extconf) {
$filename = $settings->_rootDir.'ext/'.$extname.'/controllers/class.'.$class.".php"; $filename = $settings->_rootDir.'ext/'.$extname.'/controllers/class.'.$class.".php";
if(file_exists($filename)) { if(file_exists($filename)) {
break; break;
@ -52,7 +57,6 @@ class Controller {
require_once($filename); require_once($filename);
$controller = new $classname($params); $controller = new $classname($params);
/* Set some configuration parameters */ /* Set some configuration parameters */
$controller->setParam('class', $class);
$controller->setParam('postVars', $_POST); $controller->setParam('postVars', $_POST);
$controller->setParam('getVars', $_GET); $controller->setParam('getVars', $_GET);
$controller->setParam('requestVars', $_REQUEST); $controller->setParam('requestVars', $_REQUEST);
@ -61,6 +65,8 @@ class Controller {
$controller->setParam('settings', $settings); $controller->setParam('settings', $settings);
$controller->setParam('logger', $logger); $controller->setParam('logger', $logger);
$controller->setParam('notifier', $notifier); $controller->setParam('notifier', $notifier);
$controller->setParam('fulltextservice', $fulltextservice);
$controller->setParam('translator', $translator);
return $controller; return $controller;
} }
return null; return null;

View File

@ -285,7 +285,7 @@ class SeedDMS_Controller_Common {
if(is_string($tmpret)) { if(is_string($tmpret)) {
$ret = ($ret === null) ? $tmpret : (is_string($ret) ? $ret.$tmpret : array_merge($ret, array($tmpret))); $ret = ($ret === null) ? $tmpret : (is_string($ret) ? $ret.$tmpret : array_merge($ret, array($tmpret)));
} elseif(is_array($tmpret)) { // || is_object($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 } else
$ret = $tmpret; $ret = $tmpret;
} }
@ -317,26 +317,4 @@ class SeedDMS_Controller_Common {
} }
return false; return false;
} /* }}} */ } /* }}} */
/**
* Check if the access on the contoller with given name or the current
* controller itself may be accessed.
*
* The function requires the parameter 'accessobject' to be available in the
* controller, because it calls SeedDMS_AccessOperation::check_controller_access()
* to check access rights. If the the optional $name is not set the
* current controller is used.
*
* @param string|array $name name of controller or list of controller names
* @return boolean true if access is allowed otherwise false
*/
protected function check_access($name='') { /* {{{ */
if(!$name)
$name = $this;
if(!isset($this->params['accessobject']))
return false;
$access = $this->params['accessobject']->check_controller_access($name);
return $access;
} /* }}} */
} }

View File

@ -93,6 +93,18 @@ class SeedDMS_Download_Mgr {
*/ */
protected $filenames; 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 * @var boolean $skipdefaultcols skip default columns, will only export extracols
* @access protected * @access protected

View File

@ -36,6 +36,8 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
*/ */
protected $_dms; protected $_dms;
protected $_translator;
protected $smtp_server; protected $smtp_server;
protected $smtp_port; protected $smtp_port;
@ -52,8 +54,9 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
protected $debug; 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->_dms = $dms;
$this->_translator = $translator;
$this->smtp_server = $smtp_server; $this->smtp_server = $smtp_server;
$this->smtp_port = $smtp_port; $this->smtp_port = $smtp_port;
$this->smtp_user = $smtp_username; $this->smtp_user = $smtp_username;
@ -122,41 +125,42 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
$from = $this->from_address; $from = $this->from_address;
} }
$body = ''; $body = '';
if(!isset($params['__skip_header__']) || !$params['__skip_header__']) { if(!isset($params['__skip_header__']) || !$params['__skip_header__']) {
if(!isset($params['__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__']) 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__'])) if(isset($params['__body__']))
$body .= $params['__body__']; $body .= $params['__body__'];
else 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['__skip_footer__']) || !$params['__skip_footer__']) {
if(!isset($params['__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__']) 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 = ''; $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['__skip_header__']) || !$params['__skip_header__']) {
if(!isset($params['__header_html__'])) 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__']) 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__'])) if(isset($params['__body_html__']))
$bodyhtml .= $params['__body_html__']; $bodyhtml .= $params['__body_html__'];
else 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['__skip_footer__']) || !$params['__skip_footer__']) {
if(!isset($params['__footer_html__'])) 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__']) 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);
} }
} }
@ -206,7 +210,7 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
$headers['Return-Path'] = $returnpath; $headers['Return-Path'] = $returnpath;
$headers['To'] = $to; $headers['To'] = $to;
$preferences = array("input-charset" => "UTF-8", "output-charset" => "UTF-8", "scheme"=>"Q"); $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['Subject'] = substr($encoded_subject, strlen('Subject: '));
$headers['Date'] = date('r', time()); $headers['Date'] = date('r', time());
$headers['MIME-Version'] = "1.0"; $headers['MIME-Version'] = "1.0";
@ -239,7 +243,7 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
if (isset($GLOBALS['SEEDDMS_HOOKS']['mailqueue'])) { if (isset($GLOBALS['SEEDDMS_HOOKS']['mailqueue'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['mailqueue'] as $queueService) { foreach($GLOBALS['SEEDDMS_HOOKS']['mailqueue'] as $queueService) {
if(method_exists($queueService, 'queueMailJob')) { 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) if($ret !== null)
return $ret; return $ret;
} }
@ -279,12 +283,10 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
* The dispatching is now done in SeedDMS_NotificationService::toList() * The dispatching is now done in SeedDMS_NotificationService::toList()
*/ */
function toList($sender, $recipients, $subject, $message, $params=array()) { /* {{{ */ function toList($sender, $recipients, $subject, $message, $params=array()) { /* {{{ */
/*
if ((!is_object($sender) && strcasecmp(get_class($sender), $this->_dms->getClassname('user'))) || if ((!is_object($sender) && strcasecmp(get_class($sender), $this->_dms->getClassname('user'))) ||
(!is_array($recipients) && count($recipients)==0)) { (!is_array($recipients) && count($recipients)==0)) {
return false; return false;
} }
*/
$ret = true; $ret = true;
foreach ($recipients as $recipient) { foreach ($recipients as $recipient) {

View File

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

View File

@ -14,6 +14,10 @@
* @version Release: @package_version@ * @version Release: @package_version@
*/ */
namespace Seeddms\Seeddms;
use Seeddms\Seeddms\Utilities;
/** /**
* Class to represent an extension manager * Class to represent an extension manager
* *
@ -25,7 +29,7 @@
* @copyright 2011 Uwe Steinmann * @copyright 2011 Uwe Steinmann
* @version Release: @package_version@ * @version Release: @package_version@
*/ */
class SeedDMS_Extension_Mgr { class ExtensionMgr {
/** /**
* @var string $extdir directory where extensions are located * @var string $extdir directory where extensions are located
* @access protected * @access protected
@ -81,6 +85,12 @@ class SeedDMS_Extension_Mgr {
*/ */
protected $errmsgs; 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 * Name of json file containg available extension from repository
*/ */
@ -148,10 +158,6 @@ class SeedDMS_Extension_Mgr {
} }
} /* }}} */ } /* }}} */
public function getRepositoryUrl() { /* {{{ */
return $this->reposurl;
} /* }}} */
private function getStreamContext() { /* {{{ */ private function getStreamContext() { /* {{{ */
if(!$this->proxyurl) if(!$this->proxyurl)
return null; return null;
@ -179,6 +185,10 @@ class SeedDMS_Extension_Mgr {
return $this->cachedir."/extensions.php"; return $this->cachedir."/extensions.php";
} /* }}} */ } /* }}} */
public function setRepositoryUrl($reposurl) { /* {{{ */
$this->reposurl = $reposurl;
} /* }}} */
/** /**
* Get the configuration of extensions * Get the configuration of extensions
* *
@ -262,14 +272,14 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
unlink ($destination); unlink ($destination);
} }
$zip = new ZipArchive(); $zip = new \ZipArchive();
if (!$zip->open($destination, ZIPARCHIVE::CREATE)) { if (!$zip->open($destination, \ZipArchive::CREATE)) {
return false; return false;
} }
$source = str_replace('\\', '/', realpath($source)); $source = str_replace('\\', '/', realpath($source));
if (is_dir($source) === true) { 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) { if ($include_dir) {
$arr = explode("/",$source); $arr = explode("/",$source);
@ -318,13 +328,19 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
* @param string $version version of extension (x.y.z) * @param string $version version of extension (x.y.z)
* @return string name of temporary file with archive * @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)) if(!is_dir($this->extdir ."/". $extname))
return false; return false;
if ($dir) {
if (!is_dir($dir))
return false;
$tmpfile = $dir."/".$extname."-".$version.".zip";
} else {
$tmpfile = $this->cachedir."/".$extname."-".$version.".zip"; $tmpfile = $this->cachedir."/".$extname."-".$version.".zip";
}
if(!SeedDMS_Extension_Mgr::Zip($this->extdir."/".$extname, $tmpfile)) { if(!ExtensionMgr::Zip($this->extdir."/".$extname, $tmpfile)) {
return false; return false;
} }
// $cmd = "cd ".$this->extdir."/".$extname."; zip -r ".$tmpfile." ."; // $cmd = "cd ".$this->extdir."/".$extname."; zip -r ".$tmpfile." .";
@ -397,17 +413,22 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
return false; return false;
return self::checkExtensionByName($extname, $extconf, $options); 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 * This method checks if the configurations of an extension is complete
* or an array containing the configuration. * and all dependencies specified in the configuration are met.
* @param array $options array with options elements 'noconstraints' and 'nofiles'. *
* Set 'noconstraints' to true if * @param string $extname not used anymore. Was previously use to store
* constraints to local seeddms installation shall not be checked. Set 'nofiles' * result of the check into $this->configcache, but this method can be
* to true to turn off checking of files * 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 * @return boolean true if check was successful, otherwise false
*/ */
public function checkExtensionByName($extname, $extconf, $options=array()) { /* {{{ */ public function checkExtensionByName($extname, $extconf, $options=array()) { /* {{{ */
@ -416,6 +437,7 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
} }
$this->errmsgs = array(); $this->errmsgs = array();
$this->warnmsgs = array();
if(!isset($extconf['constraints']['depends']['seeddms'])) { if(!isset($extconf['constraints']['depends']['seeddms'])) {
$this->errmsgs[] = "Missing dependency on SeedDMS"; $this->errmsgs[] = "Missing dependency on SeedDMS";
@ -432,13 +454,16 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
if(!isset($extconf['author'])) { if(!isset($extconf['author'])) {
$this->errmsgs[] = "Missing author"; $this->errmsgs[] = "Missing author";
} }
if(!isset($extconf['changes'])) {
$this->warnmsgs[] = "Missing changes";
}
if(!isset($options['noconstraints']) || $options['noconstraints'] == false) { if(!isset($options['noconstraints']) || $options['noconstraints'] == false) {
if(isset($extconf['constraints']['depends'])) { if(isset($extconf['constraints']['depends'])) {
foreach($extconf['constraints']['depends'] as $dkey=>$dval) { foreach($extconf['constraints']['depends'] as $dkey=>$dval) {
switch($dkey) { switch($dkey) {
case 'seeddms': case 'seeddms':
$version = new SeedDMS_Version; $version = new Version;
if(is_array($dval)) { if(is_array($dval)) {
$fullfill = false; $fullfill = false;
foreach($dval as $ddval) { foreach($dval as $ddval) {
@ -515,13 +540,13 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
$newdir = addDirSep($this->cachedir)."ext.new"; $newdir = addDirSep($this->cachedir)."ext.new";
/* First remove a left over from a previous extension */ /* First remove a left over from a previous extension */
if(file_exists($newdir)) { if(file_exists($newdir)) {
SeedDMS_Utils::rrmdir($newdir); Utilities::rrmdir($newdir);
} }
if(!mkdir($newdir, 0755)) { if(!mkdir($newdir, 0755)) {
$this->errmsgs[] = "Cannot create temp. extension directory"; $this->errmsgs[] = "Cannot create temp. extension directory";
return false; return false;
} }
$zip = new ZipArchive; $zip = new \ZipArchive;
$res = $zip->open($file); $res = $zip->open($file);
if ($res === TRUE) { if ($res === TRUE) {
$zip->extractTo($newdir); $zip->extractTo($newdir);
@ -535,7 +560,7 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
/* Check if extension is complete and fullfills the constraints */ /* Check if extension is complete and fullfills the constraints */
if(!self::checkExtensionByDir($newdir)) { if(!self::checkExtensionByDir($newdir)) {
SeedDMS_Utils::rrmdir($newdir); Utilities::rrmdir($newdir);
return false; return false;
} }
@ -546,11 +571,11 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
if(!is_dir($this->extdir)) { if(!is_dir($this->extdir)) {
if(!mkdir($this->extdir, 0755)) { if(!mkdir($this->extdir, 0755)) {
$this->errmsgs[] = "Cannot create extension directory"; $this->errmsgs[] = "Cannot create extension directory";
SeedDMS_Utils::rrmdir($newdir); Utilities::rrmdir($newdir);
return false; return false;
} }
} elseif(is_dir($this->extdir ."/". $extname)) { } 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 */ /* Move the temp. created ext directory to the final location */
/* rename() may fail if dirs are moved from one device to another. /* rename() may fail if dirs are moved from one device to another.
@ -572,10 +597,15 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
* has been copied. * has been copied.
*/ */
$this->errmsgs[] = "Cannot move temp. extension directory to final destination"; $this->errmsgs[] = "Cannot move temp. extension directory to final destination";
SeedDMS_Utils::rrmdir($this->extdir ."/". $extname); Utilities::rrmdir($this->extdir ."/". $extname);
return false; return false;
} }
if (!$this->createExtensionConf()) {
// $this->errmsgs[] = "Cannot update extension configuration";
// return false;
}
return true; return true;
} /* }}} */ } /* }}} */
@ -586,7 +616,7 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
* single lines. Each line is either a comment if it starts with an '#' * single lines. Each line is either a comment if it starts with an '#'
* or a json encoded array containing the extension configuration. * 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. * currently cached extension list file is up to date.
* *
* @return string[] list of json strings or comments * @return string[] list of json strings or comments
@ -606,7 +636,7 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
* a list of extension configurations. Only the most recent version * a list of extension configurations. Only the most recent version
* of an extension will be included. * 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. * currently cached extension list file is up to date.
* *
* @return array[] list of extension configurations * @return array[] list of extension configurations
@ -616,8 +646,8 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
$result = array(); $result = array();
$vcache = array(); // keep highest version of extension $vcache = array(); // keep highest version of extension
foreach($list as $e) { foreach($list as $e) {
if($e[0] != '#' && trim($e)) { if($e[0] != '#') {
if($re = json_decode($e, true)) { $re = json_decode($e, true);
if(!isset($result[$re['name']])) { if(!isset($result[$re['name']])) {
$result[$re['name']] = $re; $result[$re['name']] = $re;
$vcache[$re['name']] = $re['version']; $vcache[$re['name']] = $re['version'];
@ -627,7 +657,6 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
} }
} }
} }
}
return $result; return $result;
} /* }}} */ } /* }}} */
@ -638,7 +667,7 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
* a list of extension configurations. Only those extensions will * a list of extension configurations. Only those extensions will
* be included which maches the given name. * 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. * currently cached extension list file is up to date.
* *
* @return array[] list of extension configurations * @return array[] list of extension configurations
@ -654,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; return $result;
} /* }}} */ } /* }}} */
/** /**
* Import list of extension from repository * 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 * @param boolean $force force download even if file already exists
*/ */
public function updateExtensionList($version='', $force=false) { /* {{{ */ public function updateExtensionList($version='', $force=false) { /* {{{ */
@ -698,9 +730,13 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
*/ */
public function getExtensionFromRepository($file) { /* {{{ */ public function getExtensionFromRepository($file) { /* {{{ */
$content = file_get_contents($this->reposurl."/".$file, false, $this->getStreamContext()); $content = file_get_contents($this->reposurl."/".$file, false, $this->getStreamContext());
if ($content) {
$tmpfile = tempnam(sys_get_temp_dir(), ''); $tmpfile = tempnam(sys_get_temp_dir(), '');
file_put_contents($tmpfile, $content); file_put_contents($tmpfile, $content);
return $tmpfile; return $tmpfile;
} else {
return false;
}
} /* }}} */ } /* }}} */
/** /**
@ -723,4 +759,13 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
public function getErrorMsgs() { /* {{{ */ public function getErrorMsgs() { /* {{{ */
return $this->errmsgs; return $this->errmsgs;
} /* }}} */ } /* }}} */
/**
* Return all warning messages
*
* @return string[]
*/
public function getWarningMsgs() { /* {{{ */
return $this->warnmsgs;
} /* }}} */
} }

View File

@ -28,12 +28,12 @@ class SeedDMS_LdapAuthentication extends SeedDMS_Authentication {
var $settings; var $settings;
protected function addUser($username, $info) { protected function addUser($username, $info) { /* {{{ */
$mailfield = !empty($this->settings->_ldapMailField) ? $this->settings->_ldapMailField : 'mail'; $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"); 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'; $mailfield = !empty($this->settings->_ldapMailField) ? $this->settings->_ldapMailField : 'mail';
if(isset($info['cn'][0]) && ($info['cn'][0] != $user->getFullName())) { if(isset($info['cn'][0]) && ($info['cn'][0] != $user->getFullName())) {
$user->setFullName($info['cn'][0]); $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())) { if(isset($info[$mailfield][0]) && ($info[$mailfield][0] != $user->getEmail())) {
$user->setEmail($info[$mailfield][0]); $user->setEmail($info[$mailfield][0]);
} }
} } /* }}} */
protected function syncGroups($user, $ldapgroups) { protected function syncGroups($user, $ldapgroups) { /* {{{ */
$groupnames = []; $groupnames = [];
$count = 0; $count = 0;
if(isset($ldapgroups['count'])) if(isset($ldapgroups['count']))
@ -88,7 +88,7 @@ class SeedDMS_LdapAuthentication extends SeedDMS_Authentication {
} }
} }
} }
} } /* }}} */
public function __construct($dms, $settings) { /* {{{ */ public function __construct($dms, $settings) { /* {{{ */
$this->dms = $dms; $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 /* 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 * The username may not be the one passed to this function anymore. It
* could have been overwritten by uid (or sAMAccountName) derived from * could have been overwritten by uid (or sAMAccountName) derived from
* the above ldap search. * the above ldap search.

View File

@ -41,6 +41,11 @@ class SeedDMS_NotificationService {
*/ */
protected $settings; protected $settings;
/*
* Translator
*/
protected $translator;
/* /*
* Possible types of receivers * Possible types of receivers
*/ */
@ -51,14 +56,13 @@ class SeedDMS_NotificationService {
const RECV_APPROVER = 4; const RECV_APPROVER = 4;
const RECV_WORKFLOW = 5; const RECV_WORKFLOW = 5;
const RECV_UPLOADER = 6; const RECV_UPLOADER = 6;
const RECV_REVISOR = 7;
const RECV_RECIPIENT = 8;
public function __construct($logger = null, $settings = null) { /* {{{ */ public function __construct($logger = null, $settings = null, $translator=null) { /* {{{ */
$this->services = array(); $this->services = array();
$this->errors = array(); $this->errors = array();
$this->logger = $logger; $this->logger = $logger;
$this->settings = $settings; $this->settings = $settings;
$this->translator = $translator;
} /* }}} */ } /* }}} */
public function addService($service, $name='') { /* {{{ */ public function addService($service, $name='') { /* {{{ */
@ -68,6 +72,10 @@ class SeedDMS_NotificationService {
$this->errors[$name] = true; $this->errors[$name] = true;
} /* }}} */ } /* }}} */
public function getTranslator() { /* {{{ */
return $this->translator;
} /* }}} */
public function getServices() { /* {{{ */ public function getServices() { /* {{{ */
return $this->services; return $this->services;
} /* }}} */ } /* }}} */
@ -685,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) { /* {{{ */ public function sendChangedFolderAttributesMail($folder, $user, $oldattributes) { /* {{{ */
$dms = $folder->getDMS(); $dms = $folder->getDMS();
$notifyList = $folder->getNotifyList(); $notifyList = $folder->getNotifyList();
@ -1177,80 +1243,6 @@ class SeedDMS_NotificationService {
$this->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_UPLOADER); $this->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_UPLOADER);
} /* }}} */ } /* }}} */
public function sendSubmittedReceiptMail($content, $user, $receiptlog) { /* {{{ */
$document = $content->getDocument();
$nl=$document->getNotifyList();
$folder = $document->getFolder();
$subject = "receipt_submit_email_subject";
$message = "receipt_submit_email_body";
$params = array();
$params['name'] = $document->getName();
$params['document_id'] = $document->getId();
$params['version'] = $content->getVersion();
$params['folder_path'] = $folder->getFolderPathPlain();
$params['status'] = getReceiptStatusText($receiptlog["status"]);
$params['comment'] = $receiptlog['comment'];
$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, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
foreach ($nl["groups"] as $grp) {
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
/* Send mail to owner only if the currently logged in user is not the
* owner and the owner is not already in the list of notifiers.
*/
/*
if($user->getID() != $document->getOwner()->getID() && false === SeedDMS_Core_DMS::inList($document->getOwner(), $nl['users']))
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
*/
/* Send mail to uploader of version only if the uploader is not the owner and
* the currently logged in user is not the
* owner and the owner is not already in the list of notifiers.
*/
if($user->getID() != $content->getUser()->getID() /* && $content->getUser()->getID() != $document->getOwner()->getID() */ && false === SeedDMS_Core_DMS::inList($content->getUser(), $nl['users']))
$this->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_UPLOADER);
} /* }}} */
public function sendSubmittedRevisionMail($content, $user, $revisionlog) { /* {{{ */
$document = $content->getDocument();
$nl=$document->getNotifyList();
$folder = $document->getFolder();
$subject = "revision_submit_email_subject";
$message = "revision_submit_email_body";
$params = array();
$params['name'] = $document->getName();
$params['document_id'] = $document->getId();
$params['version'] = $content->getVersion();
$params['folder_path'] = $folder->getFolderPathPlain();
$params['status'] = getRevisionStatusText($revisionlog["status"]);
$params['comment'] = $revisionlog['comment'];
$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, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
foreach ($nl["groups"] as $grp) {
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
/* Send mail to owner only if the currently logged in user is not the
* owner and the owner is not already in the list of notifiers.
*/
/*
if($user->getID() != $document->getOwner()->getID() && false === SeedDMS_Core_DMS::inList($document->getOwner(), $nl['users']))
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
*/
/* Send mail to uploader of version only if the uploader is not the owner and
* the currently logged in user is not the
* owner and the owner is not already in the list of notifiers.
*/
if($user->getID() != $content->getUser()->getID() /* && $content->getUser()->getID() != $document->getOwner()->getID() */ && false === SeedDMS_Core_DMS::inList($content->getUser(), $nl['users']))
$this->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_UPLOADER);
} /* }}} */
public function sendDeleteApprovalMail($content, $user, $approver) { /* {{{ */ public function sendDeleteApprovalMail($content, $user, $approver) { /* {{{ */
$document = $content->getDocument(); $document = $content->getDocument();
$folder = $document->getFolder(); $folder = $document->getFolder();
@ -1284,11 +1276,7 @@ class SeedDMS_NotificationService {
$params['folder_path'] = $folder->getFolderPathPlain(); $params['folder_path'] = $folder->getFolderPathPlain();
$params['version'] = $content->getVersion(); $params['version'] = $content->getVersion();
$params['comment'] = $content->getComment(); $params['comment'] = $content->getComment();
if($reviewer->isType('user')) $params['username'] = $user->getFullName();
$params['reviewer'] = $reviewer->getFullName();
elseif($reviewer->isType('group'))
$params['reviewer'] = $reviewer->getName();
$params['username'] = $user->getName();
$params['sitename'] = $this->settings->_siteName; $params['sitename'] = $this->settings->_siteName;
$params['http_root'] = $this->settings->_httpRoot; $params['http_root'] = $this->settings->_httpRoot;
$params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); $params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
@ -1299,58 +1287,6 @@ class SeedDMS_NotificationService {
$this->toGroup($user, $reviewer, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER); $this->toGroup($user, $reviewer, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER);
} /* }}} */ } /* }}} */
public function sendDeleteRevisionMail($content, $user, $revisor) { /* {{{ */
$document = $content->getDocument();
$folder = $document->getFolder();
$subject = "revision_deletion_email_subject";
$message = "revision_deletion_email_body";
$params = array();
$params['name'] = $document->getName();
$params['document_id'] = $document->getId();
$params['folder_path'] = $folder->getFolderPathPlain();
$params['version'] = $content->getVersion();
$params['comment'] = $content->getComment();
if($revisor->isType('user'))
$params['revisor'] = $revisor->getFullName();
elseif($revisor->isType('group'))
$params['revisor'] = $revisor->getName();
$params['username'] = $user->getFullName();
$params['sitename'] = $this->settings->_siteName;
$params['http_root'] = $this->settings->_httpRoot;
$params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
if($revisor->isType('user'))
$this->toIndividual($user, $revisor, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVISOR);
elseif($revisor->isType('group'))
$this->toGroup($user, $revisor, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVISOR);
} /* }}} */
public function sendDeleteReceiptMail($content, $user, $recipient) { /* {{{ */
$document = $content->getDocument();
$folder = $document->getFolder();
$subject = "receipt_deletion_email_subject";
$message = "receipt_deletion_email_body";
$params = array();
$params['name'] = $document->getName();
$params['document_id'] = $document->getId();
$params['folder_path'] = $folder->getFolderPathPlain();
$params['version'] = $content->getVersion();
$params['comment'] = $content->getComment();
if($recipient->isType('user'))
$params['recipient'] = $recipient->getFullName();
elseif($recipient->isType('group'))
$params['recipient'] = $recipient->getName();
$params['username'] = $user->getFullName();
$params['sitename'] = $this->settings->_siteName;
$params['http_root'] = $this->settings->_httpRoot;
$params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
if($recipient->isType('user'))
$this->toIndividual($user, $recipient, $subject, $message, $params, SeedDMS_NotificationService::RECV_RECIPIENT);
elseif($recipient->isType('group'))
$this->toGroup($user, $recipient, $subject, $message, $params, SeedDMS_NotificationService::RECV_RECIPIENT);
} /* }}} */
/** /**
* This notification is send if a new approver is added. * This notification is send if a new approver is added.
* *
@ -1402,10 +1338,6 @@ class SeedDMS_NotificationService {
$params['folder_path'] = $folder->getFolderPathPlain(); $params['folder_path'] = $folder->getFolderPathPlain();
$params['version'] = $content->getVersion(); $params['version'] = $content->getVersion();
$params['comment'] = $content->getComment(); $params['comment'] = $content->getComment();
if($reviewer->isType('user'))
$params['reviewer'] = $reviewer->getFullName();
elseif($reviewer->isType('group'))
$params['reviewer'] = $reviewer->getName();
$params['username'] = $user->getFullName(); $params['username'] = $user->getFullName();
$params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); $params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
$params['sitename'] = $this->settings->_siteName; $params['sitename'] = $this->settings->_siteName;
@ -1417,89 +1349,6 @@ class SeedDMS_NotificationService {
$this->toGroup($user, $reviewer, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER); $this->toGroup($user, $reviewer, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER);
} /* }}} */ } /* }}} */
public function sendAddRevisionMail($content, $user, $revisor) { /* {{{ */
$document = $content->getDocument();
$folder = $document->getFolder();
$subject = "revision_request_email_subject";
$message = "revision_request_email_body";
$params = array();
$params['name'] = $document->getName();
$params['document_id'] = $document->getId();
$params['folder_path'] = $folder->getFolderPathPlain();
$params['version'] = $content->getVersion();
$params['comment'] = $content->getComment();
if($revisor->isType('user'))
$params['revisor'] = $revisor->getFullName();
elseif($revisor->isType('group'))
$params['revisor'] = $user->getName();
$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;
if($revisor->isType('user'))
$this->toIndividual($user, $revisor, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVISOR);
elseif($revisor->isType('group'))
$this->toGroup($user, $revisor, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVISOR);
} /* }}} */
public function sendAddReceiptMail($content, $user, $recipient) { /* {{{ */
$document = $content->getDocument();
$folder = $document->getFolder();
$subject = "receipt_request_email_subject";
$message = "receipt_request_email_body";
$params = array();
$params['name'] = $document->getName();
$params['document_id'] = $document->getId();
$params['folder_path'] = $folder->getFolderPathPlain();
$params['version'] = $content->getVersion();
$params['comment'] = $content->getComment();
if($recipient->isType('user'))
$params['recipient'] = $recipient->getFullName();
elseif($recipient->isType('group'))
$params['recipient'] = $user->getName();
$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;
if($recipient->isType('user'))
$this->toIndividual($user, $recipient, $subject, $message, $params, SeedDMS_NotificationService::RECV_RECIPIENT);
elseif($recipient->isType('group'))
$this->toGroup($user, $recipient, $subject, $message, $params, SeedDMS_NotificationService::RECV_RECIPIENT);
} /* }}} */
/**
* Send a request receipt notification to all recipients of the document content
*
* This method can be called when the status of a document content changes
* to 'released'. The recipients haven't been informed when the
* document content was created but not immediatly released.
*/
public function sendToAllReceiptMail($content, $user) { /* {{{ */
$dms = $content->getDMS();
$receiptStatus = $content->getReceiptStatus();
if (!empty($receiptStatus)) {
foreach ($receiptStatus as $r) {
if($r['status'] == 0) {
switch ($r["type"]) {
case 0: // Recipient is an individual.
if($recipient = $dms->getUser($r["required"]))
$this->sendAddReceiptMail($content, $user, $recipient);
break;
case 1: // Recipient is a group.
if($recipient = $dms->getGroup($r["required"]))
$this->sendAddReceiptMail($content, $user, $recipient);
break;
}
}
}
}
} /* }}} */
public function sendChangedDocumentOwnerMail($document, $user, $oldowner) { /* {{{ */ public function sendChangedDocumentOwnerMail($document, $user, $oldowner) { /* {{{ */
if($oldowner->getID() != $document->getOwner()->getID()) { if($oldowner->getID() != $document->getOwner()->getID()) {
$notifyList = $document->getNotifyList(); $notifyList = $document->getNotifyList();

View File

@ -1,74 +0,0 @@
<?php
/**
* Implementation of an SchedulerTask.
*
* SeedDMS can be extended by extensions. Extension usually implement
* hook.
*
* @category DMS
* @package SeedDMS
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright 2018 Uwe Steinmann
* @version Release: @package_version@
*/
/**
* Class to represent a SchedulerTask
*
* This class provides some very basic methods to manage extensions.
*
* @category DMS
* @package SeedDMS
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
* @copyright 2011 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_Scheduler {
/**
* Instanz of database
*/
protected $db;
public function getTask($id) { /* {{{ */
return SeedDMS_SchedulerTask::getInstance($id, $this->db);
} /* }}} */
public function getTasksByExtension($extname, $taskname) { /* {{{ */
return SeedDMS_SchedulerTask::getInstancesByExtension($extname, $taskname, $this->db);
} /* }}} */
public function getTasks() { /* {{{ */
return SeedDMS_SchedulerTask::getInstances($this->db);
} /* }}} */
public function addTask($extname, $taskname, $name, $description, $frequency, $disabled, $params) { /* {{{ */
$db = $this->db;
if(!$extname)
return false;
if(!$taskname)
return false;
try {
$cron = Cron\CronExpression::factory($frequency);
} catch (Exception $e) {
return false;
}
$nextrun = $cron->getNextRunDate()->format('Y-m-d H:i:s');
$queryStr = "INSERT INTO `tblSchedulerTask` (`extension`, `task`, `name`, `description`, `frequency`, `disabled`, `params`, `nextrun`, `lastrun`) VALUES (".$db->qstr($extname).", ".$db->qstr($taskname).", ".$db->qstr($name).", ".$db->qstr($description).", ".$db->qstr($frequency).", ".intval($disabled).", ".$db->qstr(json_encode($params)).", '".$nextrun."', NULL)";
$res = $db->getResult($queryStr);
if (!$res)
return false;
$task = SeedDMS_SchedulerTask::getInstance($db->getInsertID('tblSchedulerTask'), $db);
return $task;
} /* }}} */
function __construct($db) {
$this->db = $db;
}
}

View File

@ -1,347 +0,0 @@
<?php
/**
* Implementation of an SchedulerTask.
*
* SeedDMS can be extended by extensions. Extension usually implement
* hook.
*
* @category DMS
* @package SeedDMS
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright 2018 Uwe Steinmann
* @version Release: @package_version@
*/
/**
* Class to represent a SchedulerTask
*
* This class provides some very basic methods to manage extensions.
*
* @category DMS
* @package SeedDMS
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
* @copyright 2011 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_SchedulerTask {
/**
* Instanz of database
*/
protected $db;
/**
* @var integer unique id of task
*/
protected $_id;
/**
* @var string name of task
*/
protected $_name;
/**
* @var string description of task
*/
protected $_description;
/**
* @var string extension of task
*/
protected $_extension;
/**
* @var string task of task
*/
protected $_task;
/**
* @var string frequency of task
*/
protected $_frequency;
/**
* @var integer set if disabled
*/
protected $_disabled;
/**
* @var array list of parameters
*/
protected $_params;
/**
* @var integer last run
*/
protected $_lastrun;
/**
* @var integer next run
*/
protected $_nextrun;
public static function getInstance($id, $db) { /* {{{ */
$queryStr = "SELECT * FROM `tblSchedulerTask` WHERE `id` = " . (int) $id;
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && $resArr == false)
return false;
if (count($resArr) != 1)
return null;
$row = $resArr[0];
$task = new self($row["id"], $row['name'], $row["description"], $row["extension"], $row["task"], $row["frequency"], $row['disabled'], json_decode($row['params'], true), $row["nextrun"], $row["lastrun"]);
$task->setDB($db);
return $task;
} /* }}} */
public static function getInstances($db) { /* {{{ */
$queryStr = "SELECT * FROM `tblSchedulerTask`";
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && $resArr == false)
return false;
if (count($resArr) == 0)
return array();
$tasks = array();
foreach($resArr as $row) {
$task = new self($row["id"], $row['name'], $row["description"], $row["extension"], $row["task"], $row["frequency"], $row['disabled'], json_decode($row['params'], true), $row["nextrun"], $row["lastrun"]);
$task->setDB($db);
$tasks[] = $task;
}
return $tasks;
} /* }}} */
public static function getInstancesByExtension($extname, $taskname, $db) { /* {{{ */
$queryStr = "SELECT * FROM `tblSchedulerTask` WHERE `extension` = '".$extname."' AND `task` = '".$taskname."'";
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && $resArr == false)
return false;
if (count($resArr) == 0)
return array();
$tasks = array();
foreach($resArr as $row) {
$task = new self($row["id"], $row['name'], $row["description"], $row["extension"], $row["task"], $row["frequency"], $row['disabled'], json_decode($row['params'], true), $row["nextrun"], $row["lastrun"]);
$task->setDB($db);
$tasks[] = $task;
}
return $tasks;
} /* }}} */
function __construct($id, $name, $description, $extension, $task, $frequency, $disabled, $params, $nextrun, $lastrun) {
$this->_id = $id;
$this->_name = $name;
$this->_description = $description;
$this->_extension = $extension;
$this->_task = $task;
$this->_frequency = $frequency;
$this->_disabled = $disabled;
$this->_params = $params;
$this->_nextrun = $nextrun;
$this->_lastrun = $lastrun;
}
public function setDB($db) {
$this->db = $db;
}
public function getID() {
return $this->_id;
}
public function getName() {
return $this->_name;
}
public function setName($newName) { /* {{{ */
$db = $this->db;
$queryStr = "UPDATE `tblSchedulerTask` SET `name` =".$db->qstr($newName)." WHERE `id` = " . $this->_id;
$res = $db->getResult($queryStr);
if (!$res)
return false;
$this->_name = $newName;
return true;
} /* }}} */
public function getDescription() {
return $this->_description;
}
public function setDescription($newDescripion) { /* {{{ */
$db = $this->db;
$queryStr = "UPDATE `tblSchedulerTask` SET `description` =".$db->qstr($newDescripion)." WHERE `id` = " . $this->_id;
$res = $db->getResult($queryStr);
if (!$res)
return false;
$this->_description = $newDescripion;
return true;
} /* }}} */
public function getExtension() {
return $this->_extension;
}
public function getTask() {
return $this->_task;
}
public function getFrequency() {
return $this->_frequency;
}
public function setFrequency($newFrequency) { /* {{{ */
$db = $this->db;
try {
$cron = Cron\CronExpression::factory($newFrequency);
} catch (Exception $e) {
return false;
}
$nextrun = $cron->getNextRunDate()->format('Y-m-d H:i:s');
$queryStr = "UPDATE `tblSchedulerTask` SET `frequency` =".$db->qstr($newFrequency).", `nextrun` = '".$nextrun."' WHERE `id` = " . $this->_id;
$res = $db->getResult($queryStr);
if (!$res)
return false;
$this->_frequency = $newFrequency;
$this->_nextrun = $nextrun;
return true;
} /* }}} */
public function getNextRun() {
return $this->_nextrun;
}
public function getLastRun() {
return $this->_lastrun;
}
public function getDisabled() {
return $this->_disabled;
}
public function setDisabled($newDisabled) { /* {{{ */
$db = $this->db;
$queryStr = "UPDATE `tblSchedulerTask` SET `disabled` =".intval($newDisabled)." WHERE `id` = " . $this->_id;
$res = $db->getResult($queryStr);
if (!$res)
return false;
$this->_disabled = $newDisabled;
return true;
} /* }}} */
public function setParameter($newParams) { /* {{{ */
$db = $this->db;
$queryStr = "UPDATE `tblSchedulerTask` SET `params` =".$db->qstr(json_encode($newParams))." WHERE `id` = " . $this->_id;
$res = $db->getResult($queryStr);
if (!$res)
return false;
$this->_params = $newParams;
return true;
} /* }}} */
public function getParameter($name = '') {
if($name)
return isset($this->_params[$name]) ? $this->_params[$name] : null;
return $this->_params;
}
/**
* Check if task is due
*
* This methods compares the current time with the time in the database
* field `nextrun`.
* If nextrun is smaller than the current time, the the task is due.
* The methode does not rely on the value in the class variable `_nextrun`,
* because that value could be 'very old', retrieved at a time
* when the task list was fetched for checking due tasks e.g. by the
* scheduler client. There is good reason to always take the current
* value of nextrun from the database.
*
* Assuming there are two tasks. Task 1 takes 13 mins and task 2 takes only
* 30 sec. Task 1 is run every hour and task 2 starts at 8:06. The cronjob
* runs every 5 min. At e.g. 8:00 the list of tasks is read from the database
* task 1 is due and starts running and before it runs it sets the database
* field nextrun to 9:00. Task 2 isn't due at that time.
* At 8:05 the cron job runs again, task 1 has already a new nextrun value
* and will not run again. Task 2 isn't due yet and task 1 started at 8:00 is
* still running.
* At 8:10 task 1 is still running an not due again, but task 2 is due and
* will be run. The database field `nextrun` of task 2 will be set to 8:06
* on the next day.
* At 8:13 task 1 which started at 8:00 is finished and the list of tasks
* from that time will be processed further. Task 2 still has the old value
* in the class variable `_nextrun` (8:06 the current day),
* though the database field `nextrun` has been updated in
* between. Taking the value of the class variable would rerun task 2 again,
* though it ran at 8:10 already.
* That's why this method always takes the current value of nextrun
* from the database.
*
* @return boolean true if task is due, otherwise false
*/
public function isDue() {
$db = $this->db;
$queryStr = "SELECT * FROM `tblSchedulerTask` WHERE `id` = " . $this->_id;
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && $resArr == false)
return false;
if (count($resArr) != 1)
return false;
$row = $resArr[0];
$this->_nextrun = $row['nextrun'];
return $this->_nextrun < date('Y-m-d H:i:s');
}
public function updateLastNextRun() {
$db = $this->db;
$lastrun = date('Y-m-d H:i:s');
try {
$cron = Cron\CronExpression::factory($this->_frequency);
$nextrun = $cron->getNextRunDate()->format('Y-m-d H:i:s');
} catch (Exception $e) {
$nextrun = null;
}
$queryStr = "UPDATE `tblSchedulerTask` SET `lastrun`=".$db->qstr($lastrun).", `nextrun`=".($nextrun ? $db->qstr($nextrun) : "NULL")." WHERE `id` = " . $this->_id;
$res = $db->getResult($queryStr);
if (!$res)
return false;
$this->_lastrun = $lastrun;
$this->_nextrun = $nextrun;
}
/**
* Delete task
*
* @return boolean true on success or false in case of an error
*/
function remove() { /* {{{ */
$db = $this->db;
$queryStr = "DELETE FROM `tblSchedulerTask` WHERE `id` = " . $this->_id;
if (!$db->getResult($queryStr)) {
return false;
}
return true;
} /* }}} */
}

View File

@ -1,139 +0,0 @@
<?php
/***************************************************************
* Copyright notice
*
* (c) 2018 Uwe Steinmann <uwe@steinmann.cx>
* All rights reserved
*
* This script is part of the SeedDMS project. The SeedDMS project 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.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script 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.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Base class for scheduler task
*
* @author Uwe Steinmann <uwe@steinmann.cx>
* @package SeedDMS
*/
class SeedDMS_SchedulerTaskBase {
var $dms;
var $user;
var $settings;
var $logger;
var $fulltextservice;
var $notifier;
var $conversionmgr;
/**
* Call a hook with a given name
*
* Checks if a hook with the given name and for the current task
* exists and executes it. The name of the current task is taken
* from the current class name by lower casing the first char.
* This function will execute all registered hooks in the order
* they were registered.
*
* Attention: as func_get_arg() cannot handle references passed to the hook,
* callHook() should not be called if that is required. In that case get
* a list of hook objects with getHookObjects() and call the hooks yourself.
*
* @params string $hook name of hook
* @return string concatenated string, merged arrays or whatever the hook
* function returns
*/
public function callHook($hook) { /* {{{ */
$tmps = array();
$tmp = explode('_', get_class($this));
$tmps[] = $tmp[1];
$tmp = explode('_', get_parent_class($this));
$tmps[] = $tmp[1];
/* Run array_unique() in case the parent class has the same suffix */
$tmps = array_unique($tmps);
$ret = null;
foreach($tmps as $tmp)
if(isset($GLOBALS['SEEDDMS_HOOKS']['task'][lcfirst($tmp)])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['task'][lcfirst($tmp)] as $hookObj) {
if (method_exists($hookObj, $hook)) {
switch(func_num_args()) {
case 1:
$tmpret = $hookObj->$hook($this);
break;
case 2:
$tmpret = $hookObj->$hook($this, func_get_arg(1));
break;
case 3:
$tmpret = $hookObj->$hook($this, func_get_arg(1), func_get_arg(2));
break;
case 4:
$tmpret = $hookObj->$hook($this, func_get_arg(1), func_get_arg(2), func_get_arg(3));
break;
default:
case 5:
$tmpret = $hookObj->$hook($this, func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4));
break;
}
if($tmpret !== null) {
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));
} else
$ret = $tmpret;
}
}
}
}
return $ret;
} /* }}} */
public function __construct($dms=null, $user=null, $settings=null, $logger=null, $fulltextservice=null, $notifier=null, $conversionmgr=null) { /* {{{ */
$this->dms = $dms;
$this->user = $user;
$this->settings = $settings;
$this->logger = $logger;
$this->fulltextservice = $fulltextservice;
$this->notifier = $notifier;
$this->conversionmgr = $conversionmgr;
} /* }}} */
public function execute(SeedDMS_SchedulerTask $task) { /* {{{ */
return true;
} /* }}} */
public function getDescription() { /* {{{ */
return '';
} /* }}} */
public function getAdditionalParams() { /* {{{ */
return array();
} /* }}} */
public function getAdditionalParamByName($name) { /* {{{ */
foreach($this->getAdditionalParams() as $param) {
if($param['name'] == $name)
return $param;
}
return null;
} /* }}} */
}
?>

View File

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

View File

@ -11,6 +11,12 @@
* @version Release: @package_version@ * @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 * Class for reading and writing the configuration file
* *
@ -45,8 +51,6 @@ class Settings { /* {{{ */
var $_enableGuestLogin = false; var $_enableGuestLogin = false;
// If you even want guest to be logged in automatically, set the following to true // If you even want guest to be logged in automatically, set the following to true
var $_enableGuestAutoLogin = false; var $_enableGuestAutoLogin = false;
// Set to true for 2-factor Authentication
var $_enable2FactorAuthentication = false;
// If you want to allow login by email, set the following to true // If you want to allow login by email, set the following to true
var $_enableLoginByEmail = false; var $_enableLoginByEmail = false;
// Allow users to reset their password // Allow users to reset their password
@ -118,12 +122,6 @@ class Settings { /* {{{ */
var $_dropFolderDir = null; var $_dropFolderDir = null;
// Where the backup directory is located // Where the backup directory is located
var $_backupDir = null; var $_backupDir = null;
// Where the library folder is located
var $_libraryFolder = 1;
// Where the checked out files are located
var $_checkOutDir = null;
// Create checkout dir if it doesn't exists
var $_createCheckOutDir = false;
// Where the repository for extensions is located // Where the repository for extensions is located
var $_repositoryUrl = null; var $_repositoryUrl = null;
// URL of proxy // URL of proxy
@ -154,6 +152,10 @@ class Settings { /* {{{ */
var $_showSingleSearchHit = true; var $_showSingleSearchHit = true;
// enable/disable use of memcached // enable/disable use of memcached
var $_enableMemcached = false; var $_enableMemcached = false;
// memcached host
var $_memcachedHost = 'localhost';
// memcached port
var $_memcachedPort = '11211';
// contentOffsetDirTo // contentOffsetDirTo
var $_contentOffsetDir = "1048576"; var $_contentOffsetDir = "1048576";
// Maximum number of sub-directories per parent directory // Maximum number of sub-directories per parent directory
@ -196,18 +198,6 @@ class Settings { /* {{{ */
var $_enableUpdateRevApp = false; var $_enableUpdateRevApp = false;
// enable/disable removal of a review/approval by the administrator // enable/disable removal of a review/approval by the administrator
var $_enableRemoveRevApp = false; var $_enableRemoveRevApp = false;
// enable/disable listing logged in user as recipient
var $_enableSelfReceipt = false;
// enable/disable hidden user as recipient
var $_enableHiddenReceipt = true;
// enable/disable update of a receipt by the recipient
var $_enableUpdateReceipt = false;
// enable/disable listing administrator as recipient
var $_enableAdminReceipt = false;
// enable/disable listing owner as recipient
var $_enableOwnerReceipt = false;
// enable/disable filter for receipt by the recipient
var $_enableFilterReceipt = false;
// group manager is mandatory reviewer // group manager is mandatory reviewer
var $_addManagerAsReviewer = false; var $_addManagerAsReviewer = false;
// group manager is mandatory approver // group manager is mandatory approver
@ -230,12 +220,8 @@ class Settings { /* {{{ */
var $_enableDuplicateDocNames = true; var $_enableDuplicateDocNames = true;
// enable/disable duplicate names of a subfolder in a folder // enable/disable duplicate names of a subfolder in a folder
var $_enableDuplicateSubFolderNames = true; var $_enableDuplicateSubFolderNames = true;
// allow/disallow to cancel a checkout
var $_enableCancelCheckout = true;
// override mimetype set by browser when uploading a file // override mimetype set by browser when uploading a file
var $_overrideMimeType = false; var $_overrideMimeType = false;
// advanced access control lists
var $_advancedAcl = false;
// enable/disable notification when added as a reviewer/approver // enable/disable notification when added as a reviewer/approver
var $_enableNotificationAppRev = true; var $_enableNotificationAppRev = true;
// enable/disable notification of users/group who need to take action for // enable/disable notification of users/group who need to take action for
@ -245,26 +231,12 @@ class Settings { /* {{{ */
var $_enableNotificationWorkflow = false; var $_enableNotificationWorkflow = false;
// preset expiration date // preset expiration date
var $_presetExpirationDate = ""; var $_presetExpirationDate = "";
// initial document status
var $_initialDocumentStatus = 2; //S_RELEASED;
// the name of the versioning info file created by the backup tool // the name of the versioning info file created by the backup tool
var $_versioningFileName = "versioning_info.txt"; var $_versioningFileName = "versioning_info.txt";
// the mode of workflow // the mode of workflow
var $_workflowMode = "traditional"; var $_workflowMode = "traditional";
// enable/disable acknowledge workflow
var $_enableReceiptWorkflow = true;
// enable/disable reject of reception
var $_enableReceiptReject = false;
// enable/disable comment of reception
var $_disableReceiptComment = false;
// enable/disable revision workflow
var $_enableRevisionWorkflow = true;
// enable/disable revision on vote reject
var $_enableRevisionOneVoteReject = true;
// Allow to set just a reviewer in tradional workflow // Allow to set just a reviewer in tradional workflow
var $_allowReviewerOnly = true; var $_allowReviewerOnly = true;
// Allow to change reviewer/approver after review/approval has started
var $_allowChangeRevAppInProcess = false;
// enable/disable log system // enable/disable log system
var $_logFileEnable = true; var $_logFileEnable = true;
// max log level // max log level
@ -301,12 +273,8 @@ class Settings { /* {{{ */
var $_enableClipboard = true; var $_enableClipboard = true;
// show always clipboard in main menu, even if empty // show always clipboard in main menu, even if empty
var $_alwaysShowClipboard = false; var $_alwaysShowClipboard = false;
// enable/disable list of transmittals in main menu
var $_enableMenuTransmittals = false;
// enable/disable list of tasks in main menu // enable/disable list of tasks in main menu
var $_enableMenuTasks = true; var $_enableMenuTasks = true;
// select which tasks show up in main menu
var $_tasksInMenu = array();
// show always tasks in main menu, even if none are due // show always tasks in main menu, even if none are due
var $_alwaysShowMenuTasks = true; var $_alwaysShowMenuTasks = true;
// enable/disable list of files in drop folder // enable/disable list of files in drop folder
@ -362,6 +330,8 @@ class Settings { /* {{{ */
var $_previewWidthDetail = 100; var $_previewWidthDetail = 100;
// Preview image width in drop folder list // Preview image width in drop folder list
var $_previewWidthDropFolderList = 100; var $_previewWidthDropFolderList = 100;
// download or view online when clicking on preview image
var $_defaultThumbnailClick = 'download';
// show full preview on document details page // show full preview on document details page
var $_showFullPreview = false; var $_showFullPreview = false;
// convert to pdf for preview on document details page // convert to pdf for preview on document details page
@ -448,6 +418,9 @@ class Settings { /* {{{ */
// Load config file // Load config file
if (!defined("SEEDDMS_INSTALL")) { if (!defined("SEEDDMS_INSTALL")) {
if(!file_exists($configFilePath)) { if(!file_exists($configFilePath)) {
if(php_sapi_name() === 'cli')
echo "You do not seem to have a valid configuration. Set SEEDDMS_CONFIG_FILE to the path of the configuration file.\n";
else
echo "You do not seem to have a valid configuration. Run the <a href=\"install/install.php\">install tool</a> first."; echo "You do not seem to have a valid configuration. Run the <a href=\"install/install.php\">install tool</a> first.";
exit; exit;
} }
@ -458,17 +431,14 @@ class Settings { /* {{{ */
echo "Your configuration contains errors."; echo "Your configuration contains errors.";
exit; 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' * Check if the passed parameter equals to 'true', 'on', 'yes' or 'y'
* and returns true. * and returns true, if it does.
* *
* @param string $var value * @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) { /* {{{ */ protected static function boolVal($var) { /* {{{ */
$var = strtolower(strval($var)); $var = strtolower(strval($var));
@ -486,22 +456,10 @@ class Settings { /* {{{ */
} /* }}} */ } /* }}} */
/** /**
* Check if a variable is a string and returns an array * Create ';' seperated string from array
*
* @param array $var value
* @return true/false
*/
function arrayVal($var) { /* {{{ */
if((string) $var)
return explode(';', $var);
return array();
} /* }}} */
/**
* Return ';' seperated string from array
* *
* @param array $value * @param array $value
* * @return string
*/ */
function arrayToString($value) { /* {{{ */ function arrayToString($value) { /* {{{ */
return implode(";", $value); return implode(";", $value);
@ -511,14 +469,14 @@ class Settings { /* {{{ */
* Return array from ';' seperated string * Return array from ';' seperated string
* *
* @param string $value * @param string $value
* * @return array
*/ */
function stringToArray($value) { /* {{{ */ function stringToArray($value) { /* {{{ */
return explode(";", $value); return explode(";", $value);
} /* }}} */ } /* }}} */
/** /**
* set $_viewOnlineFileTypes * Set $_viewOnlineFileTypes
* *
* @param string $stringValue string value * @param string $stringValue string value
* *
@ -528,7 +486,7 @@ class Settings { /* {{{ */
} /* }}} */ } /* }}} */
/** /**
* get $_viewOnlineFileTypes in a string value * Get $_viewOnlineFileTypes in a string value
* *
* @return string value * @return string value
* *
@ -538,7 +496,7 @@ class Settings { /* {{{ */
} /* }}} */ } /* }}} */
/** /**
* set $_editOnlineFileTypes * Set $_editOnlineFileTypes
* *
* @param string $stringValue string value * @param string $stringValue string value
* *
@ -548,7 +506,7 @@ class Settings { /* {{{ */
} /* }}} */ } /* }}} */
/** /**
* get $_editOnlineFileTypes in a string value * Get $_editOnlineFileTypes in a string value
* *
* @return string value * @return string value
* *
@ -561,8 +519,7 @@ class Settings { /* {{{ */
* Load config file * Load config file
* *
* @param string $configFilePath config file path * @param string $configFilePath config file path
* * @return boolean true, if loading was successful, otherwise false
* @return true/false
*/ */
public function load($configFilePath) { /* {{{ */ public function load($configFilePath) { /* {{{ */
$contents = file_get_contents($configFilePath); $contents = file_get_contents($configFilePath);
@ -596,6 +553,7 @@ class Settings { /* {{{ */
$this->_previewWidthDetail = intval($tab["previewWidthDetail"]); $this->_previewWidthDetail = intval($tab["previewWidthDetail"]);
if(isset($tab["previewWidthDropFolderList"])) if(isset($tab["previewWidthDropFolderList"]))
$this->_previewWidthDropFolderList = intval($tab["previewWidthDropFolderList"]); $this->_previewWidthDropFolderList = intval($tab["previewWidthDropFolderList"]);
$this->_defaultThumbnailClick = strval($tab["defaultThumbnailClick"]);
$this->_showFullPreview = Settings::boolVal($tab["showFullPreview"]); $this->_showFullPreview = Settings::boolVal($tab["showFullPreview"]);
$this->_convertToPdf = Settings::boolVal($tab["convertToPdf"]); $this->_convertToPdf = Settings::boolVal($tab["convertToPdf"]);
if(isset($tab["maxItemsPerPage"])) if(isset($tab["maxItemsPerPage"]))
@ -621,10 +579,8 @@ class Settings { /* {{{ */
$this->_enableSessionList = Settings::boolVal($tab["enableSessionList"]); $this->_enableSessionList = Settings::boolVal($tab["enableSessionList"]);
$this->_enableClipboard = Settings::boolVal($tab["enableClipboard"]); $this->_enableClipboard = Settings::boolVal($tab["enableClipboard"]);
$this->_alwaysShowClipboard = Settings::boolVal($tab["alwaysShowClipboard"]); $this->_alwaysShowClipboard = Settings::boolVal($tab["alwaysShowClipboard"]);
$this->_enableMenuTransmittals = Settings::boolVal($tab["enableMenuTransmittals"]);
$this->_enableMenuTasks = Settings::boolVal($tab["enableMenuTasks"]); $this->_enableMenuTasks = Settings::boolVal($tab["enableMenuTasks"]);
$this->_alwaysShowMenuTasks = Settings::boolVal($tab["alwaysShowMenuTasks"]); $this->_alwaysShowMenuTasks = Settings::boolVal($tab["alwaysShowMenuTasks"]);
$this->_tasksInMenu = Settings::arrayVal($tab["tasksInMenu"]);
$this->_enableDropFolderList = Settings::boolVal($tab["enableDropFolderList"]); $this->_enableDropFolderList = Settings::boolVal($tab["enableDropFolderList"]);
$this->_enableDropUpload = Settings::boolVal($tab["enableDropUpload"]); $this->_enableDropUpload = Settings::boolVal($tab["enableDropUpload"]);
$this->_enableMultiUpload = Settings::boolVal($tab["enableMultiUpload"]); $this->_enableMultiUpload = Settings::boolVal($tab["enableMultiUpload"]);
@ -650,7 +606,6 @@ class Settings { /* {{{ */
$this->_sortUsersInList = strval($tab["sortUsersInList"]); $this->_sortUsersInList = strval($tab["sortUsersInList"]);
$this->_sortFoldersDefault = strval($tab["sortFoldersDefault"]); $this->_sortFoldersDefault = strval($tab["sortFoldersDefault"]);
$this->_expandFolderTree = intval($tab["expandFolderTree"]); $this->_expandFolderTree = intval($tab["expandFolderTree"]);
$this->_libraryFolder = intval($tab["libraryFolder"]);
$this->_defaultDocPosition = strval($tab["defaultDocPosition"]); $this->_defaultDocPosition = strval($tab["defaultDocPosition"]);
$this->_defaultFolderPosition = strval($tab["defaultFolderPosition"]); $this->_defaultFolderPosition = strval($tab["defaultFolderPosition"]);
@ -694,8 +649,6 @@ class Settings { /* {{{ */
$this->_luceneDir = strval($tab["luceneDir"]); $this->_luceneDir = strval($tab["luceneDir"]);
$this->_dropFolderDir = strval($tab["dropFolderDir"]); $this->_dropFolderDir = strval($tab["dropFolderDir"]);
$this->_backupDir = strval($tab["backupDir"]); $this->_backupDir = strval($tab["backupDir"]);
$this->_checkOutDir = strval($tab["checkOutDir"]);
$this->_createCheckOutDir = Settings::boolVal($tab["createCheckOutDir"]);
$this->_repositoryUrl = strval($tab["repositoryUrl"]); $this->_repositoryUrl = strval($tab["repositoryUrl"]);
$this->_proxyUrl = strval($tab["proxyUrl"]); $this->_proxyUrl = strval($tab["proxyUrl"]);
$this->_proxyUser = strval($tab["proxyUser"]); $this->_proxyUser = strval($tab["proxyUser"]);
@ -709,13 +662,16 @@ class Settings { /* {{{ */
$this->_maxUploadSize = strval($tab["maxUploadSize"]); $this->_maxUploadSize = strval($tab["maxUploadSize"]);
$this->_enableXsendfile = Settings::boolVal($tab["enableXsendfile"]); $this->_enableXsendfile = Settings::boolVal($tab["enableXsendfile"]);
$this->_enableMemcached = Settings::boolVal($tab["enableMemcached"]); $this->_enableMemcached = Settings::boolVal($tab["enableMemcached"]);
$this->_memcachedHost = strval($tab["memcachedHost"]);
$this->_memcachedPort = strval($tab["memcachedPort"]);
}
// XML Path: /configuration/system/authentication // XML Path: /configuration/system/authentication
$node = $xml->xpath('/configuration/system/authentication'); $node = $xml->xpath('/configuration/system/authentication');
if($node) {
$tab = $node[0]->attributes(); $tab = $node[0]->attributes();
$this->_enableGuestLogin = Settings::boolVal($tab["enableGuestLogin"]); $this->_enableGuestLogin = Settings::boolVal($tab["enableGuestLogin"]);
$this->_enableGuestAutoLogin = Settings::boolVal($tab["enableGuestAutoLogin"]); $this->_enableGuestAutoLogin = Settings::boolVal($tab["enableGuestAutoLogin"]);
$this->_enable2FactorAuthentication = Settings::boolVal($tab["enable2FactorAuthentication"]);
$this->_enableLoginByEmail = Settings::boolVal($tab["enableLoginByEmail"]); $this->_enableLoginByEmail = Settings::boolVal($tab["enableLoginByEmail"]);
$this->_enablePasswordForgotten = Settings::boolVal($tab["enablePasswordForgotten"]); $this->_enablePasswordForgotten = Settings::boolVal($tab["enablePasswordForgotten"]);
$this->_passwordStrength = intval($tab["passwordStrength"]); $this->_passwordStrength = intval($tab["passwordStrength"]);
@ -853,11 +809,6 @@ class Settings { /* {{{ */
$this->_enableHiddenRevApp = Settings::boolval($tab["enableHiddenRevApp"]); $this->_enableHiddenRevApp = Settings::boolval($tab["enableHiddenRevApp"]);
$this->_enableUpdateRevApp = Settings::boolval($tab["enableUpdateRevApp"]); $this->_enableUpdateRevApp = Settings::boolval($tab["enableUpdateRevApp"]);
$this->_enableRemoveRevApp = Settings::boolval($tab["enableRemoveRevApp"]); $this->_enableRemoveRevApp = Settings::boolval($tab["enableRemoveRevApp"]);
$this->_enableSelfReceipt = Settings::boolval($tab["enableSelfReceipt"]);
$this->_enableAdminReceipt = Settings::boolval($tab["enableAdminReceipt"]);
$this->_enableOwnerReceipt = Settings::boolval($tab["enableOwnerReceipt"]);
$this->_enableUpdateReceipt = Settings::boolval($tab["enableUpdateReceipt"]);
$this->_enableFilterReceipt = Settings::boolval($tab["enableFilterReceipt"]);
$this->_addManagerAsReviewer = Settings::boolval($tab["addManagerAsReviewer"]); $this->_addManagerAsReviewer = Settings::boolval($tab["addManagerAsReviewer"]);
$this->_addManagerAsApprover = Settings::boolval($tab["addManagerAsApprover"]); $this->_addManagerAsApprover = Settings::boolval($tab["addManagerAsApprover"]);
if(trim(strval($tab["globalReviewer"]))) if(trim(strval($tab["globalReviewer"])))
@ -869,23 +820,14 @@ class Settings { /* {{{ */
if(trim(strval($tab["globalGroupApprover"]))) if(trim(strval($tab["globalGroupApprover"])))
$this->_globalGroupApprover = explode(',',strval($tab["globalGroupApprover"])); $this->_globalGroupApprover = explode(',',strval($tab["globalGroupApprover"]));
$this->_presetExpirationDate = strval($tab["presetExpirationDate"]); $this->_presetExpirationDate = strval($tab["presetExpirationDate"]);
$this->_initialDocumentStatus = intval($tab["initialDocumentStatus"]);
$this->_versioningFileName = strval($tab["versioningFileName"]); $this->_versioningFileName = strval($tab["versioningFileName"]);
$this->_workflowMode = strval($tab["workflowMode"]); $this->_workflowMode = strval($tab["workflowMode"]);
$this->_enableReceiptWorkflow = Settings::boolval($tab["enableReceiptWorkflow"]);
$this->_enableReceiptReject = Settings::boolval($tab["enableReceiptReject"]);
$this->_disableReceiptComment = Settings::boolval($tab["disableReceiptComment"]);
$this->_enableRevisionWorkflow = Settings::boolval($tab["enableRevisionWorkflow"]);
$this->_enableRevisionOneVoteReject = Settings::boolval($tab["enableRevisionOneVoteReject"]);
$this->_allowReviewerOnly = Settings::boolval($tab["allowReviewerOnly"]); $this->_allowReviewerOnly = Settings::boolval($tab["allowReviewerOnly"]);
$this->_allowChangeRevAppInProcess = Settings::boolval($tab["allowChangeRevAppInProcess"]);
$this->_enableVersionDeletion = Settings::boolval($tab["enableVersionDeletion"]); $this->_enableVersionDeletion = Settings::boolval($tab["enableVersionDeletion"]);
$this->_enableVersionModification = Settings::boolval($tab["enableVersionModification"]); $this->_enableVersionModification = Settings::boolval($tab["enableVersionModification"]);
$this->_enableDuplicateDocNames = Settings::boolval($tab["enableDuplicateDocNames"]); $this->_enableDuplicateDocNames = Settings::boolval($tab["enableDuplicateDocNames"]);
$this->_enableDuplicateSubFolderNames = Settings::boolval($tab["enableDuplicateSubFolderNames"]); $this->_enableDuplicateSubFolderNames = Settings::boolval($tab["enableDuplicateSubFolderNames"]);
$this->_enableCancelCheckout = Settings::boolval($tab["enableCancelCheckout"]);
$this->_overrideMimeType = Settings::boolval($tab["overrideMimeType"]); $this->_overrideMimeType = Settings::boolval($tab["overrideMimeType"]);
$this->_advancedAcl = Settings::boolval($tab["advancedAcl"]);
$this->_removeFromDropFolder = Settings::boolval($tab["removeFromDropFolder"]); $this->_removeFromDropFolder = Settings::boolval($tab["removeFromDropFolder"]);
$this->_uploadedAttachmentIsPublic = Settings::boolval($tab["uploadedAttachmentIsPublic"]); $this->_uploadedAttachmentIsPublic = Settings::boolval($tab["uploadedAttachmentIsPublic"]);
} }
@ -970,8 +912,6 @@ class Settings { /* {{{ */
$attributValue = "true"; $attributValue = "true";
else else
$attributValue = "false"; $attributValue = "false";
} elseif(is_array($attributValue)) {
$attributValue = implode(';', $attributValue);
} }
if (isset($node[$attributName])) { if (isset($node[$attributName])) {
@ -1037,6 +977,7 @@ class Settings { /* {{{ */
$this->setXMLAttributValue($node, "previewWidthMenuList", $this->_previewWidthMenuList); $this->setXMLAttributValue($node, "previewWidthMenuList", $this->_previewWidthMenuList);
$this->setXMLAttributValue($node, "previewWidthDetail", $this->_previewWidthDetail); $this->setXMLAttributValue($node, "previewWidthDetail", $this->_previewWidthDetail);
$this->setXMLAttributValue($node, "previewWidthDropFolderList", $this->_previewWidthDropFolderList); $this->setXMLAttributValue($node, "previewWidthDropFolderList", $this->_previewWidthDropFolderList);
$this->setXMLAttributValue($node, "defaultThumbnailClick", $this->_defaultThumbnailClick);
$this->setXMLAttributValue($node, "showFullPreview", $this->_showFullPreview); $this->setXMLAttributValue($node, "showFullPreview", $this->_showFullPreview);
$this->setXMLAttributValue($node, "convertToPdf", $this->_convertToPdf); $this->setXMLAttributValue($node, "convertToPdf", $this->_convertToPdf);
$this->setXMLAttributValue($node, "maxItemsPerPage", $this->_maxItemsPerPage); $this->setXMLAttributValue($node, "maxItemsPerPage", $this->_maxItemsPerPage);
@ -1057,10 +998,8 @@ class Settings { /* {{{ */
$this->setXMLAttributValue($node, "enableSessionList", $this->_enableSessionList); $this->setXMLAttributValue($node, "enableSessionList", $this->_enableSessionList);
$this->setXMLAttributValue($node, "enableClipboard", $this->_enableClipboard); $this->setXMLAttributValue($node, "enableClipboard", $this->_enableClipboard);
$this->setXMLAttributValue($node, "alwaysShowClipboard", $this->_alwaysShowClipboard); $this->setXMLAttributValue($node, "alwaysShowClipboard", $this->_alwaysShowClipboard);
$this->setXMLAttributValue($node, "enableMenuTransmittals", $this->_enableMenuTransmittals);
$this->setXMLAttributValue($node, "enableMenuTasks", $this->_enableMenuTasks); $this->setXMLAttributValue($node, "enableMenuTasks", $this->_enableMenuTasks);
$this->setXMLAttributValue($node, "alwaysShowMenuTasks", $this->_alwaysShowMenuTasks); $this->setXMLAttributValue($node, "alwaysShowMenuTasks", $this->_alwaysShowMenuTasks);
$this->setXMLAttributValue($node, "tasksInMenu", $this->_tasksInMenu);
$this->setXMLAttributValue($node, "enableDropFolderList", $this->_enableDropFolderList); $this->setXMLAttributValue($node, "enableDropFolderList", $this->_enableDropFolderList);
$this->setXMLAttributValue($node, "enableDropUpload", $this->_enableDropUpload); $this->setXMLAttributValue($node, "enableDropUpload", $this->_enableDropUpload);
$this->setXMLAttributValue($node, "enableMultiUpload", $this->_enableMultiUpload); $this->setXMLAttributValue($node, "enableMultiUpload", $this->_enableMultiUpload);
@ -1083,7 +1022,6 @@ class Settings { /* {{{ */
$this->setXMLAttributValue($node, "stopWordsFile", $this->_stopWordsFile); $this->setXMLAttributValue($node, "stopWordsFile", $this->_stopWordsFile);
$this->setXMLAttributValue($node, "sortUsersInList", $this->_sortUsersInList); $this->setXMLAttributValue($node, "sortUsersInList", $this->_sortUsersInList);
$this->setXMLAttributValue($node, "sortFoldersDefault", $this->_sortFoldersDefault); $this->setXMLAttributValue($node, "sortFoldersDefault", $this->_sortFoldersDefault);
$this->setXMLAttributValue($node, "libraryFolder", $this->_libraryFolder);
$this->setXMLAttributValue($node, "defaultDocPosition", $this->_defaultDocPosition); $this->setXMLAttributValue($node, "defaultDocPosition", $this->_defaultDocPosition);
$this->setXMLAttributValue($node, "defaultFolderPosition", $this->_defaultFolderPosition); $this->setXMLAttributValue($node, "defaultFolderPosition", $this->_defaultFolderPosition);
@ -1115,8 +1053,6 @@ class Settings { /* {{{ */
$this->setXMLAttributValue($node, "luceneDir", $this->_luceneDir); $this->setXMLAttributValue($node, "luceneDir", $this->_luceneDir);
$this->setXMLAttributValue($node, "dropFolderDir", $this->_dropFolderDir); $this->setXMLAttributValue($node, "dropFolderDir", $this->_dropFolderDir);
$this->setXMLAttributValue($node, "backupDir", $this->_backupDir); $this->setXMLAttributValue($node, "backupDir", $this->_backupDir);
$this->setXMLAttributValue($node, "checkOutDir", $this->_checkOutDir);
$this->setXMLAttributValue($node, "createCheckOutDir", $this->_createCheckOutDir);
$this->setXMLAttributValue($node, "repositoryUrl", $this->_repositoryUrl); $this->setXMLAttributValue($node, "repositoryUrl", $this->_repositoryUrl);
$this->setXMLAttributValue($node, "proxyUrl", $this->_proxyUrl); $this->setXMLAttributValue($node, "proxyUrl", $this->_proxyUrl);
$this->setXMLAttributValue($node, "proxyUser", $this->_proxyUser); $this->setXMLAttributValue($node, "proxyUser", $this->_proxyUser);
@ -1130,12 +1066,13 @@ class Settings { /* {{{ */
$this->setXMLAttributValue($node, "maxUploadSize", $this->_maxUploadSize); $this->setXMLAttributValue($node, "maxUploadSize", $this->_maxUploadSize);
$this->setXMLAttributValue($node, "enableXsendfile", $this->_enableXsendfile); $this->setXMLAttributValue($node, "enableXsendfile", $this->_enableXsendfile);
$this->setXMLAttributValue($node, "enableMemcached", $this->_enableMemcached); $this->setXMLAttributValue($node, "enableMemcached", $this->_enableMemcached);
$this->setXMLAttributValue($node, "memcachedHost", $this->_memcachedHost);
$this->setXMLAttributValue($node, "memcachedPort", $this->_memcachedPort);
// XML Path: /configuration/system/authentication // XML Path: /configuration/system/authentication
$node = $this->getXMLNode($xml, '/configuration/system', 'authentication'); $node = $this->getXMLNode($xml, '/configuration/system', 'authentication');
$this->setXMLAttributValue($node, "enableGuestLogin", $this->_enableGuestLogin); $this->setXMLAttributValue($node, "enableGuestLogin", $this->_enableGuestLogin);
$this->setXMLAttributValue($node, "enableGuestAutoLogin", $this->_enableGuestAutoLogin); $this->setXMLAttributValue($node, "enableGuestAutoLogin", $this->_enableGuestAutoLogin);
$this->setXMLAttributValue($node, "enable2FactorAuthentication", $this->_enable2FactorAuthentication);
$this->setXMLAttributValue($node, "enableLoginByEmail", $this->_enableLoginByEmail); $this->setXMLAttributValue($node, "enableLoginByEmail", $this->_enableLoginByEmail);
$this->setXMLAttributValue($node, "enablePasswordForgotten", $this->_enablePasswordForgotten); $this->setXMLAttributValue($node, "enablePasswordForgotten", $this->_enablePasswordForgotten);
$this->setXMLAttributValue($node, "passwordStrength", $this->_passwordStrength); $this->setXMLAttributValue($node, "passwordStrength", $this->_passwordStrength);
@ -1247,13 +1184,6 @@ class Settings { /* {{{ */
$this->setXMLAttributValue($node, "enableHiddenRevApp", $this->_enableHiddenRevApp); $this->setXMLAttributValue($node, "enableHiddenRevApp", $this->_enableHiddenRevApp);
$this->setXMLAttributValue($node, "enableUpdateRevApp", $this->_enableUpdateRevApp); $this->setXMLAttributValue($node, "enableUpdateRevApp", $this->_enableUpdateRevApp);
$this->setXMLAttributValue($node, "enableRemoveRevApp", $this->_enableRemoveRevApp); $this->setXMLAttributValue($node, "enableRemoveRevApp", $this->_enableRemoveRevApp);
$this->setXMLAttributValue($node, "enableSelfReceipt", $this->_enableSelfReceipt);
$this->setXMLAttributValue($node, "enableAdminReceipt", $this->_enableAdminReceipt);
$this->setXMLAttributValue($node, "enableOwnerReceipt", $this->_enableOwnerReceipt);
$this->setXMLAttributValue($node, "enableUpdateReceipt", $this->_enableUpdateReceipt);
$this->setXMLAttributValue($node, "enableFilterReceipt", $this->_enableFilterReceipt);
$this->setXMLAttributValue($node, "presetExpirationDate", $this->_presetExpirationDate);
$this->setXMLAttributValue($node, "initialDocumentStatus", $this->_initialDocumentStatus);
$this->setXMLAttributValue($node, "addManagerAsReviewer", $this->_addManagerAsReviewer); $this->setXMLAttributValue($node, "addManagerAsReviewer", $this->_addManagerAsReviewer);
$this->setXMLAttributValue($node, "addManagerAsApprover", $this->_addManagerAsApprover); $this->setXMLAttributValue($node, "addManagerAsApprover", $this->_addManagerAsApprover);
$this->setXMLAttributValue($node, "globalReviewer", implode(',', $this->_globalReviewer)); $this->setXMLAttributValue($node, "globalReviewer", implode(',', $this->_globalReviewer));
@ -1263,21 +1193,14 @@ class Settings { /* {{{ */
$this->setXMLAttributValue($node, "presetExpirationDate", $this->_presetExpirationDate); $this->setXMLAttributValue($node, "presetExpirationDate", $this->_presetExpirationDate);
$this->setXMLAttributValue($node, "apiOrigin", $this->_apiOrigin); $this->setXMLAttributValue($node, "apiOrigin", $this->_apiOrigin);
$this->setXMLAttributValue($node, "versioningFileName", $this->_versioningFileName); $this->setXMLAttributValue($node, "versioningFileName", $this->_versioningFileName);
$this->setXMLAttributValue($node, "presetExpirationDate", $this->_presetExpirationDate);
$this->setXMLAttributValue($node, "workflowMode", $this->_workflowMode); $this->setXMLAttributValue($node, "workflowMode", $this->_workflowMode);
$this->setXMLAttributValue($node, "enableReceiptWorkflow", $this->_enableReceiptWorkflow);
$this->setXMLAttributValue($node, "enableReceiptReject", $this->_enableReceiptReject);
$this->setXMLAttributValue($node, "disableReceiptComment", $this->_disableReceiptComment);
$this->setXMLAttributValue($node, "enableRevisionWorkflow", $this->_enableRevisionWorkflow);
$this->setXMLAttributValue($node, "enableRevisionOneVoteReject", $this->_enableRevisionOneVoteReject);
$this->setXMLAttributValue($node, "allowReviewerOnly", $this->_allowReviewerOnly); $this->setXMLAttributValue($node, "allowReviewerOnly", $this->_allowReviewerOnly);
$this->setXMLAttributValue($node, "allowChangeRevAppInProcess", $this->_allowChangeRevAppInProcess);
$this->setXMLAttributValue($node, "enableVersionDeletion", $this->_enableVersionDeletion); $this->setXMLAttributValue($node, "enableVersionDeletion", $this->_enableVersionDeletion);
$this->setXMLAttributValue($node, "enableVersionModification", $this->_enableVersionModification); $this->setXMLAttributValue($node, "enableVersionModification", $this->_enableVersionModification);
$this->setXMLAttributValue($node, "enableDuplicateDocNames", $this->_enableDuplicateDocNames); $this->setXMLAttributValue($node, "enableDuplicateDocNames", $this->_enableDuplicateDocNames);
$this->setXMLAttributValue($node, "enableDuplicateSubFolderNames", $this->_enableDuplicateSubFolderNames); $this->setXMLAttributValue($node, "enableDuplicateSubFolderNames", $this->_enableDuplicateSubFolderNames);
$this->setXMLAttributValue($node, "enableCancelCheckout", $this->_enableCancelCheckout);
$this->setXMLAttributValue($node, "overrideMimeType", $this->_overrideMimeType); $this->setXMLAttributValue($node, "overrideMimeType", $this->_overrideMimeType);
$this->setXMLAttributValue($node, "advancedAcl", $this->_advancedAcl);
$this->setXMLAttributValue($node, "removeFromDropFolder", $this->_removeFromDropFolder); $this->setXMLAttributValue($node, "removeFromDropFolder", $this->_removeFromDropFolder);
$this->setXMLAttributValue($node, "uploadedAttachmentIsPublic", $this->_uploadedAttachmentIsPublic); $this->setXMLAttributValue($node, "uploadedAttachmentIsPublic", $this->_uploadedAttachmentIsPublic);
@ -1677,16 +1600,6 @@ class Settings { /* {{{ */
} }
if($dsn) { if($dsn) {
$connTmp = new PDO($dsn, $this->_dbUser, $this->_dbPass); $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); $db = new SeedDMS_Core_DatabaseAccess($this->_dbDriver, $this->_dbHostname, $this->_dbUser, $this->_dbPass, $this->_dbDatabase);
if(!$db->connect()) { if(!$db->connect()) {
$result["dbDatabase"] = array( $result["dbDatabase"] = array(
@ -1695,21 +1608,6 @@ class Settings { /* {{{ */
"currentvalue" => '[host, user, database] -> [' . $this->_dbHostname . ',' . $this->_dbUser . ',' . $this->_dbDatabase .']', "currentvalue" => '[host, user, database] -> [' . $this->_dbHostname . ',' . $this->_dbUser . ',' . $this->_dbDatabase .']',
"systemerror" => $connTmp->ErrorMsg() "systemerror" => $connTmp->ErrorMsg()
); );
} else {
/*
$dms = new SeedDMS_Core_DMS($db, $this->_contentDir.$this->_contentOffsetDir);
if(!$dms->checkVersion()) {
$result["dbVersion"] = array(
"status" => "error",
"type" => "error",
"currentvalue" => $dms->version,
"suggestion" => 'updateDatabase'
);
}
*/
}
$connTmp = null;
} }
} }
} catch(Exception $e) { } catch(Exception $e) {
@ -1871,13 +1769,13 @@ class Settings { /* {{{ */
* Check if extension is disabled * Check if extension is disabled
* *
* @param string $extname name of extension * @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) { /* {{{ */ public function extensionIsDisabled($extname) { /* {{{ */
if(array_key_exists($extname, $this->_extensions)) if(array_key_exists($extname, $this->_extensions))
return $this->_extensions[$extname]['__disable__']; return $this->_extensions[$extname]['__disable__'];
return false; return true;
} /* }}} */ } /* }}} */
/** /**
@ -1921,5 +1819,66 @@ class Settings { /* {{{ */
return min($mus); 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
View 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;
}
} /* }}} */
} /* }}} */

View File

@ -20,7 +20,6 @@
require_once('inc.ClassUI_Default.php'); require_once('inc.ClassUI_Default.php');
require_once('inc.ClassViewCommon.php'); require_once('inc.ClassViewCommon.php');
require_once('inc.ClassAccessOperation.php');
/* $theme was possibly set in inc.Authentication.php */ /* $theme was possibly set in inc.Authentication.php */
if (!isset($theme) || strlen($theme)==0) { if (!isset($theme) || strlen($theme)==0) {
@ -46,7 +45,12 @@ class UI extends UI_Default {
* @return object an object of a class implementing the view * @return object an object of a class implementing the view
*/ */
static public function factory($theme, $class='', $params=array()) { /* {{{ */ static public function factory($theme, $class='', $params=array()) { /* {{{ */
global $settings, $dms, $user, $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) { if(!$class) {
$class = 'Bootstrap'; $class = 'Bootstrap';
$class = 'Style'; $class = 'Style';
@ -56,9 +60,9 @@ class UI extends UI_Default {
} }
/* Collect all decorators */ /* Collect all decorators */
$decorators = array(); $decorators = array();
foreach($extMgr->getExtensionConfiguration() as $extname=>$extconf) { foreach($extmgr->getExtensionConfiguration() as $extname=>$extconf) {
if(!$settings->extensionIsDisabled($extname)) { if(!$settings->extensionIsDisabled($extname)) {
if($extMgr->checkExtensionByName($extname, $extconf)) { if($extmgr->checkExtensionByName($extname, $extconf)) {
if(isset($extconf['decorators'][$class])) { if(isset($extconf['decorators'][$class])) {
$filename = $settings->_rootDir.'ext/'.$extname.'/decorators/'.$theme."/".$extconf['decorators'][$class]['file']; $filename = $settings->_rootDir.'ext/'.$extname.'/decorators/'.$theme."/".$extconf['decorators'][$class]['file'];
if(file_exists($filename)) { if(file_exists($filename)) {
@ -73,9 +77,9 @@ class UI extends UI_Default {
*/ */
$filename = ''; $filename = '';
$httpbasedir = ''; $httpbasedir = '';
foreach($extMgr->getExtensionConfiguration() as $extname=>$extconf) { foreach($extmgr->getExtensionConfiguration() as $extname=>$extconf) {
if(!$settings->extensionIsDisabled($extname)) { 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 /* Setting the 'views' element in the configuration can be used to
* replace an existing view in views/bootstrap/, e.g. class.ViewFolder.php * replace an existing view in views/bootstrap/, e.g. class.ViewFolder.php
* without providing an out/out.ViewFolder.php. In that case $httpbasedir * without providing an out/out.ViewFolder.php. In that case $httpbasedir
@ -128,7 +132,6 @@ class UI extends UI_Default {
$params['settings'] = $settings; $params['settings'] = $settings;
$view = new $classname($params, $theme); $view = new $classname($params, $theme);
/* Set some configuration parameters */ /* Set some configuration parameters */
$view->setParam('accessobject', new SeedDMS_AccessOperation($dms, $user, $settings));
$view->setParam('referer', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''); $view->setParam('referer', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '');
$view->setParam('requesturi', $_SERVER['REQUEST_URI']); $view->setParam('requesturi', $_SERVER['REQUEST_URI']);
$view->setParam('absbaseprefix', $settings->_httpRoot.$httpbasedir); $view->setParam('absbaseprefix', $settings->_httpRoot.$httpbasedir);
@ -139,6 +142,7 @@ class UI extends UI_Default {
$view->setParam('logger', $logger); $view->setParam('logger', $logger);
$view->setParam('notifier', $notifier); $view->setParam('notifier', $notifier);
$view->setParam('fulltextservice', $fulltextservice); $view->setParam('fulltextservice', $fulltextservice);
$view->setParam('translator', $translator);
// $view->setParam('settings', $settings); // $view->setParam('settings', $settings);
$view->setParam('sitename', $settings->_siteName); $view->setParam('sitename', $settings->_siteName);
$view->setParam('rootfolderid', $settings->_rootFolderID); $view->setParam('rootfolderid', $settings->_rootFolderID);
@ -156,14 +160,11 @@ class UI extends UI_Default {
$view->setParam('enablefoldertree', $settings->_enableFolderTree); $view->setParam('enablefoldertree', $settings->_enableFolderTree);
$view->setParam('enablelanguageselector', $settings->_enableLanguageSelector); $view->setParam('enablelanguageselector', $settings->_enableLanguageSelector);
$view->setParam('enableclipboard', $settings->_enableClipboard); $view->setParam('enableclipboard', $settings->_enableClipboard);
$view->setParam('enablemenutransmittals', $settings->_enableMenuTransmittals);
$view->setParam('enablemenutasks', $settings->_enableMenuTasks); $view->setParam('enablemenutasks', $settings->_enableMenuTasks);
$view->setParam('tasksinmenu', $settings->_tasksInMenu);
$view->setParam('enabledropfolderlist', $settings->_enableDropFolderList); $view->setParam('enabledropfolderlist', $settings->_enableDropFolderList);
$view->setParam('dropfolderdir', $settings->_dropFolderDir); $view->setParam('dropfolderdir', $settings->_dropFolderDir);
$view->setParam('enablesessionlist', $settings->_enableSessionList); $view->setParam('enablesessionlist', $settings->_enableSessionList);
$view->setParam('workflowmode', $settings->_workflowMode); $view->setParam('workflowmode', $settings->_workflowMode);
$view->setParam('checkoutdir', $settings->_checkOutDir);
$view->setParam('partitionsize', SeedDMS_Core_File::parse_filesize( $settings->_partitionSize)); $view->setParam('partitionsize', SeedDMS_Core_File::parse_filesize( $settings->_partitionSize));
$view->setParam('maxuploadsize', $settings->getMaximumUploadSize()); $view->setParam('maxuploadsize', $settings->getMaximumUploadSize());
$view->setParam('showmissingtranslations', $settings->_showMissingTranslations); $view->setParam('showmissingtranslations', $settings->_showMissingTranslations);
@ -199,6 +200,7 @@ class UI extends UI_Default {
static public function exitError($pagetitle, $error, $noexit=false, $plain=false) { static public function exitError($pagetitle, $error, $noexit=false, $plain=false) {
global $theme, $dms, $user, $settings; global $theme, $dms, $user, $settings;
$accessop = new SeedDMS_AccessOperation($dms, null, $user, $settings);
$view = UI::factory($theme, 'ErrorDlg'); $view = UI::factory($theme, 'ErrorDlg');
$request = $view->getParam('request'); $request = $view->getParam('request');
if($request) { if($request) {
@ -206,6 +208,7 @@ class UI extends UI_Default {
} }
$view->setParam('dms', $dms); $view->setParam('dms', $dms);
$view->setParam('user', $user); $view->setParam('user', $user);
$view->setParam('accessobject', $accessop);
$view->setParam('pagetitle', $pagetitle); $view->setParam('pagetitle', $pagetitle);
$view->setParam('errormsg', $error); $view->setParam('errormsg', $error);
$view->setParam('plain', $plain); $view->setParam('plain', $plain);

View 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');

View File

@ -213,7 +213,7 @@ class SeedDMS_View_Common {
if(is_string($tmpret)) { if(is_string($tmpret)) {
$ret = ($ret === null) ? $tmpret : (is_string($ret) ? $ret.$tmpret : array_merge($ret, array($tmpret))); $ret = ($ret === null) ? $tmpret : (is_string($ret) ? $ret.$tmpret : array_merge($ret, array($tmpret)));
} elseif(is_array($tmpret) || is_object($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 } else
$ret = $tmpret; $ret = $tmpret;
} }
@ -322,10 +322,8 @@ class SeedDMS_View_Common {
*/ */
protected function html_url($view, $urlparams=array()) { /* {{{ */ protected function html_url($view, $urlparams=array()) { /* {{{ */
$url = $this->params['settings']->_httpRoot."out/out.".$view.".php"; $url = $this->params['settings']->_httpRoot."out/out.".$view.".php";
if(is_array($urlparams)) if($urlparams)
$url .= "?".http_build_query($urlparams); $url .= "?".http_build_query($urlparams);
elseif(is_string($urlparams))
$url .= "?".$urlparams;
return $url; return $url;
} /* }}} */ } /* }}} */

View File

@ -56,12 +56,14 @@ if(isset($GLOBALS['SEEDDMS_HOOKS']['initStorage'])) {
$dms = new SeedDMS_Core_DMS($db, $storage ? $storage : $settings->_contentDir.$settings->_contentOffsetDir); $dms = new SeedDMS_Core_DMS($db, $storage ? $storage : $settings->_contentDir.$settings->_contentOffsetDir);
$memcache = null;
if($settings->_enableMemcached && extension_loaded('memcached')) { if($settings->_enableMemcached && extension_loaded('memcached')) {
$memcache = new Memcached('seeddms'); $mc = new Memcached('seeddms');
$memcache->addServers(array( $mc->addServers(array(
array('localhost',11211), 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()) { if(!$settings->_doNotCheckDBVersion && !$dms->checkVersion()) {
@ -87,11 +89,8 @@ if(isset($GLOBALS['SEEDDMS_HOOKS']['initDMS'])) {
} }
} }
require_once('inc/inc.Tasks.php');
require_once("inc.ConversionInit.php"); require_once("inc.ConversionInit.php");
require_once('inc.FulltextInit.php'); require_once('inc.FulltextInit.php');
require_once('inc.AuthenticationInit.php'); require_once('inc.AuthenticationInit.php');
require_once("inc.ClassNotificationService.php");
require_once("inc.ClassEmailNotify.php");
require_once('inc.Notification.php'); require_once('inc.Notification.php');

View File

@ -11,35 +11,36 @@
* @version Release: @package_version@ * @version Release: @package_version@
*/ */
global $logger; require_once "inc.ClassExtensionMgr.php";
require "inc.ClassExtensionMgr.php";
require_once "inc.ClassSchedulerTaskBase.php";
require_once "inc.ClassExtBase.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');
if(!$settings->extensionIsDisabled($extname)) { /* Declare an alias as long as it used by extensions */
$disabled = true; class_alias('Seeddms\Seeddms\ExtensionBase', 'SeedDMS_ExtBase');
if($extMgr->checkExtensionByName($extname, $extconf)) {
$disabled = false; $extmgr = new ExtensionMgr($settings->_rootDir."/ext", $settings->_cacheDir, $settings->_repositoryUrl, $settings->_proxyUrl, $settings->_proxyUser, $settings->_proxyPassword);
} else {
foreach($extmgr->getExtensionConfiguration() as $extname=>$extconf) {
if($extconf['disable']) {
$settings->disableExtension($extname); $settings->disableExtension($extname);
// echo $extMgr->getErrorMsg(); continue;
} }
/* check for requirements */ if(!$settings->extensionIsDisabled($extname)) {
/*
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; $disabled = false;
if($extmgr->checkExtensionByName($extname, $extconf)) {
$disabled = false;
$settings->enableExtension($extname);
} else {
$disabled = true;
$settings->disableExtension($extname);
// echo $extmgr->getErrorMsg();
} }
*/
if(!$disabled) { if(!$disabled) {
if(isset($extconf['class']) && isset($extconf['class']['file']) && isset($extconf['class']['name'])) { if(isset($extconf['class']) && isset($extconf['class']['file']) && isset($extconf['class']['name'])) {
$classfile = $settings->_rootDir."/ext/".$extname."/".$extconf['class']['file']; $classfile = $settings->_rootDir."/ext/".$extname."/".$extconf['class']['file'];
@ -47,7 +48,7 @@ foreach($extMgr->getExtensionConfiguration() as $extname=>$extconf) {
include($classfile); include($classfile);
$obj = new $extconf['class']['name']($settings, null, $logger); $obj = new $extconf['class']['name']($settings, null, $logger);
if(method_exists($obj, 'init')) if(method_exists($obj, 'init'))
$obj->init($extMgr); $obj->init($extmgr);
} }
} }
if(isset($extconf['language']['file'])) { if(isset($extconf['language']['file'])) {
@ -57,14 +58,15 @@ foreach($extMgr->getExtensionConfiguration() as $extname=>$extconf) {
include($langfile); include($langfile);
if(isset($__lang) && $__lang) { if(isset($__lang) && $__lang) {
foreach($__lang as $lang=>&$data) { foreach($__lang as $lang=>&$data) {
if(isset($GLOBALS['LANG'][$lang])) $translator->addPhrases($lang, $data);
$GLOBALS['LANG'][$lang] = array_merge($GLOBALS['LANG'][$lang], $data);
else
$GLOBALS['LANG'][$lang] = $data;
} }
} }
} }
} }
} }
} else {
// Ensure $settings->_extensions has an entry for the extension, even if
// the extension is disabled already.
$settings->disableExtension($extname);
} }
} }

View File

@ -26,7 +26,6 @@ $fulltextservice = null;
if($settings->_enableFullSearch) { if($settings->_enableFullSearch) {
require_once("inc.ClassFulltextService.php"); require_once("inc.ClassFulltextService.php");
$fulltextservice = new SeedDMS_FulltextService(); $fulltextservice = new SeedDMS_FulltextService();
$fulltextservice->setLogger($logger);
if($settings->_fullSearchEngine == 'sqlitefts') { if($settings->_fullSearchEngine == 'sqlitefts') {
$indexconf = array( $indexconf = array(

View File

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

View File

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

View File

@ -12,8 +12,10 @@
* @version Release: @package_version@ * @version Release: @package_version@
*/ */
global $logger; require_once("inc.ClassEmailNotify.php");
$notifier = new SeedDMS_NotificationService($logger, $settings); require_once("inc.ClassNotificationService.php");
$notifier = new SeedDMS_NotificationService($logger, $settings, $translator);
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) { if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) { foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) {
@ -24,7 +26,7 @@ if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
} }
if($settings->_enableEmail) { 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'])) { if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {

View File

@ -1,17 +0,0 @@
<?php
/**
* Initialize scheduler
*
* @category DMS
* @package SeedDMS
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2018 Uwe Steinmann
* @version Release: @package_version@
*/
require_once "inc.ClassSchedulerTaskBase.php";
require_once "inc.ClassScheduler.php";
require_once "inc.ClassSchedulerTask.php";

View File

@ -18,6 +18,8 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
use Seeddms\Seeddms\Settings;
require_once('inc.ClassSettings.php'); require_once('inc.ClassSettings.php');
if(defined("SEEDDMS_CONFIG_FILE")) if(defined("SEEDDMS_CONFIG_FILE"))
$settings = new Settings(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"; $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)) { if(!empty($settings->_extraPath)) {
ini_set('include_path', $settings->_extraPath. PATH_SEPARATOR .ini_get('include_path')); ini_set('include_path', $settings->_extraPath. PATH_SEPARATOR .ini_get('include_path'));
} }
@ -75,13 +77,7 @@ if(isset($settings->_maxExecutionTime)) {
* relative to it. * relative to it.
*/ */
ini_set('include_path', $settings->_rootDir. PATH_SEPARATOR .ini_get('include_path')); 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 */ require_once 'vendor/autoload.php';
if(!defined("SEEDDMS_INSTALL"))
require_once 'vendor/autoload.php';
require_once "inc.Version.php"; require_once "inc.Version.php";

File diff suppressed because it is too large Load Diff

View File

@ -86,21 +86,29 @@ function getPeriodOfTime($timestamp) { /* {{{ */
$timestamp = strtotime($timestamp); $timestamp = strtotime($timestamp);
$time = time() - $timestamp; // to get the time since that moment $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 ( $tokens = array (
31536000 => 'abbr_year', 31536000 => 'year',
2592000 => 'abbr_month', 2592000 => 'month',
604800 => 'abbr_week', 604800 => 'week',
86400 => 'abbr_day', 86400 => 'day',
3600 => 'abbr_hour', 3600 => 'hour',
60 => 'abbr_minute', 60 => 'minute',
1 => 'abbr_second' 1 => 'second'
); );
if($time == 0)
return getMLText('now');
foreach ($tokens as $unit => $text) { foreach ($tokens as $unit => $text) {
if ($time < $unit) continue; if ($time < $unit) continue;
$numberOfUnits = floor($time / $unit); $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 * @return integer/boolean unix timestamp or false in case of an error
*/ */
function makeTsFromDate($date) { /* {{{ */ function makeTsFromDate($date) { /* {{{ */
return strtotime($date); return $date ? strtotime($date) : false;
} /* }}} */ } /* }}} */
/* /*
@ -447,7 +455,7 @@ function utf8_basename($path, $suffix='') { /* {{{ */
* @return string valid file name * @return string valid file name
*/ */
function getFilenameByDocname($content) { /* {{{ */ function getFilenameByDocname($content) { /* {{{ */
if(is_string($content)) { if(is_string) {
$filename = $content; $filename = $content;
} else { } else {
$document = $content->getDocument(); $document = $content->getDocument();
@ -462,10 +470,31 @@ function getFilenameByDocname($content) { /* {{{ */
return mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $filename); return mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $filename);
} /* }}} */ } /* }}} */
function getLogger($prefix='', $mask=PEAR_LOG_INFO) { /* {{{ */ function getStreamContext($proxyurl, $proxyuser, $proxypass) { /* {{{ */
global $settings; 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()); if ($settings->_logFileRotation=="h") $logname=date("YmdH", time());
else if ($settings->_logFileRotation=="d") $logname=date("Ymd", time()); else if ($settings->_logFileRotation=="d") $logname=date("Ymd", time());
else $logname=date("Ym", 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. * quota is reached. Negative values indicate a disk usage above quota.
*/ */
function checkQuota($user) { /* {{{ */ function checkQuota($user) { /* {{{ */
global $settings, $dms; global $settings;
/* check if quota is turn off system wide */ /* check if quota is turn off system wide */
if($settings->_quota == 0) if($settings->_quota == 0)
@ -743,6 +772,7 @@ function get_extension($mimetype) { /* {{{ */
case 'video/webm': return '.webm'; case 'video/webm': return '.webm';
case 'application/zip': return '.zip'; case 'application/zip': return '.zip';
case 'application/x-gzip': return '.gz'; case 'application/x-gzip': return '.gz';
case 'application/x-xz': return '.xz';
case 'application/x-rar': return '.rar'; case 'application/x-rar': return '.rar';
case 'application/x-7z-compressed': return '.7z'; case 'application/x-7z-compressed': return '.7z';
case 'application/x-compressed-tar': return '.tgz'; case 'application/x-compressed-tar': return '.tgz';
@ -795,18 +825,6 @@ function addDirSep($str, $chr=DIRECTORY_SEPARATOR) { /* {{{ */
} /* }}} */ } /* }}} */
/** /**
* Formats comments for aknowledge of reception.
*
* Only use in documentListRow()
*/
function formatComment($an) { /* {{{ */
$t = array();
foreach($an as $a)
$t[] = $a['n']." × ".$a['c'];
return $t;
} /* }}} */
/*
* Determines if a command exists on the current environment * Determines if a command exists on the current environment
* *
* @param string $command The command to check * @param string $command The command to check
@ -982,52 +1000,6 @@ function seed_pass_verify($password, $hash) { /* {{{ */
return $hash === md5($password); return $hash === md5($password);
} /* }}} */ } /* }}} */
function resolveTask($task) { /* {{{ */
global $dms, $user, $settings, $logger, $fulltextservice, $notifier, $conversionmgr;
if(is_object($task))
return $task;
if(is_string($task)) {
if(class_exists($task)) {
$task = new $task($dms, $user, $settings, $logger, $fulltextservice, $notifier, $conversionmgr);
}
}
return $task;
} /* }}} */
/**
* Return nonce for CSP
*
* @return string
*/
function createNonce() { /* {{{ */
$length = 16;
$usable = true;
$bytes = openssl_random_pseudo_bytes($length, $usable);
if ($usable === false) {
// weak
// @TODO do something?
}
return base64_encode($bytes);
} /* }}} */
/**
* Create a real uniqid for cryptographic purposes
*
* @ return string
*/
function uniqidReal($lenght = 13) {
// uniqid gives 13 chars, but you could adjust it to your needs.
if (function_exists("random_bytes")) {
$bytes = random_bytes(ceil($lenght / 2));
} elseif (function_exists("openssl_random_pseudo_bytes")) {
$bytes = openssl_random_pseudo_bytes(ceil($lenght / 2));
} else {
throw new Exception("no cryptographically secure random function available");
}
return substr(bin2hex($bytes), 0, $lenght);
}
/** /**
* Compare function for sorting users by login * Compare function for sorting users by login
* *
@ -1150,9 +1122,9 @@ function getMandatoryReviewers($folder, $document, $user) { /* {{{ */
foreach($revg as $gid) { foreach($revg as $gid) {
if($g = $dms->getGroup($gid)) { if($g = $dms->getGroup($gid)) {
if($document) if($document)
$accessmode = $document->getGroupAccessMode($u); $accessmode = $document->getGroupAccessMode($g);
else else
$accessmode = $folder->getGroupAccessMode($u); $accessmode = $folder->getGroupAccessMode($g);
if($accessmode < M_READ || !$g->getUsers()) if($accessmode < M_READ || !$g->getUsers())
$reviewers["ng"][] = $g->getId(); $reviewers["ng"][] = $g->getId();
else else
@ -1247,9 +1219,9 @@ function getMandatoryApprovers($folder, $document, $user) { /* {{{ */
foreach($appg as $gid) { foreach($appg as $gid) {
if($g = $dms->getGroup($gid)) { if($g = $dms->getGroup($gid)) {
if($document) if($document)
$accessmode = $document->getGroupAccessMode($u); $accessmode = $document->getGroupAccessMode($g);
else else
$accessmode = $folder->getGroupAccessMode($u); $accessmode = $folder->getGroupAccessMode($g);
if($accessmode < M_READ || !$g->getUsers()) if($accessmode < M_READ || !$g->getUsers())
$approvers["ng"][] = $g->getId(); $approvers["ng"][] = $g->getId();
else else
@ -1260,33 +1232,7 @@ function getMandatoryApprovers($folder, $document, $user) { /* {{{ */
return $approvers; return $approvers;
} /* }}} */ } /* }}} */
/** require_once "inc/inc.ClassUtilities.php";
* Class with various utility methods
*
* This class will sooner or later comprise the functions above
*
*/
class SeedDMS_Utils { /* {{{ */
/**
* Recursively remove a directory on disc
*
* @param string $dir name of directory
*/
static public function rrmdir($dir) { /* {{{ */
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir."/".$object) == "dir") self::rrmdir($dir."/".$object); else unlink($dir."/".$object);
}
}
reset($objects);
rmdir($dir);
}
} /* }}} */
} /* }}} */
/** /**
* Class for creating encrypted api keys * Class for creating encrypted api keys
@ -1432,6 +1378,8 @@ class SeedDMS_Search { /* {{{ */
public $searchparams; public $searchparams;
protected $total;
protected $dcount; protected $dcount;
protected $fcount; protected $fcount;
@ -1444,6 +1392,10 @@ class SeedDMS_Search { /* {{{ */
protected $searchTime; protected $searchTime;
protected $facets;
protected $stats;
public function __construct($dms, $user, $fulltextservice, $settings) { public function __construct($dms, $user, $fulltextservice, $settings) {
$this->dms = $dms; $this->dms = $dms;
$this->user = $user; $this->user = $user;
@ -1452,6 +1404,7 @@ class SeedDMS_Search { /* {{{ */
$this->searchparams = []; $this->searchparams = [];
$this->dcount = 0; $this->dcount = 0;
$this->fcount = 0; $this->fcount = 0;
$this->total = 0;
$this->totalPages = 0; $this->totalPages = 0;
$this->entries = array(); $this->entries = array();
$this->terms = array(); $this->terms = array();
@ -1787,33 +1740,6 @@ class SeedDMS_Search { /* {{{ */
} }
$this->searchparams['startFolder'] = $startFolder; $this->searchparams['startFolder'] = $startFolder;
/* Revision date {{{ */
$revisionstartts = null;
$revisionstartdate = array();
$revisionendts = null;
$revisionenddate = array();
$revised['from'] = null;
$revised['to'] = null;
if(!empty($get["revisiondatestart"])) {
$revisionstartts = makeTsFromDate($get["revisiondatestart"]);
$revisionstartdate = array('year'=>(int)date('Y', $revisionstartts), 'month'=>(int)date('m', $revisionstartts), 'day'=>(int)date('d', $revisionstartts), 'hour'=>0, 'minute'=>0, 'second'=>0);
if (!checkdate($revisionstartdate['month'], $revisionstartdate['day'], $revisionstartdate['year'])) {
UI::exitError(getMLText("search"),getMLText("invalid_revision_date_start"));
}
$revised['from'] = $revisionstartts;
}
$this->searchparams['revisionstartdate'] = $revisionstartdate;
if(!empty($get["revisiondateend"])) {
$revisionendts = makeTsFromDate($get["revisiondateend"]);
$revisionenddate = array('year'=>(int)date('Y', $revisionendts), 'month'=>(int)date('m', $revisionendts), 'day'=>(int)date('d', $revisionendts), 'hour'=>23, 'minute'=>59, 'second'=>59);
if (!checkdate($revisionenddate['month'], $revisionenddate['day'], $revisionenddate['year'])) {
UI::exitError(getMLText("search"),getMLText("invalid_revision_date_end"));
}
$revised['to'] = $revisionendts;
}
$this->searchparams['revisionenddate'] = $revisionenddate;
/* }}} */
/* Status date {{{ */ /* Status date {{{ */
$statusstartdate = array(); $statusstartdate = array();
$statusenddate = array(); $statusenddate = array();
@ -1858,12 +1784,6 @@ class SeedDMS_Search { /* {{{ */
$this->searchparams['expenddate'] = $expenddate; $this->searchparams['expenddate'] = $expenddate;
/* }}} */ /* }}} */
$reception = array();
if (isset($get["reception"])){
$reception = $get["reception"];
}
$this->searchparams['reception'] = $reception;
/* Do not search for folders if result shall be filtered by status. /* Do not search for folders if result shall be filtered by status.
* If this is not done, unexplainable results will be delivered. * If this is not done, unexplainable results will be delivered.
* e.g. a search for expired documents of a given user will list * e.g. a search for expired documents of a given user will list
@ -1879,8 +1799,8 @@ class SeedDMS_Search { /* {{{ */
$attributes = array(); $attributes = array();
foreach($attributes as $attrdefid=>$attribute) { foreach($attributes as $attrdefid=>$attribute) {
$attrdef = $this->dms->getAttributeDefinition($attrdefid);
if($attribute) { if($attribute) {
if($attrdef = $this->dms->getAttributeDefinition($attrdefid)) {
if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) { if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) {
if(is_array($attribute)) { if(is_array($attribute)) {
if(!empty($attributes[$attrdefid]['from'])) if(!empty($attributes[$attrdefid]['from']))
@ -1893,6 +1813,7 @@ class SeedDMS_Search { /* {{{ */
} }
} }
} }
}
$this->searchparams['attributes'] = $attributes; $this->searchparams['attributes'] = $attributes;
// }}} // }}}
@ -2014,9 +1935,6 @@ class SeedDMS_Search { /* {{{ */
'mode'=>$this->searchparams['resultmode'], 'mode'=>$this->searchparams['resultmode'],
'expirationstartdate'=>$this->searchparams['expstartdate'], 'expirationstartdate'=>$this->searchparams['expstartdate'],
'expirationenddate'=>$this->searchparams['expenddate'], 'expirationenddate'=>$this->searchparams['expenddate'],
'revisionstartdate'=>$this->searchparams['revisionstartdate'],
'revisionenddate'=>$this->searchparams['revisionenddate'],
'reception'=>$this->searchparams['reception'],
'statusstartdate'=>$this->searchparams['statusstartdate'], 'statusstartdate'=>$this->searchparams['statusstartdate'],
'statusenddate'=>$this->searchparams['statusenddate'], 'statusenddate'=>$this->searchparams['statusenddate'],
'orderby'=>$this->searchparams['orderby'] 'orderby'=>$this->searchparams['orderby']

View File

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

View File

@ -46,21 +46,6 @@ CREATE TABLE `tblAttributeDefinitions` (
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Table structure for table `tblRoles`
--
CREATE TABLE `tblRoles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`role` smallint(1) NOT NULL DEFAULT '0',
`noaccess` varchar(30) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
-- --
-- Table structure for table `tblUsers` -- Table structure for table `tblUsers`
-- --
@ -69,13 +54,12 @@ CREATE TABLE `tblUsers` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`login` varchar(50) DEFAULT NULL, `login` varchar(50) DEFAULT NULL,
`pwd` varchar(50) DEFAULT NULL, `pwd` varchar(50) DEFAULT NULL,
`secret` varchar(50) DEFAULT NULL,
`fullName` varchar(100) DEFAULT NULL, `fullName` varchar(100) DEFAULT NULL,
`email` varchar(70) DEFAULT NULL, `email` varchar(70) DEFAULT NULL,
`language` varchar(32) NOT NULL, `language` varchar(32) NOT NULL,
`theme` varchar(32) NOT NULL, `theme` varchar(32) NOT NULL,
`comment` text NOT NULL, `comment` text NOT NULL,
`role` int(11) NOT NULL, `role` smallint(1) NOT NULL DEFAULT '0',
`hidden` smallint(1) NOT NULL DEFAULT '0', `hidden` smallint(1) NOT NULL DEFAULT '0',
`pwdExpiration` datetime DEFAULT NULL, `pwdExpiration` datetime DEFAULT NULL,
`loginfailures` tinyint(4) NOT NULL DEFAULT '0', `loginfailures` tinyint(4) NOT NULL DEFAULT '0',
@ -83,28 +67,11 @@ CREATE TABLE `tblUsers` (
`quota` bigint(20) DEFAULT NULL, `quota` bigint(20) DEFAULT NULL,
`homefolder` int(11) DEFAULT NULL, `homefolder` int(11) DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `login` (`login`), UNIQUE KEY `login` (`login`)
CONSTRAINT `tblUsers_role` FOREIGN KEY (`role`) REFERENCES `tblRoles` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Table structure for table `tblUserSubstitutes`
--
CREATE TABLE `tblUserSubstitutes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user` int(11) DEFAULT null,
`substitute` int(11) DEFAULT null,
PRIMARY KEY (`id`),
UNIQUE KEY `user` (`user`,`substitute`),
CONSTRAINT `tblUserSubstitutes_user` FOREIGN KEY (`user`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblUserSubstitutes_substitute` FOREIGN KEY (`substitute`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
);
-- --------------------------------------------------------
-- --
-- Table structure for table `tblUserPasswordRequest` -- Table structure for table `tblUserPasswordRequest`
-- --
@ -255,7 +222,6 @@ CREATE TABLE `tblDocumentApprovers` (
UNIQUE KEY `documentID` (`documentID`,`version`,`type`,`required`), UNIQUE KEY `documentID` (`documentID`,`version`,`type`,`required`),
CONSTRAINT `tblDocumentApprovers_document` FOREIGN KEY (`documentID`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE CONSTRAINT `tblDocumentApprovers_document` FOREIGN KEY (`documentID`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE INDEX `indDocumentApproversRequired` ON `tblDocumentApprovers` (`required`);
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -296,7 +262,6 @@ CREATE TABLE `tblDocumentContent` (
`mimeType` varchar(100) NOT NULL DEFAULT '', `mimeType` varchar(100) NOT NULL DEFAULT '',
`fileSize` bigint(20) DEFAULT NULL, `fileSize` bigint(20) DEFAULT NULL,
`checksum` char(32) DEFAULT NULL, `checksum` char(32) DEFAULT NULL,
`revisiondate` datetime DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `document` (`document`,`version`), UNIQUE KEY `document` (`document`,`version`),
CONSTRAINT `tblDocumentContent_document` FOREIGN KEY (`document`) REFERENCES `tblDocuments` (`id`) CONSTRAINT `tblDocumentContent_document` FOREIGN KEY (`document`) REFERENCES `tblDocuments` (`id`)
@ -384,23 +349,6 @@ CREATE TABLE `tblDocumentLocks` (
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Table structure for table `tblDocumentCheckOuts`
--
CREATE TABLE `tblDocumentCheckOuts` (
`document` int(11) NOT NULL DEFAULT '0',
`version` smallint(5) unsigned NOT NULL DEFAULT '0',
`userID` int(11) NOT NULL DEFAULT '0',
`date` datetime NOT NULL,
`filename` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`document`),
CONSTRAINT `tblDocumentCheckOuts_document` FOREIGN KEY (`document`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblDocumentCheckOuts_user` FOREIGN KEY (`userID`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
-- --
-- Table structure for table `tblDocumentReviewers` -- Table structure for table `tblDocumentReviewers`
-- --
@ -415,7 +363,6 @@ CREATE TABLE `tblDocumentReviewers` (
UNIQUE KEY `documentID` (`documentID`,`version`,`type`,`required`), UNIQUE KEY `documentID` (`documentID`,`version`,`type`,`required`),
CONSTRAINT `tblDocumentReviewers_document` FOREIGN KEY (`documentID`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE CONSTRAINT `tblDocumentReviewers_document` FOREIGN KEY (`documentID`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE INDEX `indDocumentReviewersRequired` ON `tblDocumentReviewers` (`required`);
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -439,83 +386,6 @@ CREATE TABLE `tblDocumentReviewLog` (
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Table structure for table `tblDocumentRecipients`
--
CREATE TABLE `tblDocumentRecipients` (
`receiptID` int(11) NOT NULL AUTO_INCREMENT,
`documentID` int(11) NOT NULL DEFAULT '0',
`version` smallint(5) unsigned NOT NULL DEFAULT '0',
`type` tinyint(4) NOT NULL DEFAULT '0',
`required` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`receiptID`),
UNIQUE KEY `documentID` (`documentID`,`version`,`type`,`required`),
CONSTRAINT `tblDocumentRecipients_document` FOREIGN KEY (`documentID`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE INDEX `indDocumentRecipientsRequired` ON `tblDocumentRecipients` (`required`);
-- --------------------------------------------------------
--
-- Table structure for table `tblDocumentReceiptLog`
--
CREATE TABLE `tblDocumentReceiptLog` (
`receiptLogID` int(11) NOT NULL AUTO_INCREMENT,
`receiptID` int(11) NOT NULL DEFAULT '0',
`status` tinyint(4) NOT NULL DEFAULT '0',
`comment` text NOT NULL,
`date` datetime NOT NULL,
`userID` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`receiptLogID`),
KEY `tblDocumentReceiptLog_receipt` (`receiptID`),
KEY `tblDocumentReceiptLog_user` (`userID`),
CONSTRAINT `tblDocumentReceiptLog_recipient` FOREIGN KEY (`receiptID`) REFERENCES `tblDocumentRecipients` (`receiptID`) ON DELETE CASCADE,
CONSTRAINT `tblDocumentReceiptLog_user` FOREIGN KEY (`userID`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `tblDocumentRevisors`
--
CREATE TABLE `tblDocumentRevisors` (
`revisionID` int(11) NOT NULL AUTO_INCREMENT,
`documentID` int(11) NOT NULL DEFAULT '0',
`version` smallint(5) unsigned NOT NULL DEFAULT '0',
`type` tinyint(4) NOT NULL DEFAULT '0',
`required` int(11) NOT NULL DEFAULT '0',
`startdate` datetime DEFAULT NULL,
PRIMARY KEY (`revisionID`),
UNIQUE KEY `documentID` (`documentID`,`version`,`type`,`required`),
CONSTRAINT `tblDocumentRevisors_document` FOREIGN KEY (`documentID`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE INDEX `indDocumentRevisorsRequired` ON `tblDocumentRevisors` (`required`);
-- --------------------------------------------------------
--
-- Table structure for table `tblDocumentRevisionLog`
--
CREATE TABLE `tblDocumentRevisionLog` (
`revisionLogID` int(11) NOT NULL AUTO_INCREMENT,
`revisionID` int(11) NOT NULL DEFAULT '0',
`status` tinyint(4) NOT NULL DEFAULT '0',
`comment` text NOT NULL,
`date` datetime NOT NULL,
`userID` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`revisionLogID`),
KEY `tblDocumentRevisionLog_revision` (`revisionID`),
KEY `tblDocumentRevisionLog_user` (`userID`),
CONSTRAINT `tblDocumentRevisionLog_revision` FOREIGN KEY (`revisionID`) REFERENCES `tblDocumentRevisors` (`revisionID`) ON DELETE CASCADE,
CONSTRAINT `tblDocumentRevisionLog_user` FOREIGN KEY (`userID`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
-- --
-- Table structure for table `tblDocumentStatus` -- Table structure for table `tblDocumentStatus`
-- --
@ -738,7 +608,6 @@ CREATE TABLE `tblWorkflows` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`name` text NOT NULL, `name` text NOT NULL,
`initstate` int(11) NOT NULL, `initstate` int(11) NOT NULL,
`layoutdata` text DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `tblWorkflow_initstate` (`initstate`), KEY `tblWorkflow_initstate` (`initstate`),
CONSTRAINT `tblWorkflow_initstate` FOREIGN KEY (`initstate`) REFERENCES `tblWorkflowStates` (`id`) ON DELETE CASCADE CONSTRAINT `tblWorkflow_initstate` FOREIGN KEY (`initstate`) REFERENCES `tblWorkflowStates` (`id`) ON DELETE CASCADE
@ -805,48 +674,49 @@ CREATE TABLE `tblWorkflowTransitionGroups` (
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Table structure for table `tblWorkflowDocumentContent`
--
CREATE TABLE `tblWorkflowDocumentContent` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parent` int(11) DEFAULT NULL,
`workflow` int(11) DEFAULT NULL,
`document` int(11) DEFAULT NULL,
`version` smallint(5) DEFAULT NULL,
`state` int(11) DEFAULT NULL,
`date` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `tblWorkflowDocument_document` (`document`),
KEY `tblWorkflowDocument_workflow` (`workflow`),
KEY `tblWorkflowDocument_state` (`state`),
CONSTRAINT `tblWorkflowDocument_document` FOREIGN KEY (`document`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblWorkflowDocument_state` FOREIGN KEY (`state`) REFERENCES `tblWorkflowStates` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblWorkflowDocumentContent_parent` FOREIGN KEY (`parent`) REFERENCES `tblWorkflowDocumentContent` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblWorkflowDocument_workflow` FOREIGN KEY (`workflow`) REFERENCES `tblWorkflows` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
-- --
-- Table structure for table `tblWorkflowLog` -- Table structure for table `tblWorkflowLog`
-- --
CREATE TABLE `tblWorkflowLog` ( CREATE TABLE `tblWorkflowLog` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`workflowdocumentcontent` int(11) NOT NULL DEFAULT '0', `document` int(11) DEFAULT NULL,
`version` smallint(5) DEFAULT NULL,
`workflow` int(11) DEFAULT NULL,
`userid` int(11) DEFAULT NULL, `userid` int(11) DEFAULT NULL,
`transition` int(11) DEFAULT NULL, `transition` int(11) DEFAULT NULL,
`date` datetime NOT NULL, `date` datetime NOT NULL,
`comment` text, `comment` text,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `tblWorkflowLog_document` (`document`),
KEY `tblWorkflowLog_workflow` (`workflow`),
KEY `tblWorkflowLog_userid` (`userid`), KEY `tblWorkflowLog_userid` (`userid`),
KEY `tblWorkflowLog_transition` (`transition`), KEY `tblWorkflowLog_transition` (`transition`),
KEY `tblWorkflowLog_workflowdocumentcontent` (`workflowdocumentcontent`), CONSTRAINT `tblWorkflowLog_document` FOREIGN KEY (`document`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblWorkflowLog_workflowdocumentcontent` FOREIGN KEY (`workflowdocumentcontent`) REFERENCES `tblWorkflowDocumentContent` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblWorkflowLog_transition` FOREIGN KEY (`transition`) REFERENCES `tblWorkflowTransitions` (`id`) ON DELETE CASCADE, CONSTRAINT `tblWorkflowLog_transition` FOREIGN KEY (`transition`) REFERENCES `tblWorkflowTransitions` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblWorkflowLog_userid` FOREIGN KEY (`userid`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE CONSTRAINT `tblWorkflowLog_userid` FOREIGN KEY (`userid`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblWorkflowLog_workflow` FOREIGN KEY (`workflow`) REFERENCES `tblWorkflows` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `tblWorkflowDocumentContent`
--
CREATE TABLE `tblWorkflowDocumentContent` (
`parentworkflow` int(11) DEFAULT '0',
`workflow` int(11) DEFAULT NULL,
`document` int(11) DEFAULT NULL,
`version` smallint(5) DEFAULT NULL,
`state` int(11) DEFAULT NULL,
`date` datetime NOT NULL,
KEY `tblWorkflowDocument_document` (`document`),
KEY `tblWorkflowDocument_workflow` (`workflow`),
KEY `tblWorkflowDocument_state` (`state`),
CONSTRAINT `tblWorkflowDocument_document` FOREIGN KEY (`document`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblWorkflowDocument_state` FOREIGN KEY (`state`) REFERENCES `tblWorkflowStates` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblWorkflowDocument_workflow` FOREIGN KEY (`workflow`) REFERENCES `tblWorkflows` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -866,127 +736,6 @@ CREATE TABLE `tblWorkflowMandatoryWorkflow` (
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Table structure for transmittal
--
CREATE TABLE `tblTransmittals` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` text NOT NULL,
`comment` text NOT NULL,
`userID` int(11) NOT NULL DEFAULT '0',
`date` datetime DEFAULT NULL,
`public` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
CONSTRAINT `tblTransmittals_user` FOREIGN KEY (`userID`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for transmittal item
--
CREATE TABLE `tblTransmittalItems` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`transmittal` int(11) NOT NULL DEFAULT '0',
`document` int(11) DEFAULT NULL,
`version` smallint(5) unsigned NOT NULL DEFAULT '0',
`date` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE (transmittal, document, version),
CONSTRAINT `tblTransmittalItems_document` FOREIGN KEY (`document`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblTransmittalItem_transmittal` FOREIGN KEY (`transmittal`) REFERENCES `tblTransmittals` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for cached read access
--
CREATE TABLE `tblCachedAccess` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`document` int(11) DEFAULT NULL,
`user` int(11) DEFAULT null,
`mode` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
CONSTRAINT `tblCachedAccess_document` FOREIGN KEY (`document`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblCachedAccess_user` FOREIGN KEY (`user`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for access request objects
--
CREATE TABLE `tblAros` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parent` int(11),
`model` text NOT NULL,
`foreignid` int(11) NOT NULL DEFAULT '0',
`alias` varchar(255),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for access control objects
--
CREATE TABLE `tblAcos` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parent` int(11),
`model` text NOT NULL,
`foreignid` int(11) NOT NULL DEFAULT '0',
`alias` varchar(255),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for acos/aros relation
--
CREATE TABLE `tblArosAcos` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`aro` int(11) NOT NULL DEFAULT '0',
`aco` int(11) NOT NULL DEFAULT '0',
`create` tinyint(4) NOT NULL DEFAULT '-1',
`read` tinyint(4) NOT NULL DEFAULT '-1',
`update` tinyint(4) NOT NULL DEFAULT '-1',
`delete` tinyint(4) NOT NULL DEFAULT '-1',
PRIMARY KEY (`id`),
UNIQUE (aco, aro),
CONSTRAINT `tblArosAcos_acos` FOREIGN KEY (`aco`) REFERENCES `tblAcos` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblArosAcos_aros` FOREIGN KEY (`aro`) REFERENCES `tblAros` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `tblSchedulerTask`
--
CREATE TABLE `tblSchedulerTask` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) DEFAULT NULL,
`description` text DEFAULT NULL,
`disabled` smallint(1) NOT NULL DEFAULT '0',
`extension` varchar(100) DEFAULT NULL,
`task` varchar(100) DEFAULT NULL,
`frequency` varchar(100) DEFAULT NULL,
`params` text DEFAULT NULL,
`nextrun` datetime DEFAULT NULL,
`lastrun` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
-- --
-- Table structure for table `tblVersion` -- Table structure for table `tblVersion`
-- --
@ -1004,10 +753,7 @@ CREATE TABLE `tblVersion` (
-- Initial content for database -- Initial content for database
-- --
INSERT INTO `tblRoles` (`id`, `name`, `role`) VALUES (1, 'Admin', 1); INSERT INTO tblUsers VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Administrator', 'info@seeddms.org', '', '', '', 1, 0, NULL, 0, 0, 0, NULL);
INSERT INTO `tblRoles` (`id`, `name`, `role`) VALUES (2, 'Guest', 2); INSERT INTO tblUsers VALUES (2, 'guest', NULL, 'Guest User', NULL, '', '', '', 2, 0, NULL, 0, 0, 0, NULL);
INSERT INTO `tblRoles` (`id`, `name`, `role`) VALUES (3, 'User', 0);
INSERT INTO tblUsers VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', '', 'Administrator', 'info@seeddms.org', '', '', '', 1, 0, NULL, 0, 0, 0, NULL);
INSERT INTO tblUsers VALUES (2, 'guest', NULL, '', 'Guest User', NULL, '', '', '', 2, 0, NULL, 0, 0, 0, NULL);
INSERT INTO tblFolders VALUES (1, 'DMS', 0, '', 'DMS root', UNIX_TIMESTAMP(), 1, 0, 2, 0); INSERT INTO tblFolders VALUES (1, 'DMS', 0, '', 'DMS root', UNIX_TIMESTAMP(), 1, 0, 2, 0);
INSERT INTO tblVersion VALUES (NOW(), 6, 0, 0); INSERT INTO tblVersion VALUES (NOW(), 5, 1, 0);

View File

@ -43,19 +43,6 @@ CREATE TABLE "tblAttributeDefinitions" (
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Table structure for table `tblRoles`
--
CREATE TABLE "tblRoles" (
"id" SERIAL UNIQUE,
"name" varchar(50) default NULL,
"role" INTEGER NOT NULL default '0',
"noaccess" varchar(30) NOT NULL default ''
) ;
-- --------------------------------------------------------
-- --
-- Table structure for table "tblUsers" -- Table structure for table "tblUsers"
-- --
@ -64,7 +51,6 @@ CREATE TABLE "tblUsers" (
"id" SERIAL UNIQUE, "id" SERIAL UNIQUE,
"login" varchar(50) default NULL, "login" varchar(50) default NULL,
"pwd" varchar(50) default NULL, "pwd" varchar(50) default NULL,
"secret" varchar(50) default NULL,
"fullName" varchar(100) default NULL, "fullName" varchar(100) default NULL,
"email" varchar(70) default NULL, "email" varchar(70) default NULL,
"language" varchar(32) NOT NULL, "language" varchar(32) NOT NULL,
@ -82,18 +68,6 @@ CREATE TABLE "tblUsers" (
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Table structure for table `tblUserSubstitutes`
--
CREATE TABLE "tblUserSubstitutes" (
"id" SERIAL UNIQUE,
"user" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE,
"substitute" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE
);
-- --------------------------------------------------------
-- --
-- Table structure for table "tblUserPasswordRequest" -- Table structure for table "tblUserPasswordRequest"
-- --
@ -251,7 +225,6 @@ CREATE TABLE "tblDocumentContent" (
"mimeType" varchar(100) NOT NULL default '', "mimeType" varchar(100) NOT NULL default '',
"fileSize" BIGINT, "fileSize" BIGINT,
"checksum" char(32), "checksum" char(32),
"revisiondate" TIMESTAMP default NULL,
UNIQUE ("document","version") UNIQUE ("document","version")
) ; ) ;
@ -317,21 +290,6 @@ CREATE TABLE "tblDocumentLocks" (
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Table structure for table `tblDocumentCheckOuts`
--
CREATE TABLE "tblDocumentCheckOuts" (
"document" INTEGER REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
"version" INTEGER NOT NULL default '0',
"userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id"),
"date" TEXT NOT NULL,
"filename" varchar(255) NOT NULL default '',
UNIQUE ("document")
) ;
-- --------------------------------------------------------
-- --
-- Table structure for table "tblDocumentReviewers" -- Table structure for table "tblDocumentReviewers"
-- --
@ -362,67 +320,6 @@ CREATE TABLE "tblDocumentReviewLog" (
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Table structure for table `tblDocumentRecipients`
--
CREATE TABLE "tblDocumentRecipients" (
"receiptID" SERIAL UNIQUE,
"documentID" INTEGER NOT NULL default '0' REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
"version" INTEGER NOT NULL default '0',
"type" INTEGER NOT NULL default '0',
"required" INTEGER NOT NULL default '0',
UNIQUE ("documentID","version","type","required")
) ;
-- --------------------------------------------------------
--
-- Table structure for table "tblDocumentReceiptLog"
--
CREATE TABLE "tblDocumentReceiptLog" (
"receiptLogID" SERIAL UNIQUE,
"receiptID" INTEGER NOT NULL default 0 REFERENCES "tblDocumentRecipients" ("receiptID") ON DELETE CASCADE,
"status" INTEGER NOT NULL default 0,
"comment" TEXT NOT NULL,
"date" TEXT NOT NULL,
"userID" INTEGER NOT NULL default 0 REFERENCES "tblUsers" ("id") ON DELETE CASCADE
) ;
-- --------------------------------------------------------
--
-- Table structure for table `tblDocumentRevisors`
--
CREATE TABLE "tblDocumentRevisors" (
"revisionID" SERIAL UNIQUE,
"documentID" INTEGER NOT NULL default '0' REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
"version" INTEGER NOT NULL default '0',
"type" INTEGER NOT NULL default '0',
"required" INTEGER NOT NULL default '0',
"startdate" TIMESTAMP default NULL,
UNIQUE ("documentID","version","type","required")
) ;
-- --------------------------------------------------------
--
-- Table structure for table "tblDocumentRevisionLog"
--
CREATE TABLE "tblDocumentRevisionLog" (
"revisionLogID" SERIAL UNIQUE,
"revisionID" INTEGER NOT NULL default 0 REFERENCES "tblDocumentRevisors" ("revisionID") ON DELETE CASCADE,
"status" INTEGER NOT NULL default 0,
"comment" TEXT NOT NULL,
"date" TIMESTAMP default NULL,
"userID" INTEGER NOT NULL default 0 REFERENCES "tblUsers" ("id") ON DELETE CASCADE
) ;
-- --------------------------------------------------------
-- --
-- Table structure for table "tblDocumentStatus" -- Table structure for table "tblDocumentStatus"
-- --
@ -617,8 +514,7 @@ CREATE TABLE "tblWorkflowActions" (
CREATE TABLE "tblWorkflows" ( CREATE TABLE "tblWorkflows" (
"id" SERIAL UNIQUE, "id" SERIAL UNIQUE,
"name" text NOT NULL, "name" text NOT NULL,
"initstate" INTEGER NOT NULL REFERENCES "tblWorkflowStates" ("id") ON DELETE CASCADE, "initstate" INTEGER NOT NULL REFERENCES "tblWorkflowStates" ("id") ON DELETE CASCADE
"layoutdata" text default NULL
) ; ) ;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -663,29 +559,15 @@ CREATE TABLE "tblWorkflowTransitionGroups" (
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Table structure for workflow document relation
--
CREATE TABLE "tblWorkflowDocumentContent" (
"id" SERIAL UNIQUE,
"parent" INTEGER DEFAULT NULL REFERENCES "tblWorkflowDocumentContent" ("id") ON DELETE CASCADE,
"workflow" INTEGER DEFAULT NULL REFERENCES "tblWorkflows" ("id") ON DELETE CASCADE,
"document" INTEGER DEFAULT NULL REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
"version" INTEGER DEFAULT NULL,
"state" INTEGER DEFAULT NULL REFERENCES "tblWorkflowStates" ("id") ON DELETE CASCADE,
"date" TIMESTAMP default NULL
) ;
-- --------------------------------------------------------
-- --
-- Table structure for workflow log -- Table structure for workflow log
-- --
CREATE TABLE "tblWorkflowLog" ( CREATE TABLE "tblWorkflowLog" (
"id" SERIAL UNIQUE, "id" SERIAL UNIQUE,
"workflowdocumentcontent" INTEGER DEFAULT NULL REFERENCES "tblWorkflowDocumentContent" ("id") ON DELETE CASCADE, "document" INTEGER default NULL REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
"version" INTEGER default NULL,
"workflow" INTEGER default NULL REFERENCES "tblWorkflows" ("id") ON DELETE CASCADE,
"userid" INTEGER default NULL REFERENCES "tblUsers" ("id") ON DELETE CASCADE, "userid" INTEGER default NULL REFERENCES "tblUsers" ("id") ON DELETE CASCADE,
"transition" INTEGER default NULL REFERENCES "tblWorkflowTransitions" ("id") ON DELETE CASCADE, "transition" INTEGER default NULL REFERENCES "tblWorkflowTransitions" ("id") ON DELETE CASCADE,
"date" TIMESTAMP default NULL, "date" TIMESTAMP default NULL,
@ -694,6 +576,21 @@ CREATE TABLE "tblWorkflowLog" (
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Table structure for workflow document relation
--
CREATE TABLE "tblWorkflowDocumentContent" (
"parentworkflow" INTEGER DEFAULT 0,
"workflow" INTEGER DEFAULT NULL REFERENCES "tblWorkflows" ("id") ON DELETE CASCADE,
"document" INTEGER DEFAULT NULL REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
"version" INTEGER DEFAULT NULL,
"state" INTEGER DEFAULT NULL REFERENCES "tblWorkflowStates" ("id") ON DELETE CASCADE,
"date" TIMESTAMP default NULL
) ;
-- --------------------------------------------------------
-- --
-- Table structure for mandatory workflows -- Table structure for mandatory workflows
-- --
@ -706,101 +603,6 @@ CREATE TABLE "tblWorkflowMandatoryWorkflow" (
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Table structure for transmittal
--
CREATE TABLE "tblTransmittals" (
"id" SERIAL UNIQUE,
"name" text NOT NULL,
"comment" text NOT NULL,
"userID" INTEGER NOT NULL default '0' REFERENCES "tblUsers" ("id") ON DELETE CASCADE,
"date" TIMESTAMP default NULL,
"public" INTEGER NOT NULL default '0'
);
-- --------------------------------------------------------
--
-- Table structure for transmittal item
--
CREATE TABLE "tblTransmittalItems" (
"id" SERIAL UNIQUE,
"transmittal" INTEGER NOT NULL DEFAULT '0' REFERENCES "tblTransmittals" ("id") ON DELETE CASCADE,
"document" INTEGER default NULL REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
"version" INTEGER NOT NULL default '0',
"date" TIMESTAMP default NULL,
UNIQUE (transmittal, document, version)
);
-- --------------------------------------------------------
--
-- Table structure for access request objects
--
CREATE TABLE "tblAros" (
"id" SERIAL UNIQUE,
"parent" INTEGER,
"model" TEXT NOT NULL,
"foreignid" INTEGER NOT NULL DEFAULT '0',
"alias" TEXT
) ;
-- --------------------------------------------------------
--
-- Table structure for access control objects
--
CREATE TABLE "tblAcos" (
"id" SERIAL UNIQUE,
"parent" INTEGER,
"model" TEXT NOT NULL,
"foreignid" INTEGER NOT NULL DEFAULT '0',
"alias" TEXT
) ;
-- --------------------------------------------------------
--
-- Table structure for acos/aros relation
--
CREATE TABLE "tblArosAcos" (
"id" SERIAL UNIQUE,
"aro" INTEGER NOT NULL DEFAULT '0' REFERENCES "tblAros" ("id") ON DELETE CASCADE,
"aco" INTEGER NOT NULL DEFAULT '0' REFERENCES "tblAcos" ("id") ON DELETE CASCADE,
"create" INTEGER NOT NULL DEFAULT '-1',
"read" INTEGER NOT NULL DEFAULT '-1',
"update" INTEGER NOT NULL DEFAULT '-1',
"delete" INTEGER NOT NULL DEFAULT '-1',
UNIQUE (aco, aro)
) ;
-- --------------------------------------------------------
--
-- Table structure for tblSchedulerTask
--
CREATE TABLE "tblSchedulerTask" (
"id" SERIAL UNIQUE,
"name" varchar(100) DEFAULT NULL,
"description" TEXT DEFAULT NULL,
"disabled" INTEGER NOT NULL DEFAULT '0',
"extension" varchar(100) DEFAULT NULL,
"task" varchar(100) DEFAULT NULL,
"frequency" varchar(100) DEFAULT NULL,
"params" TEXT DEFAULT NULL,
"nextrun" TIMESTAMP DEFAULT NULL,
"lastrun" TIMESTAMP DEFAULT NULL
) ;
-- --------------------------------------------------------
-- --
-- Table structure for version -- Table structure for version
-- --
@ -818,16 +620,10 @@ CREATE TABLE "tblVersion" (
-- Initial content for database -- Initial content for database
-- --
INSERT INTO "tblRoles" ("id", "name", "role") VALUES (1, 'Admin', 1); INSERT INTO "tblUsers" VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Administrator', 'info@seeddms.org', '', '', '', 1, 0, NULL, 0, 0, 0, NULL);
SELECT nextval('"tblRoles_id_seq"');
INSERT INTO "tblRoles" ("id", "name", "role") VALUES (2, 'Guest', 2);
SELECT nextval('"tblRoles_id_seq"');
INSERT INTO "tblRoles" ("id", "name", "role") VALUES (3, 'User', 0);
SELECT nextval('"tblRoles_id_seq"');
INSERT INTO "tblUsers" VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', '', 'Administrator', 'info@seeddms.org', '', '', '', 1, 0, NULL, 0, 0, 0, NULL);
SELECT nextval('"tblUsers_id_seq"'); SELECT nextval('"tblUsers_id_seq"');
INSERT INTO "tblUsers" VALUES (2, 'guest', NULL, '', 'Guest User', NULL, '', '', '', 2, 0, NULL, 0, 0, 0, NULL); INSERT INTO "tblUsers" VALUES (2, 'guest', NULL, 'Guest User', NULL, '', '', '', 2, 0, NULL, 0, 0, 0, NULL);
SELECT nextval('"tblUsers_id_seq"'); SELECT nextval('"tblUsers_id_seq"');
INSERT INTO "tblFolders" VALUES (1, 'DMS', 0, '', 'DMS root', extract(epoch from now()), 1, 0, 2, 0); INSERT INTO "tblFolders" VALUES (1, 'DMS', 0, '', 'DMS root', extract(epoch from now()), 1, 0, 2, 0);
SELECT nextval('"tblFolders_id_seq"'); SELECT nextval('"tblFolders_id_seq"');
INSERT INTO "tblVersion" VALUES (CURRENT_TIMESTAMP, 6, 0, 0); INSERT INTO "tblVersion" VALUES (CURRENT_TIMESTAMP, 5, 1, 0);

View File

@ -43,20 +43,6 @@ CREATE TABLE `tblAttributeDefinitions` (
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Table structure for table `tblRoles`
--
CREATE TABLE `tblRoles` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` varchar(50) default NULL,
`role` INTEGER NOT NULL default '0',
`noaccess` varchar(30) NOT NULL default '',
UNIQUE (`name`)
) ;
-- --------------------------------------------------------
-- --
-- Table structure for table `tblUsers` -- Table structure for table `tblUsers`
-- --
@ -65,13 +51,12 @@ CREATE TABLE `tblUsers` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT, `id` INTEGER PRIMARY KEY AUTOINCREMENT,
`login` varchar(50) default NULL, `login` varchar(50) default NULL,
`pwd` varchar(50) default NULL, `pwd` varchar(50) default NULL,
`secret` varchar(50) default NULL,
`fullName` varchar(100) default NULL, `fullName` varchar(100) default NULL,
`email` varchar(70) default NULL, `email` varchar(70) default NULL,
`language` varchar(32) NOT NULL, `language` varchar(32) NOT NULL,
`theme` varchar(32) NOT NULL, `theme` varchar(32) NOT NULL,
`comment` text NOT NULL, `comment` text NOT NULL,
`role` INTEGER NOT NULL REFERENCES `tblRoles` (`id`), `role` INTEGER NOT NULL default '0',
`hidden` INTEGER NOT NULL default '0', `hidden` INTEGER NOT NULL default '0',
`pwdExpiration` TEXT default NULL, `pwdExpiration` TEXT default NULL,
`loginfailures` INTEGER NOT NULL default '0', `loginfailures` INTEGER NOT NULL default '0',
@ -83,19 +68,6 @@ CREATE TABLE `tblUsers` (
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Table structure for table `tblUserSubstitutes`
--
CREATE TABLE `tblUserSubstitutes` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`user` INTEGER NOT NULL default '0' REFERENCES `tblUsers` (`id`) ON DELETE CASCADE,
`substitute` INTEGER NOT NULL default '0' REFERENCES `tblUsers` (`id`) ON DELETE CASCADE,
UNIQUE (`user`, `substitute`)
);
-- --------------------------------------------------------
-- --
-- Table structure for table `tblUserPasswordRequest` -- Table structure for table `tblUserPasswordRequest`
-- --
@ -163,7 +135,7 @@ CREATE TABLE `tblFolderAttributes` (
`folder` INTEGER default NULL REFERENCES `tblFolders` (`id`) ON DELETE CASCADE, `folder` INTEGER default NULL REFERENCES `tblFolders` (`id`) ON DELETE CASCADE,
`attrdef` INTEGER default NULL REFERENCES `tblAttributeDefinitions` (`id`), `attrdef` INTEGER default NULL REFERENCES `tblAttributeDefinitions` (`id`),
`value` text default NULL, `value` text default NULL,
UNIQUE (`folder`, `attrdef`) UNIQUE (folder, attrdef)
) ; ) ;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -199,7 +171,7 @@ CREATE TABLE `tblDocumentAttributes` (
`document` INTEGER default NULL REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE, `document` INTEGER default NULL REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
`attrdef` INTEGER default NULL REFERENCES `tblAttributeDefinitions` (`id`), `attrdef` INTEGER default NULL REFERENCES `tblAttributeDefinitions` (`id`),
`value` text default NULL, `value` text default NULL,
UNIQUE (`document`, `attrdef`) UNIQUE (document, attrdef)
) ; ) ;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -216,7 +188,6 @@ CREATE TABLE `tblDocumentApprovers` (
`required` INTEGER NOT NULL default '0', `required` INTEGER NOT NULL default '0',
UNIQUE (`documentID`,`version`,`type`,`required`) UNIQUE (`documentID`,`version`,`type`,`required`)
) ; ) ;
CREATE INDEX `indDocumentApproversRequired` ON `tblDocumentApprovers` (`required`);
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -232,7 +203,6 @@ CREATE TABLE `tblDocumentApproveLog` (
`date` TEXT NOT NULL, `date` TEXT NOT NULL,
`userID` INTEGER NOT NULL default '0' REFERENCES `tblUsers` (`id`) ON DELETE CASCADE `userID` INTEGER NOT NULL default '0' REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
) ; ) ;
CREATE INDEX `indDocumentApproveLogApproveID` ON `tblDocumentApproveLog` (`approveID`);
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -253,7 +223,6 @@ CREATE TABLE `tblDocumentContent` (
`mimeType` varchar(100) NOT NULL default '', `mimeType` varchar(100) NOT NULL default '',
`fileSize` INTEGER, `fileSize` INTEGER,
`checksum` char(32), `checksum` char(32),
`revisiondate` TEXT default NULL,
UNIQUE (`document`,`version`) UNIQUE (`document`,`version`)
) ; ) ;
@ -268,7 +237,7 @@ CREATE TABLE `tblDocumentContentAttributes` (
`content` INTEGER default NULL REFERENCES `tblDocumentContent` (`id`) ON DELETE CASCADE, `content` INTEGER default NULL REFERENCES `tblDocumentContent` (`id`) ON DELETE CASCADE,
`attrdef` INTEGER default NULL REFERENCES `tblAttributeDefinitions` (`id`), `attrdef` INTEGER default NULL REFERENCES `tblAttributeDefinitions` (`id`),
`value` text default NULL, `value` text default NULL,
UNIQUE (`content`, `attrdef`) UNIQUE (content, attrdef)
) ; ) ;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -319,21 +288,6 @@ CREATE TABLE `tblDocumentLocks` (
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Table structure for table `tblDocumentCheckOuts`
--
CREATE TABLE `tblDocumentCheckOuts` (
`document` INTEGER REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
`version` INTEGER unsigned NOT NULL default '0',
`userID` INTEGER NOT NULL default '0' REFERENCES `tblUsers` (`id`),
`date` TEXT NOT NULL,
`filename` varchar(255) NOT NULL default '',
UNIQUE (`document`)
) ;
-- --------------------------------------------------------
-- --
-- Table structure for table `tblDocumentReviewers` -- Table structure for table `tblDocumentReviewers`
-- --
@ -346,7 +300,6 @@ CREATE TABLE `tblDocumentReviewers` (
`required` INTEGER NOT NULL default '0', `required` INTEGER NOT NULL default '0',
UNIQUE (`documentID`,`version`,`type`,`required`) UNIQUE (`documentID`,`version`,`type`,`required`)
) ; ) ;
CREATE INDEX `indDocumentReviewersRequired` ON `tblDocumentReviewers` (`required`);
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -362,72 +315,6 @@ CREATE TABLE `tblDocumentReviewLog` (
`date` TEXT NOT NULL, `date` TEXT NOT NULL,
`userID` INTEGER NOT NULL default 0 REFERENCES `tblUsers` (`id`) ON DELETE CASCADE `userID` INTEGER NOT NULL default 0 REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
) ; ) ;
CREATE INDEX `indDocumentReviewLogReviewID` ON `tblDocumentReviewLog` (`reviewID`);
-- --------------------------------------------------------
--
-- Table structure for table `tblDocumentRecipients`
--
CREATE TABLE `tblDocumentRecipients` (
`receiptID` INTEGER PRIMARY KEY AUTOINCREMENT,
`documentID` INTEGER NOT NULL default '0' REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
`version` INTEGER unsigned NOT NULL default '0',
`type` INTEGER NOT NULL default '0',
`required` INTEGER NOT NULL default '0',
UNIQUE (`documentID`,`version`,`type`,`required`)
) ;
CREATE INDEX `indDocumentRecipientsRequired` ON `tblDocumentRecipients` (`required`);
-- --------------------------------------------------------
--
-- Table structure for table `tblDocumentReceiptLog`
--
CREATE TABLE `tblDocumentReceiptLog` (
`receiptLogID` INTEGER PRIMARY KEY AUTOINCREMENT,
`receiptID` INTEGER NOT NULL default 0 REFERENCES `tblDocumentRecipients` (`receiptID`) ON DELETE CASCADE,
`status` INTEGER NOT NULL default 0,
`comment` TEXT NOT NULL,
`date` TEXT NOT NULL,
`userID` INTEGER NOT NULL default 0 REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
) ;
CREATE INDEX `indDocumentReceiptLogReceiptID` ON `tblDocumentReceiptLog` (`receiptID`);
-- --------------------------------------------------------
--
-- Table structure for table `tblDocumentRevisors`
--
CREATE TABLE `tblDocumentRevisors` (
`revisionID` INTEGER PRIMARY KEY AUTOINCREMENT,
`documentID` INTEGER NOT NULL default '0' REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
`version` INTEGER unsigned NOT NULL default '0',
`type` INTEGER NOT NULL default '0',
`required` INTEGER NOT NULL default '0',
`startdate` TEXT default NULL,
UNIQUE (`documentID`,`version`,`type`,`required`)
) ;
CREATE INDEX `indDocumentRevisorsRequired` ON `tblDocumentRevisors` (`required`);
-- --------------------------------------------------------
--
-- Table structure for table `tblDocumentRevisionLog`
--
CREATE TABLE `tblDocumentRevisionLog` (
`revisionLogID` INTEGER PRIMARY KEY AUTOINCREMENT,
`revisionID` INTEGER NOT NULL default 0 REFERENCES `tblDocumentRevisors` (`revisionID`) ON DELETE CASCADE,
`status` INTEGER NOT NULL default 0,
`comment` TEXT NOT NULL,
`date` TEXT NOT NULL,
`userID` INTEGER NOT NULL default 0 REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
) ;
CREATE INDEX `indDocumentRevisionLogRevisionID` ON `tblDocumentRevisionLog` (`revisionID`);
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -456,7 +343,6 @@ CREATE TABLE `tblDocumentStatusLog` (
`date` TEXT NOT NULL, `date` TEXT NOT NULL,
`userID` INTEGER NOT NULL default '0' REFERENCES `tblUsers` (`id`) ON DELETE CASCADE `userID` INTEGER NOT NULL default '0' REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
) ; ) ;
CREATE INDEX `indDocumentStatusLogStatusID` ON `tblDocumentStatusLog` (`StatusID`);
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -626,8 +512,7 @@ CREATE TABLE `tblWorkflowActions` (
CREATE TABLE `tblWorkflows` ( CREATE TABLE `tblWorkflows` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT, `id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` text NOT NULL, `name` text NOT NULL,
`initstate` INTEGER NOT NULL REFERENCES `tblWorkflowStates` (`id`) ON DELETE CASCADE, `initstate` INTEGER NOT NULL REFERENCES `tblWorkflowStates` (`id`) ON DELETE CASCADE
`layoutdata` text default NULL
) ; ) ;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -672,29 +557,15 @@ CREATE TABLE `tblWorkflowTransitionGroups` (
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Table structure for table `tblWorkflowDocumentContent`
--
CREATE TABLE `tblWorkflowDocumentContent` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`parent` INTEGER DEFAULT NULL REFERENCES `tblWorkflowDocumentContent` (`id`) ON DELETE CASCADE,
`workflow` INTEGER DEFAULT NULL REFERENCES `tblWorkflows` (`id`) ON DELETE CASCADE,
`document` INTEGER DEFAULT NULL REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
`version` INTEGER DEFAULT NULL,
`state` INTEGER DEFAULT NULL REFERENCES `tblWorkflowStates` (`id`) ON DELETE CASCADE,
`date` datetime NOT NULL
) ;
-- --------------------------------------------------------
-- --
-- Table structure for table `tblWorkflowLog` -- Table structure for table `tblWorkflowLog`
-- --
CREATE TABLE `tblWorkflowLog` ( CREATE TABLE `tblWorkflowLog` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT, `id` INTEGER PRIMARY KEY AUTOINCREMENT,
`workflowdocumentcontent` INTEGER DEFAULT NULL REFERENCES `tblWorkflowDocumentContent` (`id`) ON DELETE CASCADE, `document` INTEGER default NULL REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
`version` INTEGER default NULL,
`workflow` INTEGER default NULL REFERENCES `tblWorkflows` (`id`) ON DELETE CASCADE,
`userid` INTEGER default NULL REFERENCES `tblUsers` (`id`) ON DELETE CASCADE, `userid` INTEGER default NULL REFERENCES `tblUsers` (`id`) ON DELETE CASCADE,
`transition` INTEGER default NULL REFERENCES `tblWorkflowTransitions` (`id`) ON DELETE CASCADE, `transition` INTEGER default NULL REFERENCES `tblWorkflowTransitions` (`id`) ON DELETE CASCADE,
`date` datetime NOT NULL, `date` datetime NOT NULL,
@ -703,6 +574,21 @@ CREATE TABLE `tblWorkflowLog` (
-- -------------------------------------------------------- -- --------------------------------------------------------
--
-- Table structure for table `tblWorkflowDocumentContent`
--
CREATE TABLE `tblWorkflowDocumentContent` (
`parentworkflow` INTEGER DEFAULT 0,
`workflow` INTEGER DEFAULT NULL REFERENCES `tblWorkflows` (`id`) ON DELETE CASCADE,
`document` INTEGER DEFAULT NULL REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
`version` INTEGER DEFAULT NULL,
`state` INTEGER DEFAULT NULL REFERENCES `tblWorkflowStates` (`id`) ON DELETE CASCADE,
`date` datetime NOT NULL
) ;
-- --------------------------------------------------------
-- --
-- Table structure for table `tblWorkflowMandatoryWorkflow` -- Table structure for table `tblWorkflowMandatoryWorkflow`
-- --
@ -710,102 +596,7 @@ CREATE TABLE `tblWorkflowLog` (
CREATE TABLE `tblWorkflowMandatoryWorkflow` ( CREATE TABLE `tblWorkflowMandatoryWorkflow` (
`userid` INTEGER default NULL REFERENCES `tblUsers` (`id`) ON DELETE CASCADE, `userid` INTEGER default NULL REFERENCES `tblUsers` (`id`) ON DELETE CASCADE,
`workflow` INTEGER default NULL REFERENCES `tblWorkflows` (`id`) ON DELETE CASCADE, `workflow` INTEGER default NULL REFERENCES `tblWorkflows` (`id`) ON DELETE CASCADE,
UNIQUE(`userid`, `workflow`) UNIQUE(userid, workflow)
) ;
-- --------------------------------------------------------
--
-- Table structure for transmittal
--
CREATE TABLE `tblTransmittals` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` text NOT NULL,
`comment` text NOT NULL,
`userID` INTEGER NOT NULL default '0' REFERENCES `tblUsers` (`id`) ON DELETE CASCADE,
`date` TEXT default NULL,
`public` INTEGER NOT NULL default '0'
);
-- --------------------------------------------------------
--
-- Table structure for transmittal item
--
CREATE TABLE `tblTransmittalItems` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`transmittal` INTEGER NOT NULL DEFAULT '0' REFERENCES `tblTransmittals` (`id`) ON DELETE CASCADE,
`document` INTEGER default NULL REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
`version` INTEGER unsigned NOT NULL default '0',
`date` TEXT default NULL,
UNIQUE (`transmittal`, `document`, `version`)
);
-- --------------------------------------------------------
--
-- Table structure for access request objects
--
CREATE TABLE `tblAros` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`parent` INTEGER,
`model` TEXT NOT NULL,
`foreignid` INTEGER NOT NULL DEFAULT '0',
`alias` TEXT
) ;
-- --------------------------------------------------------
--
-- Table structure for access control objects
--
CREATE TABLE `tblAcos` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`parent` INTEGER,
`model` TEXT NOT NULL,
`foreignid` INTEGER NOT NULL DEFAULT '0',
`alias` TEXT
) ;
-- --------------------------------------------------------
--
-- Table structure for acos/aros relation
--
CREATE TABLE `tblArosAcos` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`aro` INTEGER NOT NULL DEFAULT '0' REFERENCES `tblAros` (`id`) ON DELETE CASCADE,
`aco` INTEGER NOT NULL DEFAULT '0' REFERENCES `tblAcos` (`id`) ON DELETE CASCADE,
`create` INTEGER NOT NULL DEFAULT '-1',
`read` INTEGER NOT NULL DEFAULT '-1',
`update` INTEGER NOT NULL DEFAULT '-1',
`delete` INTEGER NOT NULL DEFAULT '-1',
UNIQUE (`aco`, `aro`)
) ;
-- --------------------------------------------------------
--
-- Table structure for table `tblSchedulerTask`
--
CREATE TABLE `tblSchedulerTask` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` varchar(100) DEFAULT NULL,
`description` TEXT DEFAULT NULL,
`disabled` INTEGER NOT NULL DEFAULT '0',
`extension` varchar(100) DEFAULT NULL,
`task` varchar(100) DEFAULT NULL,
`frequency` varchar(100) DEFAULT NULL,
`params` TEXT DEFAULT NULL,
`nextrun` TEXT DEFAULT NULL,
`lastrun` TEXT DEFAULT NULL
) ; ) ;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -827,10 +618,7 @@ CREATE TABLE `tblVersion` (
-- Initial content for database -- Initial content for database
-- --
INSERT INTO `tblRoles` (`id`, `name`, `role`) VALUES (1, 'Admin', 1);
INSERT INTO `tblRoles` (`id`, `name`, `role`) VALUES (2, 'Guest', 2);
INSERT INTO `tblRoles` (`id`, `name`, `role`) VALUES (3, 'User', 0);
INSERT INTO `tblUsers` (`id`, `login`, `pwd`, `fullName`, `email`, `language`, `theme`, `comment`, `role`, `hidden`, `pwdExpiration`, `loginfailures`, `disabled`, `quota`, `homefolder`) VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Administrator', 'info@seeddms.org', '', '', '', 1, 0, '', 0, 0, 0, NULL); INSERT INTO `tblUsers` (`id`, `login`, `pwd`, `fullName`, `email`, `language`, `theme`, `comment`, `role`, `hidden`, `pwdExpiration`, `loginfailures`, `disabled`, `quota`, `homefolder`) VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Administrator', 'info@seeddms.org', '', '', '', 1, 0, '', 0, 0, 0, NULL);
INSERT INTO `tblUsers` (`id`, `login`, `pwd`, `fullName`, `email`, `language`, `theme`, `comment`, `role`, `hidden`, `pwdExpiration`, `loginfailures`, `disabled`, `quota`, `homefolder`) VALUES (2, 'guest', NULL, 'Guest User', NULL, '', '', '', 2, 0, '', 0, 0, 0, NULL); INSERT INTO `tblUsers` (`id`, `login`, `pwd`, `fullName`, `email`, `language`, `theme`, `comment`, `role`, `hidden`, `pwdExpiration`, `loginfailures`, `disabled`, `quota`, `homefolder`) VALUES (2, 'guest', NULL, 'Guest User', NULL, '', '', '', 2, 0, '', 0, 0, 0, NULL);
INSERT INTO `tblFolders` (`id`, `name`, `parent`, `folderList`, `comment`, `date`, `owner`, `inheritAccess`, `defaultAccess`, `sequence`) VALUES (1, 'DMS', NULL, '', 'DMS root', strftime('%s','now'), 1, 0, 2, 0); INSERT INTO `tblFolders` (`id`, `name`, `parent`, `folderList`, `comment`, `date`, `owner`, `inheritAccess`, `defaultAccess`, `sequence`) VALUES (1, 'DMS', NULL, '', 'DMS root', strftime('%s','now'), 1, 0, 2, 0);
INSERT INTO `tblVersion` VALUES (DATETIME(), 6, 0, 0); INSERT INTO `tblVersion` VALUES (DATETIME(), 5, 1, 0);

View File

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

View File

@ -62,6 +62,7 @@ function fileExistsInIncludePath($file) { /* {{{ */
/** /**
* Load default settings + set * Load default settings + set
*/ */
require_once '../vendor/autoload.php';
require_once('../inc/inc.Version.php'); require_once('../inc/inc.Version.php');
$ver = new SeedDMS_Version(); $ver = new SeedDMS_Version();
define("SEEDDMS_INSTALL", "on"); define("SEEDDMS_INSTALL", "on");
@ -69,7 +70,7 @@ define("SEEDDMS_VERSION", $ver->version());
require_once('../inc/inc.ClassSettings.php'); require_once('../inc/inc.ClassSettings.php');
$configDir = Settings::getConfigDir(); $configDir = Seeddms\Seeddms\Settings::getConfigDir();
/** /**
* Check if ENABLE_INSTALL_TOOL exists in config dir * Check if ENABLE_INSTALL_TOOL exists in config dir
@ -92,8 +93,7 @@ if (!file_exists($configDir."/settings.xml")) {
} }
// Set folders settings // Set folders settings
$settings = new Settings(); $settings = new Seeddms\Seeddms\Settings($configDir."/settings.xml");
$settings->load($configDir."/settings.xml");
$rootDir = realpath (".."); $rootDir = realpath ("..");
$installPath = realpath ("install.php"); $installPath = realpath ("install.php");

View File

@ -1,181 +0,0 @@
START TRANSACTION;
ALTER TABLE "tblDocumentContent" ADD COLUMN "revisiondate" TIMESTAMP default NULL;
ALTER TABLE "tblUsers" ADD COLUMN "secret" varchar(50) default NULL;
ALTER TABLE "tblWorkflows" ADD COLUMN "layoutdata" text default NULL;
ALTER TABLE "tblWorkflowDocumentContent" ADD COLUMN "id" SERIAL UNIQUE;
ALTER TABLE "tblWorkflowLog" ADD COLUMN "workflowdocumentcontent" INTEGER NOT NULL DEFAULT '0';
UPDATE "tblWorkflowLog" SET "workflowdocumentcontent" = "tblWorkflowDocumentContent"."id" FROM "tblWorkflowDocumentContent" WHERE "tblWorkflowLog"."document" = "tblWorkflowDocumentContent"."document" AND "tblWorkflowLog"."version" = "tblWorkflowDocumentContent"."version" AND "tblWorkflowLog"."workflow" = "tblWorkflowDocumentContent"."workflow";
INSERT INTO "tblWorkflowDocumentContent" ("parentworkflow", "workflow", "document", "version", "state", "date") SELECT 0 AS "parentworkflow", "workflow", "document", "version", NULL AS "state", max("date") AS "date" FROM "tblWorkflowLog" WHERE "workflowdocumentcontent" = 0 GROUP BY "workflow", "document", "version";
UPDATE "tblWorkflowLog" SET "workflowdocumentcontent" = "tblWorkflowDocumentContent"."id" FROM "tblWorkflowDocumentContent" WHERE "tblWorkflowLog"."document" = "tblWorkflowDocumentContent"."document" AND "tblWorkflowLog"."version" = "tblWorkflowDocumentContent"."version" AND "tblWorkflowLog"."workflow" = "tblWorkflowDocumentContent"."workflow";
ALTER TABLE "tblWorkflowLog" ADD CONSTRAINT "tblWorkflowLog_workflowdocumentcontent" FOREIGN KEY ("workflowdocumentcontent") REFERENCES "tblWorkflowDocumentContent" ("id") ON DELETE CASCADE;
ALTER TABLE "tblWorkflowDocumentContent" ADD COLUMN "parent" INTEGER DEFAULT NULL;
ALTER TABLE "tblWorkflowDocumentContent" ADD CONSTRAINT "tblWorkflowDocumentContent_parent" FOREIGN KEY ("parent") REFERENCES "tblWorkflowDocumentContent" ("id") ON DELETE CASCADE;
ALTER TABLE "tblWorkflowDocumentContent" DROP COLUMN "parentworkflow";
ALTER TABLE "tblWorkflowLog" DROP COLUMN "document";
ALTER TABLE "tblWorkflowLog" DROP COLUMN "version";
ALTER TABLE "tblWorkflowLog" DROP COLUMN "workflow";
CREATE TABLE "tblUserSubstitutes" (
"id" SERIAL UNIQUE,
"user" INTEGER default null,
"substitute" INTEGER default null,
UNIQUE ("user", "substitute"),
CONSTRAINT "tblUserSubstitutes_user" FOREIGN KEY ("user") REFERENCES "tblUsers" ("id") ON DELETE CASCADE,
CONSTRAINT "tblUserSubstitutes_substitute" FOREIGN KEY ("user") REFERENCES "tblUsers" ("id") ON DELETE CASCADE
);
CREATE TABLE "tblDocumentCheckOuts" (
"document" INTEGER NOT NULL default '0',
"version" INTEGER NOT NULL default '0',
"userID" INTEGER NOT NULL default '0',
"date" TIMESTAMP NOT NULL,
"filename" varchar(255) NOT NULL default '',
CONSTRAINT "tblDocumentCheckOuts_document" FOREIGN KEY ("document") REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
CONSTRAINT "tblDocumentCheckOuts_user" FOREIGN KEY ("userID") REFERENCES "tblUsers" ("id") ON DELETE CASCADE
);
CREATE TABLE "tblDocumentRecipients" (
"receiptID" SERIAL UNIQUE,
"documentID" INTEGER NOT NULL default '0',
"version" INTEGER NOT NULL default '0',
"type" INTEGER NOT NULL default '0',
"required" INTEGER NOT NULL default '0',
UNIQUE ("documentID","version","type","required"),
CONSTRAINT "tblDocumentRecipients_document" FOREIGN KEY ("documentID") REFERENCES "tblDocuments" ("id") ON DELETE CASCADE
);
CREATE TABLE "tblDocumentReceiptLog" (
"receiptLogID" SERIAL UNIQUE,
"receiptID" INTEGER NOT NULL default '0',
"status" INTEGER NOT NULL default '0',
"comment" text NOT NULL,
"date" TIMESTAMP NOT NULL,
"userID" INTEGER NOT NULL default '0',
CONSTRAINT "tblDocumentReceiptLog_recipient" FOREIGN KEY ("receiptID") REFERENCES "tblDocumentRecipients" ("receiptID") ON DELETE CASCADE,
CONSTRAINT "tblDocumentReceiptLog_user" FOREIGN KEY ("userID") REFERENCES "tblUsers" ("id") ON DELETE CASCADE
);
CREATE TABLE "tblDocumentRevisors" (
"revisionID" SERIAL UNIQUE,
"documentID" INTEGER NOT NULL default '0',
"version" INTEGER NOT NULL default '0',
"type" INTEGER NOT NULL default '0',
"required" INTEGER NOT NULL default '0',
"startdate" TIMESTAMP default NULL,
UNIQUE ("documentID","version","type","required"),
CONSTRAINT "tblDocumentRevisors_document" FOREIGN KEY ("documentID") REFERENCES "tblDocuments" ("id") ON DELETE CASCADE
);
CREATE TABLE "tblDocumentRevisionLog" (
"revisionLogID" SERIAL UNIQUE,
"revisionID" INTEGER NOT NULL default '0',
"status" INTEGER NOT NULL default '0',
"comment" text NOT NULL,
"date" TIMESTAMP NOT NULL,
"userID" INTEGER NOT NULL default '0',
CONSTRAINT "tblDocumentRevisionLog_revision" FOREIGN KEY ("revisionID") REFERENCES "tblDocumentRevisors" ("revisionID") ON DELETE CASCADE,
CONSTRAINT "tblDocumentRevisionLog_user" FOREIGN KEY ("userID") REFERENCES "tblUsers" ("id") ON DELETE CASCADE
);
CREATE TABLE "tblTransmittals" (
"id" SERIAL UNIQUE,
"name" text NOT NULL,
"comment" text NOT NULL,
"userID" INTEGER NOT NULL default '0',
"date" TIMESTAMP default NULL,
"public" INTEGER NOT NULL default '0',
CONSTRAINT "tblTransmittals_user" FOREIGN KEY ("userID") REFERENCES "tblUsers" ("id") ON DELETE CASCADE
);
CREATE TABLE "tblTransmittalItems" (
"id" SERIAL UNIQUE,
"transmittal" INTEGER NOT NULL DEFAULT '0',
"document" INTEGER default NULL,
"version" INTEGER NOT NULL default '0',
"date" TIMESTAMP default NULL,
UNIQUE ("transmittal", "document", "version"),
CONSTRAINT "tblTransmittalItems_document" FOREIGN KEY ("document") REFERENCES "tblDocuments" ("id") ON DELETE CASCADE,
CONSTRAINT "tblTransmittalItem_transmittal" FOREIGN KEY ("transmittal") REFERENCES "tblTransmittals" ("id") ON DELETE CASCADE
);
CREATE TABLE "tblRoles" (
"id" SERIAL UNIQUE,
"name" varchar(50) default NULL,
"role" INTEGER NOT NULL default '0',
"noaccess" varchar(30) NOT NULL default '',
UNIQUE ("name")
);
INSERT INTO "tblRoles" ("id", "name", "role") VALUES (1, 'Admin', 1);
SELECT nextval('"tblRoles_id_seq"');
INSERT INTO "tblRoles" ("id", "name", "role") VALUES (2, 'Guest', 2);
SELECT nextval('"tblRoles_id_seq"');
INSERT INTO "tblRoles" ("id", "name", "role") VALUES (3, 'User', 0);
SELECT nextval('"tblRoles_id_seq"');
ALTER TABLE "tblUsers" ALTER "role" DROP DEFAULT;
ALTER TABLE "tblUsers" ALTER "role" SET NOT NULL;
UPDATE "tblUsers" SET role=3 WHERE role=0;
ALTER TABLE "tblUsers" ADD CONSTRAINT "tblUsers_role" FOREIGN KEY ("role") REFERENCES "tblRoles" ("id");
CREATE TABLE "tblAros" (
"id" SERIAL UNIQUE,
"parent" INTEGER,
"model" text NOT NULL,
"foreignid" INTEGER NOT NULL DEFAULT '0',
"alias" varchar(255)
);
CREATE TABLE "tblAcos" (
"id" SERIAL UNIQUE,
"parent" INTEGER,
"model" text NOT NULL,
"foreignid" INTEGER NOT NULL DEFAULT '0',
"alias" varchar(255)
);
CREATE TABLE "tblArosAcos" (
"id" SERIAL UNIQUE,
"aro" INTEGER NOT NULL DEFAULT '0',
"aco" INTEGER NOT NULL DEFAULT '0',
"create" INTEGER NOT NULL DEFAULT '-1',
"read" INTEGER NOT NULL DEFAULT '-1',
"update" INTEGER NOT NULL DEFAULT '-1',
"delete" INTEGER NOT NULL DEFAULT '-1',
UNIQUE ("aco", "aro"),
CONSTRAINT "tblArosAcos_acos" FOREIGN KEY ("aco") REFERENCES "tblAcos" ("id") ON DELETE CASCADE,
CONSTRAINT "tblArosAcos_aros" FOREIGN KEY ("aro") REFERENCES "tblAros" ("id") ON DELETE CASCADE
);
CREATE TABLE "tblSchedulerTask" (
"id" SERIAL UNIQUE,
"name" varchar(100) DEFAULT NULL,
"description" TEXT DEFAULT NULL,
"disabled" INTEGER NOT NULL DEFAULT '0',
"extension" varchar(100) DEFAULT NULL,
"task" varchar(100) DEFAULT NULL,
"frequency" varchar(100) DEFAULT NULL,
"params" TEXT DEFAULT NULL,
"nextrun" TIMESTAMP DEFAULT NULL,
"lastrun" TIMESTAMP DEFAULT NULL
) ;
UPDATE "tblVersion" set "major"=6, "minor"=0, "subminor"=0;
COMMIT;

View File

@ -1,206 +0,0 @@
BEGIN;
ALTER TABLE `tblDocumentContent` ADD COLUMN `revisiondate` TEXT default NULL;
ALTER TABLE `tblUsers` ADD COLUMN `secret` varchar(50) default NULL;
ALTER TABLE `tblWorkflows` ADD COLUMN `layoutdata` text default NULL;
CREATE TABLE `new_tblWorkflowDocumentContent` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`parent` INTEGER DEFAULT NULL REFERENCES `tblWorkflowDocumentContent` (`id`) ON DELETE CASCADE,
`workflow` INTEGER DEFAULT NULL REFERENCES `tblWorkflows` (`id`) ON DELETE CASCADE,
`document` INTEGER DEFAULT NULL REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
`version` INTEGER DEFAULT NULL,
`state` INTEGER DEFAULT NULL REFERENCES `tblWorkflowStates` (`id`) ON DELETE CASCADE,
`date` datetime NOT NULL
) ;
INSERT INTO `new_tblWorkflowDocumentContent` (`parent`, `workflow`, `document`, `version`, `state`, `date`) SELECT NULL as `parent`, `workflow`, `document`, `version`, `state`, `date` FROM `tblWorkflowDocumentContent`;
INSERT INTO `new_tblWorkflowDocumentContent` (`parent`, `workflow`, `document`, `version`, `state`, `date`) SELECT NULL, `a`.`workflow`, `a`.`document`, `a`.`version`, NULL AS `state`, max(`a`.`date`) FROM `tblWorkflowLog` `a` LEFT JOIN `tblWorkflowDocumentContent` `b` ON `a`.`document`=`b`.`document` AND `a`.`version`=`b`.`version` AND `a`.`workflow`=`b`.`workflow` WHERE `b`.`document` IS NULL GROUP BY `a`.`document`, `a`.`version`, `a`.`workflow`;
CREATE TABLE `new_tblWorkflowLog` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`workflowdocumentcontent` INTEGER DEFAULT NULL REFERENCES `tblWorkflowDocumentContent` (`id`) ON DELETE CASCADE,
`userid` INTEGER default NULL REFERENCES `tblUsers` (`id`) ON DELETE CASCADE,
`transition` INTEGER default NULL REFERENCES `tblWorkflowTransitions` (`id`) ON DELETE CASCADE,
`date` datetime NOT NULL,
`comment` text
) ;
INSERT INTO `new_tblWorkflowLog` (`id`, `workflowdocumentcontent`, `userid`, `transition`, `date`, `comment`) SELECT `a`.`id`, `b`.`id`, `a`.`userid`, `a`.`transition`, `a`.`date`, `a`.`comment` FROM `tblWorkflowLog` `a` LEFT JOIN `new_tblWorkflowDocumentContent` `b` ON `a`.`document`=`b`.`document` AND `a`.`version`=`b`.`version` AND `a`.`workflow`=`b`.`workflow` WHERE `b`.`document` IS NOT NULL;
DROP TABLE `tblWorkflowLog`;
ALTER TABLE `new_tblWorkflowLog` RENAME TO `tblWorkflowLog`;
DROP TABLE `tblWorkflowDocumentContent`;
ALTER TABLE `new_tblWorkflowDocumentContent` RENAME TO `tblWorkflowDocumentContent`;
CREATE TABLE `tblUserSubstitutes` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`user` INTEGER NOT NULL default '0' REFERENCES `tblUsers` (`id`) ON DELETE CASCADE,
`substitute` INTEGER NOT NULL default '0' REFERENCES `tblUsers` (`id`) ON DELETE CASCADE,
UNIQUE (`user`, `substitute`)
);
CREATE TABLE `tblDocumentCheckOuts` (
`document` INTEGER REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
`version` INTEGER unsigned NOT NULL default '0',
`userID` INTEGER NOT NULL default '0' REFERENCES `tblUsers` (`id`),
`date` TEXT NOT NULL,
`filename` varchar(255) NOT NULL default '',
UNIQUE (`document`)
) ;
CREATE TABLE `tblDocumentRecipients` (
`receiptID` INTEGER PRIMARY KEY AUTOINCREMENT,
`documentID` INTEGER NOT NULL default '0' REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
`version` INTEGER unsigned NOT NULL default '0',
`type` INTEGER NOT NULL default '0',
`required` INTEGER NOT NULL default '0',
UNIQUE (`documentID`,`version`,`type`,`required`)
) ;
CREATE INDEX `indDocumentRecipientsRequired` ON `tblDocumentRecipients` (`required`);
CREATE TABLE `tblDocumentReceiptLog` (
`receiptLogID` INTEGER PRIMARY KEY AUTOINCREMENT,
`receiptID` INTEGER NOT NULL default 0 REFERENCES `tblDocumentRecipients` (`receiptID`) ON DELETE CASCADE,
`status` INTEGER NOT NULL default 0,
`comment` TEXT NOT NULL,
`date` TEXT NOT NULL,
`userID` INTEGER NOT NULL default 0 REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
) ;
CREATE INDEX `indDocumentReceiptLogReceiptID` ON `tblDocumentReceiptLog` (`receiptID`);
CREATE TABLE `tblDocumentRevisors` (
`revisionID` INTEGER PRIMARY KEY AUTOINCREMENT,
`documentID` INTEGER NOT NULL default '0' REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
`version` INTEGER unsigned NOT NULL default '0',
`type` INTEGER NOT NULL default '0',
`required` INTEGER NOT NULL default '0',
`startdate` TEXT default NULL,
UNIQUE (`documentID`,`version`,`type`,`required`)
) ;
CREATE INDEX `indDocumentRevisorsRequired` ON `tblDocumentRevisors` (`required`);
CREATE TABLE `tblDocumentRevisionLog` (
`revisionLogID` INTEGER PRIMARY KEY AUTOINCREMENT,
`revisionID` INTEGER NOT NULL default 0 REFERENCES `tblDocumentRevisors` (`revisionID`) ON DELETE CASCADE,
`status` INTEGER NOT NULL default 0,
`comment` TEXT NOT NULL,
`date` TEXT NOT NULL,
`userID` INTEGER NOT NULL default 0 REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
) ;
CREATE INDEX `indDocumentRevisionLogRevisionID` ON `tblDocumentRevisionLog` (`revisionID`);
CREATE TABLE `tblTransmittals` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` text NOT NULL,
`comment` text NOT NULL,
`userID` INTEGER NOT NULL default '0' REFERENCES `tblUsers` (`id`) ON DELETE CASCADE,
`date` TEXT default NULL,
`public` INTEGER NOT NULL default '0'
);
CREATE TABLE `tblTransmittalItems` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`transmittal` INTEGER NOT NULL DEFAULT '0' REFERENCES `tblTransmittals` (`id`) ON DELETE CASCADE,
`document` INTEGER default NULL REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
`version` INTEGER unsigned NOT NULL default '0',
`date` TEXT default NULL,
UNIQUE (transmittal, document, version)
);
CREATE TABLE `tblRoles` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` varchar(50) default NULL,
`role` INTEGER NOT NULL default '0',
`noaccess` varchar(30) NOT NULL default '',
UNIQUE (`name`)
);
INSERT INTO `tblRoles` (`id`, `name`, `role`) VALUES (1, 'Admin', 1);
INSERT INTO `tblRoles` (`id`, `name`, `role`) VALUES (2, 'Guest', 2);
INSERT INTO `tblRoles` (`id`, `name`, `role`) VALUES (3, 'User', 0);
UPDATE `tblUsers` SET role=3 WHERE role=0;
CREATE TABLE `new_tblUsers` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`login` varchar(50) default NULL,
`pwd` varchar(50) default NULL,
`fullName` varchar(100) default NULL,
`email` varchar(70) default NULL,
`language` varchar(32) NOT NULL,
`theme` varchar(32) NOT NULL,
`comment` text NOT NULL,
`role` INTEGER NOT NULL REFERENCES `tblRoles` (`id`),
`hidden` INTEGER NOT NULL default '0',
`pwdExpiration` TEXT default NULL,
`loginfailures` INTEGER NOT NULL default '0',
`disabled` INTEGER NOT NULL default '0',
`quota` INTEGER,
`homefolder` INTEGER default NULL REFERENCES `tblFolders` (`id`),
`secret` varchar(50) default NULL,
UNIQUE (`login`)
);
INSERT INTO new_tblUsers SELECT * FROM tblUsers;
DROP TABLE tblUsers;
ALTER TABLE new_tblUsers RENAME TO tblUsers;
CREATE TABLE `tblAros` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`parent` INTEGER,
`model` TEXT NOT NULL,
`foreignid` INTEGER NOT NULL DEFAULT '0',
`alias` TEXT
) ;
CREATE TABLE `tblAcos` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`parent` INTEGER,
`model` TEXT NOT NULL,
`foreignid` INTEGER NOT NULL DEFAULT '0',
`alias` TEXT
) ;
CREATE TABLE `tblArosAcos` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`aro` INTEGER NOT NULL DEFAULT '0' REFERENCES `tblAros` (`id`) ON DELETE CASCADE,
`aco` INTEGER NOT NULL DEFAULT '0' REFERENCES `tblAcos` (`id`) ON DELETE CASCADE,
`create` INTEGER NOT NULL DEFAULT '-1',
`read` INTEGER NOT NULL DEFAULT '-1',
`update` INTEGER NOT NULL DEFAULT '-1',
`delete` INTEGER NOT NULL DEFAULT '-1',
UNIQUE (aco, aro)
) ;
CREATE INDEX `indDocumentStatusLogStatusID` ON `tblDocumentStatusLog` (`StatusID`);
CREATE INDEX `indDocumentApproversRequired` ON `tblDocumentApprovers` (`required`);
CREATE INDEX `indDocumentApproveLogApproveID` ON `tblDocumentApproveLog` (`approveID`);
CREATE INDEX `indDocumentReviewersRequired` ON `tblDocumentReviewers` (`required`);
CREATE INDEX `indDocumentReviewLogReviewID` ON `tblDocumentReviewLog` (`reviewID`);
CREATE TABLE `tblSchedulerTask` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` varchar(100) DEFAULT NULL,
`description` TEXT DEFAULT NULL,
`disabled` INTEGER NOT NULL DEFAULT '0',
`extension` varchar(100) DEFAULT NULL,
`task` varchar(100) DEFAULT NULL,
`frequency` varchar(100) DEFAULT NULL,
`params` TEXT DEFAULT NULL,
`nextrun` TEXT DEFAULT NULL,
`lastrun` TEXT DEFAULT NULL
) ;
UPDATE tblVersion set major=6, minor=0, subminor=0;
COMMIT;

View File

@ -1,200 +0,0 @@
START TRANSACTION;
ALTER TABLE `tblDocumentContent` ADD COLUMN `revisiondate` datetime DEFAULT NULL;
ALTER TABLE `tblUsers` ADD COLUMN `secret` varchar(50) DEFAULT NULL AFTER `pwd`;
ALTER TABLE `tblWorkflows` ADD COLUMN `layoutdata` text DEFAULT NULL AFTER `initstate`;
ALTER TABLE `tblWorkflowDocumentContent` ADD COLUMN `id` int(11) NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (`id`);
ALTER TABLE `tblWorkflowLog` ADD COLUMN `workflowdocumentcontent` int(11) NOT NULL DEFAULT '0' AFTER `id`;
UPDATE `tblWorkflowLog` a, `tblWorkflowDocumentContent` b SET a.`workflowdocumentcontent` = b.`id` WHERE a.`document` = b.`document` AND a.`version` = b.`version` AND a.`workflow` = b.`workflow`;
INSERT INTO `tblWorkflowDocumentContent` (`parentworkflow`, `workflow`, `document`, `version`, `state`, `date`) SELECT 0 AS `parentworkflow`, `workflow`, `document`, `version`, NULL AS `state`, max(`date`) AS `date` FROM `tblWorkflowLog` WHERE `workflowdocumentcontent` = 0 GROUP BY `workflow`, `document`, `version`;
UPDATE `tblWorkflowLog` a, `tblWorkflowDocumentContent` b SET a.`workflowdocumentcontent` = b.`id` WHERE a.`document` = b.`document` AND a.`version` = b.`version` AND a.`workflow` = b.`workflow`;
ALTER TABLE `tblWorkflowLog` ADD CONSTRAINT `tblWorkflowLog_workflowdocumentcontent` FOREIGN KEY (`workflowdocumentcontent`) REFERENCES `tblWorkflowDocumentContent` (`id`) ON DELETE CASCADE;
ALTER TABLE `tblWorkflowDocumentContent` ADD COLUMN `parent` int(11) DEFAULT NULL AFTER `id`;
ALTER TABLE `tblWorkflowDocumentContent` ADD CONSTRAINT `tblWorkflowDocumentContent_parent` FOREIGN KEY (`parent`) REFERENCES `tblWorkflowDocumentContent` (`id`) ON DELETE CASCADE;
ALTER TABLE `tblWorkflowDocumentContent` DROP COLUMN `parentworkflow`;
ALTER TABLE `tblWorkflowLog` DROP FOREIGN KEY `tblWorkflowLog_document`;
ALTER TABLE `tblWorkflowLog` DROP COLUMN `document`;
ALTER TABLE `tblWorkflowLog` DROP COLUMN `version`;
ALTER TABLE `tblWorkflowLog` DROP FOREIGN KEY `tblWorkflowLog_workflow`;
ALTER TABLE `tblWorkflowLog` DROP COLUMN `workflow`;
CREATE TABLE `tblUserSubstitutes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user` int(11) DEFAULT null,
`substitute` int(11) DEFAULT null,
PRIMARY KEY (`id`),
UNIQUE (`user`, `substitute`),
CONSTRAINT `tblUserSubstitutes_user` FOREIGN KEY (`user`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblUserSubstitutes_substitute` FOREIGN KEY (`substitute`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tblDocumentCheckOuts` (
`document` int(11) NOT NULL DEFAULT '0',
`version` smallint(5) unsigned NOT NULL DEFAULT '0',
`userID` int(11) NOT NULL DEFAULT '0',
`date` datetime NOT NULL,
`filename` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`document`),
CONSTRAINT `tblDocumentCheckOuts_document` FOREIGN KEY (`document`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblDocumentCheckOuts_user` FOREIGN KEY (`userID`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tblDocumentRecipients` (
`receiptID` int(11) NOT NULL AUTO_INCREMENT,
`documentID` int(11) NOT NULL DEFAULT '0',
`version` smallint(5) unsigned NOT NULL DEFAULT '0',
`type` tinyint(4) NOT NULL DEFAULT '0',
`required` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`receiptID`),
UNIQUE KEY `documentID` (`documentID`,`version`,`type`,`required`),
CONSTRAINT `tblDocumentRecipients_document` FOREIGN KEY (`documentID`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE INDEX `indDocumentRecipientsRequired` ON `tblDocumentRecipients` (`required`);
CREATE TABLE `tblDocumentReceiptLog` (
`receiptLogID` int(11) NOT NULL AUTO_INCREMENT,
`receiptID` int(11) NOT NULL DEFAULT '0',
`status` tinyint(4) NOT NULL DEFAULT '0',
`comment` text NOT NULL,
`date` datetime NOT NULL,
`userID` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`receiptLogID`),
KEY `tblDocumentReceiptLog_receipt` (`receiptID`),
KEY `tblDocumentReceiptLog_user` (`userID`),
CONSTRAINT `tblDocumentReceiptLog_recipient` FOREIGN KEY (`receiptID`) REFERENCES `tblDocumentRecipients` (`receiptID`) ON DELETE CASCADE,
CONSTRAINT `tblDocumentReceiptLog_user` FOREIGN KEY (`userID`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tblDocumentRevisors` (
`revisionID` int(11) NOT NULL AUTO_INCREMENT,
`documentID` int(11) NOT NULL DEFAULT '0',
`version` smallint(5) unsigned NOT NULL DEFAULT '0',
`type` tinyint(4) NOT NULL DEFAULT '0',
`required` int(11) NOT NULL DEFAULT '0',
`startdate` datetime DEFAULT NULL,
PRIMARY KEY (`revisionID`),
UNIQUE KEY `documentID` (`documentID`,`version`,`type`,`required`),
CONSTRAINT `tblDocumentRevisors_document` FOREIGN KEY (`documentID`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE INDEX `indDocumentRevisorsRequired` ON `tblDocumentRevisors` (`required`);
CREATE TABLE `tblDocumentRevisionLog` (
`revisionLogID` int(11) NOT NULL AUTO_INCREMENT,
`revisionID` int(11) NOT NULL DEFAULT '0',
`status` tinyint(4) NOT NULL DEFAULT '0',
`comment` text NOT NULL,
`date` datetime NOT NULL,
`userID` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`revisionLogID`),
KEY `tblDocumentRevisionLog_revision` (`revisionID`),
KEY `tblDocumentRevisionLog_user` (`userID`),
CONSTRAINT `tblDocumentRevisionLog_revision` FOREIGN KEY (`revisionID`) REFERENCES `tblDocumentRevisors` (`revisionID`) ON DELETE CASCADE,
CONSTRAINT `tblDocumentRevisionLog_user` FOREIGN KEY (`userID`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tblTransmittals` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` text NOT NULL,
`comment` text NOT NULL,
`userID` int(11) NOT NULL DEFAULT '0',
`date` datetime DEFAULT NULL,
`public` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
CONSTRAINT `tblTransmittals_user` FOREIGN KEY (`userID`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tblTransmittalItems` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`transmittal` int(11) NOT NULL DEFAULT '0',
`document` int(11) DEFAULT NULL,
`version` smallint(5) unsigned NOT NULL DEFAULT '0',
`date` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE (transmittal, document, version),
CONSTRAINT `tblTransmittalItems_document` FOREIGN KEY (`document`) REFERENCES `tblDocuments` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblTransmittalItem_transmittal` FOREIGN KEY (`transmittal`) REFERENCES `tblTransmittals` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tblRoles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`role` smallint(1) NOT NULL DEFAULT '0',
`noaccess` varchar(30) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `tblRoles` (`id`, `name`, `role`) VALUES (1, 'Admin', 1);
INSERT INTO `tblRoles` (`id`, `name`, `role`) VALUES (2, 'Guest', 2);
INSERT INTO `tblRoles` (`id`, `name`, `role`) VALUES (3, 'User', 0);
ALTER TABLE `tblRoles` AUTO_INCREMENT=4;
ALTER TABLE tblUsers CHANGE role role int(11) NOT NULL;
UPDATE `tblUsers` SET role=3 WHERE role=0;
ALTER TABLE tblUsers ADD CONSTRAINT `tblUsers_role` FOREIGN KEY (`role`) REFERENCES `tblRoles` (`id`);
CREATE TABLE `tblAros` (
`id` int(11) NOT NULL auto_increment,
`parent` int(11),
`model` text NOT NULL,
`foreignid` int(11) NOT NULL DEFAULT '0',
`alias` varchar(255),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tblAcos` (
`id` int(11) NOT NULL auto_increment,
`parent` int(11),
`model` text NOT NULL,
`foreignid` int(11) NOT NULL DEFAULT '0',
`alias` varchar(255),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tblArosAcos` (
`id` int(11) NOT NULL auto_increment,
`aro` int(11) NOT NULL DEFAULT '0',
`aco` int(11) NOT NULL DEFAULT '0',
`create` tinyint(4) NOT NULL DEFAULT '-1',
`read` tinyint(4) NOT NULL DEFAULT '-1',
`update` tinyint(4) NOT NULL DEFAULT '-1',
`delete` tinyint(4) NOT NULL DEFAULT '-1',
PRIMARY KEY (`id`),
UNIQUE (aco, aro),
CONSTRAINT `tblArosAcos_acos` FOREIGN KEY (`aco`) REFERENCES `tblAcos` (`id`) ON DELETE CASCADE,
CONSTRAINT `tblArosAcos_aros` FOREIGN KEY (`aro`) REFERENCES `tblAros` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tblSchedulerTask` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) DEFAULT NULL,
`description` text DEFAULT NULL,
`disabled` smallint(1) NOT NULL DEFAULT '0',
`extension` varchar(100) DEFAULT NULL,
`task` varchar(100) DEFAULT NULL,
`frequency` varchar(100) DEFAULT NULL,
`params` text DEFAULT NULL,
`nextrun` datetime DEFAULT NULL,
`lastrun` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
UPDATE tblVersion set major=6, minor=0, subminor=0;
COMMIT;

View File

@ -1,52 +0,0 @@
Caution when you update seeddms with workflow mode `advanced`
=============================================================
The previous database layout for tracking the workflow state of a
document content was not very well done. It did not allow to run
the document through another workflow at a later time, expecially
the same workflow, e.g. for a scheduled revision of a document.
Technical details
==================
This update modifies the tables tblWorkflowDocumentContent and
tblWorkflowLog. It adds a new autoincrement field as a primary key
(id) to tblWorkflowDocumentContent and references that field in
tblWorkflowLog (workflowdocumentcontent). Till now the two tables
where linked by the fields `document`, `version`, and `workflow` which will
be replaced by the two new fields. The fields `document`, `version`, and
`workflow` will be removed from tblWorkflowLog. tblWorkflowDocumentContent
contained just the workflows currently active for a particlar document.
From now on the table will also contain finished workflows, which
will have the field `state` set to null. This allows to run even the
same workflow again and still be able to distinguish the log entries.
MySQL
------
The update process will first add the new auto incrementing, primary
field to tblWorkflowDocumentContent and a referencing field to
tblWorkflowLog. It will then fill out the referencing field with the
automatically incremented field value from tblWorkflowDocumentContent
by joining the two tables with its common fields document, version,
and workflow. This will not fill out all referencing field values,
because once a workflow has ended the record in
tblWorkflowDocumentContent will be deleted and just the records in
tblWorkflowLog are kept. The still missing records in
tblWorkflowDocumentContent for already completed workflows will be
reconstructed from the records in tblWorkflowLog which do not have a
reference to tblWorkflowDocumentContent yet. Once that is done the
referencing field in tblWorkflowLog can be filled in a second pass.
The date of the new records in tblWorkflowDocumentContent will be
taken from the last record for that workflow in tblWorkflowLog. The
state of the new records will be set null, indicating that this
workflow is no longer active.
SQLite
-------
The update process will first create new table for tblWorkflowDocumentContent
containing a new field for the primary key field. It then copies the
records from the old table to the new table. The missing records for
workflows which has been finished already are recreated from the old
table `tblWorkflowLog`. Which is then replaced by a new table having
the foreign key to table `tblWorkflowDocumentContent`.

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

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