From cc8f6f3a90b669ee7613ec304e8459c8c2bfbe0e Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 6 Feb 2017 15:01:57 +0100 Subject: [PATCH] add script to download document by temp. link --- op/op.DownloadLink.php | 69 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 op/op.DownloadLink.php diff --git a/op/op.DownloadLink.php b/op/op.DownloadLink.php new file mode 100644 index 000000000..064872f4f --- /dev/null +++ b/op/op.DownloadLink.php @@ -0,0 +1,69 @@ +getUser(); + $document = $link->getDocument(); + $version = $ling->getVersion(); + + $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); + $controller = Controller::factory($tmp[1]); + $accessop = new SeedDMS_AccessOperation($dms, $user, $settings); + if (!$accessop->check_controller_access($controller, $_POST)) { + UI::exitError(getMLText("document_title", array("documentname" => "")),getMLText("access_denied")); + } + + if (!is_object($document)) { + UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); + + } + + if ($document->getAccessMode($user) < M_READ) { + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); + } + + $content = $document->getContentByVersion($version); + + if (!is_object($content)) { + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version")); + } + + $controller->setParam('content', $content); + $controller->version(); + +} /* }}} */ + +add_log_line(); +exit();