mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
8e1e94e01a
|
@ -163,6 +163,13 @@ class SeedDMS_Core_DMS {
|
|||
*/
|
||||
public $noReadForStatus;
|
||||
|
||||
/**
|
||||
* @var boolean $checkWithinRootDir check if folder/document being accessed
|
||||
* is within the rootdir
|
||||
* @access public
|
||||
*/
|
||||
public $checkWithinRootDir;
|
||||
|
||||
/**
|
||||
* @var string $version version of pear package
|
||||
* @access public
|
||||
|
@ -455,6 +462,7 @@ class SeedDMS_Core_DMS {
|
|||
$this->rootFolderID = 1;
|
||||
$this->maxDirID = 0; //31998;
|
||||
$this->forceRename = false;
|
||||
$this->checkWithinRootDir = false;
|
||||
$this->enableConverting = false;
|
||||
$this->convertFileTypes = array();
|
||||
$this->noReadForStatus = array();
|
||||
|
@ -1990,6 +1998,10 @@ class SeedDMS_Core_DMS {
|
|||
$searchFolder = "";
|
||||
if ($startFolder) {
|
||||
$searchFolder = "`tblFolders`.`folderList` LIKE '%:".$startFolder->getID().":%'";
|
||||
if($this->checkWithinRootDir)
|
||||
$searchFolder = '('.$searchFolder." AND `tblFolders`.`folderList` LIKE '%:".$this->rootFolderID.":%')";
|
||||
} elseif($this->checkWithinRootDir) {
|
||||
$searchFolder = "`tblFolders`.`folderList` LIKE '%:".$this->rootFolderID.":%'";
|
||||
}
|
||||
|
||||
// Check to see if the search has been restricted to a particular
|
||||
|
@ -2152,6 +2164,10 @@ class SeedDMS_Core_DMS {
|
|||
$searchFolder = "";
|
||||
if ($startFolder) {
|
||||
$searchFolder = "`tblDocuments`.`folderList` LIKE '%:".$startFolder->getID().":%'";
|
||||
if($this->checkWithinRootDir)
|
||||
$searchFolder = '('.$searchFolder." AND `tblDocuments`.`folderList` LIKE '%:".$this->rootFolderID.":%')";
|
||||
} elseif($this->checkWithinRootDir) {
|
||||
$searchFolder = "`tblDocuments`.`folderList` LIKE '%:".$this->rootFolderID.":%'";
|
||||
}
|
||||
|
||||
// Check to see if the search has been restricted to a particular
|
||||
|
@ -2468,6 +2484,9 @@ class SeedDMS_Core_DMS {
|
|||
* @return SeedDMS_Core_Folder|boolean found folder or false
|
||||
*/
|
||||
function getFolderByName($name, $folder=null) { /* {{{ */
|
||||
$classname = $this->classnames['folder'];
|
||||
return $classname::getInstanceByName($name, $folder, $this);
|
||||
|
||||
if (!$name) return false;
|
||||
|
||||
$queryStr = "SELECT * FROM `tblFolders` WHERE `name` = " . $this->db->qstr($name);
|
||||
|
|
|
@ -321,6 +321,8 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
|
||||
// $queryStr = "SELECT * FROM `tblDocuments` WHERE `id` = " . (int) $id;
|
||||
$queryStr = "SELECT `tblDocuments`.*, `tblDocumentLocks`.`userID` as `lock` FROM `tblDocuments` LEFT JOIN `tblDocumentLocks` ON `tblDocuments`.`id` = `tblDocumentLocks`.`document` WHERE `id` = " . (int) $id;
|
||||
if($dms->checkWithinRootDir)
|
||||
$queryStr .= " AND `folderList` LIKE '%:".$dms->rootFolderID.":%'";
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && $resArr == false)
|
||||
return false;
|
||||
|
|
|
@ -205,21 +205,48 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
$db = $dms->getDB();
|
||||
|
||||
$queryStr = "SELECT * FROM `tblFolders` WHERE `id` = " . (int) $id;
|
||||
if($dms->checkWithinRootDir && ($id != $dms->rootFolderID))
|
||||
$queryStr .= " AND `folderList` LIKE '%:".$dms->rootFolderID.":%'";
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && $resArr == false)
|
||||
return false;
|
||||
else if (count($resArr) != 1)
|
||||
elseif (count($resArr) != 1)
|
||||
return null;
|
||||
|
||||
return self::getInstanceByData($resArr[0], $dms);
|
||||
|
||||
$resArr = $resArr[0];
|
||||
$classname = $dms->getClassname('folder');
|
||||
/** @var SeedDMS_Core_Folder $folder */
|
||||
$folder = new $classname($resArr["id"], $resArr["name"], $resArr["parent"], $resArr["comment"], $resArr["date"], $resArr["owner"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["sequence"]);
|
||||
$folder->setDMS($dms);
|
||||
$folder = $folder->applyDecorators();
|
||||
return $folder;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Return a folder by its name
|
||||
*
|
||||
* This function retrieves a folder from the database by its name. The
|
||||
* search covers the whole database. If
|
||||
* the parameter $folder is not null, it will search for the name
|
||||
* only within this parent folder. It will not be done recursively.
|
||||
*
|
||||
* @param string $name name of the folder
|
||||
* @param SeedDMS_Core_Folder $folder parent folder
|
||||
* @return SeedDMS_Core_Folder|boolean found folder or false
|
||||
*/
|
||||
public static function getInstanceByName($name, $folder=null, $dms) { /* {{{ */
|
||||
if (!$name) return false;
|
||||
|
||||
$db = $dms->getDB();
|
||||
$queryStr = "SELECT * FROM `tblFolders` WHERE `name` = " . $db->qstr($name);
|
||||
if($folder)
|
||||
$queryStr .= " AND `parent` = ". $folder->getID();
|
||||
if($dms->checkWithinRootDir && ($id != $dms->rootFolderID))
|
||||
$queryStr .= " AND `folderList` LIKE '%:".$dms->rootFolderID.":%'";
|
||||
$queryStr .= " LIMIT 1";
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
|
||||
if (is_bool($resArr) && $resArr == false)
|
||||
return false;
|
||||
|
||||
if(!$resArr)
|
||||
return false;
|
||||
|
||||
return self::getInstanceByData($resArr[0], $dms);
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
|
|
|
@ -1857,6 +1857,7 @@ add method SeedDMS_Core_DatabaseAccess::setLogFp()
|
|||
- SeedDMS_Folder_DMS::getAccessList() and getDefaultAccess() do not return fals anymore if the parent does not exists. They just stop inheritance.
|
||||
- pass attribute value to callback 'onAttributeValidate'
|
||||
- new paramter 'new' of methode SeedDMЅ_Core_AttributeDefinition::validate()
|
||||
- check if folder/document is below rootDir can be turned on (default off)
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
|
|
|
@ -61,7 +61,7 @@ class SeedDMS_View_Tasks extends SeedDMS_Bootstrap_Style {
|
|||
$docs = array();
|
||||
foreach ($resArr as $res) {
|
||||
$document = $dms->getDocument($res["id"]);
|
||||
if($document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
if($document && $document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
$docs[] = $document;
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ class SeedDMS_View_Tasks extends SeedDMS_Bootstrap_Style {
|
|||
$docs = array();
|
||||
foreach ($resArr as $res) {
|
||||
$document = $dms->getDocument($res["id"]);
|
||||
if($document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
if($document && $document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
$docs[] = $document;
|
||||
// $tasks['review'][] = array('id'=>$res['id'], 'name'=>$res['name']);
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ class SeedDMS_View_Tasks extends SeedDMS_Bootstrap_Style {
|
|||
$docs = array();
|
||||
foreach ($resArr as $res) {
|
||||
$document = $dms->getDocument($res["id"]);
|
||||
if($document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
if($document && $document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
$docs[] = $document;
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ class SeedDMS_View_Tasks extends SeedDMS_Bootstrap_Style {
|
|||
$docs = array();
|
||||
foreach ($resArr as $res) {
|
||||
$document = $dms->getDocument($res["id"]);
|
||||
if($document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
if($document && $document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
$docs[] = $document;
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ class SeedDMS_View_Tasks extends SeedDMS_Bootstrap_Style {
|
|||
$docs = array();
|
||||
foreach ($resArr as $res) {
|
||||
$document = $dms->getDocument($res["id"]);
|
||||
if($document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
if($document && $document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
$docs[] = $document;
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ class SeedDMS_View_Tasks extends SeedDMS_Bootstrap_Style {
|
|||
$docs = array();
|
||||
foreach ($resArr as $res) {
|
||||
$document = $dms->getDocument($res["id"]);
|
||||
if($document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
if($document && $document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
$docs[] = $document;
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ class SeedDMS_View_Tasks extends SeedDMS_Bootstrap_Style {
|
|||
$docs = array();
|
||||
foreach ($resArr as $res) {
|
||||
$document = $dms->getDocument($res["id"]);
|
||||
if($document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
if($document && $document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
$docs[] = $document;
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ class SeedDMS_View_Tasks extends SeedDMS_Bootstrap_Style {
|
|||
$docs = array();
|
||||
foreach ($resArr as $res) {
|
||||
$document = $dms->getDocument($res["id"]);
|
||||
if($document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
if($document && $document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
||||
$docs[] = $document;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user