mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-13 13:11:31 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
a830b18fc3
|
@ -6,7 +6,7 @@ Header set X-Content-Type-Options: "nosniff"
|
|||
</IfModule>
|
||||
|
||||
RewriteEngine On
|
||||
RewriteRule ^favicon.ico$ styles/bootstrap/favicon.ico [L]
|
||||
RewriteRule ^favicon.ico$ views/bootstrap/images/favicon.svg [L]
|
||||
|
||||
# Store the current location in an environment variable CWD to use
|
||||
# mod_rewrite in .htaccess files without knowing the RewriteBase
|
||||
|
|
|
@ -218,6 +218,7 @@
|
|||
a folder
|
||||
- get zendframework from pkgist
|
||||
- auto generate path if not set in settings.xml
|
||||
- add document conversion service
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Changes in version 5.1.23
|
||||
|
|
|
@ -38,6 +38,12 @@ define("M_READWRITE", 3);
|
|||
*/
|
||||
define("M_ALL", 4);
|
||||
|
||||
/*
|
||||
* Lowest and highest access right
|
||||
*/
|
||||
define("M_LOWEST_RIGHT", 1);
|
||||
define("M_HIGHEST_RIGHT", 4);
|
||||
|
||||
define ("O_GTEQ", ">=");
|
||||
define ("O_LTEQ", "<=");
|
||||
define ("O_EQ", "=");
|
||||
|
|
|
@ -486,11 +486,12 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
$db = $this->_dms->getDB();
|
||||
|
||||
if(!$this->_categories) {
|
||||
$queryStr = "SELECT * FROM `tblCategory` where `id` in (select `categoryID` from `tblDocumentCategory` where `documentID` = ".$this->_id.")";
|
||||
$queryStr = "SELECT * FROM `tblCategory` WHERE `id` IN (SELECT `categoryID` FROM `tblDocumentCategory` WHERE `documentID` = ".$this->_id.")";
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$resArr)
|
||||
return false;
|
||||
|
||||
$this->_categories = [];
|
||||
foreach ($resArr as $row) {
|
||||
$cat = new SeedDMS_Core_DocumentCategory($row['id'], $row['name']);
|
||||
$cat->setDMS($this->_dms);
|
||||
|
@ -512,7 +513,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
$db = $this->_dms->getDB();
|
||||
|
||||
$db->startTransaction();
|
||||
$queryStr = "DELETE from `tblDocumentCategory` WHERE `documentID` = ". $this->_id;
|
||||
$queryStr = "DELETE FROM `tblDocumentCategory` WHERE `documentID` = ". $this->_id;
|
||||
if (!$db->getResult($queryStr)) {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
|
@ -577,7 +578,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
foreach($categories as $cat)
|
||||
$catids[] = $cat->getID();
|
||||
|
||||
$queryStr = "DELETE from `tblDocumentCategory` WHERE `documentID` = ". $this->_id ." AND `categoryID` IN (".implode(',', $catids).")";
|
||||
$queryStr = "DELETE FROM `tblDocumentCategory` WHERE `documentID` = ". $this->_id ." AND `categoryID` IN (".implode(',', $catids).")";
|
||||
if (!$db->getResult($queryStr)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -677,6 +678,12 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
function setFolder($newFolder) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
if(!$newFolder)
|
||||
return false;
|
||||
|
||||
if(!$newFolder->isType('folder'))
|
||||
return false;
|
||||
|
||||
$queryStr = "UPDATE `tblDocuments` SET `folder` = " . $newFolder->getID() . " WHERE `id` = ". $this->_id;
|
||||
if (!$db->getResult($queryStr))
|
||||
return false;
|
||||
|
@ -721,6 +728,12 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
function setOwner($newOwner) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
if(!$newOwner)
|
||||
return false;
|
||||
|
||||
if(!$newOwner->isType('user'))
|
||||
return false;
|
||||
|
||||
$oldOwner = self::getOwner();
|
||||
|
||||
$db->startTransaction();
|
||||
|
@ -769,22 +782,33 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
* Set default access mode
|
||||
*
|
||||
* This method sets the default access mode and also removes all notifiers which
|
||||
* will not have read access anymore.
|
||||
* will not have read access anymore. Setting a default access mode will only
|
||||
* have an immediate effect if the access rights are not inherited, otherwise
|
||||
* it just updates the database record of the document and once the
|
||||
* inheritance is turn off the default access mode will take effect.
|
||||
*
|
||||
* @param integer $mode access mode
|
||||
* @param bool|string $noclean set to true if notifier list shall not be clean up
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function setDefaultAccess($mode, $noclean="false") { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
if($mode < M_LOWEST_RIGHT || $mode > M_HIGHEST_RIGHT)
|
||||
return false;
|
||||
|
||||
$queryStr = "UPDATE `tblDocuments` set `defaultAccess` = " . (int) $mode . " WHERE `id` = " . $this->_id;
|
||||
if (!$db->getResult($queryStr))
|
||||
return false;
|
||||
|
||||
$this->_defaultAccess = $mode;
|
||||
|
||||
if(!$noclean)
|
||||
/* Setting the default access mode does not have any effect if access
|
||||
* is still inherited. In that case there is no need to clean the
|
||||
* notification list.
|
||||
*/
|
||||
if(!$noclean && !$this->_inheritAccess)
|
||||
$this->cleanNotifyList();
|
||||
|
||||
return true;
|
||||
|
@ -795,6 +819,13 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
*/
|
||||
function inheritsAccess() { return $this->_inheritAccess; }
|
||||
|
||||
/**
|
||||
* This is supposed to be a replacement for inheritsAccess()
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function getInheritAccess() { return $this->_inheritAccess; }
|
||||
|
||||
/**
|
||||
* Set inherited access mode
|
||||
* Setting inherited access mode will set or unset the internal flag which
|
||||
|
@ -1838,7 +1869,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
* innodb is used. That's why the version is now determined here.
|
||||
*/
|
||||
if ((int)$version<1) {
|
||||
$queryStr = "SELECT MAX(`version`) as m from `tblDocumentContent` where `document` = ".$this->_id;
|
||||
$queryStr = "SELECT MAX(`version`) AS m FROM `tblDocumentContent` WHERE `document` = ".$this->_id;
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$resArr)
|
||||
return false;
|
||||
|
@ -2015,7 +2046,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
/* If $version < 1 than replace the content of the latest version.
|
||||
*/
|
||||
if ((int) $version<1) {
|
||||
$queryStr = "SELECT MAX(`version`) as m from `tblDocumentContent` where `document` = ".$this->_id;
|
||||
$queryStr = "SELECT MAX(`version`) AS m FROM `tblDocumentContent` WHERE `document` = ".$this->_id;
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$resArr)
|
||||
return false;
|
||||
|
@ -2238,10 +2269,6 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
private function _removeContent($version) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
if (file_exists( $this->_dms->contentDir.$version->getPath() ))
|
||||
if (!SeedDMS_Core_File::removeFile( $this->_dms->contentDir.$version->getPath() ))
|
||||
return false;
|
||||
|
||||
$db->startTransaction();
|
||||
|
||||
$status = $version->getStatus();
|
||||
|
@ -2422,6 +2449,12 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
return false;
|
||||
}
|
||||
|
||||
if (file_exists( $this->_dms->contentDir.$version->getPath() ))
|
||||
if (!SeedDMS_Core_File::removeFile( $this->_dms->contentDir.$version->getPath() )) {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
|
||||
$db->commitTransaction();
|
||||
return true;
|
||||
} /* }}} */
|
||||
|
@ -2434,6 +2467,23 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
*/
|
||||
function removeContent($version) { /* {{{ */
|
||||
$this->_dms->lasterror = '';
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
/* Make sure the version exists */
|
||||
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `document` = " . $this->getID() . " AND `version` = " . $version->getVersion();
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$resArr)
|
||||
return false;
|
||||
if (count($resArr)==0)
|
||||
return false;
|
||||
|
||||
/* Make sure this is not the last version */
|
||||
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `document` = " . $this->getID();
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$resArr)
|
||||
return false;
|
||||
if (count($resArr)==1)
|
||||
return false;
|
||||
|
||||
/* Check if 'onPreRemoveDocument' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPreRemoveContent'])) {
|
||||
|
@ -3054,7 +3104,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
function getFolderList() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$queryStr = "SELECT `folderList` FROM `tblDocuments` where id = ".$this->_id;
|
||||
$queryStr = "SELECT `folderList` FROM `tblDocuments` WHERE id = ".$this->_id;
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$resArr)
|
||||
return false;
|
||||
|
@ -3455,7 +3505,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
$this->_document = $document;
|
||||
$this->_version = (int) $version;
|
||||
$this->_comment = $comment;
|
||||
$this->_date = $date;
|
||||
$this->_date = (int) $date;
|
||||
$this->_userID = (int) $userID;
|
||||
$this->_dir = $dir;
|
||||
$this->_orgFileName = $orgFileName;
|
||||
|
@ -3564,17 +3614,28 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Set upload date of document content
|
||||
*
|
||||
* @param string $date date must be a timestamp or in the format 'Y-m-d H:i:s'
|
||||
*
|
||||
* @return boolean true on success, otherwise false
|
||||
*/
|
||||
function setDate($date = false) { /* {{{ */
|
||||
$db = $this->_document->getDMS()->getDB();
|
||||
|
||||
if(!$date)
|
||||
$date = time();
|
||||
else {
|
||||
if(!is_numeric($date))
|
||||
if(is_string($date) && SeedDMS_Core_DMS::checkDate($date, 'Y-m-d H:i:s')) {
|
||||
$date = strtotime($date);
|
||||
} elseif(is_numeric($date))
|
||||
$date = (int) $date;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
$queryStr = "UPDATE `tblDocumentContent` SET `date` = ".(int) $date." WHERE `document` = " . $this->_document->getID() . " AND `version` = " . $this->_version;
|
||||
$queryStr = "UPDATE `tblDocumentContent` SET `date` = ". $date." WHERE `document` = " . $this->_document->getID() . " AND `version` = " . $this->_version;
|
||||
if (!$db->getResult($queryStr))
|
||||
return false;
|
||||
|
||||
|
@ -3596,7 +3657,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
return false;
|
||||
|
||||
$db = $this->_document->getDMS()->getDB();
|
||||
$queryStr = "UPDATE `tblDocumentContent` SET `fileSize` = ".$filesize." where `document` = " . $this->_document->getID() . " AND `version` = " . $this->_version;
|
||||
$queryStr = "UPDATE `tblDocumentContent` SET `fileSize` = ".$filesize." WHERE `document` = " . $this->_document->getID() . " AND `version` = " . $this->_version;
|
||||
if (!$db->getResult($queryStr))
|
||||
return false;
|
||||
$this->_fileSize = $filesize;
|
||||
|
@ -3617,7 +3678,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
return false;
|
||||
|
||||
$db = $this->_document->getDMS()->getDB();
|
||||
$queryStr = "UPDATE `tblDocumentContent` SET `checksum` = ".$db->qstr($checksum)." where `document` = " . $this->_document->getID() . " AND `version` = " . $this->_version;
|
||||
$queryStr = "UPDATE `tblDocumentContent` SET `checksum` = ".$db->qstr($checksum)." WHERE `document` = " . $this->_document->getID() . " AND `version` = " . $this->_version;
|
||||
if (!$db->getResult($queryStr))
|
||||
return false;
|
||||
$this->_checksum = $checksum;
|
||||
|
@ -3659,6 +3720,23 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
return false;
|
||||
} /* }}} */
|
||||
|
||||
function setMimeType($newMimetype) { /* {{{ */
|
||||
$db = $this->_document->getDMS()->getDB();
|
||||
|
||||
$newMimetype = trim($newMimetype);
|
||||
|
||||
if(!$newMimetype)
|
||||
return false;
|
||||
|
||||
$queryStr = "UPDATE `tblDocumentContent` SET `mimeType` = ".$db->qstr($newMimetype)." WHERE `document` = " . $this->_document->getID() . " AND `version` = " . $this->_version;
|
||||
if (!$db->getResult($queryStr))
|
||||
return false;
|
||||
|
||||
$this->_mimeType = $newMimetype;
|
||||
|
||||
return true;
|
||||
} /* }}} */
|
||||
|
||||
function setComment($newComment) { /* {{{ */
|
||||
$db = $this->_document->getDMS()->getDB();
|
||||
|
||||
|
@ -3761,6 +3839,8 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
* @param integer $status new status of content
|
||||
* @param string $comment comment for this status change
|
||||
* @param object $updateUser user initiating the status change
|
||||
* @param string $date date in the format 'Y-m-d H:i:s'
|
||||
*
|
||||
* @return boolean true on success, otherwise false
|
||||
*/
|
||||
function setStatus($status, $comment, $updateUser, $date='') { /* {{{ */
|
||||
|
@ -3769,7 +3849,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
if (!is_numeric($status)) return false;
|
||||
|
||||
/* return an error if $updateuser is not set */
|
||||
if(!$updateUser)
|
||||
if(!$updateUser || !$updateUser->isType('user'))
|
||||
return false;
|
||||
|
||||
// If the supplied value lies outside of the accepted range, return an
|
||||
|
@ -3786,9 +3866,11 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
if ($this->_status["status"]==$status) {
|
||||
return true;
|
||||
}
|
||||
if($date)
|
||||
if($date) {
|
||||
if(!SeedDMS_Core_DMS::checkDate($date, 'Y-m-d H:i:s'))
|
||||
return false;
|
||||
$ddate = $db->qstr($date);
|
||||
else
|
||||
} else
|
||||
$ddate = $db->getCurrentDatetime();
|
||||
$db->startTransaction();
|
||||
$queryStr = "INSERT INTO `tblDocumentStatusLog` (`statusID`, `status`, `comment`, `date`, `userID`) ".
|
||||
|
@ -3842,7 +3924,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
$db->startTransaction();
|
||||
|
||||
/* First, remove the old entries */
|
||||
$queryStr = "DELETE from `tblDocumentStatusLog` where `statusID`=".$statusID;
|
||||
$queryStr = "DELETE FROM `tblDocumentStatusLog` WHERE `statusID`=".$statusID;
|
||||
if (!$db->getResult($queryStr)) {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
|
@ -4147,13 +4229,13 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
$reviewID = $review['reviewID'];
|
||||
|
||||
/* First, remove the old entries */
|
||||
$queryStr = "DELETE from `tblDocumentReviewLog` where `reviewID`=".$reviewID;
|
||||
$queryStr = "DELETE FROM `tblDocumentReviewLog` WHERE `reviewID`=".$reviewID;
|
||||
if (!$db->getResult($queryStr)) {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
|
||||
$queryStr = "DELETE from `tblDocumentReviewers` where `reviewID`=".$reviewID;
|
||||
$queryStr = "DELETE FROM `tblDocumentReviewers` WHERE `reviewID`=".$reviewID;
|
||||
if (!$db->getResult($queryStr)) {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
|
@ -4327,13 +4409,13 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
$reviewID = $review['reviewID'];
|
||||
|
||||
/* First, remove the old entries */
|
||||
$queryStr = "DELETE from `tblDocumentApproveLog` where `approveID`=".$reviewID;
|
||||
$queryStr = "DELETE FROM `tblDocumentApproveLog` WHERE `approveID`=".$reviewID;
|
||||
if (!$db->getResult($queryStr)) {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
|
||||
$queryStr = "DELETE from `tblDocumentApprovers` where `approveID`=".$reviewID;
|
||||
$queryStr = "DELETE FROM `tblDocumentApprovers` WHERE `approveID`=".$reviewID;
|
||||
if (!$db->getResult($queryStr)) {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
|
@ -4811,7 +4893,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
"VALUES ('". $this->_document->getID() ."', '". $this->_version ."', '1', '". $groupID ."')";
|
||||
$res = $db->getResult($queryStr);
|
||||
if (is_bool($res) && !$res) {
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
$reviewID = $db->getInsertID('tblDocumentReviewers', 'reviewID');
|
||||
}
|
||||
|
@ -6190,7 +6272,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Assign a workflow to a document
|
||||
* Assign a workflow to a document content
|
||||
*
|
||||
* @param object $workflow
|
||||
*/
|
||||
|
|
|
@ -55,7 +55,7 @@ class SeedDMS_Core_DocumentCategory {
|
|||
|
||||
function setName($newName) { /* {{{ */
|
||||
$newName = trim($newName);
|
||||
if(!$name)
|
||||
if(!$newName)
|
||||
return false;
|
||||
|
||||
$db = $this->_dms->getDB();
|
||||
|
|
|
@ -180,7 +180,12 @@ class SeedDMS_Core_Workflow { /* {{{ */
|
|||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* Get all states this workflow at some point may reach
|
||||
*
|
||||
* It basically iterates through all transistions and makes a unique
|
||||
* list of the start and end state.
|
||||
*
|
||||
* @return array list of states
|
||||
*/
|
||||
function getStates() { /* {{{ */
|
||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||
|
|
|
@ -58,10 +58,10 @@ class SeedDMS_Core_File {
|
|||
*/
|
||||
static function moveFile($source, $target) { /* {{{ */
|
||||
/** @noinspection PhpUndefinedFunctionInspection */
|
||||
if (!@copyFile($source, $target))
|
||||
if (!self::copyFile($source, $target))
|
||||
return false;
|
||||
/** @noinspection PhpUndefinedFunctionInspection */
|
||||
return @removeFile($source);
|
||||
return self::removeFile($source);
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
|
@ -69,7 +69,7 @@ class SeedDMS_Core_File {
|
|||
* @return bool|int
|
||||
*/
|
||||
static function fileSize($file) { /* {{{ */
|
||||
if(!$a = fopen($file, 'r'))
|
||||
if(!$a = @fopen($file, 'r'))
|
||||
return false;
|
||||
fseek($a, 0, SEEK_END);
|
||||
$filesize = ftell($a);
|
||||
|
@ -84,6 +84,7 @@ class SeedDMS_Core_File {
|
|||
*/
|
||||
static function format_filesize($size, $sizes = array('Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB')) { /* {{{ */
|
||||
if ($size == 0) return('0 Bytes');
|
||||
if ($size == 1) return('1 Byte');
|
||||
/** @noinspection PhpIllegalArrayKeyTypeInspection */
|
||||
return (round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $sizes[$i]);
|
||||
} /* }}} */
|
||||
|
@ -204,14 +205,14 @@ class SeedDMS_Core_File {
|
|||
{
|
||||
if ($entry == ".." || $entry == ".")
|
||||
continue;
|
||||
else if (is_dir($path . $entry))
|
||||
else if (is_dir($path . DIRECTORY_SEPARATOR . $entry))
|
||||
{
|
||||
if (!self::removeDir($path . $entry . "/"))
|
||||
if (!self::removeDir($path . DIRECTORY_SEPARATOR . $entry . "/"))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!@unlink($path . $entry))
|
||||
if (!@unlink($path . DIRECTORY_SEPARATOR . $entry))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -231,10 +232,10 @@ class SeedDMS_Core_File {
|
|||
if ($entry == ".." || $entry == ".")
|
||||
continue;
|
||||
else if (is_dir($sourcePath . $entry)) {
|
||||
if (!self::copyDir($sourcePath . $entry . "/", $targetPath . $entry . "/"))
|
||||
if (!self::copyDir($sourcePath . DIRECTORY_SEPARATOR . $entry, $targetPath . DIRECTORY_SEPARATOR . $entry))
|
||||
return false;
|
||||
} else {
|
||||
if (!@copy($sourcePath . $entry, $targetPath . $entry))
|
||||
if (!@copy($sourcePath . DIRECTORY_SEPARATOR . $entry, $targetPath . DIRECTORY_SEPARATOR . $entry))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -179,9 +179,17 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
|
|||
if($version && !$nocontent) {
|
||||
$path = $dms->contentDir . $version->getPath();
|
||||
if(file_exists($path)) {
|
||||
$content = '';
|
||||
$mimetype = $version->getMimeType();
|
||||
$this->mimetype = $mimetype;
|
||||
if(is_object($convcmd) && (get_class($convcmd) == 'SeedDMS_ConversionMgr')) {
|
||||
if($convcmd->hasService($mimetype, 'text/plain')) {
|
||||
$content = $convcmd->convert($path, $mimetype, 'text/plain');
|
||||
if($content) {
|
||||
self::setContent($content);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$content = '';
|
||||
$cmd = '';
|
||||
$mimeparts = explode('/', $mimetype, 2);
|
||||
if(isset($convcmd[$mimetype])) {
|
||||
|
@ -196,7 +204,8 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
|
|||
try {
|
||||
$content = self::execWithTimeout($cmd, $timeout);
|
||||
if($content['stdout']) {
|
||||
$this->addField(Zend_Search_Lucene_Field::UnStored('content', $content['stdout'], 'utf-8'));
|
||||
self::setContent($content['stdout']);
|
||||
// $this->addField(Zend_Search_Lucene_Field::UnStored('content', $content['stdout'], 'utf-8'));
|
||||
}
|
||||
if($content['stderr']) {
|
||||
$this->errormsg = $content['stderr'];
|
||||
|
@ -206,6 +215,7 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif($document->isType('folder')) {
|
||||
$this->addField(Zend_Search_Lucene_Field::Keyword('document_id', 'F'.$document->getID()));
|
||||
$this->addField(Zend_Search_Lucene_Field::UnIndexed('created', $document->getDate()));
|
||||
|
|
|
@ -38,6 +38,12 @@ class SeedDMS_Preview_Base {
|
|||
*/
|
||||
protected $converters;
|
||||
|
||||
/**
|
||||
* @var object $conversionmgr
|
||||
* @access protected
|
||||
*/
|
||||
protected $conversionmgr;
|
||||
|
||||
/**
|
||||
* @var integer $timeout maximum time for execution of external commands
|
||||
* @access protected
|
||||
|
@ -69,6 +75,7 @@ class SeedDMS_Preview_Base {
|
|||
$this->timeout = intval($timeout);
|
||||
$this->converters = array();
|
||||
$this->xsendfile = $xsendfile;
|
||||
$this->conversionmgr = null;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
|
@ -145,6 +152,18 @@ class SeedDMS_Preview_Base {
|
|||
$this->converters = array();
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Set conversion service manager
|
||||
*
|
||||
* A conversion manager is a service for converting files from one format
|
||||
* to another format.
|
||||
*
|
||||
* @param object $conversionmgr
|
||||
*/
|
||||
function setConversionMgr($conversionmgr) { /* {{{ */
|
||||
$this->conversionmgr = $conversionmgr;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Enable/Disable xsendfile extension
|
||||
*
|
||||
|
@ -173,11 +192,16 @@ class SeedDMS_Preview_Base {
|
|||
/**
|
||||
* Check if converter for a given mimetype is set
|
||||
*
|
||||
* @param string $mimetype
|
||||
* @param string $from from mimetype
|
||||
* @param string $to to mimetype
|
||||
*
|
||||
* @return boolean true if converter exists, otherwise false
|
||||
*/
|
||||
function hasConverter($mimetype) { /* {{{ */
|
||||
return array_key_exists($mimetype, $this->converters) && $this->converters[$mimetype];
|
||||
function hasConverter($from, $to='') { /* {{{ */
|
||||
if($this->conversionmgr)
|
||||
return $this->conversionmgr->hasService($from, $to);
|
||||
else
|
||||
return array_key_exists($from, $this->converters) && $this->converters[$from];
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
|
|
|
@ -68,6 +68,17 @@ class SeedDMS_Preview_PdfPreviewer extends SeedDMS_Preview_Base {
|
|||
return $target;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Check if converter for a given mimetype is set
|
||||
*
|
||||
* @param string $mimetype from mimetype
|
||||
*
|
||||
* @return boolean true if converter exists, otherwise false
|
||||
*/
|
||||
function hasConverter($from, $to='') { /* {{{ */
|
||||
return parent::hasConverter($from, 'application/pdf');
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Create a pdf preview for a given file
|
||||
*
|
||||
|
@ -98,6 +109,11 @@ class SeedDMS_Preview_PdfPreviewer extends SeedDMS_Preview_Base {
|
|||
$target = $this->previewDir.$dir.md5($infile);
|
||||
$this->lastpreviewfile = $target.'.pdf';
|
||||
if($target != '' && (!file_exists($target.'.pdf') || filectime($target.'.pdf') < filectime($infile))) {
|
||||
if($this->conversionmgr) {
|
||||
if($this->conversionmgr->hasService($mimetype, 'application/pdf')) {
|
||||
return $this->conversionmgr->convert($infile, $mimetype, 'application/pdf', $target.'.pdf');
|
||||
}
|
||||
} else {
|
||||
$cmd = '';
|
||||
$mimeparts = explode('/', $mimetype, 2);
|
||||
if(isset($this->converters[$mimetype])) {
|
||||
|
@ -115,6 +131,7 @@ class SeedDMS_Preview_PdfPreviewer extends SeedDMS_Preview_Base {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -72,6 +72,17 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base {
|
|||
return $target;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Check if converter for a given mimetype is set
|
||||
*
|
||||
* @param string $mimetype from mimetype
|
||||
*
|
||||
* @return boolean true if converter exists, otherwise false
|
||||
*/
|
||||
function hasConverter($from, $to='') { /* {{{ */
|
||||
return parent::hasConverter($from, 'image/png');
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Create a preview image for a given file
|
||||
*
|
||||
|
@ -107,6 +118,15 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base {
|
|||
$target = $this->previewDir.$dir.md5($infile).'-'.$width;
|
||||
$this->lastpreviewfile = $target.'.png';
|
||||
if($target != '' && (!file_exists($target.'.png') || filectime($target.'.png') < filectime($infile))) {
|
||||
if($this->conversionmgr) {
|
||||
if($this->conversionmgr->hasService($mimetype, 'image/png')) {
|
||||
if(!$this->conversionmgr->convert($infile, $mimetype, 'image/png', $target.'.png', array('width'=>$width))) {
|
||||
$this->lastpreviewfile = '';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$new = true;
|
||||
} else {
|
||||
$cmd = '';
|
||||
$mimeparts = explode('/', $mimetype, 2);
|
||||
if(isset($this->converters[$mimetype])) {
|
||||
|
@ -126,6 +146,7 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
$new = false;
|
||||
|
|
|
@ -106,6 +106,9 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document {
|
|||
/**
|
||||
* Constructor. Creates our indexable document and adds all
|
||||
* necessary fields to it using the passed in document
|
||||
*
|
||||
* $convcmd can either be an array of conversion commands or
|
||||
* an object of class SeedDMS_ConversionMgr
|
||||
*/
|
||||
public function __construct($dms, $document, $convcmd=null, $nocontent=false, $timeout=5) { /* {{{ */
|
||||
$this->errormsg = '';
|
||||
|
@ -176,9 +179,20 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document {
|
|||
if($version && !$nocontent) {
|
||||
$path = $dms->contentDir . $version->getPath();
|
||||
if(file_exists($path)) {
|
||||
$content = '';
|
||||
$mimetype = $version->getMimeType();
|
||||
$this->mimetype = $mimetype;
|
||||
if(is_object($convcmd) && (get_class($convcmd) == 'SeedDMS_ConversionMgr')) {
|
||||
if($convcmd->hasService($mimetype, 'text/plain')) {
|
||||
$content = $convcmd->convert($path, $mimetype, 'text/plain');
|
||||
if($content) {
|
||||
self::setContent($content);
|
||||
}
|
||||
$this->cmd = get_class($convcmd);
|
||||
} else {
|
||||
$this->cmd = 'No service to convert '.$mimetype.' to text/plain';
|
||||
}
|
||||
} else {
|
||||
$content = '';
|
||||
$cmd = '';
|
||||
$mimeparts = explode('/', $mimetype, 2);
|
||||
if(isset($convcmd[$mimetype])) {
|
||||
|
@ -193,7 +207,8 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document {
|
|||
try {
|
||||
$content = self::execWithTimeout($cmd, $timeout);
|
||||
if($content['stdout']) {
|
||||
$this->addField(SeedDMS_SQLiteFTS_Field::UnStored('content', $content['stdout']));
|
||||
self::setContent($content['stdout']);
|
||||
// $this->addField(SeedDMS_SQLiteFTS_Field::UnStored('content', $content['stdout']));
|
||||
}
|
||||
if($content['stderr']) {
|
||||
$this->errormsg = $content['stderr'];
|
||||
|
@ -203,6 +218,7 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif($document->isType('folder')) {
|
||||
$this->addField(SeedDMS_SQLiteFTS_Field::Keyword('document_id', 'F'.$document->getID()));
|
||||
$this->addField(SeedDMS_SQLiteFTS_Field::Keyword('created', $document->getDate(), 'unindexed'));
|
||||
|
|
|
@ -130,6 +130,11 @@ class SeedDMS_SQLiteFTS_Indexer {
|
|||
${$kk} = '';
|
||||
}
|
||||
}
|
||||
$sql = "DELETE FROM docs WHERE documentid=".$this->_conn->quote($doc->getFieldValue('document_id'));
|
||||
$res = $this->_conn->exec($sql);
|
||||
if($res === false) {
|
||||
return false;
|
||||
}
|
||||
$sql = "INSERT INTO docs (documentid, title, comment, keywords, category, owner, content, mimetype, origfilename, created, users, status, path) VALUES (".$this->_conn->quote($doc->getFieldValue('document_id')).", ".$this->_conn->quote($doc->getFieldValue('title')).", ".$this->_conn->quote($comment).", ".$this->_conn->quote($keywords).", ".$this->_conn->quote($category).", ".$this->_conn->quote($doc->getFieldValue('owner')).", ".$this->_conn->quote($content).", ".$this->_conn->quote($mimetype).", ".$this->_conn->quote($origfilename).", ".(int)$created.", ".$this->_conn->quote($doc->getFieldValue('users')).", ".$this->_conn->quote($status).", ".$this->_conn->quote($doc->getFieldValue('path'))/*time()*/.")";
|
||||
$res = $this->_conn->exec($sql);
|
||||
if($res === false) {
|
||||
|
|
|
@ -27,6 +27,7 @@ class SeedDMS_Controller_PdfPreview extends SeedDMS_Controller_Common {
|
|||
$dms = $this->params['dms'];
|
||||
$type = $this->params['type'];
|
||||
$settings = $this->params['settings'];
|
||||
$conversionmgr = $this->params['conversionmgr'];
|
||||
|
||||
switch($type) {
|
||||
case "version":
|
||||
|
@ -51,6 +52,9 @@ class SeedDMS_Controller_PdfPreview extends SeedDMS_Controller_Common {
|
|||
$this->params['content'] = $content;
|
||||
if(null === $this->callHook('version')) {
|
||||
$previewer = new SeedDMS_Preview_PdfPreviewer($settings->_cacheDir, $settings->_cmdTimeout);
|
||||
if($conversionmgr)
|
||||
$previewer->setConversionMgr($conversionmgr);
|
||||
else
|
||||
$previewer->setConverters(isset($settings->_converters['pdf']) ? $settings->_converters['pdf'] : array());
|
||||
$previewer->setXsendfile($settings->_enableXsendfile);
|
||||
if(!$previewer->hasPreview($content)) {
|
||||
|
|
|
@ -27,6 +27,7 @@ class SeedDMS_Controller_Preview extends SeedDMS_Controller_Common {
|
|||
$dms = $this->params['dms'];
|
||||
$type = $this->params['type'];
|
||||
$settings = $this->params['settings'];
|
||||
$conversionmgr = $this->params['conversionmgr'];
|
||||
|
||||
switch($type) {
|
||||
case "version":
|
||||
|
@ -55,6 +56,9 @@ class SeedDMS_Controller_Preview extends SeedDMS_Controller_Common {
|
|||
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $width, $settings->_cmdTimeout);
|
||||
else
|
||||
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir);
|
||||
if($conversionmgr)
|
||||
$previewer->setConversionMgr($conversionmgr);
|
||||
else
|
||||
$previewer->setConverters($settings->_converters['preview']);
|
||||
$previewer->setXsendfile($settings->_enableXsendfile);
|
||||
if(!$previewer->hasPreview($content)) {
|
||||
|
@ -86,6 +90,9 @@ class SeedDMS_Controller_Preview extends SeedDMS_Controller_Common {
|
|||
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $width, $settings->_cmdTimeout);
|
||||
else
|
||||
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir);
|
||||
if($conversionmgr)
|
||||
$previewer->setConversionMgr($conversionmgr);
|
||||
else
|
||||
$previewer->setConverters($settings->_converters['preview']);
|
||||
$previewer->setXsendfile($settings->_enableXsendfile);
|
||||
|
||||
|
|
65
inc/inc.ClassConversionMgr.php
Normal file
65
inc/inc.ClassConversionMgr.php
Normal file
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
/**
|
||||
* Implementation of conversion manager
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @license GPL 2
|
||||
* @version @version@
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
require_once("inc/inc.ClassConversionServiceExec.php");
|
||||
require_once("inc/inc.ClassConversionServiceImageToImage.php");
|
||||
require_once("inc/inc.ClassConversionServicePdfToImage.php");
|
||||
require_once("inc/inc.ClassConversionServiceTextToText.php");
|
||||
|
||||
/**
|
||||
* Implementation of conversion manager
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class SeedDMS_ConversionMgr {
|
||||
/**
|
||||
* List of services for searching fulltext
|
||||
*/
|
||||
public $services;
|
||||
|
||||
public function __construct() {
|
||||
$this->services = array();
|
||||
}
|
||||
|
||||
public function addService($service) {
|
||||
$this->services[$service->from][$service->to][] = $service;
|
||||
return $service;
|
||||
}
|
||||
|
||||
public function hasService($from, $to) {
|
||||
if(!empty($this->services[$from][$to]))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a file
|
||||
*
|
||||
* @param string $file name of file to convert
|
||||
* @param string $from mimetype of input file
|
||||
* @param string $to mimetype of output file
|
||||
*
|
||||
* @return boolean true on success, other false
|
||||
*/
|
||||
public function convert($file, $from, $to, $target=null, $params=array()) {
|
||||
if(isset($this->services[$from][$to])) {
|
||||
$service = array_pop($this->services[$from][$to]);
|
||||
return $service->convert($file, $target, $params);
|
||||
}
|
||||
}
|
||||
}
|
54
inc/inc.ClassConversionServiceBase.php
Normal file
54
inc/inc.ClassConversionServiceBase.php
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
/**
|
||||
* Implementation of conversion service base class
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @license GPL 2
|
||||
* @version @version@
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implementation of conversion service base class
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
abstract class SeedDMS_ConversionServiceBase {
|
||||
/**
|
||||
* mimetype original file
|
||||
*/
|
||||
public $from;
|
||||
|
||||
/**
|
||||
* mimetype converted file
|
||||
*/
|
||||
public $to;
|
||||
|
||||
/**
|
||||
* logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
public function __construct() {
|
||||
$this->from = null;
|
||||
$this->to = null;
|
||||
}
|
||||
|
||||
public function setLogger($logger) {
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
public function getInfo() {
|
||||
return 'Conversion service';
|
||||
}
|
||||
|
||||
public function convert($infile, $target = null, $params = array()) {
|
||||
}
|
||||
}
|
126
inc/inc.ClassConversionServiceExec.php
Normal file
126
inc/inc.ClassConversionServiceExec.php
Normal file
|
@ -0,0 +1,126 @@
|
|||
<?php
|
||||
/**
|
||||
* Implementation of conversion service exec class
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @license GPL 2
|
||||
* @version @version@
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
require_once("inc/inc.ClassConversionServiceBase.php");
|
||||
|
||||
/**
|
||||
* Implementation of conversion service exec class
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class SeedDMS_ConversionServiceExec extends SeedDMS_ConversionServiceBase {
|
||||
/**
|
||||
* shell cmd
|
||||
*/
|
||||
public $cmd;
|
||||
|
||||
/**
|
||||
* timeout
|
||||
*/
|
||||
public $timeout;
|
||||
|
||||
/**
|
||||
* Run a shell command
|
||||
*
|
||||
* @param $cmd
|
||||
* @param int $timeout
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
static function execWithTimeout($cmd, $timeout=5) { /* {{{ */
|
||||
$descriptorspec = array(
|
||||
0 => array("pipe", "r"),
|
||||
1 => array("pipe", "w"),
|
||||
2 => array("pipe", "w")
|
||||
);
|
||||
$pipes = array();
|
||||
|
||||
$timeout += time();
|
||||
// Putting an 'exec' before the command will not fork the command
|
||||
// and therefore not create any child process. proc_terminate will
|
||||
// then reliably terminate the cmd and not just shell. See notes of
|
||||
// https://www.php.net/manual/de/function.proc-terminate.php
|
||||
$process = proc_open('exec '.$cmd, $descriptorspec, $pipes);
|
||||
if (!is_resource($process)) {
|
||||
throw new Exception("proc_open failed on: " . $cmd);
|
||||
}
|
||||
stream_set_blocking($pipes[1], 0);
|
||||
stream_set_blocking($pipes[2], 0);
|
||||
|
||||
$output = $error = '';
|
||||
$timeleft = $timeout - time();
|
||||
$read = array($pipes[1], $pipes[2]);
|
||||
$write = NULL;
|
||||
$exeptions = NULL;
|
||||
do {
|
||||
$num_changed_streams = stream_select($read, $write, $exeptions, $timeleft, 200000);
|
||||
|
||||
if ($num_changed_streams === false) {
|
||||
proc_terminate($process);
|
||||
throw new Exception("stream select failed on: " . $cmd);
|
||||
} elseif ($num_changed_streams > 0) {
|
||||
$output .= fread($pipes[1], 8192);
|
||||
$error .= fread($pipes[2], 8192);
|
||||
}
|
||||
$timeleft = $timeout - time();
|
||||
} while (!feof($pipes[1]) && $timeleft > 0);
|
||||
|
||||
fclose($pipes[0]);
|
||||
fclose($pipes[1]);
|
||||
fclose($pipes[2]);
|
||||
if ($timeleft <= 0) {
|
||||
proc_terminate($process);
|
||||
throw new Exception("command timeout on: " . $cmd);
|
||||
} else {
|
||||
$return_value = proc_close($process);
|
||||
return array('stdout'=>$output, 'stderr'=>$error, 'return'=>$return_value);
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
public function __construct($from, $to, $cmd) {
|
||||
$this->from = $from;
|
||||
$this->to = $to;
|
||||
$this->cmd = $cmd;
|
||||
$this->timeout = 5;
|
||||
}
|
||||
|
||||
public function convert($infile, $target = null, $params = array()) {
|
||||
$start = microtime(true);
|
||||
if(!$target)
|
||||
$tmpfile = tempnam(sys_get_temp_dir(), 'convert');
|
||||
else
|
||||
$tmpfile = $target;
|
||||
$cmd = str_replace(array('%w', '%f', '%o', '%m'), array(isset($params['width']) ? $params['width'] : '', $infile, $tmpfile, $this->from), $this->cmd);
|
||||
try {
|
||||
self::execWithTimeout($cmd, $this->timeout);
|
||||
} catch(Exception $e) {
|
||||
return false;
|
||||
}
|
||||
$end = microtime(true);
|
||||
if($this->logger) {
|
||||
$this->logger->log('Conversion from '.$this->from.' to '.$this->to.' with cmd "'.$this->cmd.'" took '.($end-$start).' sec.', PEAR_LOG_INFO);
|
||||
}
|
||||
if(!$target) {
|
||||
$content = file_get_contents($tmpfile);
|
||||
unlink($tmpfile);
|
||||
return $content;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
57
inc/inc.ClassConversionServiceImageToImage.php
Normal file
57
inc/inc.ClassConversionServiceImageToImage.php
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
/**
|
||||
* Implementation of conversion service image class
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @license GPL 2
|
||||
* @version @version@
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
require_once("inc/inc.ClassConversionServiceBase.php");
|
||||
|
||||
/**
|
||||
* Implementation of conversion service image class
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class SeedDMS_ConversionServiceImageToImage extends SeedDMS_ConversionServiceBase {
|
||||
/**
|
||||
* timeout
|
||||
*/
|
||||
public $timeout;
|
||||
|
||||
public function __construct($from, $to) {
|
||||
$this->from = $from;
|
||||
$this->to = $to;
|
||||
$this->timeout = 5;
|
||||
}
|
||||
|
||||
public function convert($infile, $target = null, $params = array()) {
|
||||
$start = microtime(true);
|
||||
$imagick = new Imagick();
|
||||
if($imagick->readImage($infile)) {
|
||||
if(!empty($params['width']))
|
||||
$imagick->scaleImage((int) $params['width'], 0);
|
||||
$end = microtime(true);
|
||||
if($this->logger) {
|
||||
$this->logger->log('Conversion from '.$this->from.' to '.$this->to.' with image service took '.($end-$start).' sec.', PEAR_LOG_INFO);
|
||||
}
|
||||
if($target) {
|
||||
return $imagick->writeImage($target);
|
||||
} else {
|
||||
return $imagick->getImageBlob();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
63
inc/inc.ClassConversionServicePdfToImage.php
Normal file
63
inc/inc.ClassConversionServicePdfToImage.php
Normal file
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
/**
|
||||
* Implementation of conversion service pdf class
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @license GPL 2
|
||||
* @version @version@
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
require_once("inc/inc.ClassConversionServiceBase.php");
|
||||
|
||||
/**
|
||||
* Implementation of conversion service pdf class
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class SeedDMS_ConversionServicePdfToImage extends SeedDMS_ConversionServiceBase {
|
||||
/**
|
||||
* timeout
|
||||
*/
|
||||
public $timeout;
|
||||
|
||||
public function __construct($from, $to) {
|
||||
$this->from = $from;
|
||||
$this->to = $to;
|
||||
$this->timeout = 5;
|
||||
}
|
||||
|
||||
public function convert($infile, $target = null, $params = array()) {
|
||||
$start = microtime(true);
|
||||
$imagick = new Imagick();
|
||||
/* Setting a smaller resolution will speed up the conversion
|
||||
* A resolution of 72,72 will create a 596x842 image
|
||||
*/
|
||||
$imagick->setResolution(36,36);
|
||||
if($imagick->readImage($infile.'[0]')) {
|
||||
if(!empty($params['width']))
|
||||
$imagick->scaleImage((int) $params['width'], 0);
|
||||
$imagick->setImageFormat('png');
|
||||
$end = microtime(true);
|
||||
if($this->logger) {
|
||||
$this->logger->log('Conversion from '.$this->from.' to '.$this->to.' with pdf service took '.($end-$start).' sec.', PEAR_LOG_INFO);
|
||||
}
|
||||
if($target) {
|
||||
return $imagick->writeImage($target);
|
||||
} else {
|
||||
return $imagick->getImageBlob();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
39
inc/inc.ClassConversionServiceTextToText.php
Normal file
39
inc/inc.ClassConversionServiceTextToText.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* Implementation of conversion service class
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @license GPL 2
|
||||
* @version @version@
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
require_once("inc/inc.ClassConversionServiceBase.php");
|
||||
|
||||
/**
|
||||
* Implementation of conversion service class for text to text
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class SeedDMS_ConversionServiceTextToText extends SeedDMS_ConversionServiceBase {
|
||||
public function __construct($from, $to) {
|
||||
$this->from = $from;
|
||||
$this->to = $to;
|
||||
}
|
||||
|
||||
public function convert($infile, $target = null, $params = array()) {
|
||||
if($target) {
|
||||
file_put_contents($target, file_get_contents($infile));
|
||||
return true;
|
||||
} else
|
||||
return file_get_contents($infile);
|
||||
}
|
||||
}
|
||||
|
|
@ -31,6 +31,11 @@ class SeedDMS_FulltextService {
|
|||
*/
|
||||
protected $converters;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
protected $conversionmgr;
|
||||
|
||||
/**
|
||||
* Max file size for imediate indexing
|
||||
*/
|
||||
|
@ -43,6 +48,7 @@ class SeedDMS_FulltextService {
|
|||
public function __construct() {
|
||||
$this->services = array();
|
||||
$this->converters = array();
|
||||
$this->conversionmgr = null;
|
||||
$this->maxsize = 0;
|
||||
$this->index = null;
|
||||
$this->search = null;
|
||||
|
@ -57,6 +63,18 @@ class SeedDMS_FulltextService {
|
|||
$this->converters = $converters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set conversion service manager
|
||||
*
|
||||
* A conversion manager is a service for converting files from one format
|
||||
* to another format.
|
||||
*
|
||||
* @param object $conversionmgr
|
||||
*/
|
||||
function setConversionMgr($conversionmgr) { /* {{{ */
|
||||
$this->conversionmgr = $conversionmgr;
|
||||
} /* }}} */
|
||||
|
||||
public function setMaxSize($maxsize) {
|
||||
$this->maxsize = $maxsize;
|
||||
}
|
||||
|
@ -80,7 +98,7 @@ class SeedDMS_FulltextService {
|
|||
$nocontent = ($object->getLatestContent()->getFileSize() > $this->maxsize) && !$forceupdate;
|
||||
else
|
||||
$nocontent = true;
|
||||
return new $this->services[0]['IndexedDocument']($object->getDMS(), $object, $this->converters, $nocontent, $this->cmdtimeout);
|
||||
return new $this->services[0]['IndexedDocument']($object->getDMS(), $object, $this->conversionmgr ? $this->conversionmgr : $this->converters, $nocontent, $this->cmdtimeout);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
36
inc/inc.ConversionInit.php
Normal file
36
inc/inc.ConversionInit.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
$conversionmgr = null;
|
||||
require_once("inc.ClassConversionMgr.php");
|
||||
$conversionmgr = new SeedDMS_ConversionMgr();
|
||||
|
||||
if(!empty($settings->_converters['preview'])) {
|
||||
foreach($settings->_converters['preview'] as $mimetype=>$cmd) {
|
||||
$conversionmgr->addService(new SeedDMS_ConversionServiceExec($mimetype, 'image/png', $cmd))->setLogger($logger);
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($settings->_converters['pdf'])) {
|
||||
foreach($settings->_converters['pdf'] as $mimetype=>$cmd) {
|
||||
$conversionmgr->addService(new SeedDMS_ConversionServiceExec($mimetype, 'application/pdf', $cmd))->setLogger($logger);
|
||||
}
|
||||
}
|
||||
|
||||
$conversionmgr->addService(new SeedDMS_ConversionServicePdfToImage('application/pdf', 'image/png'))->setLogger($logger);
|
||||
|
||||
$conversionmgr->addService(new SeedDMS_ConversionServiceImageToImage('image/jpeg', 'image/png'))->setLogger($logger);
|
||||
$conversionmgr->addService(new SeedDMS_ConversionServiceImageToImage('image/png', 'image/png'))->setLogger($logger);
|
||||
$conversionmgr->addService(new SeedDMS_ConversionServiceImageToImage('image/jpg', 'image/png'))->setLogger($logger);
|
||||
|
||||
$conversionmgr->addService(new SeedDMS_ConversionServiceTextToText('text/plain', 'text/plain'))->setLogger($logger);
|
||||
|
||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['initConversion'])) {
|
||||
foreach($GLOBALS['SEEDDMS_HOOKS']['initConversion'] as $hookObj) {
|
||||
if (method_exists($hookObj, 'getConversionServices')) {
|
||||
if($services = $hookObj->getConversionServices(array('dms'=>$dms, 'settings'=>$settings, 'logger'=>$logger))) {
|
||||
foreach($services as $service) {
|
||||
$conversionmgr->addService($service)->setLogger($logger);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -67,4 +67,5 @@ if(isset($GLOBALS['SEEDDMS_HOOKS']['initDMS'])) {
|
|||
}
|
||||
|
||||
require_once('inc/inc.Tasks.php');
|
||||
require_once("inc.ConversionInit.php");
|
||||
require_once('inc.FulltextInit.php');
|
||||
|
|
|
@ -42,6 +42,7 @@ if($settings->_enableFullSearch) {
|
|||
}
|
||||
}
|
||||
$fulltextservice->setConverters(isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null);
|
||||
$fulltextservice->setConversionMgr($conversionmgr);
|
||||
$fulltextservice->setMaxSize($settings->_maxSizeForFullText);
|
||||
$fulltextservice->setCmdTimeout($settings->_cmdTimeout);
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ if(isset($_GET['version'])) {
|
|||
$controller->setParam('document', $document);
|
||||
$controller->setParam('version', $version);
|
||||
$controller->setParam('type', 'version');
|
||||
$controller->setParam('conversionmgr', $conversionmgr);
|
||||
if(!$controller->run()) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ if ($document->getAccessMode($user) < M_READ) {
|
|||
exit;
|
||||
}
|
||||
|
||||
$controller->setParam('conversionmgr', $conversionmgr);
|
||||
if(isset($_GET['version'])) {
|
||||
$version = $_GET["version"];
|
||||
if (!is_numeric($version))
|
||||
|
|
|
@ -70,6 +70,7 @@ if ($latestContent->getVersion()==$version->getVersion()) {
|
|||
$folder = $document->getFolder();
|
||||
|
||||
if($view) {
|
||||
$view->setParam('conversionmgr', $conversionmgr);
|
||||
$view->setParam('folder', $folder);
|
||||
$view->setParam('document', $document);
|
||||
$view->setParam('version', $version);
|
||||
|
|
|
@ -29,7 +29,7 @@ require_once("inc/inc.Authentication.php");
|
|||
|
||||
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||
$view = UI::factory($theme, $tmp[1]);
|
||||
$accessop = new SeedDMS_AccessOperation($dms, null, $user, $settings);
|
||||
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
|
||||
|
||||
if(isset($_GET['context']))
|
||||
$context = $_GET['context'];
|
||||
|
|
|
@ -72,6 +72,7 @@ if ($document->checkForDueRevisionWorkflow($user)){
|
|||
|
||||
if($view) {
|
||||
$view->setParam('fulltextservice', $fulltextservice);
|
||||
$view->setParam('conversionmgr', $conversionmgr);
|
||||
$view->setParam('folder', $folder);
|
||||
$view->setParam('document', $document);
|
||||
$view->setParam('showtree', showtree());
|
||||
|
|
|
@ -77,6 +77,7 @@ if($view) {
|
|||
if(isset($_GET['action']) && $_GET['action'] == 'subtree')
|
||||
$view->setParam('node', $node);
|
||||
$view->setParam('fulltextservice', $fulltextservice);
|
||||
$view->setParam('conversionmgr', $conversionmgr);
|
||||
$view->setParam('folder', $folder);
|
||||
$view->setParam('orderby', $orderby);
|
||||
$view->setParam('enableFolderTree', $settings->_enableFolderTree);
|
||||
|
|
|
@ -60,6 +60,7 @@ class SeedDMS_View_DocumentVersionDetail extends SeedDMS_Theme_Style {
|
|||
$converttopdf = $this->params['convertToPdf'];
|
||||
$pdfconverters = $this->params['pdfConverters'];
|
||||
$cachedir = $this->params['cachedir'];
|
||||
$conversionmgr = $this->params['conversionmgr'];
|
||||
$version = $this->params['version'];
|
||||
if(!$showfullpreview)
|
||||
return;
|
||||
|
@ -125,6 +126,9 @@ class SeedDMS_View_DocumentVersionDetail extends SeedDMS_Theme_Style {
|
|||
|
||||
if($converttopdf) {
|
||||
$pdfpreviewer = new SeedDMS_Preview_PdfPreviewer($cachedir, $timeout, $xsendfile);
|
||||
if($conversionmgr)
|
||||
$pdfpreviewer->setConversionMgr($conversionmgr);
|
||||
else
|
||||
$pdfpreviewer->setConverters($pdfconverters);
|
||||
if($pdfpreviewer->hasConverter($version->getMimeType())) {
|
||||
$this->contentHeading(getMLText("preview_pdf"));
|
||||
|
@ -146,6 +150,7 @@ class SeedDMS_View_DocumentVersionDetail extends SeedDMS_Theme_Style {
|
|||
$viewonlinefiletypes = $this->params['viewonlinefiletypes'];
|
||||
$enableversionmodification = $this->params['enableversionmodification'];
|
||||
$cachedir = $this->params['cachedir'];
|
||||
$conversionmgr = $this->params['conversionmgr'];
|
||||
$previewwidthdetail = $this->params['previewWidthDetail'];
|
||||
$previewconverters = $this->params['previewConverters'];
|
||||
$timeout = $this->params['timeout'];
|
||||
|
@ -263,6 +268,9 @@ class SeedDMS_View_DocumentVersionDetail extends SeedDMS_Theme_Style {
|
|||
|
||||
print "</ul>";
|
||||
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidthdetail, $timeout, $xsendfile);
|
||||
if($conversionmgr)
|
||||
$previewer->setConversionMgr($conversionmgr);
|
||||
else
|
||||
$previewer->setConverters($previewconverters);
|
||||
$previewer->createPreview($version);
|
||||
if ($file_exists) {
|
||||
|
|
|
@ -59,7 +59,7 @@ class SeedDMS_View_Settings extends SeedDMS_Theme_Style {
|
|||
$class = 'input-medium';
|
||||
else
|
||||
$class = 'input-small';
|
||||
$html .= '<input '.($type=='password' ? 'type="password"' : 'type="text"').' class="form-control '.$class.'" name="'.$name.'" value="'.$value.'" placeholder="'.$placeholder.'"/>';
|
||||
$html .= '<input '.($type=='password' ? 'type="password"' : ($type=='number' ? 'type="number"' : 'type="text"')).' class="form-control '.$class.'" name="'.$name.'" value="'.$value.'" placeholder="'.$placeholder.'"/>';
|
||||
}
|
||||
return $html;
|
||||
} /* }}} */
|
||||
|
|
|
@ -120,10 +120,19 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
|
|||
$user = $this->params['user'];
|
||||
$previewwidth = $this->params['previewWidthList'];
|
||||
$cachedir = $this->params['cachedir'];
|
||||
$conversionmgr = $this->params['conversionmgr'];
|
||||
$previewconverters = $this->params['previewConverters'];
|
||||
$timeout = $this->params['timeout'];
|
||||
$xsendfile = $this->params['xsendfile'];
|
||||
$document = $this->params['document'];
|
||||
|
||||
if($document) {
|
||||
if ($document->getAccessMode($user) >= M_READ) {
|
||||
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth);
|
||||
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
||||
if($conversionmgr)
|
||||
$previewer->setConversionMgr($conversionmgr);
|
||||
else
|
||||
$previewer->setConverters($previewconverters);
|
||||
$txt = $this->callHook('documentListItem', $document, $previewer, false, 'viewitem');
|
||||
if(is_string($txt))
|
||||
$content = $txt;
|
||||
|
@ -239,6 +248,7 @@ $(document).ready( function() {
|
|||
$accessobject = $this->params['accessobject'];
|
||||
$viewonlinefiletypes = $this->params['viewonlinefiletypes'];
|
||||
$cachedir = $this->params['cachedir'];
|
||||
$conversionmgr = $this->params['conversionmgr'];
|
||||
$previewwidthdetail = $this->params['previewWidthDetail'];
|
||||
$previewconverters = $this->params['previewConverters'];
|
||||
$timeout = $this->params['timeout'];
|
||||
|
@ -246,6 +256,9 @@ $(document).ready( function() {
|
|||
$documentid = $document->getId();
|
||||
|
||||
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidthdetail, $timeout, $xsendfile);
|
||||
if($conversionmgr)
|
||||
$previewer->setConversionMgr($conversionmgr);
|
||||
else
|
||||
$previewer->setConverters($previewconverters);
|
||||
$latestContent = $this->callHook('documentLatestContent', $document);
|
||||
if($latestContent === null)
|
||||
|
@ -531,6 +544,7 @@ $(document).ready( function() {
|
|||
$converttopdf = $this->params['convertToPdf'];
|
||||
$pdfconverters = $this->params['pdfConverters'];
|
||||
$cachedir = $this->params['cachedir'];
|
||||
$conversionmgr = $this->params['conversionmgr'];
|
||||
if(!$showfullpreview)
|
||||
return;
|
||||
|
||||
|
@ -600,6 +614,9 @@ $(document).ready( function() {
|
|||
|
||||
if($converttopdf) {
|
||||
$pdfpreviewer = new SeedDMS_Preview_PdfPreviewer($cachedir, $timeout, $xsendfile);
|
||||
if($conversionmgr)
|
||||
$pdfpreviewer->setConversionMgr($conversionmgr);
|
||||
else
|
||||
$pdfpreviewer->setConverters($pdfconverters);
|
||||
if($pdfpreviewer->hasConverter($latestContent->getMimeType())) {
|
||||
$this->contentHeading(getMLText("preview_pdf"));
|
||||
|
@ -827,6 +844,7 @@ $(document).ready( function() {
|
|||
$enablerevisionworkflow = $this->params['enablerevisionworkflow'];
|
||||
$workflowmode = $this->params['workflowmode'];
|
||||
$cachedir = $this->params['cachedir'];
|
||||
$conversionmgr = $this->params['conversionmgr'];
|
||||
$previewwidthlist = $this->params['previewWidthList'];
|
||||
$previewwidthdetail = $this->params['previewWidthDetail'];
|
||||
$previewconverters = $this->params['previewConverters'];
|
||||
|
@ -982,6 +1000,9 @@ $(document).ready( function() {
|
|||
|
||||
$this->contentContainerStart();
|
||||
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidthdetail, $timeout, $xsendfile);
|
||||
if($conversionmgr)
|
||||
$previewer->setConversionMgr($conversionmgr);
|
||||
else
|
||||
$previewer->setConverters($previewconverters);
|
||||
$this->showVersionDetails($latestContent, $previewer, true);
|
||||
$this->contentContainerEnd();
|
||||
|
|
|
@ -353,6 +353,7 @@ $('body').on('click', '.order-btn', function(ev) {
|
|||
$orderby = $this->params['orderby'];
|
||||
$orderdir = (isset($orderby[1]) ? ($orderby[1] == 'd' ? 'desc' : 'asc') : 'asc');
|
||||
$cachedir = $this->params['cachedir'];
|
||||
$conversionmgr = $this->params['conversionmgr'];
|
||||
$maxItemsPerPage = $this->params['maxItemsPerPage'];
|
||||
$incItemsPerPage = $this->params['incItemsPerPage'];
|
||||
$previewwidth = $this->params['previewWidthList'];
|
||||
|
@ -362,6 +363,9 @@ $('body').on('click', '.order-btn', function(ev) {
|
|||
$onepage = $this->params['onepage'];
|
||||
|
||||
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
||||
if($conversionmgr)
|
||||
$previewer->setConversionMgr($conversionmgr);
|
||||
else
|
||||
$previewer->setConverters($previewconverters);
|
||||
|
||||
$txt = $this->callHook('listHeader', $folder);
|
||||
|
@ -491,6 +495,7 @@ $('body').on('click', '.order-btn', function(ev) {
|
|||
$orderby = $this->params['orderby'];
|
||||
$orderdir = (isset($orderby[1]) ? ($orderby[1] == 'd' ? 'desc' : 'asc') : 'asc');
|
||||
$cachedir = $this->params['cachedir'];
|
||||
$conversionmgr = $this->params['conversionmgr'];
|
||||
$previewwidth = $this->params['previewWidthList'];
|
||||
$previewconverters = $this->params['previewConverters'];
|
||||
$timeout = $this->params['timeout'];
|
||||
|
@ -501,6 +506,9 @@ $('body').on('click', '.order-btn', function(ev) {
|
|||
header('Content-Type: application/json');
|
||||
|
||||
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
||||
if($conversionmgr)
|
||||
$previewer->setConversionMgr($conversionmgr);
|
||||
else
|
||||
$previewer->setConverters($previewconverters);
|
||||
|
||||
$subFolders = $this->callHook('folderGetSubFolders', $folder, $orderby[0]);
|
||||
|
@ -568,6 +576,7 @@ $('body').on('click', '.order-btn', function(ev) {
|
|||
$expandFolderTree = $this->params['expandFolderTree'];
|
||||
$showtree = $this->params['showtree'];
|
||||
$cachedir = $this->params['cachedir'];
|
||||
$conversionmgr = $this->params['conversionmgr'];
|
||||
$enableRecursiveCount = $this->params['enableRecursiveCount'];
|
||||
$maxRecursiveCount = $this->params['maxRecursiveCount'];
|
||||
$maxItemsPerPage = $this->params['maxItemsPerPage'];
|
||||
|
@ -579,6 +588,9 @@ $('body').on('click', '.order-btn', function(ev) {
|
|||
|
||||
$folderid = $folder->getId();
|
||||
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
||||
if($conversionmgr)
|
||||
$previewer->setConversionMgr($conversionmgr);
|
||||
else
|
||||
$previewer->setConverters($previewconverters);
|
||||
|
||||
// echo $this->callHook('startPage');
|
||||
|
|
Loading…
Reference in New Issue
Block a user