From 441086887445c6686bbd44e2d003b8896ad650b6 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 7 Nov 2017 06:43:25 +0100 Subject: [PATCH 001/122] started new version 5.1.5 --- Makefile | 2 +- SeedDMS_Core/Core/inc.ClassDMS.php | 2 +- SeedDMS_Core/package.xml | 29 ++++++++++++++++++++++------- inc/inc.Version.php | 2 +- install/install.php | 2 +- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 8456bad83..0805e195a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION=5.1.4 +VERSION=5.1.5 SRC=CHANGELOG inc conf utils index.php languages views op out controllers doc styles TODO LICENSE webdav install restapi pdfviewer # webapp diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index 26a196243..96f3678fc 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -371,7 +371,7 @@ class SeedDMS_Core_DMS { $this->callbacks = array(); $this->version = '@package_version@'; if($this->version[0] == '@') - $this->version = '5.1.4'; + $this->version = '5.1.5'; } /* }}} */ /** diff --git a/SeedDMS_Core/package.xml b/SeedDMS_Core/package.xml index 422bfa92f..f1a9e9dee 100644 --- a/SeedDMS_Core/package.xml +++ b/SeedDMS_Core/package.xml @@ -12,11 +12,11 @@ uwe@steinmann.cx yes - 2017-09-05 + 2017-11-07 - 5.1.4 - 5.1.4 + 5.1.5 + 5.1.5 stable @@ -24,10 +24,6 @@ GPL License -- add virtual access mode for document links and attachments plus callbacks to - check access mode in a hook -- add new method SeedDMS_Core_DMS::getDocumentsExpired() -- all changes from 5.0.14 merged @@ -1518,5 +1514,24 @@ returns just users which are not disabled - add method SeedDMS_Core_DMS::getDocumentByOriginalFilename() + + 2017-09-05 + + + 5.1.4 + 5.1.4 + + + stable + stable + + GPL License + +- add virtual access mode for document links and attachments plus callbacks to + check access mode in a hook +- add new method SeedDMS_Core_DMS::getDocumentsExpired() +- all changes from 5.0.14 merged + + diff --git a/inc/inc.Version.php b/inc/inc.Version.php index 8dd1de705..3fcc1c88b 100644 --- a/inc/inc.Version.php +++ b/inc/inc.Version.php @@ -20,7 +20,7 @@ class SeedDMS_Version { - public $_number = "5.1.4"; + public $_number = "5.1.5"; private $_string = "SeedDMS"; function __construct() { diff --git a/install/install.php b/install/install.php index 69a1491e1..ecf7d5870 100644 --- a/install/install.php +++ b/install/install.php @@ -123,7 +123,7 @@ function fileExistsInIncludePath($file) { /* {{{ */ * Load default settings + set */ define("SEEDDMS_INSTALL", "on"); -define("SEEDDMS_VERSION", "5.1.4"); +define("SEEDDMS_VERSION", "5.1.5"); require_once('../inc/inc.ClassSettings.php'); From cc8161e353aee3fdae99b257cd1fb14236d2f024 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 7 Nov 2017 17:50:58 +0100 Subject: [PATCH 002/122] fix php warning when login fails --- op/op.Login.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/op/op.Login.php b/op/op.Login.php index c6ee172b0..f758ddb89 100644 --- a/op/op.Login.php +++ b/op/op.Login.php @@ -33,7 +33,7 @@ include $settings->_rootDir . "languages/" . $settings->_language . "/lang.inc"; function _printMessage($heading, $message) { /* {{{ */ global $dms, $theme; - $view = UI::factory($theme, 'ErrorDlg', array('dms'=>$dms)); + $view = UI::factory($theme, 'Login', array('dms'=>$dms)); $view->exitError($heading, $message, true); return; } /* }}} */ From 6e05806447bb57a7d31b896ef4ea68890affa415 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Nov 2017 06:52:24 +0100 Subject: [PATCH 003/122] remove some tasks already done --- TODO | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/TODO b/TODO index 5a54b295a..097943d42 100644 --- a/TODO +++ b/TODO @@ -2,16 +2,11 @@ Show workflow steps after document has been released (keep workflow tab) Show documents in calendar when they where uploaded. -Add attribute type 'date' - Update comment and date of a review/approval, if the same status is set again. Currently setting the same status is turned of, because it didn't have any effect, which is quite confusing if the user can do an operation which has not the expected result. -Show number of documents that needs care (approval, review, any other action -in a workflog) next to Login/Logout-Menu. - Show message on doc info page if documents expects an action like review, approval, etc. @@ -34,23 +29,15 @@ Allow to specify fine grained notification (e.g. deleting a document, folder) Have access rights depending on document status. This will allow to restrict access when a document is in a workflow or has been rejected. -There are still global variable in class SeedetoDMS_Bootstrap_Style - Settings::searchConfigFilePath() and Settings::getConfigDir() use different approaches to get the configuration directory. Show expiration status of documents in document list -Export/Import content as xml (even for subfolders) - Copy folders recursivly Allow operations like delete, move, approve, etc. on a list of documents -Upload of multiple documents without an applet - -Do not show documents which are not reviewed or approved or rejected - installation script: - user simply unpack the tar.gz in a server folder and access that folder - on startup if there are installation problems php automatically run the configuration script @@ -70,9 +57,6 @@ Sometimes in the DB are written messages strings in plain language whose language depends on the current user and will never be translated. This can be avoided using only coded messages -The mail language is translated using the current user language but should use -the receiver language (not easy). - In my Documents->all documents there should be two lists: one (the current) with the user's document, and another with the user's updated document (that's because one user could have updated a document not owned by himself) From 5c77b3aa7d35159acb4eee1b0821e34875e78d6d Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Nov 2017 07:09:55 +0100 Subject: [PATCH 004/122] add replacement for empty.png --- views/bootstrap/images/empty.svg | 466 +++++++++++++++++++++++++++++++ 1 file changed, 466 insertions(+) create mode 100644 views/bootstrap/images/empty.svg diff --git a/views/bootstrap/images/empty.svg b/views/bootstrap/images/empty.svg new file mode 100644 index 000000000..772a3c0dc --- /dev/null +++ b/views/bootstrap/images/empty.svg @@ -0,0 +1,466 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Text Preview + + + text + plaintext + regular + document + + + + + + Lapo Calamandrei + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From f7224e445e4ba6d276ef3931667b62f680a916f7 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Nov 2017 07:10:15 +0100 Subject: [PATCH 005/122] ignore ext --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 732a19b99..6ac6ee7b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.tar.gz SeedDMS_*/*.tgz +ext/* From 55433332913697aceef585ec86f3c066bf4582ba Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Nov 2017 08:33:57 +0100 Subject: [PATCH 006/122] move getUser() in file --- inc/inc.ClassSession.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/inc/inc.ClassSession.php b/inc/inc.ClassSession.php index 8aa9f0d44..30e8d6496 100644 --- a/inc/inc.ClassSession.php +++ b/inc/inc.ClassSession.php @@ -170,6 +170,15 @@ class SeedDMS_Session { return $this->id; } /* }}} */ + /** + * Get user id of session + * + * @return integer user id + */ + function getUser() { /* {{{ */ + return $this->data['userid']; + } /* }}} */ + /** * Set user of session * @@ -186,15 +195,6 @@ class SeedDMS_Session { return true; } /* }}} */ - /** - * Get language of session - * - * @return string language - */ - function getUser() { /* {{{ */ - return $this->data['userid']; - } /* }}} */ - /** * Set language of session * From 7520634c612600e4b7288c3033dbdc98cb8a6e4b Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Nov 2017 08:34:19 +0100 Subject: [PATCH 007/122] add addDirSep() --- inc/inc.Utils.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/inc/inc.Utils.php b/inc/inc.Utils.php index 093f4b9bb..327cdbf3f 100644 --- a/inc/inc.Utils.php +++ b/inc/inc.Utils.php @@ -565,9 +565,25 @@ function get_extension($mimetype) { /* {{{ */ case 'application/pdf': return '.pdf'; case 'application/postscript': return '.ps'; case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': return '.docx'; + case 'application/vnd.openxmlformats-officedocument.presentationml.presentation': return '.pptx'; case 'text/plain': return '.txt'; case 'text/csv': return '.csv'; default: return false; } } /* }}} */ + +/** + * Adds a missing front slash to a string + * + * This function is used for making sure a directory name has a + * trailing directory separator + */ +function addDirSep($str) { /* {{{ */ + if(trim($str) == '') + return ''; + if(substr(trim($str), -1, 1) != DIRECTORY_SEPARATOR) + return trim($str).DIRECTORY_SEPARATOR; + else + return trim($str); +} /* }}} */ ?> From cc6f64a1a35a0fd45c728f2a5952a281a81bdb68 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Nov 2017 08:34:38 +0100 Subject: [PATCH 008/122] add dir separator to various install directories --- op/op.Settings.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/op/op.Settings.php b/op/op.Settings.php index 3ca583bb3..7e9c89581 100644 --- a/op/op.Settings.php +++ b/op/op.Settings.php @@ -106,14 +106,14 @@ if ($action == "saveSettings") $settings->_firstDayOfWeek = intval($_POST["firstDayOfWeek"]); // SETTINGS - SYSTEM - SERVER - $settings->_rootDir = $_POST["rootDir"]; + $settings->_rootDir = addDirSep($_POST["rootDir"]); $settings->_httpRoot = $_POST["httpRoot"]; - $settings->_contentDir = $_POST["contentDir"]; - $settings->_cacheDir = $_POST["cacheDir"]; - $settings->_stagingDir = $_POST["stagingDir"]; - $settings->_luceneDir = $_POST["luceneDir"]; - $settings->_extraPath = $_POST["extraPath"]; - $settings->_dropFolderDir = $_POST["dropFolderDir"]; + $settings->_contentDir = addDirSep($_POST["contentDir"]); + $settings->_cacheDir = addDirSep($_POST["cacheDir"]); + $settings->_stagingDir = addDirSep($_POST["stagingDir"]); + $settings->_luceneDir = addDirSep($_POST["luceneDir"]); + $settings->_extraPath = addDirSep($_POST["extraPath"]); + $settings->_dropFolderDir = addDirSep($_POST["dropFolderDir"]); $settings->_logFileEnable = getBoolValue("logFileEnable"); $settings->_logFileRotation = $_POST["logFileRotation"]; $settings->_enableLargeFileUpload = getBoolValue("enableLargeFileUpload"); From 64f7e9be10a2d57af2b82ef80befa78bf491c75b Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Nov 2017 08:41:10 +0100 Subject: [PATCH 009/122] call notification hooks before and after setting up email notification --- op/op.Ajax.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/op/op.Ajax.php b/op/op.Ajax.php index 404abb96a..61209da3c 100644 --- a/op/op.Ajax.php +++ b/op/op.Ajax.php @@ -60,9 +60,25 @@ if (isset($_COOKIE["mydms_session"])) { } } $notifier = new SeedDMS_NotificationService(); + if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) { + foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) { + if(method_exists($notificationObj, 'preAddService')) { + $notificationObj->preAddService($notifier); + } + } + } + if($settings->_enableEmail) { $notifier->addService(new SeedDMS_EmailNotify($dms)); } + + if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) { + foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) { + if(method_exists($notificationObj, 'postAddService')) { + $notificationObj->postAddService($notifier); + } + } + } include $settings->_rootDir . "languages/" . $resArr["language"] . "/lang.inc"; } else { $user = null; From 51228b5a8facf377eb4a8e162f4d2dcf62dd3555 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Nov 2017 08:46:48 +0100 Subject: [PATCH 010/122] init index --- op/op.RemoveDocument.php | 1 + 1 file changed, 1 insertion(+) diff --git a/op/op.RemoveDocument.php b/op/op.RemoveDocument.php index 361c9ca17..afdcceb8b 100644 --- a/op/op.RemoveDocument.php +++ b/op/op.RemoveDocument.php @@ -59,6 +59,7 @@ if($document->isLocked()) { if($settings->_enableFullSearch) { $index = $indexconf['Indexer']::open($settings->_luceneDir); + $indexconf['Indexer']::init($settings->_stopWordsFile); } else { $index = null; } From 0421b2f0acaae5d54f0097a3c59f74cee819a432 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Nov 2017 08:47:00 +0100 Subject: [PATCH 011/122] add fold marks --- op/op.Download.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/op/op.Download.php b/op/op.Download.php index 3d157a968..742c210c9 100644 --- a/op/op.Download.php +++ b/op/op.Download.php @@ -33,7 +33,7 @@ include("../inc/inc.Authentication.php"); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $controller = Controller::factory($tmp[1]); -if (isset($_GET["version"])) { +if (isset($_GET["version"])) { /* {{{ */ // document download if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) { @@ -68,7 +68,8 @@ if (isset($_GET["version"])) { $controller->setParam('type', 'version'); $controller->run(); -} elseif (isset($_GET["file"])) { +} /* }}} */ +elseif (isset($_GET["file"])) { /* {{{ */ // file download From 53b0d98fa530972635fbf6fb9930f1afe62c83af Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Nov 2017 08:48:29 +0100 Subject: [PATCH 012/122] init index --- op/op.RemoveFolder.php | 1 + 1 file changed, 1 insertion(+) diff --git a/op/op.RemoveFolder.php b/op/op.RemoveFolder.php index 826b2dea8..34758e135 100644 --- a/op/op.RemoveFolder.php +++ b/op/op.RemoveFolder.php @@ -56,6 +56,7 @@ if ($folder->getAccessMode($user) < M_ALL) { if($settings->_enableFullSearch) { $index = $indexconf['Indexer']::open($settings->_luceneDir); + $indexconf['Indexer']::init($settings->_stopWordsFile); } else { $index = null; } From d329de70362b80e395de2a005807dcdad4419376 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Nov 2017 10:23:34 +0100 Subject: [PATCH 013/122] some minor code reorganisation --- out/out.AddDocument.php | 5 +++-- out/out.AddEvent.php | 5 +++-- out/out.AddFile.php | 8 +++----- out/out.AddSubFolder.php | 5 +++-- out/out.AdminTools.php | 7 ++----- out/out.ApprovalSummary.php | 5 +++-- out/out.AttributeMgr.php | 4 ++-- out/out.BackupTools.php | 4 ++-- out/out.Calendar.php | 5 +++-- out/out.Categories.php | 8 ++++---- out/out.Charts.php | 1 + out/out.ClearCache.php | 4 ++-- out/out.CreateIndex.php | 4 ++-- out/out.DefaultKeywords.php | 6 ++++-- out/out.EditEvent.php | 5 +++-- out/out.EditFolder.php | 5 +++-- out/out.EditOnline.php | 5 +++-- out/out.EditUserData.php | 10 ++++++++-- out/out.ExpiredDocuments.php | 4 ++-- out/out.ExtensionMgr.php | 8 +++++--- out/out.FolderAccess.php | 5 +++-- out/out.FolderNotify.php | 5 +++-- out/out.GroupMgr.php | 14 ++++++++++---- out/out.GroupView.php | 5 +++-- out/out.Hooks.php | 5 +++-- out/out.ImportFS.php | 7 ++++--- out/out.IndexInfo.php | 4 ++-- out/out.Indexer.php | 4 ++-- out/out.Info.php | 6 ++---- out/out.LogManagement.php | 7 +++++-- out/out.ManageNotify.php | 8 ++++++-- out/out.MoveFolder.php | 5 +++-- out/out.MyAccount.php | 5 +++-- out/out.MyDocuments.php | 5 +++-- out/out.RemoveArchive.php | 4 ++-- out/out.RemoveDump.php | 4 ++-- out/out.RemoveFolder.php | 5 +++-- out/out.RemoveFolderFiles.php | 4 ++-- out/out.RemoveGroup.php | 4 ++-- out/out.RemoveLog.php | 4 ++-- out/out.RemoveUser.php | 4 ++-- out/out.RemoveWorkflow.php | 4 ++-- out/out.RemoveWorkflowFromDocument.php | 8 +++----- out/out.ReviewSummary.php | 5 +++-- out/out.RewindWorkflow.php | 8 +++----- out/out.RunSubWorkflow.php | 9 ++++----- out/out.Session.php | 2 +- out/out.Settings.php | 11 +++++++++-- out/out.Statistic.php | 5 +++-- out/out.SubstituteUser.php | 4 ++-- out/out.Timeline.php | 5 +---- out/out.UpdateDocument.php | 9 ++++----- out/out.UserDefaultKeywords.php | 5 +++-- out/out.UserList.php | 10 ++++++---- out/out.UsrMgr.php | 18 ++++++++++++++---- out/out.UsrView.php | 5 +++-- out/out.ViewDocument.php | 15 +++++++-------- out/out.ViewEvent.php | 4 ++-- out/out.WorkflowActionsMgr.php | 4 ++-- out/out.WorkflowGraph.php | 5 +++-- out/out.WorkflowMgr.php | 4 ++-- out/out.WorkflowStatesMgr.php | 4 ++-- out/out.WorkflowSummary.php | 5 +++-- 63 files changed, 210 insertions(+), 161 deletions(-) diff --git a/out/out.AddDocument.php b/out/out.AddDocument.php index 54d81dfd6..fda77b3f7 100644 --- a/out/out.AddDocument.php +++ b/out/out.AddDocument.php @@ -29,6 +29,9 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } @@ -49,8 +52,6 @@ if($settings->_quota > 0) { } } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('folder', $folder); $view->setParam('strictformcheck', $settings->_strictFormCheck); diff --git a/out/out.AddEvent.php b/out/out.AddEvent.php index ef176ab9a..0412c9ccf 100644 --- a/out/out.AddEvent.php +++ b/out/out.AddEvent.php @@ -26,12 +26,13 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + if ($user->isGuest()) { UI::exitError(getMLText("edit_event"),getMLText("access_denied")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('strictformcheck', $settings->_strictFormCheck); $view($_GET); diff --git a/out/out.AddFile.php b/out/out.AddFile.php index 3b3f717be..ce68400e4 100644 --- a/out/out.AddFile.php +++ b/out/out.AddFile.php @@ -30,6 +30,9 @@ include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"]<1)) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } @@ -46,11 +49,6 @@ if ($document->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied")); } -/* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); - -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('folder', $folder); $view->setParam('document', $document); diff --git a/out/out.AddSubFolder.php b/out/out.AddSubFolder.php index 289150c5a..ba8999d91 100644 --- a/out/out.AddSubFolder.php +++ b/out/out.AddSubFolder.php @@ -29,6 +29,9 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } @@ -41,8 +44,6 @@ if ($folder->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))),getMLText("access_denied")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('folder', $folder); $view->setParam('strictformcheck', $settings->_strictFormCheck); diff --git a/out/out.AdminTools.php b/out/out.AdminTools.php index 210ff2329..873222e61 100644 --- a/out/out.AdminTools.php +++ b/out/out.AdminTools.php @@ -26,17 +26,14 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('enablefullsearch', $settings->_enableFullSearch); $view->setParam('logfileenable', $settings->_logFileEnable); $view($_GET); - exit; } - -?> diff --git a/out/out.ApprovalSummary.php b/out/out.ApprovalSummary.php index 07b78928c..1e5091fa9 100644 --- a/out/out.ApprovalSummary.php +++ b/out/out.ApprovalSummary.php @@ -28,12 +28,13 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + if ($user->isGuest()) { UI::exitError(getMLText("my_documents"),getMLText("access_denied")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('cachedir', $settings->_cacheDir); $view->setParam('previewWidthList', $settings->_previewWidthList); diff --git a/out/out.AttributeMgr.php b/out/out.AttributeMgr.php index 33b28facc..e02d80b7c 100644 --- a/out/out.AttributeMgr.php +++ b/out/out.AttributeMgr.php @@ -28,6 +28,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -40,8 +42,6 @@ if(isset($_GET['attrdefid']) && $_GET['attrdefid']) { $selattrdef = null; } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('attrdefs', $attrdefs); $view->setParam('selattrdef', $selattrdef); diff --git a/out/out.BackupTools.php b/out/out.BackupTools.php index b3cb12444..a9cdbef56 100644 --- a/out/out.BackupTools.php +++ b/out/out.BackupTools.php @@ -27,12 +27,12 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'contentdir'=>$settings->_contentDir)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'contentdir'=>$settings->_contentDir)); if($view) { $view($_GET); exit; diff --git a/out/out.Calendar.php b/out/out.Calendar.php index 0f8ca4804..9ada3263b 100644 --- a/out/out.Calendar.php +++ b/out/out.Calendar.php @@ -27,6 +27,9 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + if (isset($_GET["start"])) $start=$_GET["start"]; else $start = ''; if (isset($_GET["end"])) $end=$_GET["end"]; @@ -57,8 +60,6 @@ if(isset($_GET['eventtype']) && $_GET['eventtype']) { } else $eventtype = 'regular'; -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('calendar', $calendar); $view->setParam('start', $start); diff --git a/out/out.Categories.php b/out/out.Categories.php index cda9b14e6..12f809dc3 100644 --- a/out/out.Categories.php +++ b/out/out.Categories.php @@ -28,6 +28,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -40,10 +42,8 @@ if(isset($_GET['categoryid']) && $_GET['categoryid']) { $selcat = null; } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'categories'=>$categories, 'selcategory'=>$selcat)); if($view) { + $view->setParam('categories', $categories); + $view->setParam('selcategory', $selcat); $view($_GET); } - -?> diff --git a/out/out.Charts.php b/out/out.Charts.php index 016981f3b..84591584d 100644 --- a/out/out.Charts.php +++ b/out/out.Charts.php @@ -33,6 +33,7 @@ $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } + $rootfolder = $dms->getFolder($settings->_rootFolderID); $type = 'docsperuser'; diff --git a/out/out.ClearCache.php b/out/out.ClearCache.php index 74ec26f61..96f0b1b7b 100644 --- a/out/out.ClearCache.php +++ b/out/out.ClearCache.php @@ -29,12 +29,12 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.Authentication.php"); include("../inc/inc.ClassUI.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('cachedir', $settings->_cacheDir); $view($_GET); diff --git a/out/out.CreateIndex.php b/out/out.CreateIndex.php index 7adf4aca8..330f4fabe 100644 --- a/out/out.CreateIndex.php +++ b/out/out.CreateIndex.php @@ -30,6 +30,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -38,8 +40,6 @@ if(!$settings->_enableFullSearch) { UI::exitError(getMLText("admin_tools"),getMLText("fulltextsearch_disabled")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('enablefullsearch', $settings->_enableFullSearch); $view($_GET); diff --git a/out/out.DefaultKeywords.php b/out/out.DefaultKeywords.php index 2e572e7f6..0864b462c 100644 --- a/out/out.DefaultKeywords.php +++ b/out/out.DefaultKeywords.php @@ -28,6 +28,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -39,9 +41,9 @@ else $categories = $dms->getAllUserKeywordCategories($user->getID()); -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'categories'=>$categories, 'selcategoryid'=>$selcategoryid)); if($view) { + $view->setParam('categories', $categories); + $view->setParam('selcategoryid', $selcategoryid); $view($_GET); exit; } diff --git a/out/out.EditEvent.php b/out/out.EditEvent.php index 1d4297ca2..b60b00075 100644 --- a/out/out.EditEvent.php +++ b/out/out.EditEvent.php @@ -27,6 +27,9 @@ include("../inc/inc.ClassUI.php"); include("../inc/inc.Calendar.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + if ($user->isGuest()) { UI::exitError(getMLText("edit_event"),getMLText("access_denied")); } @@ -44,8 +47,6 @@ if (($user->getID()!=$event["userID"])&&(!$user->isAdmin())){ UI::exitError(getMLText("edit_event"),getMLText("access_denied")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('event', $event); $view->setParam('strictformcheck', $settings->_strictFormCheck); diff --git a/out/out.EditFolder.php b/out/out.EditFolder.php index 8f56eb58a..813886b9b 100644 --- a/out/out.EditFolder.php +++ b/out/out.EditFolder.php @@ -28,6 +28,9 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } @@ -43,8 +46,6 @@ if ($folder->getAccessMode($user) < M_READWRITE) { $attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_folder, SeedDMS_Core_AttributeDefinition::objtype_all)); -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('folder', $folder); $view->setParam('attrdefs', $attrdefs); diff --git a/out/out.EditOnline.php b/out/out.EditOnline.php index 780c035d0..bfc5c6027 100644 --- a/out/out.EditOnline.php +++ b/out/out.EditOnline.php @@ -28,6 +28,9 @@ include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + $documentid = $_GET["documentid"]; if (!isset($documentid) || !is_numeric($documentid) || intval($documentid)<1) { @@ -83,8 +86,6 @@ if(!$accessop->mayEditVersion($version)) { $folder = $document->getFolder(); -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('document', $document); $view->setParam('version', $content); diff --git a/out/out.EditUserData.php b/out/out.EditUserData.php index 64aa2613e..348723ef3 100644 --- a/out/out.EditUserData.php +++ b/out/out.EditUserData.php @@ -28,6 +28,9 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + if ($user->isGuest()) { UI::exitError(getMLText("edit_user_details"),getMLText("access_denied")); } @@ -37,9 +40,12 @@ if (!$user->isAdmin() && ($settings->_disableSelfEdit)) { } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'enableuserimage'=>$settings->_enableUserImage, 'enablelanguageselector'=>$settings->_enableLanguageSelector, 'enablethemeselector'=>$settings->_enableThemeSelector, 'passwordstrength'=>$settings->_passwordStrength, 'httproot'=>$settings->_httpRoot)); if($view) { + $view->setParam('enableuserimage', $settings->_enableUserImage); + $view->setParam('enablelanguageselector', $settings->_enableLanguageSelector); + $view->setParam('enablethemeselector', $settings->_enableThemeSelector); + $view->setParam('passwordstrength', $settings->_passwordStrength); + $view->setParam('httproot', $settings->_httpRoot); $view($_GET); exit; } diff --git a/out/out.ExpiredDocuments.php b/out/out.ExpiredDocuments.php index 4e38a85aa..b81b83a61 100644 --- a/out/out.ExpiredDocuments.php +++ b/out/out.ExpiredDocuments.php @@ -28,6 +28,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if ($user->isGuest()) { UI::exitError(getMLText("expired_documents"),getMLText("access_denied")); } @@ -37,8 +39,6 @@ if (isset($_GET["orderby"]) && strlen($_GET["orderby"])==1 ) { $orderby=$_GET["orderby"]; } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('orderby', $orderby); $view->setParam('cachedir', $settings->_cacheDir); diff --git a/out/out.ExtensionMgr.php b/out/out.ExtensionMgr.php index 92db8bb06..da2e5c728 100644 --- a/out/out.ExtensionMgr.php +++ b/out/out.ExtensionMgr.php @@ -26,16 +26,18 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } $v = new SeedDMS_Version; -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'httproot'=>$settings->_httpRoot, 'version'=>$v)); if($view) { - $view->show(); + $view->setParam('httproot', $settings->_httpRoot); + $view->setParam('version', $v); + $view($_GET); exit; } diff --git a/out/out.FolderAccess.php b/out/out.FolderAccess.php index fdf987425..970769c1a 100644 --- a/out/out.FolderAccess.php +++ b/out/out.FolderAccess.php @@ -29,6 +29,9 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } @@ -45,8 +48,6 @@ if ($folder->getAccessMode($user) < M_ALL) { $allUsers = $dms->getAllUsers(); $allGroups = $dms->getAllGroups(); -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('folder', $folder); $view->setParam('allusers', $allUsers); diff --git a/out/out.FolderNotify.php b/out/out.FolderNotify.php index d6ec6b7f2..100a6e248 100644 --- a/out/out.FolderNotify.php +++ b/out/out.FolderNotify.php @@ -28,6 +28,9 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } @@ -44,8 +47,6 @@ if ($folder->getAccessMode($user) < M_READ) { $allUsers = $dms->getAllUsers($settings->_sortUsersInList); $allGroups = $dms->getAllGroups(); -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('folder', $folder); $view->setParam('allusers', $allUsers); diff --git a/out/out.GroupMgr.php b/out/out.GroupMgr.php index 46fed3fbd..7f61bdaf5 100644 --- a/out/out.GroupMgr.php +++ b/out/out.GroupMgr.php @@ -28,6 +28,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -48,10 +50,14 @@ if(isset($_GET['groupid']) && $_GET['groupid']) { $selgroup = null; } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'selgroup'=>$selgroup, 'allgroups'=>$allGroups, 'allusers'=>$allUsers, 'strictformcheck'=>$settings->_strictFormCheck, 'cachedir'=>$settings->_cacheDir, 'previewWidthList'=>$settings->_previewWidthList, 'workflowmode'=>$settings->_workflowMode, 'timeout'=>$settings->_cmdTimeout)); if($view) { + $view->setParam('selgroup', $selgroup); + $view->setParam('allgroups', $allGroups); + $view->setParam('allusers', $allUsers); + $view->setParam('strictformcheck', $settings->_strictFormCheck); + $view->setParam('cachedir', $settings->_cacheDir); + $view->setParam('previewWidthList', $settings->_previewWidthList); + $view->setParam('workflowmode', $settings->_workflowMode); + $view->setParam('timeout', $settings->_cmdTimeout); $view($_GET); } - -?> diff --git a/out/out.GroupView.php b/out/out.GroupView.php index dfd596af3..8024323cb 100644 --- a/out/out.GroupView.php +++ b/out/out.GroupView.php @@ -26,6 +26,9 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + if ($user->isGuest()) { UI::exitError(getMLText("my_account"),getMLText("access_denied")); } @@ -44,8 +47,6 @@ if (is_bool($allGroups)) { UI::exitError(getMLText("admin_tools"),getMLText("internal_error")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('allusers', $allUsers); $view->setParam('allgroups', $allGroups); diff --git a/out/out.Hooks.php b/out/out.Hooks.php index 990247d41..9eda3c44b 100644 --- a/out/out.Hooks.php +++ b/out/out.Hooks.php @@ -25,13 +25,14 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'settings'=>$settings)); if($view) { + $view->setParam('settings', $settings); $view($_GET); exit; } diff --git a/out/out.ImportFS.php b/out/out.ImportFS.php index 4dd0f1ee2..af394806a 100644 --- a/out/out.ImportFS.php +++ b/out/out.ImportFS.php @@ -24,16 +24,17 @@ include("../inc/inc.Language.php"); include("../inc/inc.Init.php"); include("../inc/inc.Extension.php"); include("../inc/inc.DBInit.php"); -include("../inc/inc.Authentication.php"); include("../inc/inc.ClassUI.php"); +include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'dropfolderdir'=>$settings->_dropFolderDir)); if($view) { + $view->setParam('dropfolderdir', $settings->_dropFolderDir); $view($_GET); exit; } diff --git a/out/out.IndexInfo.php b/out/out.IndexInfo.php index 04479e9b9..6e614a927 100644 --- a/out/out.IndexInfo.php +++ b/out/out.IndexInfo.php @@ -29,6 +29,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -42,8 +44,6 @@ if(!$index) { UI::exitError(getMLText("admin_tools"),getMLText("no_fulltextindex")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('luceneclassdir', $settings->_luceneClassDir); $view->setParam('lucenedir', $settings->_luceneDir); diff --git a/out/out.Indexer.php b/out/out.Indexer.php index 85137fa2c..f7593b984 100644 --- a/out/out.Indexer.php +++ b/out/out.Indexer.php @@ -29,6 +29,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -68,8 +70,6 @@ else { } $folder = $dms->getFolder($folderid); -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('index', $index); $view->setParam('indexconf', $indexconf); diff --git a/out/out.Info.php b/out/out.Info.php index f880c8be3..09a382473 100644 --- a/out/out.Info.php +++ b/out/out.Info.php @@ -29,6 +29,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -44,13 +46,9 @@ if(@ini_get('allow_url_fopen') == '1') { } } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('version', $v); $view->setParam('availversions', $versions); $view($_GET); exit; } - -?> diff --git a/out/out.LogManagement.php b/out/out.LogManagement.php index 41fa7aa5c..b6b2ba6cc 100644 --- a/out/out.LogManagement.php +++ b/out/out.LogManagement.php @@ -27,6 +27,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -37,9 +39,10 @@ else $logname=NULL; if (isset($_GET["mode"])) $mode=$_GET["mode"]; else $mode='web'; -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'logname'=>$logname, 'mode'=>$mode, 'contentdir'=>$settings->_contentDir)); if($view) { + $view->setParam('logname', $logname); + $view->setParam('mode', $mode); + $view->setParam('contentdir', $settings->_contentDir); $view($_GET); exit; } diff --git a/out/out.ManageNotify.php b/out/out.ManageNotify.php index b554354dd..6d2419fdb 100644 --- a/out/out.ManageNotify.php +++ b/out/out.ManageNotify.php @@ -26,13 +26,17 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + if ($user->isGuest()) { UI::exitError(getMLText("my_account"),getMLText("access_denied")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'cachedir'=>$settings->_cacheDir, 'previewWidthList'=>$settings->_previewWidthList, 'timeout'=>$settings->_cmdTimeout)); if($view) { + $view->setParam('cachedir', $settings->_cacheDir); + $view->setParam('previewWidthList', $settings->_previewWidthList); + $view->setParam('timeout', $settings->_cmdTimeout); $view($_GET); exit; } diff --git a/out/out.MoveFolder.php b/out/out.MoveFolder.php index 0a467a2e7..3cace3498 100644 --- a/out/out.MoveFolder.php +++ b/out/out.MoveFolder.php @@ -28,6 +28,9 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } @@ -63,8 +66,6 @@ if(isset($_GET['targetid']) && $_GET['targetid']) { $target = null; } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('folder', $folder); $view->setParam('target', $target); diff --git a/out/out.MyAccount.php b/out/out.MyAccount.php index 2e4d267b8..27fbbd853 100644 --- a/out/out.MyAccount.php +++ b/out/out.MyAccount.php @@ -28,12 +28,13 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + if ($user->isGuest()) { UI::exitError(getMLText("my_account"),getMLText("access_denied")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('enableuserimage', $settings->_enableUserImage); $view->setParam('passwordexpiration', $settings->_passwordExpiration); diff --git a/out/out.MyDocuments.php b/out/out.MyDocuments.php index 9a7eb4987..4af578678 100644 --- a/out/out.MyDocuments.php +++ b/out/out.MyDocuments.php @@ -28,6 +28,9 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + if ($user->isGuest()) { UI::exitError(getMLText("my_documents"),getMLText("access_denied")); } @@ -44,8 +47,6 @@ if (isset($_GET["orderby"]) && strlen($_GET["orderby"])==1 ) { $orderby=$_GET["orderby"]; } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('orderby', $orderby); $view->setParam('showinprocess', $showInProcess); diff --git a/out/out.RemoveArchive.php b/out/out.RemoveArchive.php index 39af2aa29..c8da8401b 100644 --- a/out/out.RemoveArchive.php +++ b/out/out.RemoveArchive.php @@ -26,6 +26,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -36,8 +38,6 @@ if (!isset($_GET["arkname"]) || !file_exists($settings->_contentDir.$_GET["arkna $arkname = $_GET["arkname"]; -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('archive', $arkname); $view($_GET); diff --git a/out/out.RemoveDump.php b/out/out.RemoveDump.php index 245e2a990..f07777424 100644 --- a/out/out.RemoveDump.php +++ b/out/out.RemoveDump.php @@ -26,6 +26,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -36,8 +38,6 @@ if (!isset($_GET["dumpname"]) || !file_exists($settings->_contentDir.$_GET["dump $dumpname = $_GET["dumpname"]; -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('dumpfile', $dumpname); $view($_GET); diff --git a/out/out.RemoveFolder.php b/out/out.RemoveFolder.php index 94ae913a1..35b40cc52 100644 --- a/out/out.RemoveFolder.php +++ b/out/out.RemoveFolder.php @@ -28,6 +28,9 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } @@ -46,8 +49,6 @@ if ($folder->getAccessMode($user) < M_ALL) { UI::exitError(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))),getMLText("access_denied")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('folder', $folder); $view($_GET); diff --git a/out/out.RemoveFolderFiles.php b/out/out.RemoveFolderFiles.php index a8fa1bc91..2151648d0 100644 --- a/out/out.RemoveFolderFiles.php +++ b/out/out.RemoveFolderFiles.php @@ -26,6 +26,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -40,8 +42,6 @@ if (!is_object($folder)) { UI::exitError(getMLText("admin_tools"),getMLText("invalid_folder_id")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('folder', $folder); $view($_GET); diff --git a/out/out.RemoveGroup.php b/out/out.RemoveGroup.php index 8e228b8e4..0dc75c962 100644 --- a/out/out.RemoveGroup.php +++ b/out/out.RemoveGroup.php @@ -27,6 +27,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -40,8 +42,6 @@ if (!is_object($group)) { UI::exitError(getMLText("rm_group"),getMLText("invalid_group_id")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('group', $group); $view($_GET); diff --git a/out/out.RemoveLog.php b/out/out.RemoveLog.php index 2674cbe61..f8e39942c 100644 --- a/out/out.RemoveLog.php +++ b/out/out.RemoveLog.php @@ -26,6 +26,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -50,8 +52,6 @@ foreach($lognames as $file) { } } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('lognames', $lognames); $view->setParam('mode', $mode); diff --git a/out/out.RemoveUser.php b/out/out.RemoveUser.php index d11421be0..541957199 100644 --- a/out/out.RemoveUser.php +++ b/out/out.RemoveUser.php @@ -27,6 +27,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -50,8 +52,6 @@ if ($rmuser->getID()==$user->getID()) { $allusers = $dms->getAllUsers($settings->_sortUsersInList); -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('rmuser', $rmuser); $view->setParam('allusers', $allusers); diff --git a/out/out.RemoveWorkflow.php b/out/out.RemoveWorkflow.php index 2136c6940..a87592ed1 100644 --- a/out/out.RemoveWorkflow.php +++ b/out/out.RemoveWorkflow.php @@ -29,6 +29,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -42,8 +44,6 @@ if (!is_object($workflow)) { UI::exitError(getMLText("workflow_title"),getMLText("invalid_workflow_id")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('workflow', $workflow); $view($_GET); diff --git a/out/out.RemoveWorkflowFromDocument.php b/out/out.RemoveWorkflowFromDocument.php index d719ccc1f..54b6ae2b5 100644 --- a/out/out.RemoveWorkflowFromDocument.php +++ b/out/out.RemoveWorkflowFromDocument.php @@ -30,6 +30,9 @@ include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -61,11 +64,6 @@ if (!is_object($workflow)) { $folder = $document->getFolder(); -/* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); - -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('folder', $folder); $view->setParam('document', $document); diff --git a/out/out.ReviewSummary.php b/out/out.ReviewSummary.php index 07b78928c..1e5091fa9 100644 --- a/out/out.ReviewSummary.php +++ b/out/out.ReviewSummary.php @@ -28,12 +28,13 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + if ($user->isGuest()) { UI::exitError(getMLText("my_documents"),getMLText("access_denied")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('cachedir', $settings->_cacheDir); $view->setParam('previewWidthList', $settings->_previewWidthList); diff --git a/out/out.RewindWorkflow.php b/out/out.RewindWorkflow.php index d719ccc1f..54b6ae2b5 100644 --- a/out/out.RewindWorkflow.php +++ b/out/out.RewindWorkflow.php @@ -30,6 +30,9 @@ include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -61,11 +64,6 @@ if (!is_object($workflow)) { $folder = $document->getFolder(); -/* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); - -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('folder', $folder); $view->setParam('document', $document); diff --git a/out/out.RunSubWorkflow.php b/out/out.RunSubWorkflow.php index 981c8c1fd..98cfd3fa5 100644 --- a/out/out.RunSubWorkflow.php +++ b/out/out.RunSubWorkflow.php @@ -30,6 +30,10 @@ include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); + if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval($_POST["documentid"])<1) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } @@ -66,11 +70,6 @@ if (!is_object($subworkflow)) { $folder = $document->getFolder(); -/* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); - -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('folder', $folder); $view->setParam('document', $document); diff --git a/out/out.Session.php b/out/out.Session.php index 4c07bc48c..cc6ac7e71 100644 --- a/out/out.Session.php +++ b/out/out.Session.php @@ -25,9 +25,9 @@ include("../inc/inc.Language.php"); include("../inc/inc.Init.php"); include("../inc/inc.Extension.php"); include("../inc/inc.DBInit.php"); +include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); include("../inc/inc.ClassAccessOperation.php"); -include("../inc/inc.ClassUI.php"); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); diff --git a/out/out.Settings.php b/out/out.Settings.php index e7ebebee0..c379177c7 100644 --- a/out/out.Settings.php +++ b/out/out.Settings.php @@ -26,6 +26,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -34,9 +36,14 @@ if (!$user->isAdmin()) { if(!trim($settings->_encryptionKey)) $settings->_encryptionKey = md5(uniqid()); -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'settings'=>$settings, 'currenttab'=>(isset($_REQUEST['currenttab']) ? $_REQUEST['currenttab'] : ''))); +$users = $dms->getAllUsers($settings->_sortUsersInList); +$groups = $dms->getAllGroups(); + if($view) { + $view->setParam('settings', $settings); + $view->setParam('currenttab', (isset($_REQUEST['currenttab']) ? $_REQUEST['currenttab'] : '')); + $view->setParam('allusers', $users); + $view->setParam('allgroups', $groups); $view($_GET); exit; } diff --git a/out/out.Statistic.php b/out/out.Statistic.php index 4217d5b65..e5b025637 100644 --- a/out/out.Statistic.php +++ b/out/out.Statistic.php @@ -27,14 +27,15 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } $rootfolder = $dms->getFolder($settings->_rootFolderID); -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'rootfolder'=>$rootfolder)); if($view) { + $view->setParam('rootfolder', $rootfolder); $view($_GET); exit; } diff --git a/out/out.SubstituteUser.php b/out/out.SubstituteUser.php index a4cc03e00..295ee3bb5 100644 --- a/out/out.SubstituteUser.php +++ b/out/out.SubstituteUser.php @@ -27,14 +27,14 @@ include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1]); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } $allUsers = $dms->getAllUsers($settings->_sortUsersInList); -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1]); if($view) { $view->setParam('dms', $dms); $view->setParam('user', $user); diff --git a/out/out.Timeline.php b/out/out.Timeline.php index 628e528f8..8ce4607ac 100644 --- a/out/out.Timeline.php +++ b/out/out.Timeline.php @@ -28,10 +28,7 @@ include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1]); -if(!$view) { -} - +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { $view->exitError(getMLText("admin_tools"),getMLText("access_denied")); } diff --git a/out/out.UpdateDocument.php b/out/out.UpdateDocument.php index 82a743ed8..2f4081222 100644 --- a/out/out.UpdateDocument.php +++ b/out/out.UpdateDocument.php @@ -30,6 +30,10 @@ include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); + if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } @@ -59,11 +63,6 @@ if($settings->_quota > 0) { $folder = $document->getFolder(); -/* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); - -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('folder', $folder); $view->setParam('document', $document); diff --git a/out/out.UserDefaultKeywords.php b/out/out.UserDefaultKeywords.php index 85dacdeb1..d78691960 100644 --- a/out/out.UserDefaultKeywords.php +++ b/out/out.UserDefaultKeywords.php @@ -27,14 +27,15 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + if ($user->isGuest()) { UI::exitError(getMLText("edit_default_keywords"),getMLText("access_denied")); } $categories = $dms->getAllUserKeywordCategories($user->getID()); -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('categories', $categories); $view($_GET); diff --git a/out/out.UserList.php b/out/out.UserList.php index a135e91ae..6b17312df 100644 --- a/out/out.UserList.php +++ b/out/out.UserList.php @@ -27,17 +27,19 @@ include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); include("../inc/inc.ClassPasswordStrength.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } $allUsers = $dms->getAllUsers($settings->_sortUsersInList); -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'allusers'=>$allUsers, 'httproot'=>$settings->_httpRoot, 'quota'=>$settings->_quota, 'pwdexpiration'=>$settings->_passwordExpiration)); if($view) { + $view->setParam('allusers', $allUsers); + $view->setParam('httproot', $settings->_httpRoot); + $view->setParam('quota', $settings->_quota); + $view->setParam('pwdexpiration', $settings->_passwordExpiration); $view($_GET); exit; } - -?> diff --git a/out/out.UsrMgr.php b/out/out.UsrMgr.php index 27fdeae53..99e70f3f1 100644 --- a/out/out.UsrMgr.php +++ b/out/out.UsrMgr.php @@ -28,6 +28,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -48,10 +50,18 @@ if(isset($_GET['userid']) && $_GET['userid']) { $seluser = null; } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'seluser'=>$seluser, 'allusers'=>$users, 'allgroups'=>$groups, 'passwordstrength'=>$settings->_passwordStrength, 'passwordexpiration'=>$settings->_passwordExpiration, 'httproot'=>$settings->_httpRoot, 'enableuserimage'=>$settings->_enableUserImage, 'undeluserids'=>explode(',', $settings->_undelUserIds), 'workflowmode'=>$settings->_workflowMode, 'quota'=>$settings->_quota, 'strictformcheck'=>$settings->_strictFormCheck, 'enableemail'=>$settings->_enableEmail)); if($view) { + $view->setParam('seluser', $seluser); + $view->setParam('allusers', $users); + $view->setParam('allgroups', $groups); + $view->setParam('passwordstrength', $settings->_passwordStrength); + $view->setParam('passwordexpiration', $settings->_passwordExpiration); + $view->setParam('httproot', $settings->_httpRoot); + $view->setParam('enableuserimage', $settings->_enableUserImage); + $view->setParam('undeluserids', explode(',', $settings->_undelUserIds)); + $view->setParam('workflowmode', $settings->_workflowMode); + $view->setParam('quota', $settings->_quota); + $view->setParam('strictformcheck', $settings->_strictFormCheck); + $view->setParam('enableemail', $settings->_enableEmail); $view($_GET); } - -?> diff --git a/out/out.UsrView.php b/out/out.UsrView.php index 242c2421c..db19bb304 100644 --- a/out/out.UsrView.php +++ b/out/out.UsrView.php @@ -26,6 +26,9 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + if ($user->isGuest()) { UI::exitError(getMLText("my_account"),getMLText("access_denied")); } @@ -39,8 +42,6 @@ if (is_bool($users)) { UI::exitError(getMLText("my_account"),getMLText("internal_error")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('allusers', $users); $view->setParam('enableuserimage', $settings->_enableUserImage); diff --git a/out/out.ViewDocument.php b/out/out.ViewDocument.php index 8156d7900..15ccfe4a4 100644 --- a/out/out.ViewDocument.php +++ b/out/out.ViewDocument.php @@ -31,9 +31,8 @@ include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1]); -if(!$view) { -} +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) { $view->exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); @@ -44,15 +43,17 @@ if (!is_object($document)) { $view->exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } -/* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); - $folder = $document->getFolder(); if ($document->getAccessMode($user) < M_READ || !$document->getLatestContent()) { $view->exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied")); } +/* Could be that the advanced access rights prohibit access on the content */ +if (!$document->getLatestContent()) { + $view->exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied")); +} + /* Recalculate the status of a document and reload the page if the status * has changed. A status change may occur if the document has expired in * the mean time @@ -63,8 +64,6 @@ if ($document->verifyLastestContentExpriry()){ } if($view) { - $view->setParam('dms', $dms); - $view->setParam('user', $user); $view->setParam('folder', $folder); $view->setParam('document', $document); $view->setParam('accessobject', $accessop); diff --git a/out/out.ViewEvent.php b/out/out.ViewEvent.php index 61926f3e3..a19d60484 100644 --- a/out/out.ViewEvent.php +++ b/out/out.ViewEvent.php @@ -27,6 +27,8 @@ include("../inc/inc.ClassUI.php"); include("../inc/inc.Calendar.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!isset($_GET["id"])){ UI::exitError(getMLText("event_details"),getMLText("error_occured")); } @@ -36,8 +38,6 @@ if (is_bool($event)&&!$event){ UI::exitError(getMLText("event_details"),getMLText("error_occured")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('event', $event); $view($_GET); diff --git a/out/out.WorkflowActionsMgr.php b/out/out.WorkflowActionsMgr.php index 82f787ad7..84593a195 100644 --- a/out/out.WorkflowActionsMgr.php +++ b/out/out.WorkflowActionsMgr.php @@ -28,6 +28,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -43,8 +45,6 @@ if (is_bool($workflowactions)) { UI::exitError(getMLText("admin_tools"),getMLText("internal_error")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('allworkflowactions', $workflowactions); $view->setParam('selworkflowaction', $selworkflowaction); diff --git a/out/out.WorkflowGraph.php b/out/out.WorkflowGraph.php index 24ea7d051..0ea650493 100644 --- a/out/out.WorkflowGraph.php +++ b/out/out.WorkflowGraph.php @@ -28,6 +28,9 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + $workflow = $dms->getWorkflow($_GET['workflow']); if (is_bool($workflow)) { UI::exitError(getMLText("admin_tools"),getMLText("internal_error")); @@ -51,8 +54,6 @@ if(isset($_GET['transitions']) && $_GET['transitions']) { } } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('workflow', $workflow); $view->setParam('transitions', $transitions); diff --git a/out/out.WorkflowMgr.php b/out/out.WorkflowMgr.php index a51f7dc34..b56414147 100644 --- a/out/out.WorkflowMgr.php +++ b/out/out.WorkflowMgr.php @@ -28,6 +28,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -48,8 +50,6 @@ if(isset($_GET['workflowid']) && $_GET['workflowid']) { $selworkflow = null; } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('selworkflow', $selworkflow); $view->setParam('allworkflows', $workflows); diff --git a/out/out.WorkflowStatesMgr.php b/out/out.WorkflowStatesMgr.php index 101679e1a..fe226f977 100644 --- a/out/out.WorkflowStatesMgr.php +++ b/out/out.WorkflowStatesMgr.php @@ -28,6 +28,8 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if (!$user->isAdmin()) { UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } @@ -38,8 +40,6 @@ if(isset($_GET['workflowstateid']) && $_GET['workflowstateid']) { $selworkflowstate = null; } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('selworkflowstate', $selworkflowstate); $view($_GET); diff --git a/out/out.WorkflowSummary.php b/out/out.WorkflowSummary.php index 2269e4b97..e76e17833 100644 --- a/out/out.WorkflowSummary.php +++ b/out/out.WorkflowSummary.php @@ -28,12 +28,13 @@ include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); + if ($user->isGuest()) { UI::exitError(getMLText("my_documents"),getMLText("access_denied")); } -$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); if($view) { $view->setParam('cachedir', $settings->_cacheDir); $view->setParam('workflowmode', $settings->_workflowMode); From b6ce91c8ee83b63a55640e0173fe4a5e6a0f3440 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Nov 2017 11:27:17 +0100 Subject: [PATCH 014/122] fix validation return value --- SeedDMS_Core/Core/inc.ClassAttribute.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SeedDMS_Core/Core/inc.ClassAttribute.php b/SeedDMS_Core/Core/inc.ClassAttribute.php index 58bb5b027..b1d74c5e9 100644 --- a/SeedDMS_Core/Core/inc.ClassAttribute.php +++ b/SeedDMS_Core/Core/inc.ClassAttribute.php @@ -942,8 +942,10 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */ $values = array($attrvalue); } else $values = $attrvalue; - } else { + } elseif($attrvalue) { $values = array($attrvalue); + } else { + $values = array(); } $this->_validation_error = 0; From b29f7b1e9c7239c71bb8f6592c9eb5fed177b79d Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Nov 2017 11:28:18 +0100 Subject: [PATCH 015/122] add method getParent() --- SeedDMS_Core/Core/inc.ClassDocument.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SeedDMS_Core/Core/inc.ClassDocument.php b/SeedDMS_Core/Core/inc.ClassDocument.php index 3359ab1a8..9fc14d18e 100644 --- a/SeedDMS_Core/Core/inc.ClassDocument.php +++ b/SeedDMS_Core/Core/inc.ClassDocument.php @@ -441,6 +441,10 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */ * * @return object parent folder */ + function getParent() { /* {{{ */ + return self::getFolder(); + } /* }}} */ + function getFolder() { /* {{{ */ if (!isset($this->_folder)) $this->_folder = $this->_dms->getFolder($this->_folderID); From 8af798fe86e15c9b00c0b23523217dfa88bc1da1 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Nov 2017 11:28:49 +0100 Subject: [PATCH 016/122] views instead of temp. tables can be used --- SeedDMS_Core/Core/inc.DBAccessPDO.php | 225 +++++++++++++++++++++++++- 1 file changed, 221 insertions(+), 4 deletions(-) diff --git a/SeedDMS_Core/Core/inc.DBAccessPDO.php b/SeedDMS_Core/Core/inc.DBAccessPDO.php index 0e5260aae..ae7fb09ca 100644 --- a/SeedDMS_Core/Core/inc.DBAccessPDO.php +++ b/SeedDMS_Core/Core/inc.DBAccessPDO.php @@ -102,6 +102,11 @@ class SeedDMS_Core_DatabaseAccess { */ private $_logfp; + /** + * @var boolean set to true if views instead of temp. tables shall be used + */ + private $_useviews; + /** * Return list of all database tables * @@ -130,6 +135,34 @@ class SeedDMS_Core_DatabaseAccess { return $res; } /* }}} */ + /** + * Return list of all database views + * + * This function is used to retrieve a list of database views + * + * @return array list of view names + */ + public function ViewList() { /* {{{ */ + switch($this->_driver) { + case 'mysql': + $sql = "select TABLE_NAME as name from information_schema.views where TABLE_SCHEMA='".$this->_database."'"; + break; + case 'sqlite': + $sql = "select tbl_name as name from sqlite_master where type='view'"; + break; + case 'pgsql': + $sql = "select viewname as name from pg_catalog.pg_views where schemaname='public'"; + break; + default: + return false; + } + $arr = $this->getResultArray($sql); + $res = array(); + foreach($arr as $tmp) + $res[] = $tmp['name']; + return $res; + } /* }}} */ + /** * Constructor of SeedDMS_Core_DatabaseAccess * @@ -171,6 +204,7 @@ class SeedDMS_Core_DatabaseAccess { $this->_ttapproveid = false; $this->_ttstatid = false; $this->_ttcontentid = false; + $this->_useviews = true; $this->_debug = false; } /* }}} */ @@ -221,11 +255,22 @@ class SeedDMS_Core_DatabaseAccess { $this->_conn->exec('SET NAMES utf8'); /* Turn this on if you want strict checking of default values, etc. */ // $this->_conn->exec("SET SESSION sql_mode = 'STRICT_TRANS_TABLES'"); + /* The following is the default on Ubuntu 16.04 */ +// $this->_conn->exec("SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'"); break; case 'sqlite': $this->_conn->exec('PRAGMA foreign_keys = ON'); break; } + if($this->_useviews) { + $tmp = $this->ViewList(); + foreach(array('ttreviewid', 'ttapproveid', 'ttstatid', 'ttcontentid') as $viewname) { + if(in_array($viewname, $tmp)) { + $this->{"_".$viewname} = true; + } + } + } + $this->_connected = true; return true; } /* }}} */ @@ -365,7 +410,7 @@ class SeedDMS_Core_DatabaseAccess { /** * Create various temporary tables to speed up and simplify sql queries */ - function createTemporaryTable($tableName, $override=false) { /* {{{ */ + private function __createTemporaryTable($tableName, $override=false) { /* {{{ */ if (!strcasecmp($tableName, "ttreviewid")) { switch($this->_driver) { case 'sqlite': @@ -407,7 +452,7 @@ class SeedDMS_Core_DatabaseAccess { } return $this->_ttreviewid; } - else if (!strcasecmp($tableName, "ttapproveid")) { + elseif (!strcasecmp($tableName, "ttapproveid")) { switch($this->_driver) { case 'sqlite': $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttapproveid` AS ". @@ -448,7 +493,7 @@ class SeedDMS_Core_DatabaseAccess { } return $this->_ttapproveid; } - else if (!strcasecmp($tableName, "ttstatid")) { + elseif (!strcasecmp($tableName, "ttstatid")) { switch($this->_driver) { case 'sqlite': $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttstatid` AS ". @@ -489,7 +534,7 @@ class SeedDMS_Core_DatabaseAccess { } return $this->_ttstatid; } - else if (!strcasecmp($tableName, "ttcontentid")) { + elseif (!strcasecmp($tableName, "ttcontentid")) { switch($this->_driver) { case 'sqlite': $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttcontentid` AS ". @@ -533,6 +578,178 @@ class SeedDMS_Core_DatabaseAccess { return false; } /* }}} */ + /** + * Create various temporary tables to speed up and simplify sql queries + */ + private function __createView($tableName, $override=false) { /* {{{ */ + if (!strcasecmp($tableName, "ttreviewid")) { + switch($this->_driver) { + case 'sqlite': + $queryStr = "CREATE VIEW `ttreviewid` AS ". + "SELECT `tblDocumentReviewLog`.`reviewID` AS `reviewID`, ". + "MAX(`tblDocumentReviewLog`.`reviewLogID`) AS `maxLogID` ". + "FROM `tblDocumentReviewLog` ". + "GROUP BY `tblDocumentReviewLog`.`reviewID` "; //. + break; + case 'pgsql': + $queryStr = "CREATE VIEW `ttreviewid` AS ". + "SELECT `tblDocumentReviewLog`.`reviewID` AS `reviewID`, ". + "MAX(`tblDocumentReviewLog`.`reviewLogID`) AS `maxLogID` ". + "FROM `tblDocumentReviewLog` ". + "GROUP BY `tblDocumentReviewLog`.`reviewID` "; + break; + default: + $queryStr = "CREATE".($override ? " OR REPLACE" : "")." VIEW `ttreviewid` AS ". + "SELECT `tblDocumentReviewLog`.`reviewID` AS `reviewID`, ". + "MAX(`tblDocumentReviewLog`.`reviewLogID`) AS `maxLogID` ". + "FROM `tblDocumentReviewLog` ". + "GROUP BY `tblDocumentReviewLog`.`reviewID` "; + } + if (!$this->_ttreviewid) { + if (!$this->getResult($queryStr)) + return false; + $this->_ttreviewid=true; + } + else { + if (is_bool($override) && $override) { + if (!$this->getResult("DROP VIEW `ttreviewid`")) + return false; + if (!$this->getResult($queryStr)) + return false; + } + } + return $this->_ttreviewid; + } + elseif (!strcasecmp($tableName, "ttapproveid")) { + switch($this->_driver) { + case 'sqlite': + $queryStr = "CREATE VIEW `ttapproveid` AS ". + "SELECT `tblDocumentApproveLog`.`approveID` AS `approveID`, ". + "MAX(`tblDocumentApproveLog`.`approveLogID`) AS `maxLogID` ". + "FROM `tblDocumentApproveLog` ". + "GROUP BY `tblDocumentApproveLog`.`approveID` "; //. + break; + case 'pgsql': + $queryStr = "CREATE VIEW `ttapproveid` AS ". + "SELECT `tblDocumentApproveLog`.`approveID` AS `approveID`, ". + "MAX(`tblDocumentApproveLog`.`approveLogID`) AS `maxLogID` ". + "FROM `tblDocumentApproveLog` ". + "GROUP BY `tblDocumentApproveLog`.`approveID` "; + break; + default: + $queryStr = "CREATE".($override ? " OR REPLACE" : "")." VIEW `ttapproveid` AS ". + "SELECT `tblDocumentApproveLog`.`approveID`, ". + "MAX(`tblDocumentApproveLog`.`approveLogID`) AS `maxLogID` ". + "FROM `tblDocumentApproveLog` ". + "GROUP BY `tblDocumentApproveLog`.`approveID` "; + } + if (!$this->_ttapproveid) { + if (!$this->getResult($queryStr)) + return false; + $this->_ttapproveid=true; + } + else { + if (is_bool($override) && $override) { + if (!$this->getResult("DROP VIEW `ttapproveid`")) + return false; + if (!$this->getResult($queryStr)) + return false; + } + } + return $this->_ttapproveid; + } + elseif (!strcasecmp($tableName, "ttstatid")) { + switch($this->_driver) { + case 'sqlite': + $queryStr = "CREATE VIEW `ttstatid` AS ". + "SELECT `tblDocumentStatusLog`.`statusID` AS `statusID`, ". + "MAX(`tblDocumentStatusLog`.`statusLogID`) AS `maxLogID` ". + "FROM `tblDocumentStatusLog` ". + "GROUP BY `tblDocumentStatusLog`.`statusID` "; + break; + case 'pgsql': + $queryStr = "CREATE VIEW `ttstatid` AS ". + "SELECT `tblDocumentStatusLog`.`statusID` AS `statusID`, ". + "MAX(`tblDocumentStatusLog`.`statusLogID`) AS `maxLogID` ". + "FROM `tblDocumentStatusLog` ". + "GROUP BY `tblDocumentStatusLog`.`statusID` "; + break; + default: + $queryStr = "CREATE".($override ? " OR REPLACE" : "")." VIEW `ttstatid` AS ". + "SELECT `tblDocumentStatusLog`.`statusID`, ". + "MAX(`tblDocumentStatusLog`.`statusLogID`) AS `maxLogID` ". + "FROM `tblDocumentStatusLog` ". + "GROUP BY `tblDocumentStatusLog`.`statusID` "; + } + if (!$this->_ttstatid) { + if (!$this->getResult($queryStr)) + return false; + $this->_ttstatid=true; + } + else { + if (is_bool($override) && $override) { + if (!$this->getResult("DROP VIEW `ttstatid`")) + return false; + if (!$this->getResult($queryStr)) + return false; + } + } + return $this->_ttstatid; + } + elseif (!strcasecmp($tableName, "ttcontentid")) { + switch($this->_driver) { + case 'sqlite': + $queryStr = "CREATE VIEW `ttcontentid` AS ". + "SELECT `tblDocumentContent`.`document` AS `document`, ". + "MAX(`tblDocumentContent`.`version`) AS `maxVersion` ". + "FROM `tblDocumentContent` ". + "GROUP BY `tblDocumentContent`.`document` ". + "ORDER BY `tblDocumentContent`.`document`"; + break; + case 'pgsql': + $queryStr = "CREATE VIEW `ttcontentid` AS ". + "SELECT `tblDocumentContent`.`document` AS `document`, ". + "MAX(`tblDocumentContent`.`version`) AS `maxVersion` ". + "FROM `tblDocumentContent` ". + "GROUP BY `tblDocumentContent`.`document` ". + "ORDER BY `tblDocumentContent`.`document`"; + break; + default: + $queryStr = "CREATE".($override ? " OR REPLACE" : "")." VIEW `ttcontentid` AS ". + "SELECT `tblDocumentContent`.`document`, ". + "MAX(`tblDocumentContent`.`version`) AS `maxVersion` ". + "FROM `tblDocumentContent` ". + "GROUP BY `tblDocumentContent`.`document` ". + "ORDER BY `tblDocumentContent`.`document`"; + } + if (!$this->_ttcontentid) { + if (!$this->getResult($queryStr)) + return false; + $this->_ttcontentid=true; + } + else { + if (is_bool($override) && $override) { + if (!$this->getResult("DROP VIEW `ttcontentid`")) + return false; + if (!$this->getResult($queryStr)) + return false; + } + } + return $this->_ttcontentid; + } + return false; + } /* }}} */ + + /** + * Create various temporary tables to speed up and simplify sql queries + */ + public function createTemporaryTable($tableName, $override=false) { /* {{{ */ + if($this->_useviews) + return $this->__createView($tableName, $override); + else + return $this->__createTemporaryTable($tableName, $override); + } /* }}} */ + /** * Return sql statement for extracting the date part from a field * containing a unix timestamp From 8bb3821a2f031a3d19fdbc1c7e29b120afd8e7ee Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Nov 2017 11:29:49 +0100 Subject: [PATCH 017/122] $accessop must be instanciated later --- out/out.ViewDocument.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/out/out.ViewDocument.php b/out/out.ViewDocument.php index 15ccfe4a4..cd5b1ae66 100644 --- a/out/out.ViewDocument.php +++ b/out/out.ViewDocument.php @@ -32,7 +32,6 @@ include("../inc/inc.Authentication.php"); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); -$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) { $view->exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); @@ -43,6 +42,7 @@ if (!is_object($document)) { $view->exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $folder = $document->getFolder(); if ($document->getAccessMode($user) < M_READ || !$document->getLatestContent()) { From 78f4d62e367f88a8d33ce2dbe271e9ec437a17a3 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Nov 2017 11:51:12 +0100 Subject: [PATCH 018/122] optimized code to get various document lists --- SeedDMS_Core/Core/inc.ClassDMS.php | 138 ++++++++++++++++++++++++++++- 1 file changed, 137 insertions(+), 1 deletion(-) diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index 96f3678fc..7c4e91b28 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -797,6 +797,7 @@ class SeedDMS_Core_DMS { * @param string $param2 set to true * if 'AppRevByMe', 'ReviseByMe', 'ReceiptByMe' shall return even documents * І have already taken care of. + * if 'ExpiredOwner' contains the date in days or as 'yyyy-mm-dd' * @param string $param3 sort list by this field * @param string $param4 order direction * @return array list of documents records @@ -812,6 +813,7 @@ class SeedDMS_Core_DMS { /* The following statement retrieves the status of the last version of all * documents. It must be restricted by further where clauses. */ +/* $queryStr = "SELECT `tblDocuments`.*, `tblDocumentLocks`.`userID` as `lockUser`, ". "`tblDocumentContent`.`version`, `tblDocumentStatus`.*, `tblDocumentStatusLog`.`status`, ". "`tblDocumentStatusLog`.`comment` AS `statusComment`, `tblDocumentStatusLog`.`date` as `statusDate`, ". @@ -827,9 +829,33 @@ class SeedDMS_Core_DMS { "LEFT JOIN `tblUsers` AS `sTbl` on `sTbl`.`id` = `tblDocumentStatusLog`.`userID` ". "WHERE `ttstatid`.`maxLogID`=`tblDocumentStatusLog`.`statusLogID` ". "AND `ttcontentid`.`maxVersion` = `tblDocumentContent`.`version` "; + */ + /* New sql statement which retrieves all documents, its latest version and + * status, the owner and user initiating the latest status. + * It doesn't need the where clause anymore. Hence the statement could be + * extended with further left joins. + */ + $selectStr = "SELECT `tblDocuments`.*, `tblDocumentLocks`.`userID` as `lockUser`, ". + "`tblDocumentContent`.`version`, `tblDocumentStatus`.*, `tblDocumentStatusLog`.`status`, ". + "`tblDocumentStatusLog`.`comment` AS `statusComment`, `tblDocumentStatusLog`.`date` as `statusDate`, ". + "`tblDocumentStatusLog`.`userID`, `oTbl`.`fullName` AS `ownerName`, `sTbl`.`fullName` AS `statusName` "; + $queryStr = + "FROM `ttcontentid` ". + "LEFT JOIN `tblDocuments` ON `tblDocuments`.`id` = `ttcontentid`.`document` ". + "LEFT JOIN `tblDocumentContent` ON `tblDocumentContent`.`document` = `ttcontentid`.`document` AND `tblDocumentContent`.`version` = `ttcontentid`.`maxVersion` ". + "LEFT JOIN `tblDocumentStatus` ON `tblDocumentStatus`.`documentID`=`ttcontentid`.`document` AND `tblDocumentStatus`.`version`=`ttcontentid`.`maxVersion` ". + "LEFT JOIN `ttstatid` ON `ttstatid`.`statusID` = `tblDocumentStatus`.`statusID` ". + "LEFT JOIN `tblDocumentStatusLog` ON `ttstatid`.`statusID` = `tblDocumentStatusLog`.`statusID` AND `ttstatid`.`maxLogID` = `tblDocumentStatusLog`.`statusLogID` ". + "LEFT JOIN `tblDocumentLocks` ON `ttcontentid`.`document`=`tblDocumentLocks`.`document` ". + "LEFT JOIN `tblUsers` `oTbl` ON `oTbl`.`id` = `tblDocuments`.`owner` ". + "LEFT JOIN `tblUsers` `sTbl` ON `sTbl`.`id` = `tblDocumentStatusLog`.`userID` "; + +// echo $queryStr; switch($listtype) { case 'AppRevByMe': // Documents I have to review/approve {{{ + $queryStr .= "WHERE 1=1 "; + $user = $param1; // Get document list for the current user. $reviewStatus = $user->getReviewStatus(); @@ -873,6 +899,9 @@ class SeedDMS_Core_DMS { } break; // }}} case 'ReviewByMe': // Documents I have to review {{{ + if (!$this->db->createTemporaryTable("ttreviewid")) { + return false; + } $user = $param1; $orderby = $param3; if($param4 == 'desc') @@ -880,6 +909,33 @@ class SeedDMS_Core_DMS { else $orderdir = 'ASC'; + $groups = array(); + $tmp = $user->getGroups(); + foreach($tmp as $group) + $groups[] = $group->getID(); + + $selectStr .= ", `tblDocumentReviewLog`.`date` as `duedate` "; + $queryStr .= + "LEFT JOIN `tblDocumentReviewers` on `ttcontentid`.`document`=`tblDocumentReviewers`.`documentID` AND `ttcontentid`.`maxVersion`=`tblDocumentReviewers`.`version` ". + "LEFT JOIN `ttreviewid` ON `ttreviewid`.`reviewID` = `tblDocumentReviewers`.`reviewID` ". + "LEFT JOIN `tblDocumentReviewLog` ON `tblDocumentReviewLog`.`reviewLogID`=`ttreviewid`.`maxLogID` "; + + if(1) { + $queryStr .= "WHERE (`tblDocumentReviewers`.`type` = 0 AND `tblDocumentReviewers`.`required` = ".$user->getID()." "; + if($groups) + $queryStr .= "OR `tblDocumentReviewers`.`type` = 1 AND `tblDocumentReviewers`.`required` IN (".implode(',', $groups).") "; + $queryStr .= ") "; + $queryStr .= "AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_EXPIRED.") "; + if(!$param2) + $queryStr .= " AND `tblDocumentReviewLog`.`status` = 0 "; + if ($orderby=='e') $queryStr .= "ORDER BY `expires`"; + else if ($orderby=='u') $queryStr .= "ORDER BY `statusDate`"; + else if ($orderby=='s') $queryStr .= "ORDER BY `status`"; + else $queryStr .= "ORDER BY `name`"; + $queryStr .= " ".$orderdir; + } else { + $queryStr .= "WHERE 1=1 "; + // Get document list for the current user. $reviewStatus = $user->getReviewStatus(); @@ -915,8 +971,12 @@ class SeedDMS_Core_DMS { } else { $queryStr = ''; } + } break; // }}} case 'ApproveByMe': // Documents I have to approve {{{ + if (!$this->db->createTemporaryTable("ttapproveid")) { + return false; + } $user = $param1; $orderby = $param3; if($param4 == 'desc') @@ -924,6 +984,33 @@ class SeedDMS_Core_DMS { else $orderdir = 'ASC'; + $groups = array(); + $tmp = $user->getGroups(); + foreach($tmp as $group) + $groups[] = $group->getID(); + + $selectStr .= ", `tblDocumentApproveLog`.`date` as `duedate` "; + $queryStr .= + "LEFT JOIN `tblDocumentApprovers` on `ttcontentid`.`document`=`tblDocumentApprovers`.`documentID` AND `ttcontentid`.`maxVersion`=`tblDocumentApprovers`.`version` ". + "LEFT JOIN `ttapproveid` ON `ttapproveid`.`approveID` = `tblDocumentApprovers`.`approveID` ". + "LEFT JOIN `tblDocumentApproveLog` ON `tblDocumentApproveLog`.`approveLogID`=`ttapproveid`.`maxLogID` "; + + if(1) { + $queryStr .= "WHERE (`tblDocumentApprovers`.`type` = 0 AND `tblDocumentApprovers`.`required` = ".$user->getID()." "; + if($groups) + $queryStr .= "OR `tblDocumentApprovers`.`type` = 1 AND `tblDocumentApprovers`.`required` IN (".implode(',', $groups).")"; + $queryStr .= ") "; + $queryStr .= "AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_APP.", ".S_EXPIRED.") "; + if(!$param2) + $queryStr .= " AND `tblDocumentApproveLog`.`status` = 0 "; + if ($orderby=='e') $queryStr .= "ORDER BY `expires`"; + else if ($orderby=='u') $queryStr .= "ORDER BY `statusDate`"; + else if ($orderby=='s') $queryStr .= "ORDER BY `status`"; + else $queryStr .= "ORDER BY `name`"; + $queryStr .= " ".$orderdir; + } else { + $queryStr .= "WHERE 1=1 "; + // Get document list for the current user. $approvalStatus = $user->getApprovalStatus(); @@ -959,8 +1046,11 @@ class SeedDMS_Core_DMS { } else { $queryStr = ''; } + } break; // }}} case 'WorkflowByMe': // Documents I to trigger in Worklflow {{{ + $queryStr .= "WHERE 1=1 "; + $user = $param1; // Get document list for the current user. $workflowStatus = $user->getWorkflowStatus(); @@ -993,6 +1083,8 @@ class SeedDMS_Core_DMS { } break; // }}} case 'AppRevOwner': // Documents waiting for review/approval/revision I'm owning {{{ + $queryStr .= "WHERE 1=1 "; + $user = $param1; $orderby = $param3; if($param4 == 'desc') @@ -1011,6 +1103,8 @@ class SeedDMS_Core_DMS { // "ORDER BY `statusDate` DESC"; break; // }}} case 'RejectOwner': // Documents that has been rejected and I'm owning {{{ + $queryStr .= "WHERE 1=1 "; + $user = $param1; $orderby = $param3; if($param4 == 'desc') @@ -1027,6 +1121,8 @@ class SeedDMS_Core_DMS { $queryStr .= " ".$orderdir; break; // }}} case 'LockedByMe': // Documents locked by me {{{ + $queryStr .= "WHERE 1=1 "; + $user = $param1; $orderby = $param3; if($param4 == 'desc') @@ -1055,13 +1151,53 @@ class SeedDMS_Core_DMS { $queryStr = ''; } break; // }}} + case 'ExpiredOwner': // Documents expired and owned by me {{{ + if(is_int($param2)) { + $ts = mktime(0, 0, 0) + $param2 * 86400; + } elseif(is_string($param2)) { + $tmp = explode('-', $param2, 3); + if(count($tmp) != 3) + return false; + $ts = mktime(0, 0, 0, $tmp[1], $tmp[2], $tmp[0]); + } else + $ts = mktime(0, 0, 0)-365*86400; /* Start of today - 1 year */ + + $tsnow = mktime(0, 0, 0); /* Start of today */ + if($ts < $tsnow) { /* Check for docs expired in the past */ + $startts = $ts; + $endts = $tsnow+86400; /* Use end of day */ + } else { /* Check for docs which will expire in the future */ + $startts = $tsnow; + $endts = $ts+86400; /* Use end of day */ + } + + $queryStr .= + "WHERE `tblDocuments`.`expires` > ".$startts." AND `tblDocuments`.`expires` < ".$endts." "; + + $user = $param1; + $orderby = $param3; + if($param4 == 'desc') + $orderdir = 'DESC'; + else + $orderdir = 'ASC'; + $queryStr .= "AND `tblDocuments`.`owner` = '".$user->getID()."' "; + if ($orderby=='e') $queryStr .= "ORDER BY `expires`"; + else if ($orderby=='u') $queryStr .= "ORDER BY `statusDate`"; + else if ($orderby=='s') $queryStr .= "ORDER BY `status`"; + else $queryStr .= "ORDER BY `name`"; + $queryStr .= " ".$orderdir; + break; // }}} case 'WorkflowOwner': // Documents waiting for workflow trigger I'm owning {{{ + $queryStr .= "WHERE 1=1 "; + $user = $param1; $queryStr .= "AND `tblDocuments`.`owner` = '".$user->getID()."' ". "AND `tblDocumentStatusLog`.`status` IN (".S_IN_WORKFLOW.") ". "ORDER BY `statusDate` DESC"; break; // }}} case 'MyDocs': // Documents owned by me {{{ + $queryStr .= "WHERE 1=1 "; + $user = $param1; $orderby = $param3; if($param4 == 'desc') @@ -1078,7 +1214,7 @@ class SeedDMS_Core_DMS { } if($queryStr) { - $resArr = $this->db->getResultArray($queryStr); + $resArr = $this->db->getResultArray($selectStr.$queryStr); if (is_bool($resArr) && !$resArr) { return false; } From 545cdb4e32908452136483396c741f47323c1c64 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Nov 2017 11:51:45 +0100 Subject: [PATCH 019/122] backup dir can be set in configuration --- inc/inc.ClassSettings.php | 4 +++ op/op.Settings.php | 1 + out/out.BackupTools.php | 7 +++++ views/bootstrap/class.BackupTools.php | 44 +++++++++++++++------------ views/bootstrap/class.Settings.php | 4 +++ 5 files changed, 41 insertions(+), 19 deletions(-) diff --git a/inc/inc.ClassSettings.php b/inc/inc.ClassSettings.php index e253030d7..bb7f503ea 100644 --- a/inc/inc.ClassSettings.php +++ b/inc/inc.ClassSettings.php @@ -89,6 +89,8 @@ class Settings { /* {{{ */ var $_luceneDir = null; // Where the drop folders are located var $_dropFolderDir = null; + // Where the backup directory is located + var $_backupDir = null; // enable removal of file from dropfolder after success import var $_removeFromDropFolder = false; // Where the stop word file is located @@ -467,6 +469,7 @@ class Settings { /* {{{ */ $this->_stagingDir = strval($tab["stagingDir"]); $this->_luceneDir = strval($tab["luceneDir"]); $this->_dropFolderDir = strval($tab["dropFolderDir"]); + $this->_backupDir = strval($tab["backupDir"]); $this->_logFileEnable = Settings::boolVal($tab["logFileEnable"]); $this->_logFileRotation = strval($tab["logFileRotation"]); $this->_enableLargeFileUpload = Settings::boolVal($tab["enableLargeFileUpload"]); @@ -779,6 +782,7 @@ class Settings { /* {{{ */ $this->setXMLAttributValue($node, "stagingDir", $this->_stagingDir); $this->setXMLAttributValue($node, "luceneDir", $this->_luceneDir); $this->setXMLAttributValue($node, "dropFolderDir", $this->_dropFolderDir); + $this->setXMLAttributValue($node, "backupDir", $this->_backupDir); $this->setXMLAttributValue($node, "logFileEnable", $this->_logFileEnable); $this->setXMLAttributValue($node, "logFileRotation", $this->_logFileRotation); $this->setXMLAttributValue($node, "enableLargeFileUpload", $this->_enableLargeFileUpload); diff --git a/op/op.Settings.php b/op/op.Settings.php index 7e9c89581..190227213 100644 --- a/op/op.Settings.php +++ b/op/op.Settings.php @@ -114,6 +114,7 @@ if ($action == "saveSettings") $settings->_luceneDir = addDirSep($_POST["luceneDir"]); $settings->_extraPath = addDirSep($_POST["extraPath"]); $settings->_dropFolderDir = addDirSep($_POST["dropFolderDir"]); + $settings->_backupDir = addDirSep($_POST["backupDir"]); $settings->_logFileEnable = getBoolValue("logFileEnable"); $settings->_logFileRotation = $_POST["logFileRotation"]; $settings->_enableLargeFileUpload = getBoolValue("enableLargeFileUpload"); diff --git a/out/out.BackupTools.php b/out/out.BackupTools.php index a9cdbef56..3202da372 100644 --- a/out/out.BackupTools.php +++ b/out/out.BackupTools.php @@ -34,6 +34,13 @@ if (!$user->isAdmin()) { } if($view) { + if($settings->_backupDir && file_exists($settings->_backupDir)) { + $view->setParam('backupdir', $settings->_backupDir); + $view->setParam('hasbackupdir', true); + } else { + $view->setParam('backupdir', $settings->_contentDir); + $view->setParam('hasbackupdir', false); + } $view($_GET); exit; } diff --git a/views/bootstrap/class.BackupTools.php b/views/bootstrap/class.BackupTools.php index 911da6a19..f9b28b892 100644 --- a/views/bootstrap/class.BackupTools.php +++ b/views/bootstrap/class.BackupTools.php @@ -42,24 +42,29 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style { function show() { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; - $contentdir = $this->params['contentdir']; + $backupdir = $this->params['backupdir']; $this->htmlStartPage(getMLText("backup_tools")); $this->globalNavigation(); $this->contentStart(); $this->pageNavigation(getMLText("admin_tools"), "admin_tools"); - $this->contentHeading(getMLText("backup_tools")); - $this->contentContainerStart(); - print getMLText("space_used_on_data_folder")." : ".SeedDMS_Core_File::format_filesize(dskspace($contentdir)); - $this->contentContainerEnd(); + /* Calculating the size of the backup dir is only reasonable if + * it is not part of the content dir. Otherwise the content will + * be counted as well. + */ + if($this->params['hasbackupdir']) { + $this->contentHeading(getMLText("backup_tools")); + $this->contentContainerStart(); + print getMLText("space_used_on_data_folder")." : ".SeedDMS_Core_File::format_filesize(dskspace($backupdir)); + $this->contentContainerEnd(); + } // versioning file creation //////////////////////////////////////////////////// $this->contentHeading(getMLText("versioning_file_creation")); - $this->contentContainerStart(); print "

