diff --git a/SeedDMS_Core/Core/inc.ClassDownloadLink.php b/SeedDMS_Core/Core/inc.ClassDownloadLink.php deleted file mode 100644 index 18ae63b99..000000000 --- a/SeedDMS_Core/Core/inc.ClassDownloadLink.php +++ /dev/null @@ -1,183 +0,0 @@ - - * @copyright Copyright (C) 2002-2005 Markus Westphal, 2006-2008 Malcolm Cowe, - * 2010 Matteo Lucarelli, 2010 Uwe Steinmann - * @version Release: @package_version@ - */ - -/** - * Class to represent a download link in the document management system - * - * Download links are access rights to a particular document version. - * - * @category DMS - * @package SeedDMS_Core - * @author Uwe Steinmann - * @copyright Copyright (C) 2016 Uwe Steinmann - * @version Release: @package_version@ - */ -class SeedDMS_Core_DownloadLink { /* {{{ */ - /** - * @var integer unique id of object - */ - protected $_id; - - /** - * @var object document belonging to link - */ - protected $_document; - - /** - * @var integer version of document - */ - protected $_version; - - /** - * @var object user owning the document link - */ - protected $_user; - - /** - * @var string hash of document link - */ - protected $_hash; - - /** - * @var date date till links valid - */ - protected $_valid; - - /** - * @var object back reference to document management system - */ - public $_dms; - - function __construct($id, $document, $version, $user, $hash, $valid) { /* {{{ */ - $this->_id = $id; - $this->_dms = null; - $this->_document = $document; - $this->_version = $version; - $this->_user = $user; - $this->_hash = $hash; - $this->_valid = $valid; - } /* }}} */ - - private static function __getInstance($queryStr, $dms) { /* {{{ */ - $db = $dms->getDB(); - $resArr = $db->getResultArray($queryStr); - if (is_bool($resArr) && $resArr == false) - return false; - if (count($resArr) != 1) - return false; - $resArr = $resArr[0]; - - $document = $dms->getDocument($resArr['document']); - $user = $dms->getUser($resArr['userID']); - - $classname = $dms->getClassname('downloadlink'); - $downloadlink = new $classname($resArr["id"], $document, $resArr["version"], $user, $resArr["hash"], $resArr["valid"]); - $downloadlink->setDMS($dms); - return $downloadlink; - } /* }}} */ - - private static function __getAllInstances($queryStr, $dms) { /* {{{ */ - $db = $dms->getDB(); - $resArr = $db->getResultArray($queryStr); - if (is_bool($resArr) && $resArr == false) - return false; - - $downloadlinks = array(); - foreach($resArr as $rec) { - $document = $dms->getDocument($rec['document']); - $user = $dms->getUser($rec['userID']); - - $classname = $dms->getClassname('downloadlink'); - $downloadlink = new $classname($rec["id"], $document, $rec["version"], $user, $rec["hash"], $rec["valid"]); - $downloadlink->setDMS($dms); - $downloadlinks[] = $downloadlink; - } - return $downloadlinks; - } /* }}} */ - - public static function getInstance($id, $dms) { /* {{{ */ - $queryStr = "SELECT * FROM `tblDownloadLinks` WHERE `id` = " . (int) $id; - return self::__getInstance($queryStr, $dms); - } /* }}} */ - - public static function getInstanceByHash($hash, $dms) { /* {{{ */ - $queryStr = "SELECT * FROM `tblDownloadLinks` WHERE `hash` = " . $db->qstr($hash); - return self::__getInstance($queryStr, $dms); - } /* }}} */ - - public static function getAllInstances($user, $version, $dms) { /* {{{ */ - $queryStr = "SELECT * FROM `tblDownloadLinks`"; - if($user || $version) { - $queryStr .= " WHERE"; - if($user) { - $queryStr .= " `userID` = " . (int) $user->getID(); - if($version) { - $queryStr .= " AND `version` = " . (int) $version; - } - } else { - $queryStr .= " `version` = " . (int) $version; - } - } - return self::__getAllInstances($queryStr, $dms); - } /* }}} */ - - /* - * Set dms this object belongs to. - * - * Each object needs a reference to the dms it belongs to. It will be - * set when the object is created. - * The dms has a references to the currently logged in user - * and the database connection. - * - * @param object $dms reference to dms - */ - function setDMS($dms) { /* {{{ */ - $this->_dms = $dms; - } /* }}} */ - - /** - * Return owner of document link - * - * @return object owner of document link as an instance of {@link SeedDMS_Core_User} - */ - function getUser() { /* {{{ */ - return $this->_user; - } /* }}} */ - - /** - * Return hash of document link - * - * @return string hash of link - */ - function getHash() { /* {{{ */ - return $this->_hash; - } /* }}} */ - - /** - * Remove a download link - * - * @return boolean true on success, otherwise false - */ - function remove() { /* {{{ */ - $db = $this->_dms->getDB(); - - $queryStr = "DELETE FROM `tblDownloadLinks` WHERE `id` = " . $this->_id; - if (!$db->getResult($queryStr)) { - return false; - } - - return true; - } /* }}} */ - -} /* }}} */ diff --git a/op/op.CreateDownloadLink.php b/op/op.CreateDownloadLink.php deleted file mode 100644 index 5f39aa2da..000000000 --- a/op/op.CreateDownloadLink.php +++ /dev/null @@ -1,73 +0,0 @@ - getMLText("invalid_request_token"))),getMLText("invalid_request_token")); -} - -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")); -} -$documentid = $_POST["documentid"]; -$document = $dms->getDocument($documentid); - -if (!is_object($document)) { - UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); -} - -if ($document->getAccessMode($user) < M_READ) { - UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); -} - -if (!isset($_POST["version"]) || !is_numeric($_POST["version"]) || intval($_POST["version"])<1) { - UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version")); -} - -$version_num = $_POST["version"]; -$version = $document->getContentByVersion($version_num); - -if (!is_object($version)) { - UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version")); -} -if (isset($_POST["expdate"])) - $expiration = $_POST["expdate"]; -else - $expiration = null; - -if($version->createDownloadLink($user, $expiration)) { - $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_create_download_link'))); -} else { - $session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_error_create_download+link'))); -} - -add_log_line("?documentid=".$documentid."&version".$version_num); - -header("Location:../out/out.ViewDocument.php?documentid=".$documentid); - -?> diff --git a/out/out.CreateDownloadLink.php b/out/out.CreateDownloadLink.php deleted file mode 100644 index 291fa6e10..000000000 --- a/out/out.CreateDownloadLink.php +++ /dev/null @@ -1,72 +0,0 @@ -$dms, 'user'=>$user)); -$accessop = new SeedDMS_AccessOperation($dms, $user, $settings); -if (!$accessop->check_view_access($view, $_GET)) { - UI::exitError(getMLText("document_title", array("documentname" => '')),getMLText("access_denied")); -} - -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")); -} -$document = $dms->getDocument($_GET["documentid"]); - -if (!is_object($document)) { - UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); -} - -if ($document->getAccessMode($user) < M_ALL) { - UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied")); -} - -if (!isset($_GET["version"]) || !is_numeric($_GET["version"]) || intval($_GET["version"]<1)) { - UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("invalid_version")); -} - -$content = $document->getContentByVersion($_GET["version"]); -if (!is_object($content)) { - UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("invalid_version")); -} - -$folder = $document->getFolder(); - -if($view) { - $view->setParam('folder', $folder); - $view->setParam('document', $document); - $view->setParam('version', $content); - $view->setParam('accessobject', $accessop); - $view($_GET); - exit; -} - -?> diff --git a/views/bootstrap/class.CreateDownloadLink.php b/views/bootstrap/class.CreateDownloadLink.php deleted file mode 100644 index df506864a..000000000 --- a/views/bootstrap/class.CreateDownloadLink.php +++ /dev/null @@ -1,76 +0,0 @@ - - * @copyright Copyright (C) 2002-2005 Markus Westphal, - * 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli, - * 2010-2012 Uwe Steinmann - * @version Release: @package_version@ - */ - -/** - * Include parent class - */ -require_once("class.Bootstrap.php"); - -/** - * Class which outputs the html page for CreateDownloadLink view - * - * @category DMS - * @package SeedDMS - * @author Markus Westphal, Malcolm Cowe, Uwe Steinmann - * @copyright Copyright (C) 2002-2005 Markus Westphal, - * 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli, - * 2010-2012 Uwe Steinmann - * @version Release: @package_version@ - */ -class SeedDMS_View_CreateDownloadLink extends SeedDMS_Bootstrap_Style { - - function show() { /* {{{ */ - $dms = $this->params['dms']; - $user = $this->params['user']; - $folder = $this->params['folder']; - $transmittals = $this->params['transmittals']; - $content = $this->params['version']; - - $document = $content->getDocument(); - $this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName())))); - $this->globalNavigation(); - $this->contentStart(); - $this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document); - $this->contentHeading(getMLText("create_download_link")); - $this->contentContainerStart(); - -?> -
- - - - - -
- -
- - - - -
-
-
- -
- -
-contentContainerEnd(); - $this->contentEnd(); - $this->htmlEndPage(); - } /* }}} */ -} -?>