mirror of
https://git.code.sf.net/p/seeddms/code
synced 2026-01-22 09:09:15 +00:00
add new method createDownloadLink()
This commit is contained in:
parent
93c67753d6
commit
960d5bc43c
|
|
@ -5556,6 +5556,25 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
return $needwkflaction;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Create a new download link
|
||||
*
|
||||
* @param SeedDMS_Core_User $user
|
||||
* @param string $expirationdate
|
||||
* @return boolean true if link could be created, otherwise false
|
||||
*/
|
||||
function createDownloadLink($user, $expirationdate) { /* {{{ */
|
||||
$db = $this->_document->_dms->getDB();
|
||||
$hash = md5(uniqid());
|
||||
$queryStr = "INSERT INTO tblDownloadLinks (document, version, userID, hash) VALUES (".$this->_document->getID().", ".$this->_version.", ".$user->getID().", '".$hash."')";
|
||||
if (!$db->getResult($queryStr)) {
|
||||
return false;
|
||||
}
|
||||
$id = $db->getInsertID();
|
||||
|
||||
return SeedDMS_Core_DownloadLink::getInstance($id, $this->_document->_dms);
|
||||
} /* }}} */
|
||||
|
||||
} /* }}} */
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user