".getMLText("versioning_file_creation_warning")."

\n"; - + $this->contentContainerStart(); print "
"; $this->printFolderChooserHtml("form1",M_READWRITE); print ""; @@ -70,9 +75,8 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style { // archive creation //////////////////////////////////////////////////////////// $this->contentHeading(getMLText("archive_creation")); - $this->contentContainerStart(); print "

".getMLText("archive_creation_warning")."

\n"; - + $this->contentContainerStart(); print ""; $this->printFolderChooserHtml("form2",M_READWRITE); print ""; @@ -81,10 +85,10 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style { // list backup files - $handle = opendir($contentdir); + $handle = opendir($backupdir); $entries = array(); while ($e = readdir($handle)){ - if (is_dir($contentdir.$e)) continue; + if (is_dir($backupdir.$e)) continue; if (strpos($e,".tar.gz")==FALSE) continue; $entries[] = $e; } @@ -113,8 +117,8 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style { print "".$entry."\n"; if (is_object($folder)) print "".htmlspecialchars($folder->getName())."\n"; else print "".getMLText("unknown_id")."\n"; - print "".getLongReadableDate(filectime($contentdir.$entry))."\n"; - print "".SeedDMS_Core_File::format_filesize(filesize($contentdir.$entry))."\n"; + print "".getLongReadableDate(filectime($backupdir.$entry))."\n"; + print "".SeedDMS_Core_File::format_filesize(filesize($backupdir.$entry))."\n"; print ""; print " ".getMLText("backup_remove").""; print "\n"; @@ -128,18 +132,18 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style { // dump creation /////////////////////////////////////////////////////////////// $this->contentHeading(getMLText("dump_creation")); - $this->contentContainerStart(); print "

".getMLText("dump_creation_warning")."

\n"; + $this->contentContainerStart(); print ""; print ""; print "
\n"; // list backup files - $handle = opendir($contentdir); + $handle = opendir($backupdir); $entries = array(); while ($e = readdir($handle)){ - if (is_dir($contentdir.$e)) continue; + if (is_dir($backupdir.$e)) continue; if (strpos($e,".sql.gz")==FALSE) continue; $entries[] = $e; } @@ -160,9 +164,11 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style { foreach ($entries as $entry){ print "\n"; - print "".$entry."\n"; - print "".getLongReadableDate(filectime($contentdir.$entry))."\n"; - print "".SeedDMS_Core_File::format_filesize(filesize($contentdir.$entry))."\n"; + print ""; + print "".$entry.""; + print "\n"; + print "".getLongReadableDate(filectime($backupdir.$entry))."\n"; + print "".SeedDMS_Core_File::format_filesize(filesize($backupdir.$entry))."\n"; print ""; print " ".getMLText("dump_remove").""; print "\n"; diff --git a/views/bootstrap/class.Settings.php b/views/bootstrap/class.Settings.php index 7eba8eff8..befb7fc08 100644 --- a/views/bootstrap/class.Settings.php +++ b/views/bootstrap/class.Settings.php @@ -398,6 +398,10 @@ if(!is_writeable($settings->_configFilePath)) { : showTextField("contentDir", $settings->_contentDir); ?> + "> + : + showTextField("backupDir", $settings->_backupDir); ?> + "> : showTextField("cacheDir", $settings->_cacheDir); ?> From 1d8743fd7fa39967cda60bbe4db6d50153ce5fff Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Nov 2017 17:12:58 +0100 Subject: [PATCH 020/122] handle 'from' propperly, even if it contains a time --- op/op.EditEvent.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/op/op.EditEvent.php b/op/op.EditEvent.php index b287e40ae..55dc8cf84 100644 --- a/op/op.EditEvent.php +++ b/op/op.EditEvent.php @@ -61,7 +61,8 @@ else $comment = $_POST["comment"]; if(isset($_POST["from"])) { - $tmp = explode('-', $_POST["from"]); + $from = explode('T', $_POST["from"]); + $tmp = explode('-', $from[0]); $from = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]); } else { UI::exitError(getMLText("edit_event"),getMLText("error_occured")); From 1d21c18aa3cfed0f253cec53c1bcd16d8a13dc69 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Nov 2017 17:34:24 +0100 Subject: [PATCH 021/122] commands for creating previews can be set --- op/op.Settings.php | 24 ++++++++++++++++++------ views/bootstrap/class.Settings.php | 27 ++++++++++++++++++++++----- 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/op/op.Settings.php b/op/op.Settings.php index 190227213..bffefec43 100644 --- a/op/op.Settings.php +++ b/op/op.Settings.php @@ -194,12 +194,24 @@ if ($action == "saveSettings") $settings->_maxExecutionTime = intval($_POST["maxExecutionTime"]); $settings->_cmdTimeout = (intval($_POST["cmdTimeout"]) > 0) ?intval($_POST["cmdTimeout"]) : 1; - // SETTINGS - ADVANCED - INDEX CMD - $settings->_converters['fulltext'] = $_POST["converters"]; - $newmimetype = preg_replace('#[^A-Za-z0-9_/+.*-]+#', '', $_POST["converters_newmimetype"]); - if($newmimetype && trim($_POST["converters_newcmd"])) { - $settings->_converters['fulltext'][$newmimetype] = trim($_POST["converters_newcmd"]); - } + // SETTINGS - ADVANCED - INDEX CMD + if(isset($_POST["converters"]["fulltext"])) + $settings->_converters['fulltext'] = $_POST["converters"]["fulltext"]; + else + $settings->_converters['fulltext'] = $_POST["converters"]; + $newmimetype = preg_replace('#[^A-Za-z0-9_/+.*-]+#', '', $settings->_converters["fulltext"]["newmimetype"]); + if($newmimetype && trim($settings->_converters['fulltext']['newcmd'])) + $settings->_converters['fulltext'][$newmimetype] = trim($settings->_converters['fulltext']['newcmd']); + unset($settings->_converters['fulltext']['newmimetype']); + unset($settings->_converters['fulltext']['newcmd']); + + if(isset($_POST["converters"]["preview"])) + $settings->_converters['preview'] = $_POST["converters"]["preview"]; + $newmimetype = preg_replace('#[^A-Za-z0-9_/+.*-]+#', '', $settings->_converters["preview"]["newmimetype"]); + if($newmimetype && trim($settings->_converters['preview']['newcmd'])) + $settings->_converters['preview'][$newmimetype] = trim($settings->_converters['preview']['newcmd']); + unset($settings->_converters['preview']['newmimetype']); + unset($settings->_converters['preview']['newcmd']); // SETTINGS - EXTENSIONS $settings->_extensions = isset($_POST["extensions"]) ? $_POST["extensions"] : array(); diff --git a/views/bootstrap/class.Settings.php b/views/bootstrap/class.Settings.php index befb7fc08..cd258805e 100644 --- a/views/bootstrap/class.Settings.php +++ b/views/bootstrap/class.Settings.php @@ -740,20 +740,37 @@ if(!is_writeable($settings->_configFilePath)) { ?> : - showTextField("converters[".$mimetype."]", htmlspecialchars($cmd)); ?> + showTextField("converters[fulltext][".$mimetype."]", htmlspecialchars($cmd)); ?> - showTextField("converters_newmimetype", "", '', getMLText('mimetype')); ?> - showTextField("converters_newcmd", "", '', getMLText('command')); ?> + showTextField("converters[fulltext][newmimetype]", "", '', getMLText('converter_new_mimetype')); ?>: + showTextField("converters[fulltext][newcmd]", "", "", getMLText('converter_new_cmd')); ?> + + +_converters['preview'])) { + foreach($settings->_converters['preview'] as $mimetype=>$cmd) { +?> + + : + showTextField("converters[preview][".$mimetype."]", htmlspecialchars($cmd)); ?> + + + + showTextField("converters[preview][newmimetype]", "", '', getMLText('mimetype')); ?>: + showTextField("converters[preview][newcmd]", "", '', getMLText('command')); ?> contentContainerEnd(); ?> -
+
contentContainerStart(); ?>