diff --git a/CHANGELOG b/CHANGELOG index 89410c416..601a21d5a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,11 @@ +-------------------------------------------------------------------------------- + Changes in version 5.0.0 +-------------------------------------------------------------------------------- +- support for customer extensions +- smtp authentification +- add .xml to online file types by default +- add home folder for users + -------------------------------------------------------------------------------- Changes in version 4.3.23 -------------------------------------------------------------------------------- @@ -28,7 +36,9 @@ -------------------------------------------------------------------------------- - fix sql statement when searching for attributes (SeedDMS_Core, Closes: 227) - show preview images file list of drop folder -- add timeline +- add timeline for single document and all documents in a given period + of time +- ensure dates in database are localtime, even if sqlite3 is used - fix document and page count in fulltext search -------------------------------------------------------------------------------- diff --git a/Makefile b/Makefile index 8893fe0d7..c1d281546 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,12 @@ -VERSION=4.3.23 -SRC=CHANGELOG inc conf utils index.php languages views op out README.md README.Notification README.Ubuntu drop-tables-innodb.sql styles js TODO LICENSE Makefile webdav install restapi +VERSION=5.0.0 +SRC=CHANGELOG inc conf utils index.php languages views op out controllers README.md README.Notification README.Ubuntu drop-tables-innodb.sql styles js TODO LICENSE Makefile webdav install restapi # webapp +EXTENSIONS := \ + dynamic_content.tar.gz\ + login_action.tar.gz\ + example.tar.gz + PHPDOC=~/Downloads/phpDocumentor-2.8.1/bin/phpdoc dist: @@ -28,6 +33,17 @@ webapp: (cd tmp; tar --exclude=.svn -czvf ../seeddms-webapp-$(VERSION).tar.gz seeddms-webapp-$(VERSION)) rm -rf tmp +dynamic_content.tar.gz: ext/dynamic_content + tar czvf dynamic_content.tar.gz ext/dynamic_content + +example.tar.gz: ext/example + tar czvf example.tar.gz ext/example + +login_action.tar.gz: ext/login_action + tar czvf login_action.tar.gz ext/login_action + +extensions: $(EXTENSIONS) + doc: $(PHPDOC) -d SeedDMS_Core --ignore 'getusers.php,getfoldertree.php,config.php,reverselookup.php' --force -t html diff --git a/README.Extensions b/README.Extensions new file mode 100644 index 000000000..d1654f7dd --- /dev/null +++ b/README.Extensions @@ -0,0 +1,53 @@ +Extensions in SeedDMS +==================== + +Since verson 5.0.0 SeedDMS can be extended by extensions. Extensions +can hook up functions into certain operations, e.g. +uploading, removing or displaying a document. They can also be +used to modify some of the internal variables like the list of +translations and they can even replace classes in the core of +seeddms and hook up functions into certain operations in the core. + +All extensions are located in the folder 'ext'. Each extension +has its own folder named by the name of the extension. The central +configuration of an extension is stored in conf.php. +The configuration sets the file and classname which is loaded +during initialization of the extension. The class has to have +a method init() which is called with any page request. The +configuration itself is cached and must be updated within +the extension manager if it was changed. + +The integration into SeedDMS is done by hooks, class and file +overloading. SeedDMS manages +a globally available array of hooks ($GLOBALS['SEEDDMS_HOOKS']). +This array has the elements 'view' and 'controller'. All entries +in those array elements contain instances of self defined classes +containing the hook methods. For setting up the hooks in the view +'viewFolder' the following code is needed. + +$GLOBALS['SEEDDMS_HOOKS']['view']['viewFolder'][] = new SeedDMS_ExtExample_ViewFolder; + +class SeedDMS_ExtExample_ViewFolder { + ... +}; + +The same approach is implemented for hooks called from the controller +logic (the op/op.*.php files). + +$GLOBALS['SEEDDMS_HOOKS']['controller']['removeFolder'][] = new SeedDMS_ExtExample_RemoveFolder; + +class SeedDMS_ExtExample_RemoveFolder { + ... +}; + +Based on these two variants of adding hooks to the seeddms application code, +the seeddms core can be extended by implementing the controller hook 'initDMS' +which is called right after the class SeedDMS_Core_DMS has been initiated. + +Beside hooks and callbacks another way of modifying seeddms is given +by overloading the files in the directory 'views' and 'controllers'. Both +directories contain class files with a single class for either running +controller or view code. If an extension provides those file in its +own extension dir, they will be used instead of the files shipped with +seeddms. + diff --git a/SeedDMS_Core/Core/inc.ClassAttribute.php b/SeedDMS_Core/Core/inc.ClassAttribute.php index dd25e19e3..84a3f9b8b 100644 --- a/SeedDMS_Core/Core/inc.ClassAttribute.php +++ b/SeedDMS_Core/Core/inc.ClassAttribute.php @@ -57,6 +57,13 @@ class SeedDMS_Core_Attribute { /* {{{ */ */ protected $_value; + /** + * @var integer validation error + * + * @access protected + */ + protected $_validation_error; + /** * @var object SeedDMS_Core_DMS reference to the dms instance this attribute belongs to * @@ -77,6 +84,7 @@ class SeedDMS_Core_Attribute { /* {{{ */ $this->_obj = $obj; $this->_attrdef = $attrdef; $this->_value = $value; + $this->_validation_error = 0; $this->_dms = null; } /* }}} */ @@ -134,19 +142,19 @@ class SeedDMS_Core_Attribute { /* {{{ */ $db = $this->_dms->getDB(); switch(get_class($this->_obj)) { - case "SeedDMS_Core_Document": + case $this->_dms->getClassname('document'): if(trim($value) === '') $queryStr = "DELETE FROM tblDocumentAttributes WHERE `document` = " . $this->_obj->getID() . " AND `attrdef` = " . $this->_attrdef->getId(); else $queryStr = "UPDATE tblDocumentAttributes SET value = ".$db->qstr($value)." WHERE `document` = " . $this->_obj->getID() . " AND `attrdef` = " . $this->_attrdef->getId(); break; - case "SeedDMS_Core_DocumentContent": + case $this->_dms->getClassname('documentcontent'): if(trim($value) === '') $queryStr = "DELETE FROM tblDocumentContentAttributes WHERE `content` = " . $this->_obj->getID() . " AND `attrdef` = " . $this->_attrdef->getId(); else $queryStr = "UPDATE tblDocumentContentAttributes SET value = ".$db->qstr($value)." WHERE `content` = " . $this->_obj->getID() . " AND `attrdef` = " . $this->_attrdef->getId(); break; - case "SeedDMS_Core_Folder": + case $this->_dms->getClassname('folder'): if(trim($value) === '') $queryStr = "DELETE FROM tblFolderAttributes WHERE `folder` = " . $this->_obj->getID() . " AND `attrdef` = " . $this->_attrdef->getId(); else @@ -163,6 +171,30 @@ class SeedDMS_Core_Attribute { /* {{{ */ return true; } /* }}} */ + /** + * Validate attribute value + * + * This function checks if the attribute values fits the attribute + * definition. + * If the validation fails the validation error will be set which + * can be requested by SeedDMS_Core_Attribute::getValidationError() + * + * @return boolean true if validation succeds, otherwise false + */ + function validate() { /* {{{ */ + $attrdef = $this->_attrdef(); + $result = $attrdef->validate($this->_value); + $this->_validation_error = $attrdef->getValidationError(); + return $result; + } /* }}} */ + + /** + * Get validation error from last validation + * + * @return integer error code + */ + function getValidationError() { return $this->_validation_error; } + /** * Get definition of attribute * @@ -214,7 +246,7 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */ /** * @var string object type of attribute definition. This can be one of - * type_int, type_float, type_string, or type_boolean. + * type_int, type_float, type_string, type_boolean, type_url, or type_email. * * @access protected */ @@ -263,6 +295,13 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */ */ protected $_regex; + /** + * @var integer validation error + * + * @access protected + */ + protected $_validation_error; + /** * @var object SeedDMS_Core_DMS reference to the dms instance this attribute definition belongs to * @@ -277,6 +316,8 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */ const type_float = '2'; const type_string = '3'; const type_boolean = '4'; + const type_url = '5'; + const type_email = '6'; const type_date = '7'; /* @@ -313,6 +354,7 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */ $this->_separator = ''; $this->_regex = $regex; $this->_dms = null; + $this->_validation_error = 0; } /* }}} */ /** @@ -383,7 +425,8 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */ /** * Get type of attribute definition * - * This can be one of type_int, type_float, type_string, type_boolean. + * This can be one of type_int, type_float, type_string, type_boolean, + * type_url, type_email. * * @return integer type */ @@ -392,7 +435,8 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */ /** * Set type of attribute definition * - * This can be one of type_int, type_float, type_string, type_boolean. + * This can be one of type_int, type_float, type_string, type_boolean, + * type_url, type_email. * * @param integer $type type */ @@ -733,5 +777,103 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */ return $result; } /* }}} */ + /** + * Validate value against attribute definition + * + * This function checks if the given value fits the attribute + * definition. + * If the validation fails the validation error will be set which + * can be requested by SeedDMS_Core_Attribute::getValidationError() + * + * @param string|array $attrvalue attribute value + * @return boolean true if validation succeds, otherwise false + */ + function validate($attrvalue) { /* {{{ */ + if($this->getMultipleValues()) { + if(is_string($attrvalue)) + $values = explode($attrvalue[0], substr($attrvalue, 1)); + else + $values = $attrvalue; + } else { + $values = array($attrvalue); + } + + $this->_validation_error = 0; + if($this->getMinValues() > count($values)) { + $this->_validation_error = 1; + return false; + } + if($this->getMaxValues() && $this->getMaxValues() < count($values)) { + $this->_validation_error = 2; + return false; + } + + switch((string) $this->getType()) { + case self::type_int: + $success = true; + foreach($values as $value) { + $success &= preg_match('/^[0-9]*$/', $value) ? true : false; + } + break; + case self::type_float: + $success = true; + foreach($values as $value) { + $success &= is_numeric($value); + } + break; + case self::type_string: + $success = true; + if(trim($this->getRegex()) != '') { + foreach($values as $value) { + $success &= preg_match($this->getRegex(), $value) ? true : false; + } + } + if(!$success) + $this->_validation_error = 3; + break; + case self::type_boolean: + $success = true; + foreach($values as $value) { + $success &= preg_match('/^[01]$/', $value); + } + break; + case self::type_email: + $success = true; + foreach($values as $value) { + } + if(!$success) + $this->_validation_error = 5; + break; + case self::type_url: + $success = true; + foreach($values as $value) { + $success &= preg_match('/^http(s)?:\/\/[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(\/.*)?$/i', $value); + } + if(!$success) + $this->_validation_error = 4; + break; + } + + /* Check if value is in value set */ + if($valueset = $this->getValueSetAsArray()) { + foreach($values as $value) { + if(!in_array($value, $valueset)) { + $success = false; + $this->_validation_error = 10; + } + } + } + + return $success; + + } /* }}} */ + + /** + * Get validation error from last validation + * + * @return integer error code + */ + function getValidationError() { return $this->_validation_error; } + } /* }}} */ ?> diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index c0964b753..c48dee62d 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -79,6 +79,13 @@ class SeedDMS_Core_DMS { */ protected $db; + /** + * @var array $classnames list of classnames for objects being instanciate + * by the dms + * @access protected + */ + protected $classnames; + /** * @var object $user reference to currently logged in user. This must be * an instance of {@link SeedDMS_Core_User}. This variable is currently not @@ -100,6 +107,14 @@ class SeedDMS_Core_DMS { */ public $rootFolderID; + /** + * @var integer $maxDirID maximum number of documents per folder on the + * filesystem. If this variable is set to a value != 0, the content + * directory will have a two level hierarchy for document storage. + * @access public + */ + public $maxDirID; + /** * @var boolean $enableConverting set to true if conversion of content * is desired @@ -107,6 +122,17 @@ class SeedDMS_Core_DMS { */ public $enableConverting; + /** + * @var boolean $forceRename use renameFile() instead of copyFile() when + * copying the document content into the data store. The default is + * to copy the file. This parameter only affects the methods + * SeedDMS_Core_Document::addDocument() and + * SeedDMS_Core_Document::addDocumentFile(). Setting this to true + * may save resources especially for large files. + * @access public + */ + public $forceRename; + /** * @var array $convertFileTypes list of files types that shall be converted * @access public @@ -170,18 +196,23 @@ class SeedDMS_Core_DMS { /** * Checks if a list of objects contains a single object * - * The regular php check done by '==' compares all attributes of + * This function is only applicable on list containing objects which have + * a method getID() because it is used to check if two objects are equal. + * The regular php check on objects done by '==' compares all attributes of * two objects, which isn't required. The method will first check * if the objects are instances of the same class. * + * The result of the function can be 0 which happens if the first element + * of an indexed array matches. + * * @param object $object1 object to look for (needle) * @param array $list list of objects (haystack) - * @return boolean true if object was found, otherwise false + * @return boolean/integer index in array if object was found, otherwise false */ static function inList($object, $list) { /* {{{ */ - foreach($list as $item) { + foreach($list as $i=>$item) { if(get_class($item) == get_class($object) && $item->getID() == $object->getID()) - return true; + return $i; } return false; } /* }}} */ @@ -243,7 +274,7 @@ class SeedDMS_Core_DMS { * * @param array $links list of objects of type SeedDMS_Core_DocumentLink * @param object $user user for which access is being checked - * @return filtered list of links + * @return array filtered list of links */ static function filterDocumentLinks($user, $links) { /* {{{ */ $tmp = array(); @@ -269,11 +300,60 @@ class SeedDMS_Core_DMS { $this->contentDir = $contentDir.'/'; $this->rootFolderID = 1; $this->maxDirID = 0; //31998; + $this->forceRename = false; $this->enableConverting = false; $this->convertFileTypes = array(); + $this->classnames = array(); + $this->classnames['folder'] = 'SeedDMS_Core_Folder'; + $this->classnames['document'] = 'SeedDMS_Core_Document'; + $this->classnames['documentcontent'] = 'SeedDMS_Core_DocumentContent'; + $this->classnames['user'] = 'SeedDMS_Core_User'; + $this->classnames['group'] = 'SeedDMS_Core_Group'; $this->version = '@package_version@'; if($this->version[0] == '@') - $this->version = '4.3.23'; + $this->version = '5.0.0'; + } /* }}} */ + + /** + * Return class name of instantiated objects + * + * This method returns the class name of those objects being instatiated + * by the dms. Each class has an internal place holder, which must be + * passed to function. + * + * @param string placeholder (can be one of 'folder', 'document', + * 'documentcontent', 'user', 'group' + * + * @return string/boolean name of class or false if placeholder is invalid + */ + function getClassname($objectname) { /* {{{ */ + if(isset($this->classnames[$objectname])) + return $this->classnames[$objectname]; + else + return false; + } /* }}} */ + + /** + * Set class name of instantiated objects + * + * This method sets the class name of those objects being instatiated + * by the dms. It is mainly used to create a new class (possible + * inherited from one of the available classes) implementing new + * features. The method should be called in the postInitDMS hook. + * + * @param string placeholder (can be one of 'folder', 'document', + * 'documentcontent', 'user', 'group' + * @param string name of class + * + * @return string/boolean name of old class or false if not set + */ + function setClassname($objectname, $classname) { /* {{{ */ + if(isset($this->classnames[$objectname])) + $oldclass = $this->classnames[$objectname]; + else + $oldclass = false; + $this->classnames[$objectname] = $classname; + return $oldclass; } /* }}} */ /** @@ -393,6 +473,10 @@ class SeedDMS_Core_DMS { $this->viewOnlineFileTypes = $types; } /* }}} */ + function setForceRename($enable) { /* {{{ */ + $this->forceRename = $enable; + } /* }}} */ + /** * Login as a user * @@ -430,31 +514,8 @@ class SeedDMS_Core_DMS { * @return object instance of {@link SeedDMS_Core_Document} or false */ function getDocument($id) { /* {{{ */ - if (!is_numeric($id)) return false; - - $queryStr = "SELECT * FROM tblDocuments WHERE id = " . (int) $id; - $resArr = $this->db->getResultArray($queryStr); - if (is_bool($resArr) && $resArr == false) - return false; - if (count($resArr) != 1) - return false; - $resArr = $resArr[0]; - - // New Locking mechanism uses a separate table to track the lock. - $queryStr = "SELECT * FROM tblDocumentLocks WHERE document = " . (int) $id; - $lockArr = $this->db->getResultArray($queryStr); - if ((is_bool($lockArr) && $lockArr==false) || (count($lockArr)==0)) { - // Could not find a lock on the selected document. - $lock = -1; - } - else { - // A lock has been identified for this document. - $lock = $lockArr[0]["userID"]; - } - - $document = new SeedDMS_Core_Document($resArr["id"], $resArr["name"], $resArr["comment"], $resArr["date"], $resArr["expires"], $resArr["owner"], $resArr["folder"], $resArr["inheritAccess"], $resArr["defaultAccess"], $lock, $resArr["keywords"], $resArr["sequence"]); - $document->setDMS($this); - return $document; + $classname = $this->classnames['document']; + return $classname::getInstance($id, $this); } /* }}} */ /** @@ -469,8 +530,6 @@ class SeedDMS_Core_DMS { /** * Returns all documents locked by a given user - * FIXME: Not full implemented. Do not use, because it still requires the - * temporary tables! * * @param object $user * @return array list of documents @@ -508,7 +567,7 @@ class SeedDMS_Core_DMS { return false; $row = $resArr[0]; - $document = new SeedDMS_Core_Document($row["id"], $row["name"], $row["comment"], $row["date"], $row["expires"], $row["owner"], $row["folder"], $row["inheritAccess"], $row["defaultAccess"], $row["lockUser"], $row["keywords"], $row["sequence"]); + $document = new $this->classnames['document']($row["id"], $row["name"], $row["comment"], $row["date"], $row["expires"], $row["owner"], $row["folder"], $row["inheritAccess"], $row["defaultAccess"], $row["lockUser"], $row["keywords"], $row["sequence"]); $document->setDMS($this); return $document; } /* }}} */ @@ -533,7 +592,7 @@ class SeedDMS_Core_DMS { $row = $resArr[0]; $document = $this->getDocument($row['document']); - $version = new SeedDMS_Core_DocumentContent($row['id'], $document, $row['version'], $row['comment'], $row['date'], $row['createdBy'], $row['dir'], $row['orgFileName'], $row['fileType'], $row['mimeType'], $row['fileSize'], $row['checksum']); + $version = new $this->classnames['documentcontent']($row['id'], $document, $row['version'], $row['comment'], $row['date'], $row['createdBy'], $row['dir'], $row['orgFileName'], $row['fileType'], $row['mimeType'], $row['fileSize'], $row['checksum']); return $version; } /* }}} */ @@ -620,16 +679,9 @@ class SeedDMS_Core_DMS { $totalFolders = 0; if($mode & 0x2) { $searchKey = ""; - $searchFields = array(); - if (in_array(2, $searchin)) { - $searchFields[] = "`tblFolders`.`name`"; - } - if (in_array(3, $searchin)) { - $searchFields[] = "`tblFolders`.`comment`"; - } - if (in_array(4, $searchin)) { - $searchFields[] = "`tblFolderAttributes`.`value`"; - } + + $classname = $this->classnames['folder']; + $searchFields = $classname::getSearchFields($searchin); if (count($searchFields)>0) { foreach ($tkeys as $key) { @@ -699,7 +751,7 @@ class SeedDMS_Core_DMS { } } - $searchQuery = "FROM `tblFolders` LEFT JOIN `tblFolderAttributes` on `tblFolders`.`id`=`tblFolderAttributes`.`folder` WHERE 1=1"; + $searchQuery = "FROM ".$classname::getSearchTables()." WHERE 1=1"; if (strlen($searchKey)>0) { $searchQuery .= " AND (".$searchKey.")"; @@ -955,59 +1007,60 @@ class SeedDMS_Core_DMS { } if($searchKey || $searchOwner || $searchCategories || $searchCreateDate || $searchExpirationDate || $searchAttributes || $status) { - // Count the number of rows that the search will produce. - $resArr = $this->db->getResultArray("SELECT COUNT(*) AS num FROM (SELECT DISTINCT `tblDocuments`.id ".$searchQuery.") a"); - if (is_numeric($resArr[0]["num"]) && $resArr[0]["num"]>0) { - $totalDocs = (integer)$resArr[0]["num"]; - } + // Count the number of rows that the search will produce. + $resArr = $this->db->getResultArray("SELECT COUNT(*) AS num FROM (SELECT DISTINCT `tblDocuments`.id ".$searchQuery.") a"); + $totalDocs = 0; + if (is_numeric($resArr[0]["num"]) && $resArr[0]["num"]>0) { + $totalDocs = (integer)$resArr[0]["num"]; + } - // If there are no results from the count query, then there is no real need - // to run the full query. TODO: re-structure code to by-pass additional - // queries when no initial results are found. + // If there are no results from the count query, then there is no real need + // to run the full query. TODO: re-structure code to by-pass additional + // queries when no initial results are found. - // Prepare the complete search query, including the LIMIT clause. - $searchQuery = "SELECT DISTINCT `tblDocuments`.*, ". - "`tblDocumentContent`.`version`, ". - "`tblDocumentStatusLog`.`status`, `tblDocumentLocks`.`userID` as `lockUser` ".$searchQuery; + // Prepare the complete search query, including the LIMIT clause. + $searchQuery = "SELECT DISTINCT `tblDocuments`.*, ". + "`tblDocumentContent`.`version`, ". + "`tblDocumentStatusLog`.`status`, `tblDocumentLocks`.`userID` as `lockUser` ".$searchQuery; - // calculate the remaining entrїes of the current page - // If page is not full yet, get remaining entries - if($limit) { - $remain = $limit - count($folderresult['folders']); - if($remain) { - if($remain == $limit) - $offset -= $totalFolders; - else - $offset = 0; - if($limit) - $searchQuery .= " LIMIT ".$offset.",".$remain; + // calculate the remaining entrїes of the current page + // If page is not full yet, get remaining entries + if($limit) { + $remain = $limit - count($folderresult['folders']); + if($remain) { + if($remain == $limit) + $offset -= $totalFolders; + else + $offset = 0; + if($limit) + $searchQuery .= " LIMIT ".$offset.",".$remain; + // Send the complete search query to the database. + $resArr = $this->db->getResultArray($searchQuery); + } else { + $resArr = array(); + } + } else { // Send the complete search query to the database. $resArr = $this->db->getResultArray($searchQuery); - } else { - $resArr = array(); } - } else { - // Send the complete search query to the database. - $resArr = $this->db->getResultArray($searchQuery); - } - // ------------------- Ausgabe der Ergebnisse ---------------------------- - $numResults = count($resArr); - if ($numResults == 0) { - $docresult = array('totalDocs'=>$totalDocs, 'docs'=>array()); - } else { - foreach ($resArr as $docArr) { - $docs[] = $this->getDocument($docArr['id']); + // ------------------- Ausgabe der Ergebnisse ---------------------------- + $numResults = count($resArr); + if ($numResults == 0) { + $docresult = array('totalDocs'=>$totalDocs, 'docs'=>array()); + } else { + foreach ($resArr as $docArr) { + $docs[] = $this->getDocument($docArr['id']); + } + $docresult = array('totalDocs'=>$totalDocs, 'docs'=>$docs); } - $docresult = array('totalDocs'=>$totalDocs, 'docs'=>$docs); + } else { + $docresult = array('totalDocs'=>0, 'docs'=>array()); } } else { $docresult = array('totalDocs'=>0, 'docs'=>array()); } - } else { - $docresult = array('totalDocs'=>0, 'docs'=>array()); - } if($limit) { $totalPages = (integer)(($totalDocs+$totalFolders)/$limit); @@ -1030,20 +1083,8 @@ class SeedDMS_Core_DMS { * @return object instance of SeedDMS_Core_Folder or false */ function getFolder($id) { /* {{{ */ - if (!is_numeric($id)) return false; - - $queryStr = "SELECT * FROM tblFolders WHERE id = " . (int) $id; - $resArr = $this->db->getResultArray($queryStr); - - if (is_bool($resArr) && $resArr == false) - return false; - else if (count($resArr) != 1) - return false; - - $resArr = $resArr[0]; - $folder = new SeedDMS_Core_Folder($resArr["id"], $resArr["name"], $resArr["parent"], $resArr["comment"], $resArr["date"], $resArr["owner"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["sequence"]); - $folder->setDMS($this); - return $folder; + $classname = $this->classnames['folder']; + return $classname::getInstance($id, $this); } /* }}} */ /** @@ -1074,7 +1115,7 @@ class SeedDMS_Core_DMS { return false; $resArr = $resArr[0]; - $folder = new SeedDMS_Core_Folder($resArr["id"], $resArr["name"], $resArr["parent"], $resArr["comment"], $resArr["date"], $resArr["owner"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["sequence"]); + $folder = new $this->classnames['folder']($resArr["id"], $resArr["name"], $resArr["parent"], $resArr["comment"], $resArr["date"], $resArr["owner"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["sequence"]); $folder->setDMS($this); return $folder; } /* }}} */ @@ -1167,20 +1208,8 @@ class SeedDMS_Core_DMS { * @return object instance of {@link SeedDMS_Core_User} or false */ function getUser($id) { /* {{{ */ - if (!is_numeric($id)) - return false; - - $queryStr = "SELECT * FROM tblUsers WHERE id = " . (int) $id; - $resArr = $this->db->getResultArray($queryStr); - - if (is_bool($resArr) && $resArr == false) return false; - if (count($resArr) != 1) return false; - - $resArr = $resArr[0]; - - $user = new SeedDMS_Core_User($resArr["id"], $resArr["login"], $resArr["pwd"], $resArr["fullName"], $resArr["email"], $resArr["language"], $resArr["theme"], $resArr["comment"], $resArr["role"], $resArr["hidden"], $resArr["disabled"], $resArr["pwdExpiration"], $resArr["loginfailures"], $resArr["quota"]); - $user->setDMS($this); - return $user; + $classname = $this->classnames['user']; + return $classname::getInstance($id, $this); } /* }}} */ /** @@ -1195,19 +1224,8 @@ class SeedDMS_Core_DMS { * @return object instance of {@link SeedDMS_Core_User} or false */ function getUserByLogin($login, $email='') { /* {{{ */ - $queryStr = "SELECT * FROM tblUsers WHERE login = ".$this->db->qstr($login); - if($email) - $queryStr .= " AND email=".$this->db->qstr($email); - $resArr = $this->db->getResultArray($queryStr); - - if (is_bool($resArr) && $resArr == false) return false; - if (count($resArr) != 1) return false; - - $resArr = $resArr[0]; - - $user = new SeedDMS_Core_User($resArr["id"], $resArr["login"], $resArr["pwd"], $resArr["fullName"], $resArr["email"], $resArr["language"], $resArr["theme"], $resArr["comment"], $resArr["role"], $resArr["hidden"], $resArr["disabled"], $resArr["pwdExpiration"], $resArr["loginfailures"], $resArr["quota"]); - $user->setDMS($this); - return $user; + $classname = $this->classnames['user']; + return $classname::getInstance($login, $this, 'name', $email); } /* }}} */ /** @@ -1220,17 +1238,8 @@ class SeedDMS_Core_DMS { * @return object instance of {@link SeedDMS_Core_User} or false */ function getUserByEmail($email) { /* {{{ */ - $queryStr = "SELECT * FROM tblUsers WHERE email = ".$this->db->qstr($email); - $resArr = $this->db->getResultArray($queryStr); - - if (is_bool($resArr) && $resArr == false) return false; - if (count($resArr) != 1) return false; - - $resArr = $resArr[0]; - - $user = new SeedDMS_Core_User($resArr["id"], $resArr["login"], $resArr["pwd"], $resArr["fullName"], $resArr["email"], $resArr["language"], $resArr["theme"], $resArr["comment"], $resArr["role"], $resArr["hidden"], $resArr["disabled"], $resArr["pwdExpiration"], $resArr["loginfailures"], $resArr["quota"]); - $user->setDMS($this); - return $user; + $classname = $this->classnames['user']; + return $classname::getInstance($email, $this, 'email'); } /* }}} */ /** @@ -1239,24 +1248,8 @@ class SeedDMS_Core_DMS { * @return array of instances of {@link SeedDMS_Core_User} or false */ function getAllUsers($orderby = '') { /* {{{ */ - if($orderby == 'fullname') - $queryStr = "SELECT * FROM tblUsers ORDER BY fullname"; - else - $queryStr = "SELECT * FROM tblUsers ORDER BY login"; - $resArr = $this->db->getResultArray($queryStr); - - if (is_bool($resArr) && $resArr == false) - return false; - - $users = array(); - - for ($i = 0; $i < count($resArr); $i++) { - $user = new SeedDMS_Core_User($resArr[$i]["id"], $resArr[$i]["login"], $resArr[$i]["pwd"], $resArr[$i]["fullName"], $resArr[$i]["email"], (isset($resArr[$i]["language"])?$resArr[$i]["language"]:NULL), (isset($resArr[$i]["theme"])?$resArr[$i]["theme"]:NULL), $resArr[$i]["comment"], $resArr[$i]["role"], $resArr[$i]["hidden"], $resArr[$i]["disabled"], $resArr[$i]["pwdExpiration"], $resArr[$i]["loginfailures"], $resArr[$i]["quota"]); - $user->setDMS($this); - $users[$i] = $user; - } - - return $users; + $classname = $this->classnames['user']; + return $classname::getAllInstances($orderby, $this); } /* }}} */ /** @@ -1273,7 +1266,7 @@ class SeedDMS_Core_DMS { * @param integer $isDisabled disable user and prevent login * @return object of {@link SeedDMS_Core_User} */ - function addUser($login, $pwd, $fullName, $email, $language, $theme, $comment, $role='0', $isHidden=0, $isDisabled=0, $pwdexpiration='') { /* {{{ */ + function addUser($login, $pwd, $fullName, $email, $language, $theme, $comment, $role='0', $isHidden=0, $isDisabled=0, $pwdexpiration='', $quota=0, $homefolder=null) { /* {{{ */ $db = $this->db; if (is_object($this->getUserByLogin($login))) { return false; @@ -1282,7 +1275,7 @@ class SeedDMS_Core_DMS { $role = '0'; if(trim($pwdexpiration) == '') $pwdexpiration = '0000-00-00 00:00:00'; - $queryStr = "INSERT INTO tblUsers (login, pwd, fullName, email, language, theme, comment, role, hidden, disabled, pwdExpiration) VALUES (".$db->qstr($login).", ".$db->qstr($pwd).", ".$db->qstr($fullName).", ".$db->qstr($email).", '".$language."', '".$theme."', ".$db->qstr($comment).", '".intval($role)."', '".intval($isHidden)."', '".intval($isDisabled)."', ".$db->qstr($pwdexpiration).")"; + $queryStr = "INSERT INTO tblUsers (login, pwd, fullName, email, language, theme, comment, role, hidden, disabled, pwdExpiration, quota, homefolder) VALUES (".$db->qstr($login).", ".$db->qstr($pwd).", ".$db->qstr($fullName).", ".$db->qstr($email).", '".$language."', '".$theme."', ".$db->qstr($comment).", '".intval($role)."', '".intval($isHidden)."', '".intval($isDisabled)."', ".$db->qstr($pwdexpiration).", '".intval($quota)."', ".($homefolder ? intval($homefolder) : "NULL").")"; $res = $this->db->getResult($queryStr); if (!$res) return false; @@ -1297,22 +1290,8 @@ class SeedDMS_Core_DMS { * @return object/boolean group or false if no group was found */ function getGroup($id) { /* {{{ */ - if (!is_numeric($id)) - return false; - - $queryStr = "SELECT * FROM tblGroups WHERE id = " . (int) $id; - $resArr = $this->db->getResultArray($queryStr); - - if (is_bool($resArr) && $resArr == false) - return false; - else if (count($resArr) != 1) //wenn, dann wohl eher 0 als > 1 ;-) - return false; - - $resArr = $resArr[0]; - - $group = new SeedDMS_Core_Group($resArr["id"], $resArr["name"], $resArr["comment"]); - $group->setDMS($this); - return $group; + $classname = $this->classnames['group']; + return $classname::getInstance($id, $this, ''); } /* }}} */ /** @@ -1322,19 +1301,8 @@ class SeedDMS_Core_DMS { * @return object/boolean group or false if no group was found */ function getGroupByName($name) { /* {{{ */ - $queryStr = "SELECT `tblGroups`.* FROM `tblGroups` WHERE `tblGroups`.`name` = ".$this->db->qstr($name); - $resArr = $this->db->getResultArray($queryStr); - - if (is_bool($resArr) && $resArr == false) - return false; - else if (count($resArr) != 1) //wenn, dann wohl eher 0 als > 1 ;-) - return false; - - $resArr = $resArr[0]; - - $group = new SeedDMS_Core_Group($resArr["id"], $resArr["name"], $resArr["comment"]); - $group->setDMS($this); - return $group; + $classname = $this->classnames['group']; + return $classname::getInstance($name, $this, 'name'); } /* }}} */ /** @@ -1343,22 +1311,8 @@ class SeedDMS_Core_DMS { * @return array array of instances of {@link SeedDMS_Core_Group} */ function getAllGroups() { /* {{{ */ - $queryStr = "SELECT * FROM tblGroups ORDER BY name"; - $resArr = $this->db->getResultArray($queryStr); - - if (is_bool($resArr) && $resArr == false) - return false; - - $groups = array(); - - for ($i = 0; $i < count($resArr); $i++) { - - $group = new SeedDMS_Core_Group($resArr[$i]["id"], $resArr[$i]["name"], $resArr[$i]["comment"]); - $group->setDMS($this); - $groups[$i] = $group; - } - - return $groups; + $classname = $this->classnames['group']; + return $classname::getAllInstances('name', $this); } /* }}} */ /** @@ -2065,9 +2019,9 @@ class SeedDMS_Core_DMS { $versions = array(); foreach($resArr as $row) { - $document = new SeedDMS_Core_Document($row['document'], '', '', '', '', '', '', '', '', '', '', ''); + $document = new $this->classnames['document']($row['document'], '', '', '', '', '', '', '', '', '', '', ''); $document->setDMS($this); - $version = new SeedDMS_Core_DocumentContent($row['id'], $document, $row['version'], $row['comment'], $row['date'], $row['createdBy'], $row['dir'], $row['orgFileName'], $row['fileType'], $row['mimeType'], $row['fileSize'], $row['checksum']); + $version = new $this->classnames['documentcontent']($row['id'], $document, $row['version'], $row['comment'], $row['date'], $row['createdBy'], $row['dir'], $row['orgFileName'], $row['fileType'], $row['mimeType'], $row['fileSize'], $row['checksum']); $versions[] = $version; } return $versions; @@ -2089,9 +2043,9 @@ class SeedDMS_Core_DMS { $versions = array(); foreach($resArr as $row) { - $document = new SeedDMS_Core_Document($row['document'], '', '', '', '', '', '', '', '', '', '', ''); + $document = new $this->classnames['document']($row['document'], '', '', '', '', '', '', '', '', '', '', ''); $document->setDMS($this); - $version = new SeedDMS_Core_DocumentContent($row['id'], $document, $row['version'], $row['comment'], $row['date'], $row['createdBy'], $row['dir'], $row['orgFileName'], $row['fileType'], $row['mimeType'], $row['fileSize'], $row['checksum'], $row['fileSize'], $row['checksum']); + $version = new $this->classnames['documentcontent']($row['id'], $document, $row['version'], $row['comment'], $row['date'], $row['createdBy'], $row['dir'], $row['orgFileName'], $row['fileType'], $row['mimeType'], $row['fileSize'], $row['checksum'], $row['fileSize'], $row['checksum']); $versions[] = $version; } return $versions; @@ -2113,9 +2067,9 @@ class SeedDMS_Core_DMS { $versions = array(); foreach($resArr as $row) { - $document = new SeedDMS_Core_Document($row['document'], '', '', '', '', '', '', '', '', '', '', ''); + $document = new $this->classnames['document']($row['document'], '', '', '', '', '', '', '', '', '', '', ''); $document->setDMS($this); - $version = new SeedDMS_Core_DocumentContent($row['id'], $document, $row['version'], $row['comment'], $row['date'], $row['createdBy'], $row['dir'], $row['orgFileName'], $row['fileType'], $row['mimeType'], $row['fileSize'], $row['checksum']); + $version = new $this->classnames['documentcontent']($row['id'], $document, $row['version'], $row['comment'], $row['date'], $row['createdBy'], $row['dir'], $row['orgFileName'], $row['fileType'], $row['mimeType'], $row['fileSize'], $row['checksum']); $versions[] = $version; } return $versions; @@ -2137,9 +2091,9 @@ class SeedDMS_Core_DMS { $versions = array(); foreach($resArr as $row) { - $document = new SeedDMS_Core_Document($row['document'], '', '', '', '', '', '', '', '', '', '', ''); + $document = new $this->classnames['document']($row['document'], '', '', '', '', '', '', '', '', '', '', ''); $document->setDMS($this); - $version = new SeedDMS_Core_DocumentContent($row['id'], $document, $row['version'], $row['comment'], $row['date'], $row['createdBy'], $row['dir'], $row['orgFileName'], $row['fileType'], $row['mimeType'], $row['fileSize'], $row['checksum']); + $version = new $this->classnames['documentcontent']($row['id'], $document, $row['version'], $row['comment'], $row['date'], $row['createdBy'], $row['dir'], $row['orgFileName'], $row['fileType'], $row['mimeType'], $row['fileSize'], $row['checksum']); if(!isset($versions[$row['dupid']])) { $versions[$row['id']]['content'] = $version; $versions[$row['id']]['duplicates'] = array(); diff --git a/SeedDMS_Core/Core/inc.ClassDocument.php b/SeedDMS_Core/Core/inc.ClassDocument.php index e19ec8313..f38701c69 100644 --- a/SeedDMS_Core/Core/inc.ClassDocument.php +++ b/SeedDMS_Core/Core/inc.ClassDocument.php @@ -30,7 +30,7 @@ define("S_DRAFT_APP", 1); /* * Document is released. A document is in release state either when * it needs no review or approval after uploaded or has been reviewed - * and/or approved.. + * and/or approved. */ define("S_RELEASED", 2); @@ -167,6 +167,36 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */ $this->_notifyList = array(); } /* }}} */ + public static function getInstance($id, $dms) { /* {{{ */ + $db = $dms->getDB(); + + $queryStr = "SELECT * FROM tblDocuments WHERE id = " . (int) $id; + $resArr = $db->getResultArray($queryStr); + if (is_bool($resArr) && $resArr == false) + return false; + if (count($resArr) != 1) + return false; + $resArr = $resArr[0]; + + // New Locking mechanism uses a separate table to track the lock. + $queryStr = "SELECT * FROM tblDocumentLocks WHERE document = " . (int) $id; + $lockArr = $db->getResultArray($queryStr); + if ((is_bool($lockArr) && $lockArr==false) || (count($lockArr)==0)) { + // Could not find a lock on the selected document. + $lock = -1; + } + else { + // A lock has been identified for this document. + $lock = $lockArr[0]["userID"]; + } + + $classname = $dms->getClassname('document'); + $document = new $classname($resArr["id"], $resArr["name"], $resArr["comment"], $resArr["date"], $resArr["expires"], $resArr["owner"], $resArr["folder"], $resArr["inheritAccess"], $resArr["defaultAccess"], $lock, $resArr["keywords"], $resArr["sequence"]); + $document->setDMS($dms); + return $document; + } /* }}} */ + + /* * Return the directory of the document in the file system relativ * to the contentDir @@ -1189,7 +1219,11 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */ $db->rollbackTransaction(); return false; } - if (!SeedDMS_Core_File::copyFile($tmpFile, $this->_dms->contentDir . $dir . $version . $fileType)) { + if($this->_dms->forceRename) + $err = SeedDMS_Core_File::renameFile($tmpFile, $this->_dms->contentDir . $dir . $version . $fileType); + else + $err = SeedDMS_Core_File::copyFile($tmpFile, $this->_dms->contentDir . $dir . $version . $fileType); + if (!$err) { $db->rollbackTransaction(); return false; } @@ -1201,6 +1235,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */ if($workflow) $content->setWorkflow($workflow, $user); $docResultSet = new SeedDMS_Core_AddContentResultSet($content); + $docResultSet->setDMS($this->_dms); if($attributes) { foreach($attributes as $attrdefid=>$attribute) { @@ -1444,9 +1479,6 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */ function removeContent($version) { /* {{{ */ $db = $this->_dms->getDB(); - $emailList = array(); - $emailList[] = $version->_userID; - if (file_exists( $this->_dms->contentDir.$version->getPath() )) if (!SeedDMS_Core_File::removeFile( $this->_dms->contentDir.$version->getPath() )) return false; @@ -1495,9 +1527,6 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */ if(file_exists($file)) SeedDMS_Core_File::removeFile($file); } - if ($st["status"]==0 && !in_array($st["required"], $emailList)) { - $emailList[] = $st["required"]; - } } if (strlen($stList)>0) { @@ -1527,9 +1556,6 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */ if(file_exists($file)) SeedDMS_Core_File::removeFile($file); } - if ($st["status"]==0 && !in_array($st["required"], $emailList)) { - $emailList[] = $st["required"]; - } } if (strlen($stList)>0) { @@ -1738,7 +1764,11 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */ // copy file if (!SeedDMS_Core_File::makeDir($this->_dms->contentDir . $dir)) return false; - if (!SeedDMS_Core_File::copyFile($tmpFile, $this->_dms->contentDir . $file->getPath() )) return false; + if($this->_dms->forceRename) + $err = SeedDMS_Core_File::renameFile($tmpFile, $this->_dms->contentDir . $file->getPath()); + else + $err = SeedDMS_Core_File::copyFile($tmpFile, $this->_dms->contentDir . $file->getPath()); + if (!$err) return false; return true; } /* }}} */ @@ -2426,6 +2456,8 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ * then its status is set to S_RELEASED immediately. Any change of * the status is monitored in the table tblDocumentStatusLog. This * function will always return the latest entry for the content. + * + * @return array latest record from tblDocumentStatusLog */ function getStatus($limit=1) { /* {{{ */ $db = $this->_document->_dms->getDB(); @@ -2435,20 +2467,6 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ // Retrieve the current overall status of the content represented by // this object. if (!isset($this->_status)) { - /* - if (!$db->createTemporaryTable("ttstatid", $forceTemporaryTable)) { - return false; - } - $queryStr="SELECT `tblDocumentStatus`.*, `tblDocumentStatusLog`.`status`, ". - "`tblDocumentStatusLog`.`comment`, `tblDocumentStatusLog`.`date`, ". - "`tblDocumentStatusLog`.`userID` ". - "FROM `tblDocumentStatus` ". - "LEFT JOIN `tblDocumentStatusLog` USING (`statusID`) ". - "LEFT JOIN `ttstatid` ON `ttstatid`.`maxLogID` = `tblDocumentStatusLog`.`statusLogID` ". - "WHERE `ttstatid`.`maxLogID`=`tblDocumentStatusLog`.`statusLogID` ". - "AND `tblDocumentStatus`.`documentID` = '". $this->_document->getID() ."' ". - "AND `tblDocumentStatus`.`version` = '". $this->_version ."' "; - */ $queryStr= "SELECT `tblDocumentStatus`.*, `tblDocumentStatusLog`.`status`, ". "`tblDocumentStatusLog`.`comment`, `tblDocumentStatusLog`.`date`, ". @@ -2544,7 +2562,6 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ return false; unset($this->_status); - return true; } /* }}} */ @@ -3340,11 +3357,9 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ return $approveLogID; } /* }}} */ - function delIndReviewer($user, $requestUser) { /* {{{ */ + function delIndReviewer($user, $requestUser, $msg='') { /* {{{ */ $db = $this->_document->_dms->getDB(); - $userID = $user->getID(); - // Check to see if the user can be removed from the review list. $reviewStatus = $user->getReviewStatus($this->_document->getID(), $this->_version); if (is_bool($reviewStatus) && !$reviewStatus) { @@ -3353,7 +3368,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if (count($reviewStatus["indstatus"])==0) { // User is not assigned to review this document. No action required. // Return an error. - return -3; + return -2; } $indstatus = array_pop($reviewStatus["indstatus"]); if ($indstatus["status"]!=0) { @@ -3363,7 +3378,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ } $queryStr = "INSERT INTO `tblDocumentReviewLog` (`reviewID`, `status`, `comment`, `date`, `userID`) ". - "VALUES ('". $indstatus["reviewID"] ."', '-2', '', ".$db->getCurrentDatetime().", '". $requestUser->getID() ."')"; + "VALUES ('". $indstatus["reviewID"] ."', '-2', ".$db->qstr($msg).", ".$db->getCurrentDatetime().", '". $requestUser->getID() ."')"; $res = $db->getResult($queryStr); if (is_bool($res) && !$res) { return -1; @@ -3372,7 +3387,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ return 0; } /* }}} */ - function delGrpReviewer($group, $requestUser) { /* {{{ */ + function delGrpReviewer($group, $requestUser, $msg='') { /* {{{ */ $db = $this->_document->_dms->getDB(); $groupID = $group->getID(); @@ -3385,7 +3400,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if (count($reviewStatus)==0) { // User is not assigned to review this document. No action required. // Return an error. - return -3; + return -2; } if ($reviewStatus[0]["status"]!=0) { // User has already submitted a review or has already been deleted; @@ -3394,7 +3409,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ } $queryStr = "INSERT INTO `tblDocumentReviewLog` (`reviewID`, `status`, `comment`, `date`, `userID`) ". - "VALUES ('". $reviewStatus[0]["reviewID"] ."', '-2', '', ".$db->getCurrentDatetime().", '". $requestUser->getID() ."')"; + "VALUES ('". $reviewStatus[0]["reviewID"] ."', '-2', ".$db->qstr($msg).", ".$db->getCurrentDatetime().", '". $requestUser->getID() ."')"; $res = $db->getResult($queryStr); if (is_bool($res) && !$res) { return -1; @@ -3403,7 +3418,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ return 0; } /* }}} */ - function delIndApprover($user, $requestUser) { /* {{{ */ + function delIndApprover($user, $requestUser, $msg='') { /* {{{ */ $db = $this->_document->_dms->getDB(); $userID = $user->getID(); @@ -3416,7 +3431,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if (count($approvalStatus["indstatus"])==0) { // User is not assigned to approve this document. No action required. // Return an error. - return -3; + return -2; } $indstatus = array_pop($approvalStatus["indstatus"]); if ($indstatus["status"]!=0) { @@ -3426,7 +3441,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ } $queryStr = "INSERT INTO `tblDocumentApproveLog` (`approveID`, `status`, `comment`, `date`, `userID`) ". - "VALUES ('". $indstatus["approveID"] ."', '-2', '', ".$db->getCurrentDatetime().", '". $requestUser->getID() ."')"; + "VALUES ('". $indstatus["approveID"] ."', '-2', ".$db->qstr($msg).", ".$db->getCurrentDatetime().", '". $requestUser->getID() ."')"; $res = $db->getResult($queryStr); if (is_bool($res) && !$res) { return -1; @@ -3435,7 +3450,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ return 0; } /* }}} */ - function delGrpApprover($group, $requestUser) { /* {{{ */ + function delGrpApprover($group, $requestUser, $msg='') { /* {{{ */ $db = $this->_document->_dms->getDB(); $groupID = $group->getID(); @@ -3448,7 +3463,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if (count($approvalStatus)==0) { // User is not assigned to approve this document. No action required. // Return an error. - return -3; + return -2; } if ($approvalStatus[0]["status"]!=0) { // User has already submitted an approval or has already been deleted; @@ -3457,7 +3472,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ } $queryStr = "INSERT INTO `tblDocumentApproveLog` (`approveID`, `status`, `comment`, `date`, `userID`) ". - "VALUES ('". $approvalStatus[0]["approveID"] ."', '-2', '', ".$db->getCurrentDatetime().", '". $requestUser->getID() ."')"; + "VALUES ('". $approvalStatus[0]["approveID"] ."', '-2', ".$db->qstr($msg).", ".$db->getCurrentDatetime().", '". $requestUser->getID() ."')"; $res = $db->getResult($queryStr); if (is_bool($res) && !$res) { return -1; @@ -4361,6 +4376,11 @@ class SeedDMS_Core_AddContentResultSet { /* {{{ */ protected $_content; protected $_status; + /** + * @var object back reference to document management system + */ + protected $_dms; + function SeedDMS_Core_AddContentResultSet($content) { /* {{{ */ $this->_content = $content; $this->_indReviewers = null; @@ -4368,15 +4388,31 @@ class SeedDMS_Core_AddContentResultSet { /* {{{ */ $this->_indApprovers = null; $this->_grpApprovers = null; $this->_status = null; + $this->_dms = null; + } /* }}} */ + + /* + * 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; } /* }}} */ function addReviewer($reviewer, $type, $status) { /* {{{ */ + $dms = $this->_dms; if (!is_object($reviewer) || (strcasecmp($type, "i") && strcasecmp($type, "g")) && !is_integer($status)){ return false; } if (!strcasecmp($type, "i")) { - if (strcasecmp(get_class($reviewer), "SeedDMS_Core_User")) { + if (strcasecmp(get_class($reviewer), $dms->getClassname("user"))) { return false; } if ($this->_indReviewers == null) { @@ -4385,7 +4421,7 @@ class SeedDMS_Core_AddContentResultSet { /* {{{ */ $this->_indReviewers[$status][] = $reviewer; } if (!strcasecmp($type, "g")) { - if (strcasecmp(get_class($reviewer), "SeedDMS_Core_Group")) { + if (strcasecmp(get_class($reviewer), $dms->getClassname("group"))) { return false; } if ($this->_grpReviewers == null) { @@ -4397,12 +4433,13 @@ class SeedDMS_Core_AddContentResultSet { /* {{{ */ } /* }}} */ function addApprover($approver, $type, $status) { /* {{{ */ + $dms = $this->_dms; if (!is_object($approver) || (strcasecmp($type, "i") && strcasecmp($type, "g")) && !is_integer($status)){ return false; } if (!strcasecmp($type, "i")) { - if (strcasecmp(get_class($approver), "SeedDMS_Core_User")) { + if (strcasecmp(get_class($approver), $dms->getClassname("user"))) { return false; } if ($this->_indApprovers == null) { @@ -4411,7 +4448,7 @@ class SeedDMS_Core_AddContentResultSet { /* {{{ */ $this->_indApprovers[$status][] = $approver; } if (!strcasecmp($type, "g")) { - if (strcasecmp(get_class($approver), "SeedDMS_Core_Group")) { + if (strcasecmp(get_class($approver), $dms->getClassname("group"))) { return false; } if ($this->_grpApprovers == null) { diff --git a/SeedDMS_Core/Core/inc.ClassFolder.php b/SeedDMS_Core/Core/inc.ClassFolder.php index d58591b41..05d862e7d 100644 --- a/SeedDMS_Core/Core/inc.ClassFolder.php +++ b/SeedDMS_Core/Core/inc.ClassFolder.php @@ -87,19 +87,69 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object { $this->_notifyList = array(); } /* }}} */ + /** + * Return an array of database fields which used for searching + * a term entered in the database search form + * + * @param array $searchin integer list of search scopes (2=name, 3=comment, + * 4=attributes) + * @return array list of database fields + */ + public static function getSearchFields($searchin) { /* {{{ */ + $searchFields = array(); + if (in_array(2, $searchin)) { + $searchFields[] = "`tblFolders`.`name`"; + } + if (in_array(3, $searchin)) { + $searchFields[] = "`tblFolders`.`comment`"; + } + if (in_array(4, $searchin)) { + $searchFields[] = "`tblFolderAttributes`.`value`"; + } + return $searchFields; + } /* }}} */ + + /** + * Return a sql statement with all tables used for searching. + * This must be a syntactically correct left join of all tables. + * + * @return string sql expression for left joining tables + */ + public static function getSearchTables() { /* {{{ */ + $sql = "`tblFolders` LEFT JOIN `tblFolderAttributes` on `tblFolders`.`id`=`tblFolderAttributes`.`folder`"; + return $sql; + } /* }}} */ + + public static function getInstance($id, $dms) { /* {{{ */ + $db = $dms->getDB(); + + $queryStr = "SELECT * FROM tblFolders WHERE id = " . (int) $id; + $resArr = $db->getResultArray($queryStr); + if (is_bool($resArr) && $resArr == false) + return false; + else if (count($resArr) != 1) + return false; + + $resArr = $resArr[0]; + $classname = $dms->getClassname('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); + return $folder; + } /* }}} */ + /* * Get the name of the folder. * * @return string name of folder */ - function getName() { return $this->_name; } + public function getName() { return $this->_name; } /* * Set the name of the folder. * * @param string $newName set a new name of the folder */ - function setName($newName) { /* {{{ */ + public function setName($newName) { /* {{{ */ $db = $this->_dms->getDB(); $queryStr = "UPDATE tblFolders SET name = " . $db->qstr($newName) . " WHERE id = ". $this->_id; @@ -111,9 +161,9 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object { return true; } /* }}} */ - function getComment() { return $this->_comment; } + public function getComment() { return $this->_comment; } - function setComment($newComment) { /* {{{ */ + public function setComment($newComment) { /* {{{ */ $db = $this->_dms->getDB(); $queryStr = "UPDATE tblFolders SET comment = " . $db->qstr($newComment) . " WHERE id = ". $this->_id; @@ -129,7 +179,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object { * * @return integer unix timestamp of creation date */ - function getDate() { /* {{{ */ + public function getDate() { /* {{{ */ return $this->_date; } /* }}} */ @@ -162,7 +212,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object { * * @return object parent folder or false if there is no parent folder */ - function getParent() { /* {{{ */ + public function getParent() { /* {{{ */ if ($this->_id == $this->_dms->rootFolderID || empty($this->_parentID)) { return false; } @@ -200,7 +250,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object { * @param object $newParent new parent folder * @return boolean true if operation was successful otherwise false */ - function setParent($newParent) { /* {{{ */ + public function setParent($newParent) { /* {{{ */ $db = $this->_dms->getDB(); if ($this->_id == $this->_dms->rootFolderID || empty($this->_parentID)) { @@ -274,7 +324,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object { * * @return object owner of the folder */ - function getOwner() { /* {{{ */ + public function getOwner() { /* {{{ */ if (!isset($this->_owner)) $this->_owner = $this->_dms->getUser($this->_ownerID); return $this->_owner; @@ -427,7 +477,6 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object { $this->_subFolders = array(); for ($i = 0; $i < count($resArr); $i++) -// $this->_subFolders[$i] = new SeedDMS_Core_Folder($resArr[$i]["id"], $resArr[$i]["name"], $resArr[$i]["parent"], $resArr[$i]["comment"], $resArr[$i]["owner"], $resArr[$i]["inheritAccess"], $resArr[$i]["defaultAccess"], $resArr[$i]["sequence"]); $this->_subFolders[$i] = $this->_dms->getFolder($resArr[$i]["id"]); } @@ -735,6 +784,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object { * must be the id of the attribute definition. * @param array $version_attributes list of document version attributes. * The element key must be the id of the attribute definition. + * @param object $workflow * @return array/boolean false in case of error, otherwise an array * containing two elements. The first one is the new document, the * second one is the result set returned when inserting the content. @@ -794,6 +844,59 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object { return array($document, $res); } /* }}} */ + /** + * Remove a single folder + * + * Removes just a single folder, but not its subfolders or documents + * This function will fail if the folder has subfolders or documents + * because of referencial integrity errors. + * + * @return boolean true on success, false in case of an error + */ + protected function removeFromDatabase() { /* {{{ */ + $db = $this->_dms->getDB(); + + $db->startTransaction(); + // unset homefolder as it will no longer exist + $queryStr = "UPDATE tblUsers SET homefolder=NULL WHERE homefolder = " . $this->_id; + if (!$db->getResult($queryStr)) { + $db->rollbackTransaction(); + return false; + } + // Remove database entries + $queryStr = "DELETE FROM tblFolders WHERE id = " . $this->_id; + if (!$db->getResult($queryStr)) { + $db->rollbackTransaction(); + return false; + } + $queryStr = "DELETE FROM tblFolderAttributes WHERE folder = " . $this->_id; + if (!$db->getResult($queryStr)) { + $db->rollbackTransaction(); + return false; + } + $queryStr = "DELETE FROM tblACLs WHERE target = ". $this->_id. " AND targetType = " . T_FOLDER; + if (!$db->getResult($queryStr)) { + $db->rollbackTransaction(); + return false; + } + + $queryStr = "DELETE FROM tblNotify WHERE target = ". $this->_id. " AND targetType = " . T_FOLDER; + if (!$db->getResult($queryStr)) { + $db->rollbackTransaction(); + return false; + } + $db->commitTransaction(); + + return true; + } /* }}} */ + + /** + * Remove recursively a folder + * + * Removes a folder, all its subfolders and documents + * + * @return boolean true on success, false in case of an error + */ function remove() { /* {{{ */ $db = $this->_dms->getDB(); @@ -822,32 +925,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object { } } - //Entfernen der Datenbankeinträge - $db->startTransaction(); - $queryStr = "DELETE FROM tblFolders WHERE id = " . $this->_id; - if (!$db->getResult($queryStr)) { - $db->rollbackTransaction(); - return false; - } - $queryStr = "DELETE FROM tblFolderAttributes WHERE folder = " . $this->_id; - if (!$db->getResult($queryStr)) { - $db->rollbackTransaction(); - return false; - } - $queryStr = "DELETE FROM tblACLs WHERE target = ". $this->_id. " AND targetType = " . T_FOLDER; - if (!$db->getResult($queryStr)) { - $db->rollbackTransaction(); - return false; - } - - $queryStr = "DELETE FROM tblNotify WHERE target = ". $this->_id. " AND targetType = " . T_FOLDER; - if (!$db->getResult($queryStr)) { - $db->rollbackTransaction(); - return false; - } - $db->commitTransaction(); - - return true; + return $this->removeFromDatabase(); } /* }}} */ /** diff --git a/SeedDMS_Core/Core/inc.ClassGroup.php b/SeedDMS_Core/Core/inc.ClassGroup.php index 88535dad0..ea2ba666f 100644 --- a/SeedDMS_Core/Core/inc.ClassGroup.php +++ b/SeedDMS_Core/Core/inc.ClassGroup.php @@ -50,6 +50,62 @@ class SeedDMS_Core_Group { $this->_dms = null; } /* }}} */ + /** + * Create an instance of a group object + * + * @param string|integer $id Id, name of group, depending + * on the 3rd parameter. + * @param object $dms instance of dms + * @param string $by search by group name if set to 'name'. + * Search by Id of group if left empty. + * @return object instance of class SeedDMS_Core_Group + */ + public static function getInstance($id, $dms, $by='') { /* {{{ */ + $db = $dms->getDB(); + + switch($by) { + case 'name': + $queryStr = "SELECT * FROM `tblGroups` WHERE `name` = ".$db->qstr($id); + break; + default: + $queryStr = "SELECT * FROM `tblGroups` WHERE id = " . (int) $id; + } + + $resArr = $db->getResultArray($queryStr); + if (is_bool($resArr) && $resArr == false) + return false; + else if (count($resArr) != 1) //wenn, dann wohl eher 0 als > 1 ;-) + return false; + + $resArr = $resArr[0]; + + $group = new self($resArr["id"], $resArr["name"], $resArr["comment"]); + $group->setDMS($dms); + return $group; + } /* }}} */ + + public static function getAllInstances($orderby, $dms) { /* {{{ */ + $db = $dms->getDB(); + + switch($orderby) { + default: + $queryStr = "SELECT * FROM tblGroups ORDER BY name"; + } + $resArr = $db->getResultArray($queryStr); + + if (is_bool($resArr) && $resArr == false) + return false; + + $groups = array(); + for ($i = 0; $i < count($resArr); $i++) { + $group = new self($resArr[$i]["id"], $resArr[$i]["name"], $resArr[$i]["comment"]); + $group->setDMS($dms); + $groups[$i] = $group; + } + + return $groups; + } /* }}} */ + function setDMS($dms) { /* {{{ */ $this->_dms = $dms; } /* }}} */ @@ -95,8 +151,9 @@ class SeedDMS_Core_Group { $this->_users = array(); + $classname = $this->_dms->getClassname('user'); foreach ($resArr as $row) { - $user = new SeedDMS_Core_User($row["id"], $row["login"], $row["pwd"], $row["fullName"], $row["email"], $row["language"], $row["theme"], $row["comment"], $row["role"], $row['hidden']); + $user = new $classname($row["id"], $row["login"], $row["pwd"], $row["fullName"], $row["email"], $row["language"], $row["theme"], $row["comment"], $row["role"], $row['hidden']); array_push($this->_users, $user); } } @@ -115,8 +172,9 @@ class SeedDMS_Core_Group { $managers = array(); + $classname = $this->_dms->getClassname('user'); foreach ($resArr as $row) { - $user = new SeedDMS_Core_User($row["id"], $row["login"], $row["pwd"], $row["fullName"], $row["email"], $row["language"], $row["theme"], $row["comment"], $row["role"], $row['hidden']); + $user = new $classname($row["id"], $row["login"], $row["pwd"], $row["fullName"], $row["email"], $row["language"], $row["theme"], $row["comment"], $row["role"], $row['hidden']); array_push($managers, $user); } return $managers; diff --git a/SeedDMS_Core/Core/inc.ClassObject.php b/SeedDMS_Core/Core/inc.ClassObject.php index 894025c02..36bede8a8 100644 --- a/SeedDMS_Core/Core/inc.ClassObject.php +++ b/SeedDMS_Core/Core/inc.ClassObject.php @@ -74,13 +74,13 @@ class SeedDMS_Core_Object { /* {{{ */ $db = $this->_dms->getDB(); switch(get_class($this)) { - case "SeedDMS_Core_Document": + case $this->_dms->getClassname('document'): $queryStr = "SELECT * FROM tblDocumentAttributes WHERE document = " . $this->_id." ORDER BY `id`"; break; - case "SeedDMS_Core_DocumentContent": + case $this->_dms->getClassname('documentcontent'): $queryStr = "SELECT * FROM tblDocumentContentAttributes WHERE content = " . $this->_id." ORDER BY `id`"; break; - case "SeedDMS_Core_Folder": + case $this->_dms->getClassname('folder'): $queryStr = "SELECT * FROM tblFolderAttributes WHERE folder = " . $this->_id." ORDER BY `id`"; break; default: @@ -108,6 +108,25 @@ class SeedDMS_Core_Object { /* {{{ */ * @return array|string value of attritbute or false. The value is an array * if the attribute is defined as multi value */ + function getAttribute($attrdef) { /* {{{ */ + if (!$this->_attributes) { + $this->getAttributes(); + } + + if (isset($this->_attributes[$attrdef->getId()])) { + return $this->_attributes[$attrdef->getId()]; + } else { + return false; + } + + } /* }}} */ + + /** + * Returns an attribute value of the object for the given attribute definition + * + * @return array|string value of attritbute or false. The value is an array + * if the attribute is defined as multi value + */ function getAttributeValue($attrdef) { /* {{{ */ if (!$this->_attributes) { $this->getAttributes(); @@ -126,6 +145,50 @@ class SeedDMS_Core_Object { /* {{{ */ } /* }}} */ + /** + * Returns an attribute value of the object for the given attribute definition + * + * This is a short cut for getAttribute($attrdef)->getValueAsArray() but + * first checks if the object has an attribute for the given attribute + * definition. + * + * @return array value of attritbute or false. The value is always an array + * even if the attribute is not defined as multi value + */ + function getAttributeValueAsArray($attrdef) { /* {{{ */ + if (!$this->_attributes) { + $this->getAttributes(); + } + + if (isset($this->_attributes[$attrdef->getId()])) { + return $this->_attributes[$attrdef->getId()]->getValueAsArray(); + } else + return false; + + } /* }}} */ + + /** + * Returns an attribute value of the object for the given attribute definition + * + * This is a short cut for getAttribute($attrdef)->getValueAsString() but + * first checks if the object has an attribute for the given attribute + * definition. + * + * @return string value of attritbute or false. The value is always a string + * even if the attribute is defined as multi value + */ + function getAttributeValueAsString($attrdef) { /* {{{ */ + if (!$this->_attributes) { + $this->getAttributes(); + } + + if (isset($this->_attributes[$attrdef->getId()])) { + return $this->_attributes[$attrdef->getId()]->getValue(); + } else + return false; + + } /* }}} */ + /** * Set an attribute of the object for the given attribute definition * @@ -145,13 +208,13 @@ class SeedDMS_Core_Object { /* {{{ */ } if(!isset($this->_attributes[$attrdef->getId()])) { switch(get_class($this)) { - case "SeedDMS_Core_Document": + case $this->_dms->getClassname('document'): $queryStr = "INSERT INTO tblDocumentAttributes (document, attrdef, value) VALUES (".$this->_id.", ".$attrdef->getId().", ".$db->qstr($value).")"; break; - case "SeedDMS_Core_DocumentContent": + case $this->_dms->getClassname('documentcontent'): $queryStr = "INSERT INTO tblDocumentContentAttributes (content, attrdef, value) VALUES (".$this->_id.", ".$attrdef->getId().", ".$db->qstr($value).")"; break; - case "SeedDMS_Core_Folder": + case $this->_dms->getClassname('folder'): $queryStr = "INSERT INTO tblFolderAttributes (folder, attrdef, value) VALUES (".$this->_id.", ".$attrdef->getId().", ".$db->qstr($value).")"; break; default: @@ -184,13 +247,13 @@ class SeedDMS_Core_Object { /* {{{ */ } if(isset($this->_attributes[$attrdef->getId()])) { switch(get_class($this)) { - case "SeedDMS_Core_Document": + case $this->_dms->getClassname('document'): $queryStr = "DELETE FROM tblDocumentAttributes WHERE document=".$this->_id." AND attrdef=".$attrdef->getId(); break; - case "SeedDMS_Core_DocumentContent": + case $this->_dms->getClassname('documentcontent'): $queryStr = "DELETE FROM tblDocumentContentAttributes WHERE content=".$this->_id." AND attrdef=".$attrdef->getId(); break; - case "SeedDMS_Core_Folder": + case $this->_dms->getClassname('folder'): $queryStr = "DELETE FROM tblFolderAttributes WHERE folder=".$this->_id." AND attrdef=".$attrdef->getId(); break; default: diff --git a/SeedDMS_Core/Core/inc.ClassUser.php b/SeedDMS_Core/Core/inc.ClassUser.php index e4f0b7e9c..b05c74005 100644 --- a/SeedDMS_Core/Core/inc.ClassUser.php +++ b/SeedDMS_Core/Core/inc.ClassUser.php @@ -22,7 +22,7 @@ * 2010 Uwe Steinmann * @version Release: @package_version@ */ -class SeedDMS_Core_User { +class SeedDMS_Core_User { /* {{{ */ /** * @var integer id of user * @@ -67,9 +67,7 @@ class SeedDMS_Core_User { /** * @var string prefered language of user - * possible values are 'English', 'German', 'Chinese_ZH_TW', 'Czech' - * 'Francais', 'Hungarian', 'Italian', 'Portuguese_BR', 'Slovak', - * 'Spanish' + * possible values are subdirectories within the language directory * * @access protected */ @@ -118,6 +116,13 @@ class SeedDMS_Core_User { */ var $_loginFailures; + /** + * @var object home folder + * + * @access protected + */ + var $_homeFolder; + /** * @var object reference to the dms instance this user belongs to * @@ -129,7 +134,7 @@ class SeedDMS_Core_User { const role_admin = '1'; const role_guest = '2'; - function SeedDMS_Core_User($id, $login, $pwd, $fullName, $email, $language, $theme, $comment, $role, $isHidden=0, $isDisabled=0, $pwdExpiration='0000-00-00 00:00:00', $loginFailures=0, $quota=0) { + function SeedDMS_Core_User($id, $login, $pwd, $fullName, $email, $language, $theme, $comment, $role, $isHidden=0, $isDisabled=0, $pwdExpiration='0000-00-00 00:00:00', $loginFailures=0, $quota=0, $homeFolder=null) { $this->_id = $id; $this->_login = $login; $this->_pwd = $pwd; @@ -144,9 +149,72 @@ class SeedDMS_Core_User { $this->_pwdExpiration = $pwdExpiration; $this->_loginFailures = $loginFailures; $this->_quota = $quota; + $this->_homeFolder = $homeFolder; $this->_dms = null; } + /** + * Create an instance of a user object + * + * @param string|integer $id Id, login name, or email of user, depending + * on the 3rd parameter. + * @param object $dms instance of dms + * @param string $by search by [name|email]. If 'name' is passed, the method + * will check for the 4th paramater and also filter by email. If this + * parameter is left empty, the user will be search by its Id. + * @param string $email optional email address if searching for name + * @return object instance of class SeedDMS_Core_User + */ + public static function getInstance($id, $dms, $by='', $email='') { /* {{{ */ + $db = $dms->getDB(); + + switch($by) { + case 'name': + $queryStr = "SELECT * FROM tblUsers WHERE login = ".$db->qstr($id); + if($email) + $queryStr .= " AND email=".$db->qstr($email); + break; + case 'email': + $queryStr = "SELECT * FROM tblUsers WHERE email = ".$db->qstr($id); + break; + default: + $queryStr = "SELECT * FROM tblUsers WHERE id = " . (int) $id; + } + $resArr = $db->getResultArray($queryStr); + + if (is_bool($resArr) && $resArr == false) return false; + if (count($resArr) != 1) return false; + + $resArr = $resArr[0]; + + $user = new self($resArr["id"], $resArr["login"], $resArr["pwd"], $resArr["fullName"], $resArr["email"], $resArr["language"], $resArr["theme"], $resArr["comment"], $resArr["role"], $resArr["hidden"], $resArr["disabled"], $resArr["pwdExpiration"], $resArr["loginfailures"], $resArr["quota"], $resArr["homefolder"]); + $user->setDMS($dms); + return $user; + } /* }}} */ + + public static function getAllInstances($orderby, $dms) { /* {{{ */ + $db = $dms->getDB(); + + if($orderby == 'fullname') + $queryStr = "SELECT * FROM tblUsers ORDER BY fullname"; + else + $queryStr = "SELECT * FROM tblUsers ORDER BY login"; + $resArr = $db->getResultArray($queryStr); + + if (is_bool($resArr) && $resArr == false) + return false; + + $users = array(); + + for ($i = 0; $i < count($resArr); $i++) { + $user = new self($resArr[$i]["id"], $resArr[$i]["login"], $resArr[$i]["pwd"], $resArr[$i]["fullName"], $resArr[$i]["email"], (isset($resArr[$i]["language"])?$resArr[$i]["language"]:NULL), (isset($resArr[$i]["theme"])?$resArr[$i]["theme"]:NULL), $resArr[$i]["comment"], $resArr[$i]["role"], $resArr[$i]["hidden"], $resArr[$i]["disabled"], $resArr[$i]["pwdExpiration"], $resArr[$i]["loginfailures"], $resArr[$i]["quota"], $resArr[$i]["homefolder"]); + $user->setDMS($dms); + $users[$i] = $user; + } + + return $users; +} /* }}} */ + function setDMS($dms) { $this->_dms = $dms; } @@ -389,6 +457,19 @@ class SeedDMS_Core_User { return true; } /* }}} */ + function getHomeFolder() { return $this->_homeFolder; } + + function setHomeFolder($homefolder) { /* {{{ */ + $db = $this->_dms->getDB(); + + $queryStr = "UPDATE tblUsers SET homefolder = " . ($homefolder ? (int) $homefolder : NULL) . " WHERE id = " . $this->_id; + if (!$db->getResult($queryStr)) + return false; + + $this->_homeFolder = $homefolder; + return true; + } /* }}} */ + /** * Remove the user and also remove all its keywords, notifies, etc. * Do not remove folders and documents of the user, but assign them @@ -665,8 +746,9 @@ class SeedDMS_Core_User { return false; $this->_groups = array(); + $classname = $this->_dms->getClassname('group'); foreach ($resArr as $row) { - $group = new SeedDMS_Core_Group($row["id"], $row["name"], $row["comment"]); + $group = new $classname($row["id"], $row["name"], $row["comment"]); $group->setDMS($this->_dms); array_push($this->_groups, $group); } @@ -761,8 +843,9 @@ class SeedDMS_Core_User { return false; $documents = array(); + $classname = $this->_dms->getClassname('document'); foreach ($resArr as $row) { - $document = new SeedDMS_Core_Document($row["id"], $row["name"], $row["comment"], $row["date"], $row["expires"], $row["owner"], $row["folder"], $row["inheritAccess"], $row["defaultAccess"], $row["lockUser"], $row["keywords"], $row["sequence"]); + $document = new $classname($row["id"], $row["name"], $row["comment"], $row["date"], $row["expires"], $row["owner"], $row["folder"], $row["inheritAccess"], $row["defaultAccess"], $row["lockUser"], $row["keywords"], $row["sequence"]); $document->setDMS($this->_dms); $documents[] = $document; } @@ -771,8 +854,6 @@ class SeedDMS_Core_User { /** * Returns all documents locked by a given user - * FIXME: Not full implemented. Do not use, because it still requires the - * temporary tables! * * @param object $user * @return array list of documents @@ -790,8 +871,9 @@ class SeedDMS_Core_User { return false; $documents = array(); + $classname = $this->_dms->getClassname('document'); foreach ($resArr as $row) { - $document = new SeedDMS_Core_Document($row["id"], $row["name"], $row["comment"], $row["date"], $row["expires"], $row["owner"], $row["folder"], $row["inheritAccess"], $row["defaultAccess"], $row["lockUser"], $row["keywords"], $row["sequence"]); + $document = new $classname($row["id"], $row["name"], $row["comment"], $row["date"], $row["expires"], $row["owner"], $row["folder"], $row["inheritAccess"], $row["defaultAccess"], $row["lockUser"], $row["keywords"], $row["sequence"]); $document->setDMS($this->_dms); $documents[] = $document; } @@ -802,7 +884,7 @@ class SeedDMS_Core_User { * Get a list of reviews * This function returns a list of all reviews seperated by individual * and group reviews. If the document id - * is passed, then only this document will be checked for approvals. The + * is passed, then only this document will be checked for reviews. The * same is true for the version of a document which limits the list * further. * @@ -818,11 +900,6 @@ class SeedDMS_Core_User { function getReviewStatus($documentID=null, $version=null) { /* {{{ */ $db = $this->_dms->getDB(); -/* - if (!$db->createTemporaryTable("ttreviewid")) { - return false; - } -*/ $status = array("indstatus"=>array(), "grpstatus"=>array()); // See if the user is assigned as an individual reviewer. @@ -912,27 +989,7 @@ class SeedDMS_Core_User { function getApprovalStatus($documentID=null, $version=null) { /* {{{ */ $db = $this->_dms->getDB(); -/* - if (!$db->createTemporaryTable("ttapproveid")) { - return false; - } -*/ $status = array("indstatus"=>array(), "grpstatus"=>array()); - - // See if the user is assigned as an individual approver. - /* - $queryStr = "SELECT `tblDocumentApprovers`.*, `tblDocumentApproveLog`.`status`, ". - "`tblDocumentApproveLog`.`comment`, `tblDocumentApproveLog`.`date`, ". - "`tblDocumentApproveLog`.`userID` ". - "FROM `tblDocumentApprovers` ". - "LEFT JOIN `tblDocumentApproveLog` USING (`approveID`) ". - "LEFT JOIN `ttapproveid` on `ttapproveid`.`maxLogID` = `tblDocumentApproveLog`.`approveLogID` ". - "WHERE `ttapproveid`.`maxLogID`=`tblDocumentApproveLog`.`approveLogID` ". - ($documentID==null ? "" : "AND `tblDocumentApprovers`.`documentID` = '". $documentID ."' "). - ($version==null ? "" : "AND `tblDocumentApprovers`.`version` = '". $version ."' "). - "AND `tblDocumentApprovers`.`type`='0' ". - "AND `tblDocumentApprovers`.`required`='". $this->_id ."' "; -*/ $queryStr = "SELECT `tblDocumentApprovers`.*, `tblDocumentApproveLog`.`status`, ". "`tblDocumentApproveLog`.`comment`, `tblDocumentApproveLog`.`date`, ". @@ -962,20 +1019,6 @@ class SeedDMS_Core_User { // See if the user is the member of a group that has been assigned to // approve the document version. - /* - $queryStr = "SELECT `tblDocumentApprovers`.*, `tblDocumentApproveLog`.`status`, ". - "`tblDocumentApproveLog`.`comment`, `tblDocumentApproveLog`.`date`, ". - "`tblDocumentApproveLog`.`userID` ". - "FROM `tblDocumentApprovers` ". - "LEFT JOIN `tblDocumentApproveLog` USING (`approveID`) ". - "LEFT JOIN `tblGroupMembers` ON `tblGroupMembers`.`groupID` = `tblDocumentApprovers`.`required` ". - "LEFT JOIN `ttapproveid` on `ttapproveid`.`maxLogID` = `tblDocumentApproveLog`.`approveLogID` ". - "WHERE `ttapproveid`.`maxLogID`=`tblDocumentApproveLog`.`approveLogID` ". - ($documentID==null ? "" : "AND `tblDocumentApprovers`.`documentID` = '". $documentID ."' "). - ($version==null ? "" : "AND `tblDocumentApprovers`.`version` = '". $version ."' "). - "AND `tblDocumentApprovers`.`type`='1' ". - "AND `tblGroupMembers`.`userID`='". $this->_id ."'"; - */ $queryStr = "SELECT `tblDocumentApprovers`.*, `tblDocumentApproveLog`.`status`, ". "`tblDocumentApproveLog`.`comment`, `tblDocumentApproveLog`.`date`, ". @@ -1231,5 +1274,5 @@ class SeedDMS_Core_User { return true; } /* }}} */ -} +} /* }}} */ ?> diff --git a/SeedDMS_Core/Core/inc.DBAccessPDO.php b/SeedDMS_Core/Core/inc.DBAccessPDO.php index 8eb42c94f..deccf02a7 100644 --- a/SeedDMS_Core/Core/inc.DBAccessPDO.php +++ b/SeedDMS_Core/Core/inc.DBAccessPDO.php @@ -28,7 +28,7 @@ class SeedDMS_Core_DatabaseAccess { public $_debug; /** - * @var string name of database driver (mysql or sqlite3) + * @var string name of database driver (mysql or sqlite) */ protected $_driver; diff --git a/SeedDMS_Core/package.xml b/SeedDMS_Core/package.xml index 9f7a467a2..7e99e9d3c 100644 --- a/SeedDMS_Core/package.xml +++ b/SeedDMS_Core/package.xml @@ -12,11 +12,11 @@ uwe@steinmann.cx yes - 2016-01-21 - + 2016-01-22 + - 4.3.23 - 4.3.23 + 5.0.0 + 5.0.0 stable @@ -24,8 +24,8 @@ GPL License -- new method SeedDMS_Core_DMS::createDump() -- minor improvements int SeedDMS_Core_Document::getReadAccessList() +- classes can be overloaded +- clean workflow log when a document version was deleted @@ -926,5 +926,22 @@ by a group or user right - pass some more information for timeline + + 2016-01-21 + + + 4.3.23 + 4.3.23 + + + stable + stable + + GPL License + +- new method SeedDMS_Core_DMS::createDump() +- minor improvements int SeedDMS_Core_Document::getReadAccessList() + + diff --git a/conf/settings.xml.template b/conf/settings.xml.template index e8c0f56ae..fb40821a0 100644 --- a/conf/settings.xml.template +++ b/conf/settings.xml.template @@ -32,7 +32,7 @@ --> + * @copyright Copyright (C) 2010-2013 Uwe Steinmann + * @version Release: @package_version@ + */ + +/** + * Class which does the busines logic for downloading a document + * + * @category DMS + * @package SeedDMS + * @author Uwe Steinmann + * @copyright Copyright (C) 2010-2013 Uwe Steinmann + * @version Release: @package_version@ + */ +class SeedDMS_Controller_Download extends SeedDMS_Controller_Common { + + public function run() { + $dms = $this->params['dms']; + $type = $this->params['type']; + $content = $this->params['content']; + + switch($type) { + case "version": + + if(!$this->callHook('version')) { + header("Content-Transfer-Encoding: binary"); + header("Content-Length: " . filesize($dms->contentDir . $content->getPath() )); + $efilename = rawurlencode($content->getOriginalFileName()); + header("Content-Disposition: attachment; filename=\"" . $efilename . "\"; filename*=UTF-8''".$efilename); + header("Content-Type: " . $content->getMimeType()); + header("Cache-Control: must-revalidate"); + + readfile($dms->contentDir . $content->getPath()); + } + break; + } + } +} diff --git a/controllers/class.EditFolder.php b/controllers/class.EditFolder.php new file mode 100644 index 000000000..03d01c327 --- /dev/null +++ b/controllers/class.EditFolder.php @@ -0,0 +1,130 @@ + + * @copyright Copyright (C) 2010-2013 Uwe Steinmann + * @version Release: @package_version@ + */ + +/** + * Class which does the busines logic for editing a folder + * + * @category DMS + * @package SeedDMS + * @author Uwe Steinmann + * @copyright Copyright (C) 2010-2013 Uwe Steinmann + * @version Release: @package_version@ + */ +class SeedDMS_Controller_EditFolder extends SeedDMS_Controller_Common { + + public function run() { + $dms = $this->params['dms']; + $user = $this->params['user']; + $settings = $this->params['settings']; + $folder = $this->params['folder']; + $name = $this->params['name']; + $comment = $this->params['comment']; + $sequence = $this->params['sequence']; + $attributes = $this->params['attributes']; + + /* Get the document id and name before removing the document */ + $foldername = $folder->getName(); + $folderid = $folder->getID(); + + if(!$this->callHook('preEditFolder')) { + } + + $result = $this->callHook('editFolder', $folder); + if($result === null) { + if(($oldname = $folder->getName()) != $name) + if(!$folder->setName($name)) + return false; + + if(($oldcomment = $folder->getComment()) != $comment) + if(!$folder->setComment($comment)) + return false; + + $oldattributes = $folder->getAttributes(); + if($attributes) { + foreach($attributes as $attrdefid=>$attribute) { + $attrdef = $dms->getAttributeDefinition($attrdefid); + if($attribute) { + if(!$attrdef->validate($attribute)) { + $this->error = $attrdef->getValidationError(); + switch($attrdef->getValidationError()) { + case 5: + $this->errormsg = getMLText("attr_malformed_email", array("attrname"=>$attrdef->getName(), "value"=>$attribute)); + break; + case 4: + $this->errormsg = getMLText("attr_malformed_url", array("attrname"=>$attrdef->getName(), "value"=>$attribute)); + break; + case 3: + $this->errormsg = getMLText("attr_no_regex_match", array("attrname"=>$attrdef->getName(), "value"=>$attribute, "regex"=>$attrdef->getRegex())); + break; + case 2: + $this->errormsg = getMLText("attr_max_values", array("attrname"=>$attrdef->getName())); + break; + case 1: + $this->errormsg = getMLText("attr_min_values", array("attrname"=>$attrdef->getName())); + break; + default: + $this->errormsg = getMLText("error_occured"); + } + return false; + } + /* + if($attrdef->getRegex()) { + if(!preg_match($attrdef->getRegex(), $attribute)) { + $this->error = 1; + return false; + } + } + if(is_array($attribute)) { + if($attrdef->getMinValues() > count($attribute)) { + $this->error = 2; + return false; + } + if($attrdef->getMaxValues() && $attrdef->getMaxValues() < count($attribute)) { + $this->error = 3; + return false; + } + } + */ + if(!isset($oldattributes[$attrdefid]) || $attribute != $oldattributes[$attrdefid]->getValue()) { + if(!$folder->setAttributeValue($dms->getAttributeDefinition($attrdefid), $attribute)) + return false; + } + } elseif(isset($oldattributes[$attrdefid])) { + if(!$folder->removeAttribute($dms->getAttributeDefinition($attrdefid))) + return false; + } + } + } + foreach($oldattributes as $attrdefid=>$oldattribute) { + if(!isset($attributes[$attrdefid])) { + if(!$folder->removeAttribute($dms->getAttributeDefinition($attrdefid))) + return false; + } + } + + if(strcasecmp($sequence, "keep")) { + if($folder->setSequence($sequence)) { + } else { + return false; + } + } + + if(!$this->callHook('postEditFolder')) { + } + + } else + return $result; + + return true; + } +} diff --git a/controllers/class.Login.php b/controllers/class.Login.php new file mode 100644 index 000000000..5863676f8 --- /dev/null +++ b/controllers/class.Login.php @@ -0,0 +1,34 @@ + + * @copyright Copyright (C) 2010-2013 Uwe Steinmann + * @version Release: @package_version@ + */ + +/** + * Class which does the busines logic when logging in + * + * @category DMS + * @package SeedDMS + * @author Uwe Steinmann + * @copyright Copyright (C) 2010-2013 Uwe Steinmann + * @version Release: @package_version@ + */ +class SeedDMS_Controller_Login extends SeedDMS_Controller_Common { + + public function run() { + $dms = $this->params['dms']; + $user = $this->params['user']; + $settings = $this->params['settings']; + $session = $this->params['session']; + + if($this->callHook('postLogin')) { + } + } +} diff --git a/controllers/class.Logout.php b/controllers/class.Logout.php new file mode 100644 index 000000000..030d07599 --- /dev/null +++ b/controllers/class.Logout.php @@ -0,0 +1,34 @@ + + * @copyright Copyright (C) 2010-2013 Uwe Steinmann + * @version Release: @package_version@ + */ + +/** + * Class which does the busines logic when logging in + * + * @category DMS + * @package SeedDMS + * @author Uwe Steinmann + * @copyright Copyright (C) 2010-2013 Uwe Steinmann + * @version Release: @package_version@ + */ +class SeedDMS_Controller_Logout extends SeedDMS_Controller_Common { + + public function run() { + $dms = $this->params['dms']; + $user = $this->params['user']; + $settings = $this->params['settings']; + $session = $this->params['session']; + + if($this->callHook('postLogout')) { + } + } +} diff --git a/controllers/class.RemoveDocument.php b/controllers/class.RemoveDocument.php new file mode 100644 index 000000000..282300e05 --- /dev/null +++ b/controllers/class.RemoveDocument.php @@ -0,0 +1,64 @@ + + * @copyright Copyright (C) 2010-2013 Uwe Steinmann + * @version Release: @package_version@ + */ + +/** + * Class which does the busines logic for downloading a document + * + * @category DMS + * @package SeedDMS + * @author Uwe Steinmann + * @copyright Copyright (C) 2010-2013 Uwe Steinmann + * @version Release: @package_version@ + */ +class SeedDMS_Controller_RemoveDocument extends SeedDMS_Controller_Common { + + public function run() { + $dms = $this->params['dms']; + $user = $this->params['user']; + $settings = $this->params['settings']; + $document = $this->params['document']; + $index = $this->params['index']; + $indexconf = $this->params['indexconf']; + + $folder = $document->getFolder(); + + /* Get the document id and name before removing the document */ + $docname = $document->getName(); + $documentid = $document->getID(); + + if(!$this->callHook('preRemoveDocument')) { + } + + $result = $this->callHook('removeDocument', $document); + if($result === null) { + if (!$document->remove()) { + return false; + } else { + + if(!$this->callHook('postRemoveDocument')) { + } + + /* Remove the document from the fulltext index */ + if($index) { + $lucenesearch = new $indexconf['Search']($index); + if($hit = $lucenesearch->getDocument($documentid)) { + $index->delete($hit->id); + $index->commit(); + } + } + } + } + + return true; + } +} diff --git a/controllers/class.RemoveFolder.php b/controllers/class.RemoveFolder.php new file mode 100644 index 000000000..d8ae53128 --- /dev/null +++ b/controllers/class.RemoveFolder.php @@ -0,0 +1,71 @@ + + * @copyright Copyright (C) 2010-2013 Uwe Steinmann + * @version Release: @package_version@ + */ + +/** + * Class which does the busines logic for downloading a document + * + * @category DMS + * @package SeedDMS + * @author Uwe Steinmann + * @copyright Copyright (C) 2010-2013 Uwe Steinmann + * @version Release: @package_version@ + */ +class SeedDMS_Controller_RemoveFolder extends SeedDMS_Controller_Common { + + public function run() { + $dms = $this->params['dms']; + $user = $this->params['user']; + $settings = $this->params['settings']; + $folder = $this->params['folder']; + $index = $this->params['index']; + $indexconf = $this->params['indexconf']; + + /* Get the document id and name before removing the document */ + $foldername = $folder->getName(); + $folderid = $folder->getID(); + + if(!$this->callHook('preRemoveFolder')) { + } + + $result = $this->callHook('removeFolder', $folder); + if($result === null) { + /* Register a callback which removes each document from the fulltext index + * The callback must return true other the removal will be canceled. + */ + function removeFromIndex($arr, $document) { + $index = $arr[0]; + $indexconf = $arr[1]; + $lucenesearch = new $indexconf['Search']($index); + if($hit = $lucenesearch->getDocument($document->getID())) { + $index->delete($hit->id); + $index->commit(); + } + return true; + } + if($index) + $dms->setCallback('onPreRemoveDocument', 'removeFromIndex', array($index, $indexconf)); + + if (!$folder->remove()) { + return false; + } else { + + if(!$this->callHook('postRemoveFolder')) { + } + + } + } else + return $result; + + return true; + } +} diff --git a/controllers/class.ViewOnline.php b/controllers/class.ViewOnline.php new file mode 100644 index 000000000..0475286b1 --- /dev/null +++ b/controllers/class.ViewOnline.php @@ -0,0 +1,50 @@ + + * @copyright Copyright (C) 2010-2013 Uwe Steinmann + * @version Release: @package_version@ + */ + +/** + * Class which does the busines logic for downloading a document + * + * @category DMS + * @package SeedDMS + * @author Uwe Steinmann + * @copyright Copyright (C) 2010-2013 Uwe Steinmann + * @version Release: @package_version@ + */ +class SeedDMS_Controller_ViewOnline extends SeedDMS_Controller_Common { + + public function run() { + $dms = $this->params['dms']; + $settings = $this->params['settings']; + $type = $this->params['type']; + $content = $this->params['content']; + $document = $content->getDocument(); + + switch($type) { + case "version": + if(!$this->callHook('version')) { + header("Content-Type: " . $content->getMimeType()); + if (!isset($settings->_viewOnlineFileTypes) || !is_array($settings->_viewOnlineFileTypes) || !in_array(strtolower($content->getFileType()), $settings->_viewOnlineFileTypes)) { + header("Content-Disposition: filename=\"" . $document->getName().$content->getFileType()) . "\""; + } + header("Content-Length: " . filesize($dms->contentDir . $content->getPath())); + header("Expires: 0"); + header("Cache-Control: no-cache, must-revalidate"); + header("Pragma: no-cache"); + + ob_clean(); + readfile($dms->contentDir . $content->getPath()); + } + break; + } + } +} diff --git a/ext/example/class.example.php b/ext/example/class.example.php new file mode 100644 index 000000000..33d8c5240 --- /dev/null +++ b/ext/example/class.example.php @@ -0,0 +1,115 @@ + +* All rights reserved +* +* This script is part of the SeedDMS project. The SeedDMS project is +* free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* The GNU General Public License can be found at +* http://www.gnu.org/copyleft/gpl.html. +* +* This script is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* This copyright notice MUST APPEAR in all copies of the script! +***************************************************************/ + + +/** + * Example extension + * + * @author Uwe Steinmann + * @package SeedDMS + * @subpackage example + */ +class SeedDMS_ExtExample extends SeedDMS_ExtBase { + + /** + * Initialization + * + * Use this method to do some initialization like setting up the hooks + * You have access to the following global variables: + * $GLOBALS['dms'] : object representing dms + * $GLOBALS['user'] : currently logged in user + * $GLOBALS['session'] : current session + * $GLOBALS['settings'] : current global configuration + * $GLOBALS['settings']['_extensions']['example'] : configuration of this extension + * $GLOBALS['LANG'] : the language array with translations for all languages + * $GLOBALS['SEEDDMS_HOOKS'] : all hooks added so far + */ + function init() { /* {{{ */ + $GLOBALS['SEEDDMS_HOOKS']['view']['addDocument'][] = new SeedDMS_ExtExample_AddDocument; + $GLOBALS['SEEDDMS_HOOKS']['view']['viewFolder'][] = new SeedDMS_ExtExample_ViewFolder; + } /* }}} */ + + function main() { /* {{{ */ + } /* }}} */ +} + +/** + * Class containing methods for hooks when a document is added + * + * @author Uwe Steinmann + * @package SeedDMS + * @subpackage example + */ +class SeedDMS_ExtExample_AddDocument { + + /** + * Hook before adding a new document + */ + function preAddDocument($view) { /* {{{ */ + } /* }}} */ + + /** + * Hook after successfully adding a new document + */ + function postAddDocument($view) { /* {{{ */ + } /* }}} */ +} + +/** + * Class containing methods for hooks when a folder view is ѕhown + * + * @author Uwe Steinmann + * @package SeedDMS + * @subpackage example + */ +class SeedDMS_ExtExample_ViewFolder { + + /** + * Hook when showing a folder + * + * The returned string will be output after the object menu and before + * the actual content on the page + * + * @param object $view the current view object + * @return string content to be output + */ + function preContent($view) { /* {{{ */ + return $view->infoMsg("Content created by viewFolder::preContent hook."); + } /* }}} */ + + /** + * Hook when showing a folder + * + * The returned string will be output at the end of the content area + * + * @param object $view the current view object + * @return string content to be output + */ + function postContent($view) { /* {{{ */ + return $view->infoMsg("Content created by viewFolder::postContent hook"); + } /* }}} */ + +} + +?> diff --git a/ext/example/conf.php b/ext/example/conf.php new file mode 100644 index 000000000..6f9f09827 --- /dev/null +++ b/ext/example/conf.php @@ -0,0 +1,32 @@ + 'Example Extension', + 'description' => 'This sample extension demonstrate the use of various hooks', + 'disable' => false, + 'version' => '1.0.0', + 'releasedate' => '2013-05-03', + 'author' => array('name'=>'Uwe Steinmann', 'email'=>'uwe@steinmann.cx', 'company'=>'MMK GmbH'), + 'config' => array( + 'input_field' => array( + 'title'=>'Example input field', + 'type'=>'input', + 'size'=>20, + ), + 'checkbox' => array( + 'title'=>'Example check box', + 'type'=>'checkbox', + ), + ), + 'constraints' => array( + 'depends' => array('php' => '5.4.4-', 'seeddms' => '4.3.0-'), + ), + 'icon' => 'icon.png', + 'class' => array( + 'file' => 'class.example.php', + 'name' => 'SeedDMS_ExtExample' + ), + 'language' => array( + 'file' => 'lang.php', + ), +); +?> diff --git a/ext/example/icon.png b/ext/example/icon.png new file mode 100644 index 000000000..c89493d0b Binary files /dev/null and b/ext/example/icon.png differ diff --git a/ext/example/lang.php b/ext/example/lang.php new file mode 100644 index 000000000..55b3b860b --- /dev/null +++ b/ext/example/lang.php @@ -0,0 +1,5 @@ + 'Dies war mal "Ordner enthält". Wurde von sample Extension geändert.', +); +?> diff --git a/inc/inc.Authentication.php b/inc/inc.Authentication.php index d10c88dd1..cdef1aa93 100644 --- a/inc/inc.Authentication.php +++ b/inc/inc.Authentication.php @@ -18,43 +18,77 @@ if (!strncmp("/op", $refer, 3)) { } else { $refer = urlencode($refer); } -if (!isset($_COOKIE["mydms_session"])) { - header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer); - exit; -} require_once("inc.Utils.php"); require_once("inc.ClassEmailNotify.php"); require_once("inc.ClassSession.php"); -/* Load session */ -$dms_session = $_COOKIE["mydms_session"]; -$session = new SeedDMS_Session($db); -if(!$resArr = $session->load($dms_session)) { - setcookie("mydms_session", $dms_session, time()-3600, $settings->_httpRoot); //delete cookie - header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer); - exit; -} - -/* Update last access time */ -$session->updateAccess($dms_session); -/* Load user data */ - -$user = $dms->getUser($resArr["userID"]); -if($user->isAdmin()) { - if($resArr["su"]) { - $user = $dms->getUser($resArr["su"]); +if (!isset($_COOKIE["mydms_session"])) { + if($settings->_autoLoginUser) { + if(!($user = $dms->getUser($settings->_autoLoginUser))/* || !$user->isGuest()*/) { + header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer); + exit; + } + $theme = $user->getTheme(); + if (strlen($theme)==0) { + $theme = $settings->_theme; + $user->setTheme($theme); + } + $lang = $user->getLanguage(); + if (strlen($lang)==0) { + $lang = $settings->_language; + $user->setLanguage($lang); + } + $session = new SeedDMS_Session($db); + if(!$id = $session->create(array('userid'=>$user->getID(), 'theme'=>$theme, 'lang'=>$lang))) { + header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer); + exit; + } + /* + if($settings->_cookieLifetime) + $lifetime = time() + intval($settings->_cookieLifetime); + else + $lifetime = 0; + setcookie("mydms_session", $id, $lifetime, $settings->_httpRoot, null, null, !$settings->_enableLargeFileUpload); + */ + } else { + header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer); + exit; } -} -if (!is_object($user)) { - setcookie("mydms_session", $dms_session, time()-3600, $settings->_httpRoot); //delete cookie - header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer); - exit; +} else { + /* Load session */ + $dms_session = $_COOKIE["mydms_session"]; + $session = new SeedDMS_Session($db); + if(!$resArr = $session->load($dms_session)) { + setcookie("mydms_session", $dms_session, time()-3600, $settings->_httpRoot); //delete cookie + header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer); + exit; + } + /* Update last access time */ + $session->updateAccess($dms_session); + /* Load user data */ + + $user = $dms->getUser($resArr["userID"]); + if (!is_object($user)) { + setcookie("mydms_session", $dms_session, time()-3600, $settings->_httpRoot); //delete cookie + header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer); + exit; + } + + if($user->isAdmin()) { + if($resArr["su"]) { + $user = $dms->getUser($resArr["su"]); + } else { + $session->resetSu(); + } + } + $theme = $resArr["theme"]; + $lang = $resArr["language"]; } $dms->setUser($user); if($settings->_enableEmail) { - $notifier = new SeedDMS_EmailNotify(); + $notifier = new SeedDMS_EmailNotify($settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword); $notifier->setSender($user); } else { $notifier = null; @@ -73,9 +107,8 @@ if(file_exists($settings->_rootDir . "languages/" . $resArr["language"] . "/lang } */ -$theme = $resArr["theme"]; -if(file_exists($settings->_rootDir . "view/".$theme."/languages/" . $resArr["language"] . "/lang.inc")) { - include $settings->_rootDir . "view/".$theme."/languages/" . $resArr["language"] . "/lang.inc"; +if(file_exists($settings->_rootDir . "view/".$theme."/languages/" . $lang . "/lang.inc")) { + include $settings->_rootDir . "view/".$theme."/languages/" . $lang . "/lang.inc"; } /* Check if password needs to be changed because it expired. If it needs diff --git a/inc/inc.ClassAccessOperation.php b/inc/inc.ClassAccessOperation.php index d2e053d4a..b565a1333 100644 --- a/inc/inc.ClassAccessOperation.php +++ b/inc/inc.ClassAccessOperation.php @@ -21,6 +21,12 @@ * @version Release: @package_version@ */ class SeedDMS_AccessOperation { + /** + * @var object $dms reference to dms + * @access protected + */ + private $dms; + /** * @var object $obj object being accessed * @access protected @@ -39,7 +45,8 @@ class SeedDMS_AccessOperation { */ private $settings; - function __construct($obj, $user, $settings) { /* {{{ */ + function __construct($dms, $obj, $user, $settings) { /* {{{ */ + $this->dms = $dms; $this->obj = $obj; $this->user = $user; $this->settings = $settings; @@ -55,7 +62,7 @@ class SeedDMS_AccessOperation { * even if is disallowed in the settings. */ function mayRemoveVersion() { /* {{{ */ - if(get_class($this->obj) == 'SeedDMS_Core_Document') { + if(get_class($this->obj) == $this->dms->getClassname('document')) { $versions = $this->obj->getContent(); if ((($this->settings->_enableVersionDeletion && ($this->obj->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin() ) && (count($versions) > 1)) { return true; @@ -75,7 +82,7 @@ class SeedDMS_AccessOperation { * even if is disallowed in the settings. */ function mayOverwriteStatus() { /* {{{ */ - if(get_class($this->obj) == 'SeedDMS_Core_Document') { + if(get_class($this->obj) == $this->dms->getClassname('document')) { $latestContent = $this->obj->getLatestContent(); $status = $latestContent->getStatus(); if ((($this->settings->_enableVersionModification && ($this->obj->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && ($status["status"]==S_RELEASED || $status["status"]==S_OBSOLETE )) { @@ -95,7 +102,7 @@ class SeedDMS_AccessOperation { * settings. */ function maySetReviewersApprovers() { /* {{{ */ - if(get_class($this->obj) == 'SeedDMS_Core_Document') { + if(get_class($this->obj) == $this->dms->getClassname('document')) { $latestContent = $this->obj->getLatestContent(); $status = $latestContent->getStatus(); if ((($this->settings->_enableVersionModification && ($this->obj->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && ($status["status"]==S_DRAFT_REV || $status["status"]==S_DRAFT_APP && $this->settings->_workflowMode == 'traditional_only_approval')) { @@ -115,7 +122,7 @@ class SeedDMS_AccessOperation { * settings. */ function maySetWorkflow() { /* {{{ */ - if(get_class($this->obj) == 'SeedDMS_Core_Document') { + if(get_class($this->obj) == $this->dms->getClassname('document')) { $latestContent = $this->obj->getLatestContent(); $workflow = $latestContent->getWorkflow(); if ((($this->settings->_enableVersionModification && ($this->obj->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && (!$workflow || ($workflow->getInitState()->getID() == $latestContent->getWorkflowState()->getID()))) { @@ -132,7 +139,7 @@ class SeedDMS_AccessOperation { * expiration date is only allowed if the document has not been obsoleted. */ function maySetExpires() { /* {{{ */ - if(get_class($this->obj) == 'SeedDMS_Core_Document') { + if(get_class($this->obj) == $this->dms->getClassname('document')) { $latestContent = $this->obj->getLatestContent(); $status = $latestContent->getStatus(); if ((($this->obj->getAccessMode($this->user) == M_ALL) || $this->user->isAdmin()) && ($status["status"]!=S_OBSOLETE)) { @@ -152,7 +159,7 @@ class SeedDMS_AccessOperation { * disallowed in the settings. */ function mayEditComment() { /* {{{ */ - if(get_class($this->obj) == 'SeedDMS_Core_Document') { + if(get_class($this->obj) == $this->dms->getClassname('document')) { if($this->obj->isLocked()) { $lockingUser = $this->obj->getLockingUser(); if (($lockingUser->getID() != $this->user->getID()) && ($this->obj->getAccessMode($this->user) != M_ALL)) { @@ -178,7 +185,7 @@ class SeedDMS_AccessOperation { * disallowed in the settings. */ function mayEditAttributes() { /* {{{ */ - if(get_class($this->obj) == 'SeedDMS_Core_Document') { + if(get_class($this->obj) == $this->dms->getClassname('document')) { $latestContent = $this->obj->getLatestContent(); $status = $latestContent->getStatus(); $workflow = $latestContent->getWorkflow(); @@ -197,7 +204,7 @@ class SeedDMS_AccessOperation { * account here. */ function mayReview() { /* {{{ */ - if(get_class($this->obj) == 'SeedDMS_Core_Document') { + if(get_class($this->obj) == $this->dms->getClassname('document')) { $latestContent = $this->obj->getLatestContent(); $status = $latestContent->getStatus(); if ($status["status"]!=S_OBSOLETE) { @@ -216,10 +223,10 @@ class SeedDMS_AccessOperation { * account here. */ function mayApprove() { /* {{{ */ - if(get_class($this->obj) == 'SeedDMS_Core_Document') { + if(get_class($this->obj) == $this->dms->getClassname('document')) { $latestContent = $this->obj->getLatestContent(); $status = $latestContent->getStatus(); - if ($status["status"]!=S_OBSOLETE && $status["status"]!=S_DRAFT_REV) { + if ($status["status"]!=S_OBSOLETE && $status["status"]!=S_DRAFT_REV && $status["status"]!=S_REJECTED) { return true; } } diff --git a/inc/inc.ClassController.php b/inc/inc.ClassController.php new file mode 100644 index 000000000..22ea5428d --- /dev/null +++ b/inc/inc.ClassController.php @@ -0,0 +1,67 @@ +$extconf) { + $filename = '../ext/'.$extname.'/controllers/class.'.$class.".php"; + if(file_exists($filename)) { + break; + } + $filename = ''; + } + if(!$filename) + $filename = $settings->_rootDir."controllers/class.".$class.".php"; + if(!file_exists($filename)) + $filename = ''; + if($filename) { + require($filename); + $controller = new $classname($params); + /* Set some configuration parameters */ + $controller->setParam('dms', $dms); + $controller->setParam('user', $user); + $controller->setParam('postVars', $_POST); + $controller->setParam('getVars', $_GET); + $controller->setParam('requestVars', $_REQUEST); + $controller->setParam('session', $session); + $controller->setParam('settings', $settings); + return $controller; + } + return null; + } /* }}} */ + +} diff --git a/inc/inc.ClassControllerCommon.php b/inc/inc.ClassControllerCommon.php new file mode 100644 index 000000000..d3a949dff --- /dev/null +++ b/inc/inc.ClassControllerCommon.php @@ -0,0 +1,158 @@ +params = $params; + $this->error = 0; + $this->errormsg = ''; + } + + function setParams($params) { + $this->params = $params; + } + + function setParam($name, $value) { + $this->params[$name] = $value; + } + + /** + * Return value of a parameter with the given name + * + * This function may return null if the parameter does not exist or + * has a value of null. If in doubt call hasParam() to check if the + * parameter exists. + * + * @param string $name name of parameter + * @return mixed value of parameter or null if parameter does not exist + */ + function getParam($name) { + return isset($this->params[$name]) ? $this->params[$name] : null; + } + + /** + * Check if the controller has a parameter with the given name + * + * @param string $name name of parameter + * @return boolean true if parameter exists otherwise false + */ + function hasParam($name) { + return isset($this->params[$name]) ? true : false; + } + + /** + * Remove a parameter with the given name + * + * @param string $name name of parameter + */ + function unsetParam($name) { + if(isset($this->params[$name])) + unset($this->params[$name]); + } + + function run() { + } + + /** + * Get error number of last run + * + * @return integer error number + */ + public function getErrorNo() { /* {{{ */ + return $this->error; + } /* }}} */ + + /** + * Get error message of last run + * + * @return string error message + */ + public function getErrorMsg() { /* {{{ */ + return $this->errormsg; + } /* }}} */ + + /** + * Call a controller hook + * + * @param $hook string name of hook + * @return mixed false if one of the hooks fails, + * true if all hooks succedded, + * null if no hook was called + */ + function callHook($hook) { /* {{{ */ + $tmp = explode('_', get_class($this)); + if(isset($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp[2])])) { + foreach($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp[2])] as $hookObj) { + if (method_exists($hookObj, $hook)) { + switch(func_num_args()) { + case 2: + $result = $hookObj->$hook($this, func_get_arg(1)); + break; + case 1: + default: + $result = $hookObj->$hook($this); + } + if($result === false) { + return $result; + } + } + } + return true; + } + return null; + } /* }}} */ + + /** + * Check if a hook is registered + * + * @param $hook string name of hook + * @return mixed false if one of the hooks fails, + * true if all hooks succedded, + * null if no hook was called + */ + function hasHook($hook) { /* {{{ */ + $tmp = explode('_', get_class($this)); + if(isset($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp[2])])) { + foreach($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp[2])] as $hookObj) { + if (method_exists($hookObj, $hook)) { + return true; + } + } + } + return false; + } /* }}} */ + +} diff --git a/inc/inc.ClassEmailNotify.php b/inc/inc.ClassEmailNotify.php index 96149acd4..2123aabe3 100644 --- a/inc/inc.ClassEmailNotify.php +++ b/inc/inc.ClassEmailNotify.php @@ -17,6 +17,7 @@ * Include parent class */ require_once("inc.ClassNotify.php"); +require_once("Mail.php"); /** * Class to send email notifications to individuals or groups @@ -40,15 +41,89 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify { $this->sender = $user; } + var $smtp_server; + + var $smtp_port; + + var $smtp_user; + + var $smtp_password; + + var $from_address; + + function __construct($from_address='', $smtp_server='', $smtp_port='', $smtp_username='', $smtp_password='') { /* {{{ */ + $this->smtp_server = $smtp_server; + $this->smtp_port = $smtp_port; + $this->smtp_user = $smtp_username; + $this->smtp_password = $smtp_password; + $this->from_address = $from_address; + } /* }}} */ + + /** + * Send mail to individual user + * + * @param mixed $sender individual sending the email. This can be a + * user object or a string. If it is left empty, then + * $this->from_address will be used. + * @param object $recipient individual receiving the mail + * @param string $subject key of string containing the subject of the mail + * @param string $message key of string containing the body of the mail + * @param array $params list of parameters which replaces placeholder in + * the subject and body + * @return false or -1 in case of error, otherwise true + */ function toIndividual($sender, $recipient, $subject, $message, $params=array()) { /* {{{ */ global $settings; if ($recipient->getEmail()=="") return 0; - if ((!is_object($sender) && strcasecmp(get_class($sender), "SeedDMS_Core_User")) || - (!is_object($recipient) && strcasecmp(get_class($recipient), "SeedDMS_Core_User"))) { + if (!is_object($recipient) && strcasecmp(get_class($recipient), "SeedDMS_Core_User")) { return -1; } + if(is_object($sender) && strcasecmp(get_class($sender), "SeedDMS_Core_User")) { + $from = $sender->getFullName() ." <". $sender->getEmail() .">"; + } elseif(is_string($sender) && trim($sender) != "") { + $from = $sender; + } else { + $from = $this->from_address; + } + + $lang = $recipient->getLanguage(); + + $message = getMLText("email_header", array(), "", $lang)."\r\n\r\n".getMLText($message, $params, "", $lang); + $message .= "\r\n\r\n".getMLText("email_footer", array(), "", $lang); + + $headers = array (); + $headers['From'] = $from; + $headers['To'] = $recipient->getEmail(); + $headers['Subject'] = getMLText($subject, $params, "", $lang); + $headers['MIME-Version'] = "1.0"; + $headers['Content-type'] = "text/plain; charset=utf-8"; + + $mail_params = array(); + if($this->smtp_server) { + $mail_params['host'] = $this->smtp_server; + if($this->smtp_port) { + $mail_params['port'] = $this->smtp_port; + } + if($this->smtp_user) { + $mail_params['auth'] = true; + $mail_params['username'] = $this->smtp_user; + $mail_params['password'] = $this->smtp_password; + } + $mail = Mail::factory('smtp', $mail_params); + } else { + $mail = Mail::factory('mail', $mail_params); + } + + $result = $mail->send($recipient->getEmail(), $headers, $message); + if (PEAR::isError($result)) { + return false; + } else { + return true; + } + +/* $headers = array(); $headers[] = "MIME-Version: 1.0"; $headers[] = "Content-type: text/plain; charset=utf-8"; @@ -64,6 +139,7 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify { mail($recipient->getEmail(), $subject, $message, implode("\r\n", $headers)); return true; +*/ } /* }}} */ function toGroup($sender, $groupRecipient, $subject, $message, $params=array()) { /* {{{ */ diff --git a/inc/inc.ClassExtBase.php b/inc/inc.ClassExtBase.php new file mode 100644 index 000000000..fa7135803 --- /dev/null +++ b/inc/inc.ClassExtBase.php @@ -0,0 +1,34 @@ + +* All rights reserved +* +* This script is part of the SeedDMS project. The SeedDMS project is +* free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* The GNU General Public License can be found at +* http://www.gnu.org/copyleft/gpl.html. +* +* This script is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* This copyright notice MUST APPEAR in all copies of the script! +***************************************************************/ + +/** + * Base class for extensions + * + * @author Uwe Steinmann + * @package SeedDMS + */ +class SeedDMS_ExtBase { +} + +?> diff --git a/inc/inc.ClassExtensionMgr.php b/inc/inc.ClassExtensionMgr.php new file mode 100644 index 000000000..163893206 --- /dev/null +++ b/inc/inc.ClassExtensionMgr.php @@ -0,0 +1,93 @@ + + * @copyright 2011 Uwe Steinmann + * @version Release: @package_version@ + */ + +/** + * Class to represent an extension manager + * + * This class provides some very basic methods to manage extensions. + * + * @category DMS + * @package SeedDMS + * @author Markus Westphal, Malcolm Cowe, Uwe Steinmann + * @copyright 2011 Uwe Steinmann + * @version Release: @package_version@ + */ +class SeedDMS_Extension_Mgr { + /** + * @var string $extdir directory where extensions are located + * @access protected + */ + protected $extdir; + + /** + * @var string $cachedir directory where cached extension configuration + * is stored + * @access protected + */ + protected $cachedir; + + + function __construct($extdir = '', $cachedir = '') { + $this->cachedir = $cachedir; + $this->extdir = $extdir; + } + + function getExtensionsConfFile() { /* {{{ */ + return $this->cachedir."/extensions.php"; + } /* }}} */ + + /** + * Create the cached file containing extension information + * + * This function will always create a file, even if no extensions + * are installed. + */ + function createExtensionConf() { /* {{{ */ + $extensions = self::getExtensions(); + $fp = fopen(self::getExtensionsConfFile(), "w"); + if($fp) { + if($extensions) { + foreach($extensions as $_ext) { + if(file_exists($this->extdir . "/" . $_ext . "/conf.php")) { + $content = file_get_contents($this->extdir . "/" . $_ext . "/conf.php"); + fwrite($fp, $content); + } + } + } + fclose($fp); + return true; + } else { + return false; + } + } /* }}} */ + + function getExtensions() { /* {{{ */ + $extensions = array(); + if(file_exists($this->extdir)) { + $handle = opendir($this->extdir); + while ($entry = readdir($handle) ) { + if ($entry == ".." || $entry == ".") + continue; + else if (is_dir($this->extdir ."/". $entry)) + array_push($extensions, $entry); + } + closedir($handle); + + asort($extensions); + } + return $extensions; + } /* }}} */ +} diff --git a/inc/inc.ClassNotify.php b/inc/inc.ClassNotify.php index 8274c8a90..a0c1fa861 100644 --- a/inc/inc.ClassNotify.php +++ b/inc/inc.ClassNotify.php @@ -28,6 +28,5 @@ abstract class SeedDMS_Notify { abstract function toIndividual($sender, $recipient, $subject, $message, $params=array()); abstract function toGroup($sender, $groupRecipient, $subject, $message, $params=array()); abstract function toList($sender, $recipients, $subject, $message, $params=array()); - } ?> diff --git a/inc/inc.ClassSession.php b/inc/inc.ClassSession.php index c29eeed9e..d67532521 100644 --- a/inc/inc.ClassSession.php +++ b/inc/inc.ClassSession.php @@ -285,10 +285,11 @@ class SeedDMS_Session { function addToClipboard($object) { /* {{{ */ /* id is only set if load() was called before */ if($this->id) { - if(get_class($object) == 'SeedDMS_Core_Document') { + $dms = $object->_dms; + if(get_class($object) == $dms->getClassname('document')) { if(!in_array($object->getID(), $this->data['clipboard']['docs'])) array_push($this->data['clipboard']['docs'], $object->getID()); - } elseif(get_class($object) == 'SeedDMS_Core_Folder') { + } elseif(get_class($object) == $dms->getClassname('folder')) { if(!in_array($object->getID(), $this->data['clipboard']['folders'])) array_push($this->data['clipboard']['folders'], $object->getID()); } @@ -307,11 +308,12 @@ class SeedDMS_Session { function removeFromClipboard($object) { /* {{{ */ /* id is only set if load() was called before */ if($this->id) { - if(get_class($object) == 'SeedDMS_Core_Document') { + $dms = $object->_dms; + if(get_class($object) == $dms->getClassname('document')) { $key = array_search($object->getID(), $this->data['clipboard']['docs']); if($key !== false) unset($this->data['clipboard']['docs'][$key]); - } elseif(get_class($object) == 'SeedDMS_Core_Folder') { + } elseif(get_class($object) == $dms->getClassname('folder')) { $key = array_search($object->getID(), $this->data['clipboard']['folders']); if($key !== false) unset($this->data['clipboard']['folders'][$key]); diff --git a/inc/inc.ClassSettings.php b/inc/inc.ClassSettings.php index e987e076b..8b702eaec 100644 --- a/inc/inc.ClassSettings.php +++ b/inc/inc.ClassSettings.php @@ -50,6 +50,8 @@ class Settings { /* {{{ */ var $_passwordHistory = 10; // Number of failed logins before account is disabled var $_loginFailure = 0; + // User id that is automatically logged if nobody is logged in + var $_autoLoginUser = 0; // maximum amount of bytes a user may consume, 0 = unlimited var $_quota = 0; // comma separated list of undeleteable user ids @@ -209,6 +211,10 @@ class Settings { /* {{{ */ var $_smtpPort = null; // SMTP : send from var $_smtpSendFrom = null; + // SMTP : user + var $_smtpUser = null; + // SMTP : password + var $_smtpPassword = null; // LDAP var $_ldapHost = ""; // URIs are supported, e.g.: ldaps://ldap.host.com var $_ldapPort = 389; // Optional. @@ -219,6 +225,7 @@ class Settings { /* {{{ */ var $_ldapType = 1; // 0 = ldap; 1 = AD var $_ldapFilter = ""; var $_converters = array(); // list of commands used to convert files to text for Indexer + var $_extensions = array(); // configuration for extensions /** * Constructor @@ -388,6 +395,7 @@ class Settings { /* {{{ */ $this->_passwordExpiration = intval($tab["passwordExpiration"]); $this->_passwordHistory = intval($tab["passwordHistory"]); $this->_loginFailure = intval($tab["loginFailure"]); + $this->_autoLoginUser = intval($tab["autoLoginUser"]); $this->_quota = intval($tab["quota"]); $this->_undelUserIds = strval($tab["undelUserIds"]); $this->_encryptionKey = strval($tab["encryptionKey"]); @@ -468,6 +476,9 @@ class Settings { /* {{{ */ $this->_smtpSendFrom = strval($tab["smtpSendFrom"]); else $this->_smtpSendFrom = ini_get("sendmail_from"); + // smtpUser + $this->_smtpUser = strval($tab["smtpUser"]); + $this->_smtpPassword = strval($tab["smtpPassword"]); } // XML Path: /configuration/advanced/display @@ -534,6 +545,19 @@ class Settings { /* {{{ */ else $this->_converters[trim(strval($tab['target']))][trim(strval($tab['mimeType']))] = trim(strval($converter)); } + + // XML Path: /configuration/extensions + $extensions = $xml->xpath('/configuration/extensions/extension'); + $this->_extensions = array(); + foreach($extensions as $extension) { + $tmp = $extension->attributes(); + $extname = strval($tmp['name']); + foreach($extension->children() as $parameter) { + $tmp2 = $parameter->attributes(); + $this->_extensions[$extname][strval($tmp2['name'])] = strval($parameter); + } + } + return true; } /* }}} */ @@ -661,6 +685,7 @@ class Settings { /* {{{ */ $this->setXMLAttributValue($node, "passwordExpiration", $this->_passwordExpiration); $this->setXMLAttributValue($node, "passwordHistory", $this->_passwordHistory); $this->setXMLAttributValue($node, "loginFailure", $this->_loginFailure); + $this->setXMLAttributValue($node, "autoLoginUser", $this->_autoLoginUser); $this->setXMLAttributValue($node, "quota", $this->_quota); $this->setXMLAttributValue($node, "undelUserIds", $this->_undelUserIds); $this->setXMLAttributValue($node, "encryptionKey", $this->_encryptionKey); @@ -732,6 +757,8 @@ class Settings { /* {{{ */ $this->setXMLAttributValue($node, "smtpServer", $this->_smtpServer); $this->setXMLAttributValue($node, "smtpPort", $this->_smtpPort); $this->setXMLAttributValue($node, "smtpSendFrom", $this->_smtpSendFrom); + $this->setXMLAttributValue($node, "smtpUser", $this->_smtpUser); + $this->setXMLAttributValue($node, "smtpPassword", $this->_smtpPassword); // XML Path: /configuration/advanced/display $this->getXMLNode($xml, '/configuration', 'advanced'); @@ -803,6 +830,29 @@ class Settings { /* {{{ */ } // foreach + // XML Path: /configuration/extensions + $extnodes = $xml->xpath('/configuration/extensions'); + if(!$extnodes) { + $nodeParent = $xml->xpath('/configuration'); + $extnodes = $nodeParent[0]->addChild("extensions"); + } else { + unset($xml->extensions); + $extnodes = $xml->addChild("extensions"); + } + foreach($this->_extensions as $name => $extension) + { + // search XML node + $extnode = $extnodes->addChild('extension'); + $this->setXMLAttributValue($extnode, 'name', $name); + foreach($GLOBALS['EXT_CONF'][$name]['config'] as $fieldname=>$conf) { + $parameter = $extnode->addChild('parameter'); + $parameter[0] = isset($extension[$fieldname]) ? $extension[$fieldname] : ''; + $this->setXMLAttributValue($parameter, 'name', $fieldname); + } + + + } // foreach + // Save return $xml->asXML($configFilePath); } /* }}} */ @@ -824,16 +874,30 @@ class Settings { /* {{{ */ /** * Returns absolute path for configuration files respecting links * - * This function checks three directories for a configuration directory - * 1. The directory where the current script is located adding '/conf' - * 2. The parent directory of the current script adding '/conf' - * 3. The directory /etc/seeddms + * This function checks all parent directories of the current script + * for a configuration directory named 'conf'. It doesn't check + * if that directory contains a configuration file. + * If none was found a final try will be made checking /etc/seeddms * @return NULL|string config directory */ function getConfigDir() { /* {{{ */ $_tmp = dirname($_SERVER['SCRIPT_FILENAME']); $_arr = preg_split('/\//', rtrim(str_replace('\\', '/', $_tmp))); $configDir = null; + /* new code starts here */ + while($_arr && !$configDir) { + if(file_exists(implode('/', $_arr)."/conf/")) + $configDir = implode('/', $_arr)."/conf/"; + else + array_pop($_arr); + } + if(!$configDir) { + if(file_exists('/etc/seeddms')) + $configDir = '/etc/seeddms'; + } + return $configDir; + /* new code ends here */ + if(file_exists(implode('/', $_arr)."/conf/")) $configDir = implode('/', $_arr)."/conf/"; else { diff --git a/inc/inc.ClassUI.php b/inc/inc.ClassUI.php index bb97675fc..238a1e227 100644 --- a/inc/inc.ClassUI.php +++ b/inc/inc.ClassUI.php @@ -26,7 +26,7 @@ if (!isset($theme) || strlen($theme)==0) { $theme = $settings->_theme; } if (strlen($theme)==0) { - $theme="blue"; + $theme="bootstrap"; } /* Sooner or later the parent will be removed, because all output will @@ -45,21 +45,45 @@ class UI extends UI_Default { * @return object an object of a class implementing the view */ static function factory($theme, $class='', $params=array()) { /* {{{ */ - global $settings, $session; + global $settings, $session, $EXT_CONF; if(!$class) { $class = 'Bootstrap'; $classname = "SeedDMS_Bootstrap_Style"; } else { $classname = "SeedDMS_View_".$class; } - $filename = "../views/".$theme."/class.".$class.".php"; - if(file_exists($filename)) { + /* Do not check for class file anymore but include it relative + * to rootDir or an extension dir if it has set the include path + */ + $filename = ''; + foreach($EXT_CONF as $extname=>$extconf) { + if(!isset($extconf['disable']) || $extconf['disable'] == false) { + $filename = $settings->_rootDir.'ext/'.$extname.'/views/'.$theme."/class.".$class.".php"; + if(file_exists($filename)) { + break; + } + $filename = ''; + if(isset($extconf['views'][$class])) { + $filename = $settings->_rootDir.'ext/'.$extname.'/views/'.$theme."/".$extconf['views'][$class]['file']; + if(file_exists($filename)) { + $classname = $extconf['views'][$class]['name']; + break; + } + } + } + } + if(!$filename) + $filename = $settings->_rootDir."views/".$theme."/class.".$class.".php"; + if(!file_exists($filename)) + $filename = ''; + if($filename) { require($filename); $view = new $classname($params, $theme); /* Set some configuration parameters */ $view->setParam('refferer', $_SERVER['REQUEST_URI']); $view->setParam('class', $class); $view->setParam('session', $session); + $view->setParam('settings', $settings); $view->setParam('sitename', $settings->_siteName); $view->setParam('rootfolderid', $settings->_rootFolderID); $view->setParam('disableselfedit', $settings->_disableSelfEdit); @@ -101,9 +125,10 @@ class UI extends UI_Default { } /* }}} */ static function exitError($pagetitle, $error) { - global $theme; + global $theme, $dms; $tmp = 'ErrorDlg'; $view = UI::factory($theme, $tmp); + $view->setParam('dms', $dms); $view->exitError($pagetitle, $error); } } diff --git a/inc/inc.ClassViewCommon.php b/inc/inc.ClassViewCommon.php index 0668f2d4b..25c00c4a0 100644 --- a/inc/inc.ClassViewCommon.php +++ b/inc/inc.ClassViewCommon.php @@ -66,5 +66,106 @@ class SeedDMS_View_Common { function show() { } + + /** + * Call a hook with a given name + * + * Checks if a hook with the given name and for the current view + * exists and executes it. The name of the current view is taken + * from the current class name by lower casing the first char. + * This function will execute all registered hooks in the order + * they were registered. + * + * Attention: as func_get_arg() cannot handle references passed to the hook, + * callHook() should not be called if that is required. In that case get + * a list of hook objects with getHookObjects() and call the hooks yourself. + * + * @params string $hook name of hook + * @return string concatenated string of whatever the hook function returns + */ + function callHook($hook) { /* {{{ */ + $tmp = explode('_', get_class($this)); + $ret = null; + if(isset($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp[2])])) { + foreach($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp[2])] as $hookObj) { + if (method_exists($hookObj, $hook)) { + switch(func_num_args()) { + case 1: + $tmpret = $hookObj->$hook($this); + if(is_string($tmpret)) + $ret .= $tmpret; + else + $ret = $tmpret; + break; + case 2: + $tmpret = $hookObj->$hook($this, func_get_arg(1)); + if(is_string($tmpret)) + $ret .= $tmpret; + else + $ret = $tmpret; + break; + case 3: + default: + $tmpret = $hookObj->$hook($this, func_get_arg(1), func_get_arg(2)); + if(is_string($tmpret)) + $ret .= $tmpret; + else + $ret = $tmpret; + } + } + } + } + return $ret; + } /* }}} */ + + /** + * Return all hook objects for the given or calling class + * + * + * getHookObjects(); + * foreach($hookObjs as $hookObj) { + * if (method_exists($hookObj, $hook)) { + * $ret = $hookObj->$hook($this, ...); + * ... + * } + * } + * ?> + * + * + * @params string $classname name of class (current class if left empty) + * @return array list of hook objects registered for the class + */ + function getHookObjects($classname='') { /* {{{ */ + if($classname) + $tmp = explode('_', $classname); + else + $tmp = explode('_', get_class($this)); + if(isset($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp[2])])) { + return $GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp[2])]; + } + return array(); + } /* }}} */ + + /** + * Check if a hook is registered + * + * @param $hook string name of hook + * @return mixed false if one of the hooks fails, + * true if all hooks succedded, + * null if no hook was called + */ + function hasHook($hook) { /* {{{ */ + $tmp = explode('_', get_class($this)); + if(isset($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp[2])])) { + foreach($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp[2])] as $hookObj) { + if (method_exists($hookObj, $hook)) { + return true; + } + } + } + return false; + } /* }}} */ + } ?> diff --git a/inc/inc.DBInit.php b/inc/inc.DBInit.php index 583e6482a..1519dd4e0 100644 --- a/inc/inc.DBInit.php +++ b/inc/inc.DBInit.php @@ -18,14 +18,33 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -if(!empty($settings->_coreDir)) - require_once($settings->_coreDir.'/Core.php'); -else - require_once('SeedDMS/Core.php'); +if(isset($GLOBALS['SEEDDMS_HOOKS']['initDB'])) { + foreach($GLOBALS['SEEDDMS_HOOKS']['initDB'] as $hookObj) { + if (method_exists($hookObj, 'pretInitDB')) { + $hookObj->preInitDB(array('settings'=>$settings)); + } + } +} $db = new SeedDMS_Core_DatabaseAccess($settings->_dbDriver, $settings->_dbHostname, $settings->_dbUser, $settings->_dbPass, $settings->_dbDatabase); $db->connect() or die ("Could not connect to db-server \"" . $settings->_dbHostname . "\""); +if(isset($GLOBALS['SEEDDMS_HOOKS']['initDB'])) { + foreach($GLOBALS['SEEDDMS_HOOKS']['initDB'] as $hookObj) { + if (method_exists($hookObj, 'postInitDB')) { + $hookObj->postInitDB(array('db'=>$db, 'settings'=>$settings)); + } + } +} + +if(isset($GLOBALS['SEEDDMS_HOOKS']['initDMS'])) { + foreach($GLOBALS['SEEDDMS_HOOKS']['initDMS'] as $hookObj) { + if (method_exists($hookObj, 'pretInitDMS')) { + $hookObj->preInitDMS(array('db'=>$db, 'settings'=>$settings)); + } + } +} + $dms = new SeedDMS_Core_DMS($db, $settings->_contentDir.$settings->_contentOffsetDir); if(!$settings->_doNotCheckDBVersion && !$dms->checkVersion()) { @@ -37,4 +56,13 @@ $dms->setRootFolderID($settings->_rootFolderID); $dms->setMaxDirID($settings->_maxDirID); $dms->setEnableConverting($settings->_enableConverting); $dms->setViewOnlineFileTypes($settings->_viewOnlineFileTypes); + +if(isset($GLOBALS['SEEDDMS_HOOKS']['initDMS'])) { + foreach($GLOBALS['SEEDDMS_HOOKS']['initDMS'] as $hookObj) { + if (method_exists($hookObj, 'postInitDMS')) { + $hookObj->postInitDMS(array('dms'=>$dms, 'settings'=>$settings)); + } + } +} + ?> diff --git a/inc/inc.Extension.php b/inc/inc.Extension.php new file mode 100644 index 000000000..b3f6eaf26 --- /dev/null +++ b/inc/inc.Extension.php @@ -0,0 +1,50 @@ + + * @copyright Copyright (C) 2013 Uwe Steinmann + * @version Release: @package_version@ + */ + +require "inc.ClassExtensionMgr.php"; +require_once "inc.ClassExtBase.php"; + +$extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir); +$extconffile = $extMgr->getExtensionsConfFile(); +if(!file_exists($extconffile)) { + $extMgr->createExtensionConf(); +} +$EXT_CONF = array(); +include($extconffile); + +foreach($EXT_CONF as $extname=>$extconf) { + if(!isset($extconf['disable']) || $extconf['disable'] == false) { + $classfile = $settings->_rootDir."/ext/".$extname."/".$extconf['class']['file']; + if(file_exists($classfile)) { + include($classfile); + $obj = new $extconf['class']['name']; + if(method_exists($obj, 'init')) + $obj->init(); + } + if(isset($extconf['language']['file'])) { + $langfile = $settings->_rootDir."/ext/".$extname."/".$extconf['language']['file']; + if(file_exists($langfile)) { + unset($__lang); + include($langfile); + if($__lang) { + foreach($__lang as $lang=>&$data) { + if(isset($GLOBALS['LANG'][$lang])) + $GLOBALS['LANG'][$lang] = array_merge($GLOBALS['LANG'][$lang], $data); + else + $GLOBALS['LANG'][$lang] = $data; + } + } + } + } + } +} diff --git a/inc/inc.Init.php b/inc/inc.Init.php new file mode 100644 index 000000000..2336a7344 --- /dev/null +++ b/inc/inc.Init.php @@ -0,0 +1,25 @@ +_coreDir)) + require_once($settings->_coreDir.'/Core.php'); +else + require_once('SeedDMS/Core.php'); + diff --git a/inc/inc.Language.php b/inc/inc.Language.php index 4b7fe9fce..d1f51ab14 100644 --- a/inc/inc.Language.php +++ b/inc/inc.Language.php @@ -67,6 +67,11 @@ function getLanguages() function getMLText($key, $replace = array(), $defaulttext = "", $lang="") { /* {{{ */ GLOBAL $settings, $LANG, $session, $MISSING_LANG; + $trantext = ''; + if(0 && $settings->_otrance) { + $trantext = '
'; + } + if(!$lang) { if($session) $lang = $session->getLanguage(); @@ -87,17 +92,12 @@ function getMLText($key, $replace = array(), $defaulttext = "", $lang="") { /* { } else $tmpText = $LANG[$lang][$key]; -/* - if (!isset($text[$key])) { - if (!$defaulttext) - return "Error getting Text: " . $key . " (" . $settings->_language . ")"; - else - $tmpText = $defaulttext; - } else - $tmpText = $text[$key]; -*/ + if(0 && $settings->_otrance) { + $_GLOBALS['used_langs'][$key] = $tmpText; + } + if (count($replace) == 0) - return $tmpText; + return $tmpText.$trantext; $keys = array_keys($replace); foreach ($keys as $key) diff --git a/inc/inc.Settings.php b/inc/inc.Settings.php index a766e0811..b855a068d 100644 --- a/inc/inc.Settings.php +++ b/inc/inc.Settings.php @@ -47,7 +47,10 @@ if (file_exists("../inc/inc.Settings.old.php")) { } require_once('inc.ClassSettings.php'); -$settings = new Settings(); +if(defined("SEEDDMS_CONFIG_FILE")) + $settings = new Settings(SEEDDMS_CONFIG_FILE); +else + $settings = new Settings(); if(!defined("SEEDDMS_INSTALL") && file_exists(dirname($settings->_configFilePath)."/ENABLE_INSTALL_TOOL")) { die("SeedDMS won't run unless your remove the file ENABLE_INSTALL_TOOL from your configuration directory."); } @@ -112,4 +115,9 @@ if($settings->_enableFullSearch) { } } +/* Add root Dir. Needed because the view classes are included + * relative to it. + */ +ini_set('include_path', $settings->_rootDir. PATH_SEPARATOR .ini_get('include_path')); + ?> diff --git a/inc/inc.Utils.php b/inc/inc.Utils.php index 8342681f7..d273fc0e4 100644 --- a/inc/inc.Utils.php +++ b/inc/inc.Utils.php @@ -79,6 +79,39 @@ function getReadableDurationArray($secs) { return $units; } +/** + * Compare two version + * + * This functions compares two version in the format x.x.x + * + * @param string $ver1 + * @param string $ver2 + * @return int -1 if $ver1 < $ver2, 0 if $ver1 == $ver2, 1 if $ver1 > $ver2 + */ +function cmpVersion($ver1, $ver2) { + $tmp1 = explode('.', $ver1); + $tmp2 = explode('.', $ver2); + if(intval($tmp1[0]) < intval($tmp2[0])) { + return -1; + } elseif(intval($tmp1[0]) > intval($tmp2[0])) { + return 1; + } else { + if(intval($tmp1[1]) < intval($tmp2[1])) { + return -1; + } elseif(intval($tmp1[1]) > intval($tmp2[1])) { + return 1; + } else { + if(intval($tmp1[2]) < intval($tmp2[2])) { + return -1; + } elseif(intval($tmp1[2]) > intval($tmp2[2])) { + return 1; + } else { + return 0; + } + } + } +} + // // The original string sanitizer, kept for reference. //function sanitizeString($string) { @@ -306,15 +339,26 @@ function dskspace($dir) { /* {{{ */ return $space; } /* }}} */ -function add_log_line($msg="") { /* {{{ */ +/** + * Log a message + * + * This function is still here for convienice and because it is + * used at so many places. + * + * @param string $msg + * @param int $priority can be one of PEAR_LOG_EMERG, PEAR_LOG_ALERT, + * PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING, + * PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG. + */ +function add_log_line($msg="", $priority=null) { /* {{{ */ global $logger, $user; if(!$logger) return; if($user) - $logger->log($user->getLogin()." (".$_SERVER['REMOTE_ADDR'].") ".basename($_SERVER["REQUEST_URI"], ".php").$msg); + $logger->log($user->getLogin()." (".$_SERVER['REMOTE_ADDR'].") ".basename($_SERVER["REQUEST_URI"], ".php").$msg, $priority); else - $logger->log("-- (".$_SERVER['REMOTE_ADDR'].") ".basename($_SERVER["REQUEST_URI"], ".php").$msg); + $logger->log("-- (".$_SERVER['REMOTE_ADDR'].") ".basename($_SERVER["REQUEST_URI"], ".php").$msg, $priority); } /* }}} */ function _add_log_line($msg="") { /* {{{ */ @@ -444,6 +488,22 @@ function checkQuota($user) { /* {{{ */ return ($quota - $user->getUsedDiskSpace()); } /* }}} */ +function encryptData($key, $value){ + $text = $value; + $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); + $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); + $crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, $iv); + return $crypttext; +} + +function decryptData($key, $value){ + $crypttext = $value; + $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); + $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); + $decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $crypttext, MCRYPT_MODE_ECB, $iv); + return trim($decrypttext); +} + /** * Return file extension for a give mimetype * diff --git a/inc/inc.Version.php b/inc/inc.Version.php index 88401cc22..5e8ead552 100644 --- a/inc/inc.Version.php +++ b/inc/inc.Version.php @@ -20,7 +20,7 @@ class SeedDMS_Version { - public $_number = "4.3.23"; + public $_number = "5.0.0"; private $_string = "SeedDMS"; function SeedDMS_Version() { diff --git a/install/create_tables-innodb.sql b/install/create_tables-innodb.sql index cd065b66f..26e923ef3 100644 --- a/install/create_tables-innodb.sql +++ b/install/create_tables-innodb.sql @@ -65,6 +65,7 @@ CREATE TABLE `tblUsers` ( `loginfailures` tinyint(4) NOT NULL default '0', `disabled` smallint(1) NOT NULL default '0', `quota` bigint, + `homefolder` int(11) default NULL, PRIMARY KEY (`id`), UNIQUE (`login`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -136,6 +137,8 @@ CREATE TABLE `tblFolders` ( CONSTRAINT `tblFolders_owner` FOREIGN KEY (`owner`) REFERENCES `tblUsers` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE tblUsers ADD CONSTRAINT `tblUsers_homefolder` FOREIGN KEY (`homefolder`) REFERENCES `tblFolders` (`id`); + -- -------------------------------------------------------- -- @@ -708,8 +711,8 @@ CREATE TABLE `tblVersion` ( -- Initial content for database -- -INSERT INTO tblUsers VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Administrator', 'address@server.com', '', '', '', 1, 0, '0000-00-00 00:00:00', 0, 0, 0); -INSERT INTO tblUsers VALUES (2, 'guest', NULL, 'Guest User', NULL, '', '', '', 2, 0, '0000-00-00 00:00:00', 0, 0, 0); +INSERT INTO tblUsers VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Administrator', 'address@server.com', '', '', '', 1, 0, '0000-00-00 00:00:00', 0, 0, 0, NULL); +INSERT INTO tblUsers VALUES (2, 'guest', NULL, 'Guest User', NULL, '', '', '', 2, 0, '0000-00-00 00:00:00', 0, 0, 0, NULL); INSERT INTO tblFolders VALUES (1, 'DMS', 0, '', 'DMS root', UNIX_TIMESTAMP(), 1, 0, 2, 0); -INSERT INTO tblVersion VALUES (NOW(), 4, 3, 0); +INSERT INTO tblVersion VALUES (NOW(), 5, 0, 0); INSERT INTO tblCategory VALUES (0, ''); diff --git a/install/create_tables-sqlite3.sql b/install/create_tables-sqlite3.sql index 13378361e..444ca5c34 100644 --- a/install/create_tables-sqlite3.sql +++ b/install/create_tables-sqlite3.sql @@ -62,6 +62,7 @@ CREATE TABLE `tblUsers` ( `loginfailures` INTEGER NOT NULL default '0', `disabled` INTEGER NOT NULL default '0', `quota` INTEGER, + `homefolder` INTEGER default NULL REFERENCES `tblFolders` (`id`), UNIQUE (`login`) ); @@ -615,8 +616,8 @@ CREATE TABLE `tblVersion` ( -- Initial content for database -- -INSERT INTO tblUsers VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Administrator', 'address@server.com', '', '', '', 1, 0, '', 0, 0, 0); -INSERT INTO tblUsers VALUES (2, 'guest', NULL, 'Guest User', NULL, '', '', '', 2, 0, '', 0, 0, 0); +INSERT INTO tblUsers VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Administrator', 'address@server.com', '', '', '', 1, 0, '', 0, 0, 0, 0); +INSERT INTO tblUsers VALUES (2, 'guest', NULL, 'Guest User', NULL, '', '', '', 2, 0, '', 0, 0, 0, 0); INSERT INTO tblFolders VALUES (1, 'DMS', 0, '', 'DMS root', strftime('%s','now'), 1, 0, 2, 0); -INSERT INTO tblVersion VALUES (DATETIME(), 4, 3, 0); +INSERT INTO tblVersion VALUES (DATETIME(), 5, 0, 0); INSERT INTO tblCategory VALUES (0, ''); diff --git a/install/install.php b/install/install.php index e9762cd03..db2258bc0 100644 --- a/install/install.php +++ b/install/install.php @@ -119,7 +119,7 @@ function fileExistsInIncludePath($file) { /* {{{ */ * Load default settings + set */ define("SEEDDMS_INSTALL", "on"); -define("SEEDDMS_VERSION", "4.3.23"); +define("SEEDDMS_VERSION", "5.0.0"); require_once('../inc/inc.ClassSettings.php'); diff --git a/install/settings.xml.template_install b/install/settings.xml.template_install index d4c789800..55988c660 100644 --- a/install/settings.xml.template_install +++ b/install/settings.xml.template_install @@ -34,7 +34,7 @@ --> preAddDocument(array('name'=>&$name, 'comment'=>&$comment)); + } + } + } + $res = $folder->addDocument($name, $comment, $expires, $user, $keywords, $cats, $userfiletmp, basename($userfilename), $fileType, $userfiletype, $sequence, @@ -284,8 +294,8 @@ for ($file_num=0;$file_num $folder->getName())),getMLText("error_occured")); } else { $document = $res[0]; - if(isset($GLOBALS['SEEDDMS_HOOKS']['postAddDocument'])) { - foreach($GLOBALS['SEEDDMS_HOOKS']['postAddDocument'] as $hookObj) { + if(isset($GLOBALS['SEEDDMS_HOOKS']['addDocument'])) { + foreach($GLOBALS['SEEDDMS_HOOKS']['addDocument'] as $hookObj) { if (method_exists($hookObj, 'postAddDocument')) { $hookObj->postAddDocument($document); } diff --git a/op/op.AddDocumentLink.php b/op/op.AddDocumentLink.php index 1f33487aa..306532428 100644 --- a/op/op.AddDocumentLink.php +++ b/op/op.AddDocumentLink.php @@ -1,66 +1,68 @@ - getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); -} - -$documentid = $_GET["documentid"]; + UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); +} + +$documentid = $_GET["documentid"]; $document = $dms->getDocument($documentid); - -if (!is_object($document)) { - UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); -} - -$folder = $document->getFolder(); + +if (!is_object($document)) { + UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); +} + +$folder = $document->getFolder(); $docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; - + if ($document->getAccessMode($user) < M_READ) { - UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); -} - -$public = (isset($_GET["public"]) && $_GET["public"] == "true") ? true : false; -if ($public && ($document->getAccessMode($user) == M_READ)) { - $public = false; -} - + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); +} + +$public = (isset($_GET["public"]) && $_GET["public"] == "true") ? true : false; +if ($public && ($document->getAccessMode($user) == M_READ)) { + $public = false; +} + if (!isset($_GET["docid"]) || !is_numeric($_GET["docid"]) || intval($_GET["docid"])<1) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_target_doc_id")); } - -$docid = $_GET["docid"]; + +$docid = $_GET["docid"]; $doc = $dms->getDocument($docid); - + if (!is_object($doc)) { - UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_doc_id")); + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_doc_id")); } if (!$document->addDocumentLink($docid, $user->getID(), $public)){ - UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured")); + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured")); } header("Location:../out/out.ViewDocument.php?documentid=".$documentid."¤ttab=links"); diff --git a/op/op.AddEvent.php b/op/op.AddEvent.php index e315569a0..915d25422 100644 --- a/op/op.AddEvent.php +++ b/op/op.AddEvent.php @@ -21,6 +21,8 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); include("../inc/inc.ClassUI.php"); diff --git a/op/op.AddFile.php b/op/op.AddFile.php index 589923437..345838ee9 100644 --- a/op/op.AddFile.php +++ b/op/op.AddFile.php @@ -17,10 +17,12 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.LogInit.php"); +include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.AddFile2.php b/op/op.AddFile2.php index 4e64ba7e3..d99e14175 100644 --- a/op/op.AddFile2.php +++ b/op/op.AddFile2.php @@ -17,10 +17,12 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.LogInit.php"); +include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.AddMultiDocument.php b/op/op.AddMultiDocument.php index 05d2e902e..aeaf8d7b9 100644 --- a/op/op.AddMultiDocument.php +++ b/op/op.AddMultiDocument.php @@ -20,10 +20,12 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.LogInit.php"); +include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.Authentication.php"); $file_param_name = 'file'; diff --git a/op/op.AddSubFolder.php b/op/op.AddSubFolder.php index 31c0588ba..a084a5d20 100644 --- a/op/op.AddSubFolder.php +++ b/op/op.AddSubFolder.php @@ -21,8 +21,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.AddToClipboard.php b/op/op.AddToClipboard.php index 5426f43df..965d9b87b 100644 --- a/op/op.AddToClipboard.php +++ b/op/op.AddToClipboard.php @@ -22,6 +22,8 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.AddTransitionToWorkflow.php b/op/op.AddTransitionToWorkflow.php index 8f77b9064..e024ae6b7 100644 --- a/op/op.AddTransitionToWorkflow.php +++ b/op/op.AddTransitionToWorkflow.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.Ajax.php b/op/op.Ajax.php index 6507c2a4f..d328c557f 100644 --- a/op/op.Ajax.php +++ b/op/op.Ajax.php @@ -19,12 +19,14 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.ClassEmailNotify.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.DBInit.php"); +include("../inc/inc.ClassEmailNotify.php"); include("../inc/inc.ClassUI.php"); -require_once("../inc/inc.Utils.php"); require_once("../inc/inc.ClassSession.php"); include("../inc/inc.ClassPasswordStrength.php"); include("../inc/inc.ClassPasswordHistoryManager.php"); @@ -205,6 +207,23 @@ switch($command) { } break; /* }}} */ + case 'testmail': /* {{{ */ + if($user && $user->isAdmin()) { + if($user->getEmail()) { + $emailobj = new SeedDMS_Email($settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword); + $params = array(); + + if($emailobj->toIndividual($settings->_smtpSendFrom, $user, "testmail_subject", "testmail_body", $params)) { + echo json_encode(array("error"=>0, "msg"=>"Sending email succeded")); + } else { + echo json_encode(array("error"=>1, "msg"=>"Sending email failed")); + } + } else { + echo json_encode(array("error"=>1, "msg"=>"No email address")); + } + } + break; /* }}} */ + case 'movefolder': /* {{{ */ if($user) { if(!checkFormKey('movefolder', 'GET')) { @@ -442,7 +461,8 @@ switch($command) { $content = $view->menuClipboard($session->getClipboard()); break; case 'mainclipboard': - $content = $view->mainClipboard($session->getClipboard()); + $previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $settings->_previewWidthList); + $content = $view->mainClipboard($session->getClipboard(), $previewer); break; case 'documentlistrow': $document = $dms->getDocument($_REQUEST['id']); diff --git a/op/op.ApproveDocument.php b/op/op.ApproveDocument.php index d17aeb195..30ae35235 100644 --- a/op/op.ApproveDocument.php +++ b/op/op.ApproveDocument.php @@ -20,12 +20,15 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); +include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); -include("../inc/inc.ClassUI.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); +include("../inc/inc.ClassUI.php"); /* Check if the form data comes for a trusted request */ if(!checkFormKey('approvedocument')) { @@ -44,7 +47,6 @@ if (!is_object($document)) { } $folder = $document->getFolder(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_READ) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); @@ -68,7 +70,7 @@ if ($latestContent->getVersion()!=$version) { } /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); // verify if document may be approved if (!$accessop->mayApprove()){ diff --git a/op/op.AttributeMgr.php b/op/op.AttributeMgr.php index ac30787d9..c280c6d39 100644 --- a/op/op.AttributeMgr.php +++ b/op/op.AttributeMgr.php @@ -19,8 +19,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.Categories.php b/op/op.Categories.php index f46d81aeb..b40771729 100644 --- a/op/op.Categories.php +++ b/op/op.Categories.php @@ -18,8 +18,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.ChangePassword.php b/op/op.ChangePassword.php index cc54a228c..c0d05823c 100644 --- a/op/op.ChangePassword.php +++ b/op/op.ChangePassword.php @@ -19,9 +19,11 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.LogInit.php"); +include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); include("../inc/inc.ClassSession.php"); include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); diff --git a/op/op.ClearClipboard.php b/op/op.ClearClipboard.php index a01e0856e..f515df67f 100644 --- a/op/op.ClearClipboard.php +++ b/op/op.ClearClipboard.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.CreateDump.php b/op/op.CreateDump.php index c06f96b56..6b38f8ed7 100644 --- a/op/op.CreateDump.php +++ b/op/op.CreateDump.php @@ -19,8 +19,10 @@ include("../inc/inc.Version.php"); include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.CreateFolderArchive.php b/op/op.CreateFolderArchive.php index 71a42c759..5615e2ac7 100644 --- a/op/op.CreateFolderArchive.php +++ b/op/op.CreateFolderArchive.php @@ -18,8 +18,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); @@ -112,9 +114,7 @@ function getFolderPathPlainAST($folder) { /* {{{ */ return $path; } /* }}} */ -function createFolderTar($folder,$ark) { /* {{{ */ - global $human_readable,$dms; - +function createFolderTar($folder,$ark, $human_readable, $dms) { /* {{{ */ $documents=$folder->getDocuments(); foreach ($documents as $document){ @@ -150,7 +150,7 @@ function createFolderTar($folder,$ark) { /* {{{ */ $subFolders=$folder->getSubfolders(); foreach ($subFolders as $folder) - if (!createFolderTar($folder,$ark)) + if (!createFolderTar($folder,$ark,$human_readable,$dms)) return false; return true; @@ -173,7 +173,7 @@ else $ark_name = $settings->_contentDir.time()."_".$folderid.".tar"; $ark = fopen($ark_name,"w"); -if (!createFolderTar($folder,$ark)) { +if (!createFolderTar($folder,$ark, $human_readable, $dms)) { fclose($ark); unlink($ark_name); UI::exitError(getMLText("admin_tools"),getMLText("error_occured")); diff --git a/op/op.CreateSubFolderIndex.php b/op/op.CreateSubFolderIndex.php index ddc082c95..03dc2d33e 100644 --- a/op/op.CreateSubFolderIndex.php +++ b/op/op.CreateSubFolderIndex.php @@ -18,8 +18,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.CreateVersioningFiles.php b/op/op.CreateVersioningFiles.php index a89845163..93ab5d02d 100644 --- a/op/op.CreateVersioningFiles.php +++ b/op/op.CreateVersioningFiles.php @@ -18,8 +18,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.DefaultKeywords.php b/op/op.DefaultKeywords.php index a4c78de6a..0bd50c445 100644 --- a/op/op.DefaultKeywords.php +++ b/op/op.DefaultKeywords.php @@ -18,8 +18,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.DocumentAccess.php b/op/op.DocumentAccess.php index 89c5ae7a4..73a96ba3b 100644 --- a/op/op.DocumentAccess.php +++ b/op/op.DocumentAccess.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.DocumentNotify.php b/op/op.DocumentNotify.php index 7e1339ca4..88a119316 100644 --- a/op/op.DocumentNotify.php +++ b/op/op.DocumentNotify.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.Download.php b/op/op.Download.php index 29e793ddc..b1cb0bfd3 100644 --- a/op/op.Download.php +++ b/op/op.Download.php @@ -21,16 +21,21 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Utils.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); +include("../inc/inc.ClassController.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$controller = Controller::factory($tmp[1]); + if (isset($_GET["version"])) { // document download - 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")); } @@ -58,19 +63,10 @@ if (isset($_GET["version"])) { if (!is_object($content)) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version")); } - - //header("Content-Type: application/force-download; name=\"" . mydmsDecodeString($content->getOriginalFileName()) . "\""); - header("Content-Transfer-Encoding: binary"); - header("Content-Length: " . filesize($dms->contentDir . $content->getPath() )); - $efilename = rawurlencode($content->getOriginalFileName()); - header("Content-Disposition: attachment; filename=\"" . $efilename . "\"; filename*=UTF-8''".$efilename); - //header("Expires: 0"); - header("Content-Type: " . $content->getMimeType()); - //header("Cache-Control: no-cache, must-revalidate"); - header("Cache-Control: must-revalidate"); - //header("Pragma: no-cache"); - readfile($dms->contentDir . $content->getPath()); + $controller->setParam('content', $content); + $controller->setParam('type', 'version'); + $controller->run(); } elseif (isset($_GET["file"])) { @@ -115,6 +111,7 @@ if (isset($_GET["version"])) { header("Cache-Control: must-revalidate"); //header("Pragma: no-cache"); + ob_clean(); readfile($dms->contentDir . $file->getPath()); } elseif (isset($_GET["arkname"])) { @@ -145,6 +142,7 @@ if (isset($_GET["version"])) { header("Cache-Control: public"); //header("Pragma: no-cache"); + ob_clean(); readfile($settings->_contentDir .$filename ); } elseif (isset($_GET["logname"])) { @@ -166,7 +164,8 @@ if (isset($_GET["version"])) { $efilename = rawurlencode($filename); header("Content-Disposition: attachment; filename=\"" .$efilename . "\"; filename*=UTF-8''".$efilename); header("Cache-Control: must-revalidate"); - + + ob_clean(); readfile($settings->_contentDir .$filename ); } elseif (isset($_GET["vfile"])) { @@ -196,6 +195,7 @@ if (isset($_GET["version"])) { header("Cache-Control: must-revalidate"); //header("Pragma: no-cache"); + ob_clean(); readfile($dms->contentDir . $document->getDir() .$settings->_versioningFileName); } elseif (isset($_GET["dumpname"])) { @@ -223,6 +223,7 @@ if (isset($_GET["version"])) { header("Cache-Control: must-revalidate"); //header("Pragma: no-cache"); + ob_clean(); readfile($settings->_contentDir .$filename ); } elseif (isset($_GET["reviewlogid"])) { if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) { @@ -290,4 +291,3 @@ if (isset($_GET["version"])) { add_log_line(); exit(); -?> diff --git a/op/op.EditAttributes.php b/op/op.EditAttributes.php index bd9e33c72..d5fadc1ad 100644 --- a/op/op.EditAttributes.php +++ b/op/op.EditAttributes.php @@ -20,9 +20,11 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Utils.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.EditComment.php b/op/op.EditComment.php index df04e54b6..442f77bda 100644 --- a/op/op.EditComment.php +++ b/op/op.EditComment.php @@ -21,8 +21,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.EditDocument.php b/op/op.EditDocument.php index 2f9e8533c..9e3bd4b3b 100644 --- a/op/op.EditDocument.php +++ b/op/op.EditDocument.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); @@ -108,7 +110,7 @@ if (($oldname = $document->getName()) != $name) { // if user is not owner send notification to owner if ($user->getID() != $document->getOwner()->getID() && - !SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) { + false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) { $notifyList['users'][] = $document->getOwner(); } $notifier->toList($user, $notifyList["users"], $subject, $message, $params); @@ -162,7 +164,7 @@ if (($oldcomment = $document->getComment()) != $comment) { // if user is not owner send notification to owner if ($user->getID() != $document->getOwner()->getID() && - !SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) { + false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) { $notifyList['users'][] = $document->getOwner(); } $notifier->toList($user, $notifyList["users"], $subject, $message, $params); @@ -204,7 +206,7 @@ if ($expires != $document->getExpires()) { // if user is not owner send notification to owner if ($user->getID() != $document->getOwner()->getID() && - !SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) { + false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) { $notifyList['users'][] = $document->getOwner(); } $notifier->toList($user, $notifyList["users"], $subject, $message, $params); @@ -257,6 +259,28 @@ if($attributes) { foreach($attributes as $attrdefid=>$attribute) { $attrdef = $dms->getAttributeDefinition($attrdefid); if($attribute) { + if(!$attrdef->validate($attribute)) { + switch($attrdef->getValidationError()) { + case 5: + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("attr_malformed_email", array("attrname"=>$attrdef->getName(), "value"=>$attribute))); + break; + case 4: + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("attr_malformed_url", array("attrname"=>$attrdef->getName(), "value"=>$attribute))); + break; + case 3: + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("attr_no_regex_match", array("attrname"=>$attrdef->getName(), "value"=>$attribute, "regex"=>$attrdef->getRegex()))); + break; + case 2: + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("attr_max_values", array("attrname"=>$attrdef->getName()))); + break; + case 1: + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("attr_min_values", array("attrname"=>$attrdef->getName()))); + break; + default: + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured")); + } + } + /* if($attrdef->getRegex()) { if(!preg_match($attrdef->getRegex(), $attribute)) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("attr_no_regex_match")); @@ -270,6 +294,7 @@ if($attributes) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("attr_max_values", array("attrname"=>$attrdef->getName()))); } } + */ if(!isset($oldattributes[$attrdefid]) || $attribute != $oldattributes[$attrdefid]->getValue()) { if(!$document->setAttributeValue($dms->getAttributeDefinition($attrdefid), $attribute)) UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured")); diff --git a/op/op.EditEvent.php b/op/op.EditEvent.php index 772c75716..0a8b81c64 100644 --- a/op/op.EditEvent.php +++ b/op/op.EditEvent.php @@ -21,8 +21,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Calendar.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.EditFolder.php b/op/op.EditFolder.php index ef438246c..650caa6e9 100644 --- a/op/op.EditFolder.php +++ b/op/op.EditFolder.php @@ -20,11 +20,17 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); +include("../inc/inc.ClassController.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$controller = Controller::factory($tmp[1]); + if (!isset($_POST["folderid"]) || !is_numeric($_POST["folderid"]) || intval($_POST["folderid"])<1) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } @@ -57,141 +63,70 @@ if(isset($_POST["attributes"])) else $attributes = array(); -$wasupdated = false; -if(($oldname = $folder->getName()) != $name) { - if($folder->setName($name)) { - // Send notification to subscribers. - if($notifier) { - $notifyList = $folder->getNotifyList(); -/* - $subject = "###SITENAME###: ".$folder->getName()." - ".getMLText("folder_renamed_email"); - $message = getMLText("folder_renamed_email")."\r\n"; - $message .= - getMLText("old").": ".$oldname."\r\n". - getMLText("new").": ".$folder->getName()."\r\n". - getMLText("folder").": ".$folder->getFolderPathPlain()."\r\n". - getMLText("comment").": ".$comment."\r\n". - "URL: ###URL_PREFIX###out/out.ViewFolder.php?folderid=".$folder->getID()."\r\n"; - -// $subject=mydmsDecodeString($subject); -// $message=mydmsDecodeString($message); - - $notifier->toList($user, $folder->_notifyList["users"], $subject, $message); - foreach ($folder->_notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message); - } -*/ - - $subject = "folder_renamed_email_subject"; - $message = "folder_renamed_email_body"; - $params = array(); - $params['name'] = $folder->getName(); - $params['old_name'] = $oldname; - $params['folder_path'] = $folder->getFolderPathPlain(); - $params['username'] = $user->getFullName(); - $params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->getID(); - $params['sitename'] = $settings->_siteName; - $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $notifyList["users"], $subject, $message, $params); - foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); - } - // if user is not owner send notification to owner - if ($user->getID() != $folder->getOwner()->getID()) - $notifier->toIndividual($user, $folder->getOwner(), $subject, $message, $params); - } - } else { - UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("error_occured")); - } -} -if(($oldcomment = $folder->getComment()) != $comment) { - if($folder->setComment($comment)) { - // Send notification to subscribers. - if($notifier) { - $notifyList = $folder->getNotifyList(); -/* - $subject = "###SITENAME###: ".$folder->getName()." - ".getMLText("comment_changed_email"); - $message = getMLText("folder_comment_changed_email")."\r\n"; - $message .= - getMLText("name").": ".$folder->getName()."\r\n". - getMLText("folder").": ".$folder->getFolderPathPlain()."\r\n". - getMLText("comment").": ".$comment."\r\n". - "URL: ###URL_PREFIX###out/out.ViewFolder.php?folderid=".$folder->getID()."\r\n"; - -// $subject=mydmsDecodeString($subject); -// $message=mydmsDecodeString($message); - - $notifier->toList($user, $folder->_notifyList["users"], $subject, $message); - foreach ($folder->_notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message); - } -*/ - - $subject = "folder_comment_changed_email_subject"; - $message = "folder_comment_changed_email_body"; - $params = array(); - $params['name'] = $folder->getName(); - $params['folder_path'] = $folder->getFolderPathPlain(); - $params['old_comment'] = $oldcomment; - $params['comment'] = $comment; - $params['username'] = $user->getFullName(); - $params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->getID(); - $params['sitename'] = $settings->_siteName; - $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $notifyList["users"], $subject, $message, $params); - foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); - } - // if user is not owner send notification to owner - if ($user->getID() != $folder->getOwner()->getID()) - $notifier->toIndividual($user, $folder->getOwner(), $subject, $message, $params); - - } - } else { - UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("error_occured")); - } -} - +$oldname = $folder->getName(); +$oldcomment = $folder->getComment(); $oldattributes = $folder->getAttributes(); -if($attributes) { - foreach($attributes as $attrdefid=>$attribute) { - $attrdef = $dms->getAttributeDefinition($attrdefid); - if($attribute) { - if($attrdef->getRegex()) { - if(!preg_match($attrdef->getRegex(), $attribute)) { - UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("attr_no_regex_match")); - } - } - if(is_array($attribute)) { - if($attrdef->getMinValues() > count($attribute)) { - UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("attr_min_values", array("attrname"=>$attrdef->getName()))); - } - if($attrdef->getMaxValues() && $attrdef->getMaxValues() < count($attribute)) { - UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("attr_max_values", array("attrname"=>$attrdef->getName()))); - } - } - if(!isset($oldattributes[$attrdefid]) || $attribute != $oldattributes[$attrdefid]->getValue()) { - if(!$folder->setAttributeValue($dms->getAttributeDefinition($attrdefid), $attribute)) - UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("error_occured")); - } - } elseif(isset($oldattributes[$attrdefid])) { - if(!$folder->removeAttribute($dms->getAttributeDefinition($attrdefid))) - UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("error_occured")); - } + +$controller->setParam('folder', $folder); +$controller->setParam('name', $name); +$controller->setParam('comment', $comment); +$controller->setParam('sequence', $sequence); +$controller->setParam('attributes', $attributes); +if(!$controller->run()) { + if($controller->getErrorNo()) { + UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())), $controller->getErrorMsg()); } } -foreach($oldattributes as $attrdefid=>$oldattribute) { - if(!isset($attributes[$attrdefid])) { - if(!$folder->removeAttribute($dms->getAttributeDefinition($attrdefid))) - UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("error_occured")); - } - -} -if(strcasecmp($sequence, "keep")) { - if($folder->setSequence($sequence)) { - } else { - UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("error_occured")); +if($oldname != $name) { + // Send notification to subscribers. + if($notifier) { + $notifyList = $folder->getNotifyList(); + + $subject = "folder_renamed_email_subject"; + $message = "folder_renamed_email_body"; + $params = array(); + $params['name'] = $folder->getName(); + $params['old_name'] = $oldname; + $params['folder_path'] = $folder->getFolderPathPlain(); + $params['username'] = $user->getFullName(); + $params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->getID(); + $params['sitename'] = $settings->_siteName; + $params['http_root'] = $settings->_httpRoot; + $notifier->toList($user, $notifyList["users"], $subject, $message, $params); + foreach ($notifyList["groups"] as $grp) { + $notifier->toGroup($user, $grp, $subject, $message, $params); + } + // if user is not owner send notification to owner + if ($user->getID() != $folder->getOwner()->getID()) + $notifier->toIndividual($user, $folder->getOwner(), $subject, $message, $params); + } +} + +if($oldcomment != $comment) { + // Send notification to subscribers. + if($notifier) { + $notifyList = $folder->getNotifyList(); + + $subject = "folder_comment_changed_email_subject"; + $message = "folder_comment_changed_email_body"; + $params = array(); + $params['name'] = $folder->getName(); + $params['folder_path'] = $folder->getFolderPathPlain(); + $params['old_comment'] = $oldcomment; + $params['comment'] = $comment; + $params['username'] = $user->getFullName(); + $params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->getID(); + $params['sitename'] = $settings->_siteName; + $params['http_root'] = $settings->_httpRoot; + $notifier->toList($user, $notifyList["users"], $subject, $message, $params); + foreach ($notifyList["groups"] as $grp) { + $notifier->toGroup($user, $grp, $subject, $message, $params); + } + // if user is not owner send notification to owner + if ($user->getID() != $folder->getOwner()->getID()) + $notifier->toIndividual($user, $folder->getOwner(), $subject, $message, $params); + } } diff --git a/op/op.EditUserData.php b/op/op.EditUserData.php index b106ffaf7..0b4214380 100644 --- a/op/op.EditUserData.php +++ b/op/op.EditUserData.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); include("../inc/inc.ClassPasswordStrength.php"); diff --git a/op/op.ExtensionMgr.php b/op/op.ExtensionMgr.php new file mode 100644 index 000000000..24266d17d --- /dev/null +++ b/op/op.ExtensionMgr.php @@ -0,0 +1,43 @@ +isAdmin()) { + UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); +} + +/* Check if the form data comes for a trusted request */ +if(!checkFormKey('extensionmgr')) { + UI::exitError(getMLText("admin_tools"),getMLText("invalid_request_token")); +} + +$extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir); +$extconffile = $extMgr->getExtensionsConfFile(); +$extMgr->createExtensionConf(); + +add_log_line(); +header("Location:../out/out.ExtensionMgr.php"); +?> diff --git a/op/op.FolderAccess.php b/op/op.FolderAccess.php index d69a8e690..73a724338 100644 --- a/op/op.FolderAccess.php +++ b/op/op.FolderAccess.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.FolderNotify.php b/op/op.FolderNotify.php index bd5db4432..ac5bd0039 100644 --- a/op/op.FolderNotify.php +++ b/op/op.FolderNotify.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.GroupMgr.php b/op/op.GroupMgr.php index f8786a799..8eccb0f46 100644 --- a/op/op.GroupMgr.php +++ b/op/op.GroupMgr.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.GroupView.php b/op/op.GroupView.php index 996f9dc49..7f92e80f6 100644 --- a/op/op.GroupView.php +++ b/op/op.GroupView.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.LockDocument.php b/op/op.LockDocument.php index 3706b7bfe..d1711d5cf 100644 --- a/op/op.LockDocument.php +++ b/op/op.LockDocument.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.Login.php b/op/op.Login.php index 1c64d3e5b..2e0df1a1f 100644 --- a/op/op.Login.php +++ b/op/op.Login.php @@ -21,9 +21,12 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); include("../inc/inc.ClassSession.php"); include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); +include("../inc/inc.ClassController.php"); include $settings->_rootDir . "languages/" . $settings->_language . "/lang.inc"; @@ -35,6 +38,9 @@ function _printMessage($heading, $message) { return; } +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$controller = Controller::factory($tmp[1]); + if (isset($_REQUEST["sesstheme"]) && strlen($_REQUEST["sesstheme"])>0 && is_numeric(array_search($_REQUEST["sesstheme"],UI::getStyles())) ) { $theme = $_REQUEST["sesstheme"]; } @@ -65,17 +71,24 @@ if($settings->_enableGuestLogin && (int) $settings->_guestID) { } } -$user = false; - -// -// LDAP Sign In -// - /* Initialy set $user to false. It will contain a valid user record * if authentication against ldap succeeds. * _ldapHost will only have a value if the ldap connector has been enabled */ -if (!$user && isset($settings->_ldapHost) && strlen($settings->_ldapHost)>0) { +$user = false; + +if(isset($GLOBALS['SEEDDMS_HOOKS']['authentication'])) { + foreach($GLOBALS['SEEDDMS_HOOKS']['authentication'] as $authObj) { + if(method_exists($authObj, 'authenticate')) { + $user = $authObj->authenticate($dms, $settings, $login, $pwd); + if(is_object($user)) + $userid = $user->getID(); + } + } +} + +if (is_bool($user)) { +if (isset($settings->_ldapHost) && strlen($settings->_ldapHost)>0) { if (isset($settings->_ldapPort) && is_int($settings->_ldapPort)) { $ds = ldap_connect($settings->_ldapHost, $settings->_ldapPort); } else { @@ -146,26 +159,42 @@ if (!$user && isset($settings->_ldapHost) && strlen($settings->_ldapHost)>0) { $user = $dms->getUserByLogin($login); if (is_bool($user) && !$settings->_restricted) { // Retrieve the user's LDAP information. - if (isset($settings->_ldapFilter) && strlen($settings->_ldapFilter) > 0) { - $search = ldap_search($ds, $settings->_ldapBaseDN, "(&(".$ldapSearchAttribut.$login.")".$settings->_ldapFilter.")"); - } else { - $search = ldap_search($ds, $settings->_ldapBaseDN, $ldapSearchAttribut.$login); - } - - if (!is_bool($search)) { - $info = ldap_get_entries($ds, $search); - if (!is_bool($info) && $info["count"]==1 && $info[0]["count"]>0) { - $user = $dms->addUser($login, null, $info[0]['cn'][0], $info[0]['mail'][0], $settings->_language, $settings->_theme, ""); - } + if (isset($settings->_ldapFilter) && strlen($settings->_ldapFilter) > 0) { + $search = ldap_search($ds, $settings->_ldapBaseDN, "(&(".$ldapSearchAttribut.$login.")".$settings->_ldapFilter.")"); + } else { + $search = ldap_search($ds, $settings->_ldapBaseDN, $ldapSearchAttribut . $login); } } - if (!is_bool($user)) { - $userid = $user->getID(); + $bind = @ldap_bind($ds, $dn, $pwd); + if ($bind) { + // Successfully authenticated. Now check to see if the user exists within + // the database. If not, add them in, but do not add their password. + $user = $dms->getUserByLogin($login); + if (is_bool($user) && !$settings->_restricted) { + // Retrieve the user's LDAP information. + + + /* new code by doudoux - TO BE TESTED */ + $search = ldap_search($ds, $settings->_ldapBaseDN, $ldapSearchAttribut . $login); + /* old code */ + //$search = ldap_search($ds, $dn, "uid=".$login); + + if (!is_bool($search)) { + $info = ldap_get_entries($ds, $search); + if (!is_bool($info) && $info["count"]==1 && $info[0]["count"]>0) { + $user = $dms->addUser($login, null, $info[0]['cn'][0], $info[0]['mail'][0], $settings->_language, $settings->_theme, ""); + } + } + } + if (!is_bool($user)) { + $userid = $user->getID(); + } } + ldap_close($ds); } - ldap_close($ds); } } +} if (is_bool($user)) { // @@ -300,13 +329,17 @@ else if (isset($_GET["referuri"]) && strlen($_GET["referuri"])>0) { $referuri = trim(urldecode($_GET["referuri"])); } +$controller->setParam('user', $user); +$controller->setParam('session', $session); +$controller->run(); + add_log_line(); if (isset($referuri) && strlen($referuri)>0) { header("Location: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'] . $referuri); } else { - header("Location: ".$settings->_httpRoot.(isset($settings->_siteDefaultPage) && strlen($settings->_siteDefaultPage)>0 ? $settings->_siteDefaultPage : "out/out.ViewFolder.php?folderid=".$settings->_rootFolderID)); + header("Location: ".$settings->_httpRoot.(isset($settings->_siteDefaultPage) && strlen($settings->_siteDefaultPage)>0 ? $settings->_siteDefaultPage : "out/out.ViewFolder.php?folderid=".($user->getHomeFolder() ? $user->getHomeFolder() : $settings->_rootFolderID))); } //_printMessage(getMLText("login_ok"), diff --git a/op/op.Logout.php b/op/op.Logout.php index 613551828..45ad43612 100644 --- a/op/op.Logout.php +++ b/op/op.Logout.php @@ -20,29 +20,41 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); include("../inc/inc.ClassSession.php"); +include("../inc/inc.ClassController.php"); include("../inc/inc.DBInit.php"); +include("../inc/inc.Authentication.php"); + +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$controller = Controller::factory($tmp[1]); // Delete session from database +if(isset($_COOKIE['mydms_session'])) { + $dms_session = $_COOKIE["mydms_session"]; -$dms_session = $_COOKIE["mydms_session"]; + $session = new SeedDMS_Session($db); + $session->load($dms_session); -$session = new SeedDMS_Session($db); -$session->load($dms_session); + // If setting the user id to 0 worked, it would be a way to logout a + // user. It doesn't work because of a foreign constraint in the database + // won't allow it. So we keep on deleting the session and the cookie on + // logout + // $session->setUser(0); does not work because of foreign user constraint -// If setting the user id to 0 worked, it would be a way to logout a -// user. It doesn't work because of a foreign constraint in the database -// won't allow it. So we keep on deleting the session and the cookie on -// logout -// $session->setUser(0); does not work because of foreign user constraint + if(!$session->delete($dms_session)) { + UI::exitError(getMLText("logout"),$db->getErrorMsg()); + } -if(!$session->delete($dms_session)) { - UI::exitError(getMLText("logout"),$db->getErrorMsg()); + // Delete Cookie + setcookie("mydms_session", $dms_session, time()-3600, $settings->_httpRoot); + + $controller->setParam('user', $user); + $controller->setParam('session', $session); + $controller->run(); } -// Delete Cookie -setcookie("mydms_session", $_COOKIE["mydms_session"], time()-3600, $settings->_httpRoot); - //Forward to Login-page header("Location: ../out/out.Login.php"); ?> diff --git a/op/op.ManageNotify.php b/op/op.ManageNotify.php index d4efec291..7880f0f8d 100644 --- a/op/op.ManageNotify.php +++ b/op/op.ManageNotify.php @@ -17,8 +17,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); include("../inc/inc.Language.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.MoveClipboard.php b/op/op.MoveClipboard.php index ec7acfc0f..ae36cfc17 100644 --- a/op/op.MoveClipboard.php +++ b/op/op.MoveClipboard.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.MoveDocument.php b/op/op.MoveDocument.php index b9e94f5ac..5b2ce74aa 100644 --- a/op/op.MoveDocument.php +++ b/op/op.MoveDocument.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.MoveFolder.php b/op/op.MoveFolder.php index abdcdd19b..23a08f18b 100644 --- a/op/op.MoveFolder.php +++ b/op/op.MoveFolder.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.OverrideContentStatus.php b/op/op.OverrideContentStatus.php index d6e51cc2b..6aa0a58bf 100644 --- a/op/op.OverrideContentStatus.php +++ b/op/op.OverrideContentStatus.php @@ -20,9 +20,11 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); -include("../inc/inc.Utils.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.Utils.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.PasswordForgotten.php b/op/op.PasswordForgotten.php index 63eca6ab6..45bc1aa1a 100644 --- a/op/op.PasswordForgotten.php +++ b/op/op.PasswordForgotten.php @@ -22,8 +22,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); include("../inc/inc.Language.php"); -include("../inc/inc.ClassSession.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); include("../inc/inc.DBInit.php"); +include("../inc/inc.ClassSession.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassEmailUtils.php"); @@ -53,11 +55,14 @@ if (empty($email) || empty($login)) { $user = $dms->getUserByLogin($login, $email); if($user) { if($hash = $dms->createPasswordRequest($user)) { - $emailobj = new SeedDMS_EmailUtils(); - $subject = "###SITENAME###: ".getMLText("password_forgotten_email_subject"); - $message = str_replace('###HASH###', $hash, getMLText("password_forgotten_email_body")); - - $emailobj->sendPassword($settings->_smtpSendFrom, $user, $subject, $message); + $emailobj = new SeedDMS_EmailUtils($settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword); + $subject = "password_forgotten_email_subject"; + $message = "password_forgotten_email_body"; + $params = array(); + $params['sitename'] = $settings->_siteName; + $params['hash'] = $hash; + $params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ChangePassword.php?hash=".$hash; + $emailobj->sendPassword($settings->_smtpSendFrom, $user, $subject, $message, $params); } } diff --git a/op/op.Preview.php b/op/op.Preview.php index d4428cfaa..8eacdc31a 100644 --- a/op/op.Preview.php +++ b/op/op.Preview.php @@ -22,8 +22,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.RemoveArchive.php b/op/op.RemoveArchive.php index ff5ca117f..2b688943a 100644 --- a/op/op.RemoveArchive.php +++ b/op/op.RemoveArchive.php @@ -18,8 +18,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.RemoveDocument.php b/op/op.RemoveDocument.php index eb6897322..1a54692e4 100644 --- a/op/op.RemoveDocument.php +++ b/op/op.RemoveDocument.php @@ -19,11 +19,17 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); +include("../inc/inc.ClassController.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$controller = Controller::factory($tmp[1]); + /* Check if the form data comes for a trusted request */ if(!checkFormKey('removedocument')) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_request_token"))),getMLText("invalid_request_token")); @@ -50,6 +56,12 @@ if($document->isLocked()) { } } +if($settings->_enableFullSearch) { + $index = $indexconf['Indexer']::open($settings->_luceneDir); +} else { + $index = null; +} + $folder = $document->getFolder(); /* Get the notify list before removing the document */ @@ -60,40 +72,31 @@ $nl = array( 'groups'=>array_merge($dnl['groups'], $fnl['groups']) ); $docname = $document->getName(); -if (!$document->remove()) { + +$controller->setParam('document', $document); +$controller->setParam('index', $index); +$controller->setParam('indexconf', $indexconf); +if(!$controller->run()) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("error_occured")); -} else { - - /* Remove the document from the fulltext index */ - if($settings->_enableFullSearch) { - $index = $indexconf['Indexer']::open($settings->_luceneDir); - if($index) { - $lucenesearch = new $indexconf['Search']($index); - if($hit = $lucenesearch->getDocument($documentid)) { - $index->delete($hit->id); - $index->commit(); - } - } - } - - if ($notifier){ - $subject = "document_deleted_email_subject"; - $message = "document_deleted_email_body"; - $params = array(); - $params['name'] = $docname; - $params['folder_path'] = $folder->getFolderPathPlain(); - $params['username'] = $user->getFullName(); - $params['sitename'] = $settings->_siteName; - $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $nl["users"], $subject, $message, $params); - foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); - } - } - - $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_rm_document'))); } +if ($notifier){ + $subject = "document_deleted_email_subject"; + $message = "document_deleted_email_body"; + $params = array(); + $params['name'] = $docname; + $params['folder_path'] = $folder->getFolderPathPlain(); + $params['username'] = $user->getFullName(); + $params['sitename'] = $settings->_siteName; + $params['http_root'] = $settings->_httpRoot; + $notifier->toList($user, $nl["users"], $subject, $message, $params); + foreach ($nl["groups"] as $grp) { + $notifier->toGroup($user, $grp, $subject, $message, $params); + } +} + +$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_rm_document'))); + add_log_line("?documentid=".$documentid); header("Location:../out/out.ViewFolder.php?folderid=".$folder->getID()); diff --git a/op/op.RemoveDocumentFile.php b/op/op.RemoveDocumentFile.php index 4c9c988ea..e59e32d80 100644 --- a/op/op.RemoveDocumentFile.php +++ b/op/op.RemoveDocumentFile.php @@ -18,8 +18,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.RemoveDocumentLink.php b/op/op.RemoveDocumentLink.php index 3c6df96d1..ae0d6d355 100644 --- a/op/op.RemoveDocumentLink.php +++ b/op/op.RemoveDocumentLink.php @@ -18,8 +18,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.RemoveDump.php b/op/op.RemoveDump.php index 5c1f35097..af99707dd 100644 --- a/op/op.RemoveDump.php +++ b/op/op.RemoveDump.php @@ -1,46 +1,48 @@ -isAdmin()) { - UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); + UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); } - + /* Check if the form data comes for a trusted request */ if(!checkFormKey('removedump')) { UI::exitError(getMLText("admin_tools"),getMLText("invalid_request_token")); } -if (!isset($_POST["dumpname"]) || !file_exists($settings->_contentDir.$_POST["dumpname"]) ) { - UI::exitError(getMLText("admin_tools"),getMLText("unknown_id")); +if (!isset($_POST["dumpname"]) || !file_exists($settings->_contentDir.$_POST["dumpname"]) ) { + UI::exitError(getMLText("admin_tools"),getMLText("unknown_id")); } - -if (!SeedDMS_Core_File::removeFile($settings->_contentDir.$_POST["dumpname"])) { - UI::exitError(getMLText("admin_tools"),getMLText("error_occured")); + +if (!SeedDMS_Core_File::removeFile($settings->_contentDir.$_POST["dumpname"])) { + UI::exitError(getMLText("admin_tools"),getMLText("error_occured")); } - -add_log_line("?dumpname=".$_POST["dumpname"]); + +add_log_line("?dumpname=".$_POST["dumpname"]); header("Location:../out/out.BackupTools.php"); - -?> + +?> diff --git a/op/op.RemoveEvent.php b/op/op.RemoveEvent.php index 9f4a4ab35..77d635260 100644 --- a/op/op.RemoveEvent.php +++ b/op/op.RemoveEvent.php @@ -1,39 +1,41 @@ -getID()!=$event["userID"])&&(!$user->isAdmin())){ } $res = delEvent($_POST["eventid"]); - + if (is_bool($res) && !$res) { UI::exitError(getMLText("edit_event"),getMLText("error_occured")); } -add_log_line("?id=".$_POST["eventid"]); +add_log_line("?id=".$_POST["eventid"]); $dt=getdate($event["start"]); - -header("Location:../out/out.Calendar.php?mode=w&day=".$dt["mday"]."&year=".$dt["year"]."&month=".$dt["mon"]); - -?> + +header("Location:../out/out.Calendar.php?mode=w&day=".$dt["mday"]."&year=".$dt["year"]."&month=".$dt["mon"]); + +?> diff --git a/op/op.RemoveFolder.php b/op/op.RemoveFolder.php index a0f375c09..e2e6fef1f 100644 --- a/op/op.RemoveFolder.php +++ b/op/op.RemoveFolder.php @@ -19,11 +19,17 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); +include("../inc/inc.ClassController.php"); include("../inc/inc.Authentication.php"); +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$controller = Controller::factory($tmp[1]); + /* Check if the form data comes for a trusted request */ if(!checkFormKey('removefolder')) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_request_token"))),getMLText("invalid_request_token")); @@ -47,62 +53,38 @@ if ($folder->getAccessMode($user) < M_ALL) { UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied")); } -$parent=$folder->getParent(); - -/* Register a callback which removes each document from the fulltext index - * The callback must return true other the removal will be canceled. - */ if($settings->_enableFullSearch) { - function removeFromIndex($arr, $document) { - $index = $arr[0]; - $indexconf = $arr[1]; - $lucenesearch = new $indexconf['Search']($index); - if($hit = $lucenesearch->getDocument($document->getID())) { - $index->delete($hit->id); - $index->commit(); - } - return true; - } $index = $indexconf['Indexer']::open($settings->_luceneDir); - if($index) - $dms->setCallback('onPreRemoveDocument', 'removeFromIndex', array($index, $indexconf)); +} else { + $index = null; } +/* save this for notification later on */ $nl = $folder->getNotifyList(); +$parent=$folder->getParent(); $foldername = $folder->getName(); -if ($folder->remove()) { - // Send notification to subscribers. - if ($notifier) { -/* - $subject = "###SITENAME###: ".$folder->getName()." - ".getMLText("folder_deleted_email"); - $message = getMLText("folder_deleted_email")."\r\n"; - $message .= - getMLText("name").": ".$folder->getName()."\r\n". - getMLText("folder").": ".$folder->getFolderPathPlain()."\r\n". - getMLText("comment").": ".$folder->getComment()."\r\n". - "URL: ###URL_PREFIX###out/out.ViewFolder.php?folderid=".$folder->getID()."\r\n"; - $notifier->toList($user, $folder->_notifyList["users"], $subject, $message); - foreach ($folder->_notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message); - } -*/ - $subject = "folder_deleted_email_subject"; - $message = "folder_deleted_email_body"; - $params = array(); - $params['name'] = $foldername; - $params['folder_path'] = $parent->getFolderPathPlain(); - $params['username'] = $user->getFullName(); - $params['sitename'] = $settings->_siteName; - $params['http_root'] = $settings->_httpRoot; - $params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$parent->getID(); - $notifier->toList($user, $nl["users"], $subject, $message, $params); - foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); - } +$controller->setParam('folder', $folder); +$controller->setParam('index', $index); +$controller->setParam('indexconf', $indexconf); +if(!$controller->run()) { + UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); +} + +if ($notifier) { + $subject = "folder_deleted_email_subject"; + $message = "folder_deleted_email_body"; + $params = array(); + $params['name'] = $foldername; + $params['folder_path'] = $parent->getFolderPathPlain(); + $params['username'] = $user->getFullName(); + $params['sitename'] = $settings->_siteName; + $params['http_root'] = $settings->_httpRoot; + $params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$parent->getID(); + $notifier->toList($user, $nl["users"], $subject, $message, $params); + foreach ($nl["groups"] as $grp) { + $notifier->toGroup($user, $grp, $subject, $message, $params); } -} else { - UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("error_occured")); } add_log_line("?folderid=".$folderid."&name=".$foldername); diff --git a/op/op.RemoveFolderFiles.php b/op/op.RemoveFolderFiles.php index 2d3c6d982..e6f99272b 100644 --- a/op/op.RemoveFolderFiles.php +++ b/op/op.RemoveFolderFiles.php @@ -18,8 +18,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.RemoveFromClipboard.php b/op/op.RemoveFromClipboard.php index 7065be794..fafde7b27 100644 --- a/op/op.RemoveFromClipboard.php +++ b/op/op.RemoveFromClipboard.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.RemoveLog.php b/op/op.RemoveLog.php index be8701fa7..a12238010 100644 --- a/op/op.RemoveLog.php +++ b/op/op.RemoveLog.php @@ -18,8 +18,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.RemoveTransitionFromWorkflow.php b/op/op.RemoveTransitionFromWorkflow.php index cdadd7f98..207900a22 100644 --- a/op/op.RemoveTransitionFromWorkflow.php +++ b/op/op.RemoveTransitionFromWorkflow.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.RemoveVersion.php b/op/op.RemoveVersion.php index f297ac074..1af1a1355 100644 --- a/op/op.RemoveVersion.php +++ b/op/op.RemoveVersion.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.RemoveWorkflow.php b/op/op.RemoveWorkflow.php index 23643eaf9..f1abeff15 100644 --- a/op/op.RemoveWorkflow.php +++ b/op/op.RemoveWorkflow.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.RemoveWorkflowAction.php b/op/op.RemoveWorkflowAction.php index 37323e7f1..a6e4c5e4e 100644 --- a/op/op.RemoveWorkflowAction.php +++ b/op/op.RemoveWorkflowAction.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.RemoveWorkflowFromDocument.php b/op/op.RemoveWorkflowFromDocument.php index c3e211b92..6e63ee2e0 100644 --- a/op/op.RemoveWorkflowFromDocument.php +++ b/op/op.RemoveWorkflowFromDocument.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.RemoveWorkflowState.php b/op/op.RemoveWorkflowState.php index 540a31127..4d27072a9 100644 --- a/op/op.RemoveWorkflowState.php +++ b/op/op.RemoveWorkflowState.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.ResetSu.php b/op/op.ResetSu.php index 3bf52b82d..b3b8b877e 100644 --- a/op/op.ResetSu.php +++ b/op/op.ResetSu.php @@ -18,8 +18,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.ReturnFromSubWorkflow.php b/op/op.ReturnFromSubWorkflow.php index 50834fa02..4402415ff 100644 --- a/op/op.ReturnFromSubWorkflow.php +++ b/op/op.ReturnFromSubWorkflow.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.ReviewDocument.php b/op/op.ReviewDocument.php index fe3ea55af..7c26fddb3 100644 --- a/op/op.ReviewDocument.php +++ b/op/op.ReviewDocument.php @@ -19,12 +19,15 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); +include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); -include("../inc/inc.ClassUI.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); +include("../inc/inc.ClassUI.php"); /* Check if the form data comes for a trusted request */ if(!checkFormKey('reviewdocument')) { @@ -64,7 +67,7 @@ if ($latestContent->getVersion()!=$version) { } /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); // verify if document may be reviewed if (!$accessop->mayReview()){ diff --git a/op/op.RewindWorkflow.php b/op/op.RewindWorkflow.php index dd25610ce..d6530e473 100644 --- a/op/op.RewindWorkflow.php +++ b/op/op.RewindWorkflow.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.RunSubWorkflow.php b/op/op.RunSubWorkflow.php index 9070e43c4..0675246e5 100644 --- a/op/op.RunSubWorkflow.php +++ b/op/op.RunSubWorkflow.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.SearchFulltext.php b/op/op.SearchFulltext.php index 6349d7f5e..012cdbfea 100644 --- a/op/op.SearchFulltext.php +++ b/op/op.SearchFulltext.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.SetExpires.php b/op/op.SetExpires.php index e1caa967b..03a51ae0e 100644 --- a/op/op.SetExpires.php +++ b/op/op.SetExpires.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.SetLanguage.php b/op/op.SetLanguage.php index a0a283ca3..3424313b7 100644 --- a/op/op.SetLanguage.php +++ b/op/op.SetLanguage.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.SetReviewersApprovers.php b/op/op.SetReviewersApprovers.php index 4e69ca64d..6d2e31098 100644 --- a/op/op.SetReviewersApprovers.php +++ b/op/op.SetReviewersApprovers.php @@ -20,9 +20,11 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Utils.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); @@ -111,9 +113,6 @@ foreach ($pIndRev as $p) { // Proposed reviewer is not a current reviewer, so add as a new // reviewer. $res = $content->addIndReviewer($docAccess["users"][$accessIndex["i"][$p]], $user); - $unm = $docAccess["users"][$accessIndex["i"][$p]]->getFullName(); - $uml = $docAccess["users"][$accessIndex["i"][$p]]->getEmail(); - switch ($res) { case 0: // Send an email notification to the new reviewer. @@ -158,6 +157,12 @@ foreach ($pIndRev as $p) { } } } + +/* $reviewIndex['i'] has now those individual reviewers which are left over + * and must be removed. There are two cases to distinguish: 1. The user may + * access the document but shall no longer review the document, 2. the user + * many not access the document any more. + */ if (count($reviewIndex["i"]) > 0) { foreach ($reviewIndex["i"] as $rx=>$rv) { if ($rv["status"] == 0) { @@ -165,14 +170,15 @@ if (count($reviewIndex["i"]) > 0) { if (!isset($docAccess["users"][$accessIndex["i"][$rx]])) { // User does not have any review privileges for this document // revision or does not exist. + /* $queryStr = "INSERT INTO `tblDocumentReviewLog` (`reviewID`, `status`, `comment`, `date`, `userID`) ". "VALUES ('". $reviewStatus[$rv["idx"]]["reviewID"] ."', '-2', '".getMLText("removed_reviewer")."', NOW(), '". $user->getID() ."')"; $res = $db->getResult($queryStr); + */ + $res = $content->delIndReviewer($dms->getUser($reviewStatus[$rv["idx"]]["required"]), $user, getMLText("removed_reviewer")); } else { $res = $content->delIndReviewer($docAccess["users"][$accessIndex["i"][$rx]], $user); - $unm = $docAccess["users"][$accessIndex["i"][$rx]]->getFullName(); - $uml = $docAccess["users"][$accessIndex["i"][$rx]]->getEmail(); switch ($res) { case 0: // Send an email notification to the reviewer. @@ -219,7 +225,6 @@ foreach ($pGrpRev as $p) { // Proposed reviewer is not a current reviewer, so add as a new // reviewer. $res = $content->addGrpReviewer($docAccess["groups"][$accessIndex["g"][$p]], $user); - $gnm = $docAccess["groups"][$accessIndex["g"][$p]]->getName(); switch ($res) { case 0: // Send an email notification to the new reviewer. @@ -269,13 +274,15 @@ if (count($reviewIndex["g"]) > 0) { if (!isset($docAccess["groups"][$accessIndex["g"][$rx]])) { // Group does not have any review privileges for this document // revision or does not exist. + /* $queryStr = "INSERT INTO `tblDocumentReviewLog` (`reviewID`, `status`, `comment`, `date`, `userID`) ". "VALUES ('". $reviewStatus[$rv["idx"]]["reviewID"] ."', '-2', '".getMLText("removed_reviewer")."', NOW(), '". $user->getID() ."')"; $res = $db->getResult($queryStr); + */ + $res = $content->delGrpReviewer($dms->getGroup($reviewStatus[$rv["idx"]]["required"]), $user, getMLText("removed_reviewer")); } else { $res = $content->delGrpReviewer($docAccess["groups"][$accessIndex["g"][$rx]], $user); - $gnm = $docAccess["groups"][$accessIndex["g"][$rx]]->getName(); switch ($res) { case 0: // Send an email notification to the review group. @@ -326,8 +333,6 @@ foreach ($pIndApp as $p) { // Proposed approver is not a current approver, so add as a new // approver. $res = $content->addIndApprover($docAccess["users"][$accessIndex["i"][$p]], $user); - $unm = $docAccess["users"][$accessIndex["i"][$p]]->getFullName(); - $uml = $docAccess["users"][$accessIndex["i"][$p]]->getEmail(); switch ($res) { case 0: // Send an email notification to the new approver. @@ -377,14 +382,15 @@ if (count($approvalIndex["i"]) > 0) { if (!isset($docAccess["users"][$accessIndex["i"][$rx]])) { // User does not have any approval privileges for this document // revision or does not exist. + /* $queryStr = "INSERT INTO `tblDocumentApproveLog` (`approveID`, `status`, `comment`, `date`, `userID`) ". "VALUES ('". $approvalStatus[$rv["idx"]]["approveID"] ."', '-2', '".getMLText("removed_approver")."', NOW(), '". $user->getID() ."')"; $res = $db->getResult($queryStr); + */ + $res = $content->delIndApprover($dms->getUser($approvalStatus[$rv["idx"]]["required"]), $user, getMLText("removed_approver")); } else { $res = $content->delIndApprover($docAccess["users"][$accessIndex["i"][$rx]], $user); - $unm = $docAccess["users"][$accessIndex["i"][$rx]]->getFullName(); - $uml = $docAccess["users"][$accessIndex["i"][$rx]]->getEmail(); switch ($res) { case 0: // Send an email notification to the approver. @@ -431,7 +437,6 @@ foreach ($pGrpApp as $p) { // Proposed approver is not a current approver, so add as a new // approver. $res = $content->addGrpApprover($docAccess["groups"][$accessIndex["g"][$p]], $user); - $gnm = $docAccess["groups"][$accessIndex["g"][$p]]->getName(); switch ($res) { case 0: // Send an email notification to the new approver. @@ -481,14 +486,15 @@ if (count($approvalIndex["g"]) > 0) { if (!isset($docAccess["groups"][$accessIndex["g"][$rx]])) { // Group does not have any approval privileges for this document // revision or does not exist. - + /* $queryStr = "INSERT INTO `tblDocumentApproveLog` (`approveID`, `status`, `comment`, `date`, `userID`) ". "VALUES ('". $approvalStatus[$rv["idx"]]["approveID"] ."', '-2', '".getMLText("removed_approver")."', NOW(), '". $user->getID() ."')"; $res = $db->getResult($queryStr); +*/ + $res = $content->delGrpApprover($dms->getGroup($approvalStatus[$rv["idx"]]["required"]), $user, getMLText("removed_approver")); } else { $res = $content->delGrpApprover($docAccess["groups"][$accessIndex["g"][$rx]], $user); - $gnm = $docAccess["groups"][$accessIndex["g"][$rx]]->getName(); switch ($res) { case 0: // Send an email notification to the approval group. diff --git a/op/op.SetWorkflow.php b/op/op.SetWorkflow.php index 3b7cf03b9..cf7e686b0 100644 --- a/op/op.SetWorkflow.php +++ b/op/op.SetWorkflow.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.Settings.php b/op/op.Settings.php index 920bd6740..c2c16d7f4 100644 --- a/op/op.Settings.php +++ b/op/op.Settings.php @@ -21,8 +21,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); @@ -110,6 +112,7 @@ if ($action == "saveSettings") $settings->_passwordExpiration = intval($_POST["passwordExpiration"]); $settings->_passwordHistory = intval($_POST["passwordHistory"]); $settings->_loginFailure = intval($_POST["loginFailure"]); + $settings->_autoLoginUser = intval($_POST["autoLoginUser"]); $settings->_quota = intval($_POST["quota"]); $settings->_undelUserIds = strval($_POST["undelUserIds"]); $settings->_encryptionKey = strval($_POST["encryptionKey"]); @@ -128,6 +131,8 @@ if ($action == "saveSettings") $settings->_smtpServer = $_POST["smtpServer"]; $settings->_smtpPort = $_POST["smtpPort"]; $settings->_smtpSendFrom = $_POST["smtpSendFrom"]; + $settings->_smtpUser = $_POST["smtpUser"]; + $settings->_smtpPassword = $_POST["smtpPassword"]; // SETTINGS -ADVANCED - DISPLAY $settings->_siteDefaultPage = $_POST["siteDefaultPage"]; @@ -168,6 +173,9 @@ if ($action == "saveSettings") // SETTINGS - ADVANCED - INDEX CMD $settings->_converters['fulltext'] = $_POST["converters"]; + // SETTINGS - EXTENSIONS + $settings->_extensions = isset($_POST["extensions"]) ? $_POST["extensions"] : array(); + // ------------------------------------------------------------------------- // save // ------------------------------------------------------------------------- diff --git a/op/op.SubstituteUser.php b/op/op.SubstituteUser.php index 7e3b16b87..9e366de98 100644 --- a/op/op.SubstituteUser.php +++ b/op/op.SubstituteUser.php @@ -18,24 +18,40 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); -if (!$user->isAdmin()) { - UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); +/* Check if the form data comes for a trusted request */ +if(!checkFormKey('substituteuser', 'GET')) { + UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_request_token"))),getMLText("invalid_request_token")); } if (!isset($_GET["userid"])) { UI::exitError(getMLText("admin_tools"),getMLText("unknown_id")); } +/* Check if user is allowed to switch to a different user */ +if (!$user->isAdmin()) { + UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); +} + $session->setSu($_GET['userid']); $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_substituted_user'))); add_log_line("?userid=".$_GET["userid"]); -header("Location: ../".(isset($settings->_siteDefaultPage) && strlen($settings->_siteDefaultPage)>0 ? $settings->_siteDefaultPage : "out/out.ViewFolder.php?folderid=".$settings->_rootFolderID)); + +$newuser = $dms->getUser($_GET["userid"]); + +if (isset($referuri) && strlen($referuri)>0) { + header("Location: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'] . $referuri); +} +else { + header("Location: ".$settings->_httpRoot.(isset($settings->_siteDefaultPage) && strlen($settings->_siteDefaultPage)>0 ? $settings->_siteDefaultPage : "out/out.ViewFolder.php?folderid=".($newuser->getHomeFolder() ? $newuser->getHomeFolder() : $settings->_rootFolderID))); +} ?> diff --git a/op/op.TriggerWorkflow.php b/op/op.TriggerWorkflow.php index 4f1f3f981..8582f5ae5 100644 --- a/op/op.TriggerWorkflow.php +++ b/op/op.TriggerWorkflow.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.UnlockDocument.php b/op/op.UnlockDocument.php index 1bef8054b..8b821f378 100644 --- a/op/op.UnlockDocument.php +++ b/op/op.UnlockDocument.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.UpdateDocument.php b/op/op.UpdateDocument.php index 5ce4dba94..7f8598563 100644 --- a/op/op.UpdateDocument.php +++ b/op/op.UpdateDocument.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.UpdateDocument2.php b/op/op.UpdateDocument2.php index 38504df4c..df5c3addf 100644 --- a/op/op.UpdateDocument2.php +++ b/op/op.UpdateDocument2.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.UserDefaultKeywords.php b/op/op.UserDefaultKeywords.php index 3fcf6994a..2bb860b5e 100644 --- a/op/op.UserDefaultKeywords.php +++ b/op/op.UserDefaultKeywords.php @@ -18,8 +18,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/op/op.UsrMgr.php b/op/op.UsrMgr.php index 63ed65b01..6494ae454 100644 --- a/op/op.UsrMgr.php +++ b/op/op.UsrMgr.php @@ -22,8 +22,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); include("../inc/inc.ClassPasswordStrength.php"); @@ -59,12 +61,14 @@ if ($action == "adduser") { $role = preg_replace('/[^0-2]+/', '', $_POST["role"]); $isHidden = (isset($_POST["ishidden"]) && $_POST["ishidden"]==1 ? 1 : 0); $isDisabled = (isset($_POST["isdisabled"]) && $_POST["isdisabled"]==1 ? 1 : 0); + $homefolder = (isset($_POST["homefolder"]) ? $_POST["homefolder"] : 0); + $quota = (isset($_POST["quota"]) ? (int) $_POST["quota"] : 0); if (is_object($dms->getUserByLogin($login))) { UI::exitError(getMLText("admin_tools"),getMLText("user_exists")); } - $newUser = $dms->addUser($login, md5($pwd), $name, $email, $settings->_language, $settings->_theme, $comment, $role, $isHidden, $isDisabled, $pwdexpiration); + $newUser = $dms->addUser($login, md5($pwd), $name, $email, $settings->_language, $settings->_theme, $comment, $role, $isHidden, $isDisabled, $pwdexpiration, $homefolder); if ($newUser) { /* Set Quota */ @@ -205,6 +209,8 @@ else if ($action == "edituser") { $role = preg_replace('/[^0-2]+/', '', $_POST["role"]); $isHidden = (isset($_POST["ishidden"]) && $_POST["ishidden"]==1 ? 1 : 0); $isDisabled = (isset($_POST["isdisabled"]) && $_POST["isdisabled"]==1 ? 1 : 0); + $homefolder = (isset($_POST["homefolder"]) ? $_POST["homefolder"] : 0); + $quota = (isset($_POST["quota"]) ? (int) $_POST["quota"] : 0); if ($editedUser->getLogin() != $login) $editedUser->setLogin($login); @@ -245,6 +251,10 @@ else if ($action == "edituser") { if(!$isDisabled) $editedUser->clearLoginFailures(); } + if ($editedUser->getHomeFolder() != $homefolder) + $editedUser->setHomeFolder($homefolder); + if ($editedUser->getQuota() != $quota) + $editedUser->setQuota($quota); if(isset($_POST["workflow"]) && $_POST["workflow"]) { $currworkflow = $editedUser->getMandatoryWorkflow(); if (!$currworkflow || ($currworkflow->getID() != $_POST["workflow"])) { diff --git a/op/op.ViewOnline.php b/op/op.ViewOnline.php index e772bcd46..f0cae78af 100644 --- a/op/op.ViewOnline.php +++ b/op/op.ViewOnline.php @@ -20,13 +20,18 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); +include("../inc/inc.ClassController.php"); include("../inc/inc.Authentication.php"); -$documentid = $_GET["documentid"]; +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$controller = Controller::factory($tmp[1]); +$documentid = $_GET["documentid"]; if (!isset($documentid) || !is_numeric($documentid) || intval($documentid)<1) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } @@ -57,16 +62,9 @@ if(isset($_GET["version"])) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version")); } - if (isset($settings->_viewOnlineFileTypes) && is_array($settings->_viewOnlineFileTypes) && in_array(strtolower($content->getFileType()), $settings->_viewOnlineFileTypes)) { - header("Content-Type: " . $content->getMimeType()); - } - header("Content-Disposition: filename=\"" . $document->getName().$content->getFileType()) . "\""; - header("Content-Length: " . filesize($dms->contentDir . $content->getPath())); - header("Expires: 0"); - header("Cache-Control: no-cache, must-revalidate"); - header("Pragma: no-cache"); - - readfile($dms->contentDir . $content->getPath()); + $controller->setParam('content', $content); + $controller->setParam('type', 'version'); + $controller->run(); } elseif(isset($_GET["file"])) { $fileid = $_GET["file"]; @@ -83,12 +81,13 @@ if(isset($_GET["version"])) { if (isset($settings->_viewOnlineFileTypes) && is_array($settings->_viewOnlineFileTypes) && in_array(strtolower($file->getFileType()), $settings->_viewOnlineFileTypes)) { header("Content-Type: " . $file->getMimeType()); } - header("Content-Disposition: filename=\"" . $file->getOriginalFileName()) . "\""; + header("Content-Disposition: filename=\"" . $file->getOriginalFileName() . "\""); header("Content-Length: " . filesize($dms->contentDir . $file->getPath() )); header("Expires: 0"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); + ob_clean(); readfile($dms->contentDir . $file->getPath()); } diff --git a/op/op.WorkflowActionsMgr.php b/op/op.WorkflowActionsMgr.php index 51a67823c..454f49b7e 100644 --- a/op/op.WorkflowActionsMgr.php +++ b/op/op.WorkflowActionsMgr.php @@ -22,8 +22,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); include("../inc/inc.ClassPasswordStrength.php"); diff --git a/op/op.WorkflowMgr.php b/op/op.WorkflowMgr.php index 23f564c9f..cab683a7f 100644 --- a/op/op.WorkflowMgr.php +++ b/op/op.WorkflowMgr.php @@ -22,8 +22,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); include("../inc/inc.ClassPasswordStrength.php"); diff --git a/op/op.WorkflowStatesMgr.php b/op/op.WorkflowStatesMgr.php index ea2757d88..6d4488ae7 100644 --- a/op/op.WorkflowStatesMgr.php +++ b/op/op.WorkflowStatesMgr.php @@ -22,8 +22,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.LogInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); include("../inc/inc.ClassPasswordStrength.php"); diff --git a/out/out.AddDocument.php b/out/out.AddDocument.php index 2a4320bde..069592e55 100644 --- a/out/out.AddDocument.php +++ b/out/out.AddDocument.php @@ -20,6 +20,8 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); include("../inc/inc.ClassUI.php"); diff --git a/out/out.AddEvent.php b/out/out.AddEvent.php index 344bb7dde..3ff2f2369 100644 --- a/out/out.AddEvent.php +++ b/out/out.AddEvent.php @@ -17,8 +17,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.AddFile.php b/out/out.AddFile.php index e25a533f5..f54c1f9f5 100644 --- a/out/out.AddFile.php +++ b/out/out.AddFile.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -43,7 +45,7 @@ if ($document->getAccessMode($user) < M_READWRITE) { } /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'strictformcheck'=>$settings->_strictFormCheck, 'enablelargefileupload'=>$settings->_enableLargeFileUpload)); diff --git a/out/out.AddFile2.php b/out/out.AddFile2.php index aea528765..bbbef28de 100644 --- a/out/out.AddFile2.php +++ b/out/out.AddFile2.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.AddMultiDocument.php b/out/out.AddMultiDocument.php index 049f962ed..86237b436 100644 --- a/out/out.AddMultiDocument.php +++ b/out/out.AddMultiDocument.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); @@ -41,6 +43,11 @@ if ($folder->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))),getMLText("access_denied")); } +$remain = checkQuota($user); +if ($remain < 0) { + UI::exitError(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))),getMLText("quota_exceeded", array('bytes'=>SeedDMS_Core_File::format_filesize(abs($remain))))); +} + $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'enableadminrevapp'=>$settings->_enableAdminRevApp, 'enableownerrevapp'=>$settings->_enableOwnerRevApp, 'enableselfrevapp'=>$settings->_enableSelfRevApp)); if($view) { diff --git a/out/out.AddSubFolder.php b/out/out.AddSubFolder.php index c737043e6..19e087cee 100644 --- a/out/out.AddSubFolder.php +++ b/out/out.AddSubFolder.php @@ -21,8 +21,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.AdminTools.php b/out/out.AdminTools.php index 86aacc592..dce5690c0 100644 --- a/out/out.AdminTools.php +++ b/out/out.AdminTools.php @@ -17,8 +17,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.ApprovalSummary.php b/out/out.ApprovalSummary.php index 7b0b49f4c..be3b983f5 100644 --- a/out/out.ApprovalSummary.php +++ b/out/out.ApprovalSummary.php @@ -19,8 +19,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.ApproveDocument.php b/out/out.ApproveDocument.php index 110e3c5f0..e50c1eaed 100644 --- a/out/out.ApproveDocument.php +++ b/out/out.ApproveDocument.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -39,7 +41,7 @@ if (!is_object($document)) { $folder = $document->getFolder(); /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); if ($document->getAccessMode($user) < M_READ) { UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied")); diff --git a/out/out.AttributeMgr.php b/out/out.AttributeMgr.php index 7ba4861e7..cf6b09fac 100644 --- a/out/out.AttributeMgr.php +++ b/out/out.AttributeMgr.php @@ -20,8 +20,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.BackupTools.php b/out/out.BackupTools.php index a19d8c84c..a5b97aad5 100644 --- a/out/out.BackupTools.php +++ b/out/out.BackupTools.php @@ -17,9 +17,11 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); +include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); include("../inc/inc.DBInit.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.Language.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.Calendar.php b/out/out.Calendar.php index c6c46e433..fb63ad412 100644 --- a/out/out.Calendar.php +++ b/out/out.Calendar.php @@ -18,8 +18,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Calendar.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.Categories.php b/out/out.Categories.php index f06dc7369..d912f67b4 100644 --- a/out/out.Categories.php +++ b/out/out.Categories.php @@ -19,8 +19,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.CategoryChooser.php b/out/out.CategoryChooser.php index f1eb7c20f..a7e57e57a 100644 --- a/out/out.CategoryChooser.php +++ b/out/out.CategoryChooser.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.ClassUI.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.Authentication.php"); $form = preg_replace('/[^A-Za-z0-9_]+/', '', $_GET["form"]); diff --git a/out/out.Charts.php b/out/out.Charts.php index 0e9844164..771d35c84 100644 --- a/out/out.Charts.php +++ b/out/out.Charts.php @@ -17,9 +17,11 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Utils.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.CreateIndex.php b/out/out.CreateIndex.php index 795c1ba99..757c611d9 100644 --- a/out/out.CreateIndex.php +++ b/out/out.CreateIndex.php @@ -22,8 +22,10 @@ include("../inc/inc.Version.php"); include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.DefaultKeywords.php b/out/out.DefaultKeywords.php index d417ca4c8..2a197a46c 100644 --- a/out/out.DefaultKeywords.php +++ b/out/out.DefaultKeywords.php @@ -19,8 +19,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.DocumentAccess.php b/out/out.DocumentAccess.php index 64de1396f..8fe5d7931 100644 --- a/out/out.DocumentAccess.php +++ b/out/out.DocumentAccess.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -45,7 +47,7 @@ $allUsers = $dms->getAllUsers($settings->_sortUsersInList); $allGroups = $dms->getAllGroups(); /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'allusers'=>$allUsers, 'allgroups'=>$allGroups)); diff --git a/out/out.DocumentChooser.php b/out/out.DocumentChooser.php index 4a9161c1a..866029117 100644 --- a/out/out.DocumentChooser.php +++ b/out/out.DocumentChooser.php @@ -19,9 +19,11 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.ClassUI.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); +include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); $folderid = intval($_GET["folderid"]); diff --git a/out/out.DocumentNotify.php b/out/out.DocumentNotify.php index f5931965e..637e55d88 100644 --- a/out/out.DocumentNotify.php +++ b/out/out.DocumentNotify.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -43,7 +45,7 @@ if ($document->getAccessMode($user) < M_READ) { } /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'sortusersinlist'=>$settings->_sortUsersInList)); diff --git a/out/out.DocumentVersionDetail.php b/out/out.DocumentVersionDetail.php index 5e53fe702..e88182a41 100644 --- a/out/out.DocumentVersionDetail.php +++ b/out/out.DocumentVersionDetail.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -65,7 +67,7 @@ if ($latestContent->getVersion()==$version->getVersion()) { $folder = $document->getFolder(); /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'version'=>$version, 'viewonlinefiletypes'=>$settings->_viewOnlineFileTypes, 'enableversionmodification'=>$settings->_enableVersionModification, 'previewwidthdetail'=>$settings->_previewWidthDetail, 'cachedir'=>$settings->_cacheDir)); diff --git a/out/out.DropFolderChooser.php b/out/out.DropFolderChooser.php index b5baf5e69..ca0a2b84e 100644 --- a/out/out.DropFolderChooser.php +++ b/out/out.DropFolderChooser.php @@ -19,9 +19,11 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.ClassUI.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); +include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); /** diff --git a/out/out.EditAttributes.php b/out/out.EditAttributes.php index eedb18f72..064544227 100644 --- a/out/out.EditAttributes.php +++ b/out/out.EditAttributes.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -44,7 +46,7 @@ if (!is_object($version)) { $folder = $document->getFolder(); /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_all)); diff --git a/out/out.EditComment.php b/out/out.EditComment.php index 0fe44c67a..63ab52bfb 100644 --- a/out/out.EditComment.php +++ b/out/out.EditComment.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -49,7 +51,7 @@ if (!is_object($version)) { $folder = $document->getFolder(); /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'version'=>$version, 'strictformcheck'=>$settings->_strictFormCheck)); diff --git a/out/out.EditDocument.php b/out/out.EditDocument.php index e9138cdea..096a38674 100644 --- a/out/out.EditDocument.php +++ b/out/out.EditDocument.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -49,7 +51,7 @@ $folder = $document->getFolder(); $attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_document, SeedDMS_Core_AttributeDefinition::objtype_all)); /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'attrdefs'=>$attrdefs, 'strictformcheck'=>$settings->_strictFormCheck, 'orderby'=>$settings->_sortFoldersDefault)); diff --git a/out/out.EditEvent.php b/out/out.EditEvent.php index 71c418db3..7cd64d4c7 100644 --- a/out/out.EditEvent.php +++ b/out/out.EditEvent.php @@ -17,8 +17,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Calendar.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.EditFolder.php b/out/out.EditFolder.php index 89e2497bc..aba8c317f 100644 --- a/out/out.EditFolder.php +++ b/out/out.EditFolder.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.EditUserData.php b/out/out.EditUserData.php index a374410e9..55b16fafc 100644 --- a/out/out.EditUserData.php +++ b/out/out.EditUserData.php @@ -19,8 +19,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.ExtensionMgr.php b/out/out.ExtensionMgr.php new file mode 100644 index 000000000..54759ed93 --- /dev/null +++ b/out/out.ExtensionMgr.php @@ -0,0 +1,41 @@ +isAdmin()) { + UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); +} + +$v = new SeedDMS_Version; + +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'httproot'=>$settings->_httpRoot, 'version'=>$v)); +if($view) { + $view->show(); + exit; +} + +?> diff --git a/out/out.FolderAccess.php b/out/out.FolderAccess.php index c4ccd5780..6a76861eb 100644 --- a/out/out.FolderAccess.php +++ b/out/out.FolderAccess.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.FolderChooser.php b/out/out.FolderChooser.php index 7d87e2545..e80110b97 100644 --- a/out/out.FolderChooser.php +++ b/out/out.FolderChooser.php @@ -18,9 +18,11 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.ClassUI.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); +include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); $form = preg_replace('/[^A-Za-z0-9_]+/', '', $_GET["form"]); diff --git a/out/out.FolderNotify.php b/out/out.FolderNotify.php index af4a03b52..c72e5c87c 100644 --- a/out/out.FolderNotify.php +++ b/out/out.FolderNotify.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.ForcePasswordChange.php b/out/out.ForcePasswordChange.php index 702e466cf..0d4db6db3 100644 --- a/out/out.ForcePasswordChange.php +++ b/out/out.ForcePasswordChange.php @@ -12,8 +12,10 @@ */ include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.GroupMgr.php b/out/out.GroupMgr.php index dc8898b23..ee231876b 100644 --- a/out/out.GroupMgr.php +++ b/out/out.GroupMgr.php @@ -20,8 +20,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.GroupView.php b/out/out.GroupView.php index 7e9402165..91c17ccd8 100644 --- a/out/out.GroupView.php +++ b/out/out.GroupView.php @@ -17,8 +17,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.Help.php b/out/out.Help.php index e68154dae..f535764d3 100644 --- a/out/out.Help.php +++ b/out/out.Help.php @@ -17,8 +17,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.IndexInfo.php b/out/out.IndexInfo.php index 5c5cb3cc1..2bb6a4342 100644 --- a/out/out.IndexInfo.php +++ b/out/out.IndexInfo.php @@ -21,8 +21,10 @@ include("../inc/inc.Version.php"); include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.Indexer.php b/out/out.Indexer.php index 5f99225d3..7e2508def 100644 --- a/out/out.Indexer.php +++ b/out/out.Indexer.php @@ -22,8 +22,10 @@ include("../inc/inc.Version.php"); include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.Info.php b/out/out.Info.php index 22caf8f8d..3fdc51744 100644 --- a/out/out.Info.php +++ b/out/out.Info.php @@ -20,8 +20,10 @@ include("../inc/inc.Version.php"); include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.KeywordChooser.php b/out/out.KeywordChooser.php index 6871d99eb..ff3618399 100644 --- a/out/out.KeywordChooser.php +++ b/out/out.KeywordChooser.php @@ -20,8 +20,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.LogManagement.php b/out/out.LogManagement.php index 5e7e74d89..599094ba6 100644 --- a/out/out.LogManagement.php +++ b/out/out.LogManagement.php @@ -17,9 +17,11 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Utils.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.Login.php b/out/out.Login.php index c849c08c4..7fa236c98 100644 --- a/out/out.Login.php +++ b/out/out.Login.php @@ -20,6 +20,8 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Utils.php"); diff --git a/out/out.ManageNotify.php b/out/out.ManageNotify.php index 383a910f4..4f9875cde 100644 --- a/out/out.ManageNotify.php +++ b/out/out.ManageNotify.php @@ -17,8 +17,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.MoveDocument.php b/out/out.MoveDocument.php index 056ce28de..17508401c 100644 --- a/out/out.MoveDocument.php +++ b/out/out.MoveDocument.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -62,7 +64,7 @@ if(isset($_GET['targetid']) && $_GET['targetid']) { $folder = $document->getFolder(); /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'target'=>$target)); diff --git a/out/out.MoveFolder.php b/out/out.MoveFolder.php index 17a7de21f..6140419ca 100644 --- a/out/out.MoveFolder.php +++ b/out/out.MoveFolder.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.MyAccount.php b/out/out.MyAccount.php index 15f1b7e5d..147f9b0d2 100644 --- a/out/out.MyAccount.php +++ b/out/out.MyAccount.php @@ -19,8 +19,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.MyDocuments.php b/out/out.MyDocuments.php index 6650d2a15..2eadea3e1 100644 --- a/out/out.MyDocuments.php +++ b/out/out.MyDocuments.php @@ -19,8 +19,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.ObjectCheck.php b/out/out.ObjectCheck.php index b7a982e83..c0457c94b 100644 --- a/out/out.ObjectCheck.php +++ b/out/out.ObjectCheck.php @@ -21,8 +21,10 @@ include("../inc/inc.Version.php"); include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.OverrideContentStatus.php b/out/out.OverrideContentStatus.php index aed70551d..2b5e24083 100644 --- a/out/out.OverrideContentStatus.php +++ b/out/out.OverrideContentStatus.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -60,7 +62,7 @@ if ($overallStatus["status"] == S_REJECTED || $overallStatus["status"] == S_EXPI $folder = $document->getFolder(); /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'version'=>$content)); diff --git a/out/out.PasswordForgotten.php b/out/out.PasswordForgotten.php index b12232c22..30c02dd9d 100644 --- a/out/out.PasswordForgotten.php +++ b/out/out.PasswordForgotten.php @@ -20,6 +20,8 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); include("../inc/inc.ClassUI.php"); include $settings->_rootDir . "languages/" . $settings->_language . "/lang.inc"; diff --git a/out/out.PasswordSend.php b/out/out.PasswordSend.php index b12232c22..30c02dd9d 100644 --- a/out/out.PasswordSend.php +++ b/out/out.PasswordSend.php @@ -20,6 +20,8 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); include("../inc/inc.ClassUI.php"); include $settings->_rootDir . "languages/" . $settings->_language . "/lang.inc"; diff --git a/out/out.RemoveArchive.php b/out/out.RemoveArchive.php index 89b8e091c..476a0ad20 100644 --- a/out/out.RemoveArchive.php +++ b/out/out.RemoveArchive.php @@ -17,8 +17,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.RemoveDocument.php b/out/out.RemoveDocument.php index 8c9320522..f4accdcbf 100644 --- a/out/out.RemoveDocument.php +++ b/out/out.RemoveDocument.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -49,7 +51,7 @@ if($document->isLocked()) { $folder = $document->getFolder(); /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document)); diff --git a/out/out.RemoveDocumentFile.php b/out/out.RemoveDocumentFile.php index 3c4fbecfb..553148079 100644 --- a/out/out.RemoveDocumentFile.php +++ b/out/out.RemoveDocumentFile.php @@ -18,8 +18,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -51,7 +53,7 @@ if (($document->getAccessMode($user) < M_ALL)&&($user->getID()!=$file->getUserID $folder = $document->getFolder(); /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'file'=>$file)); diff --git a/out/out.RemoveDump.php b/out/out.RemoveDump.php index dd0119ad9..04fae4005 100644 --- a/out/out.RemoveDump.php +++ b/out/out.RemoveDump.php @@ -17,8 +17,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.RemoveEvent.php b/out/out.RemoveEvent.php index 8ac8abded..1c2b16631 100644 --- a/out/out.RemoveEvent.php +++ b/out/out.RemoveEvent.php @@ -17,8 +17,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Calendar.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.RemoveFolder.php b/out/out.RemoveFolder.php index 2de78cf90..140e5b4d6 100644 --- a/out/out.RemoveFolder.php +++ b/out/out.RemoveFolder.php @@ -19,8 +19,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.RemoveFolderFiles.php b/out/out.RemoveFolderFiles.php index a52302721..1f5a3bacc 100644 --- a/out/out.RemoveFolderFiles.php +++ b/out/out.RemoveFolderFiles.php @@ -17,8 +17,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.RemoveGroup.php b/out/out.RemoveGroup.php index 7b9972b24..071e18723 100644 --- a/out/out.RemoveGroup.php +++ b/out/out.RemoveGroup.php @@ -19,8 +19,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.RemoveLog.php b/out/out.RemoveLog.php index b30a14bee..9b695b3c1 100644 --- a/out/out.RemoveLog.php +++ b/out/out.RemoveLog.php @@ -17,8 +17,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.RemoveUser.php b/out/out.RemoveUser.php index fcbdd9f4f..481db7f36 100644 --- a/out/out.RemoveUser.php +++ b/out/out.RemoveUser.php @@ -19,8 +19,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.RemoveVersion.php b/out/out.RemoveVersion.php index afa46211f..faa0cea33 100644 --- a/out/out.RemoveVersion.php +++ b/out/out.RemoveVersion.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -58,7 +60,7 @@ if (!is_object($version)) { $folder = $document->getFolder(); /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'version'=>$version)); diff --git a/out/out.RemoveWorkflow.php b/out/out.RemoveWorkflow.php index fb623d026..d56089463 100644 --- a/out/out.RemoveWorkflow.php +++ b/out/out.RemoveWorkflow.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.RemoveWorkflowFromDocument.php b/out/out.RemoveWorkflowFromDocument.php index da77424ff..074425b4d 100644 --- a/out/out.RemoveWorkflowFromDocument.php +++ b/out/out.RemoveWorkflowFromDocument.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -58,7 +60,7 @@ if (!is_object($workflow)) { $folder = $document->getFolder(); /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'version'=>$version)); diff --git a/out/out.ReturnFromSubWorkflow.php b/out/out.ReturnFromSubWorkflow.php index 414806810..6e3e8a256 100644 --- a/out/out.ReturnFromSubWorkflow.php +++ b/out/out.ReturnFromSubWorkflow.php @@ -20,8 +20,9 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Language.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.ReviewDocument.php b/out/out.ReviewDocument.php index 4fab1c9dd..063f53de3 100644 --- a/out/out.ReviewDocument.php +++ b/out/out.ReviewDocument.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -58,7 +60,7 @@ if ($latestContent->getVersion()!=$version) { } /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); // verify if document may be reviewed if (!$accessop->mayReview()){ diff --git a/out/out.ReviewSummary.php b/out/out.ReviewSummary.php index c49f89efc..d0086c19a 100644 --- a/out/out.ReviewSummary.php +++ b/out/out.ReviewSummary.php @@ -20,8 +20,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.RewindWorkflow.php b/out/out.RewindWorkflow.php index da77424ff..074425b4d 100644 --- a/out/out.RewindWorkflow.php +++ b/out/out.RewindWorkflow.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -58,7 +60,7 @@ if (!is_object($workflow)) { $folder = $document->getFolder(); /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'version'=>$version)); diff --git a/out/out.RunSubWorkflow.php b/out/out.RunSubWorkflow.php index 52d5d0618..8105e566a 100644 --- a/out/out.RunSubWorkflow.php +++ b/out/out.RunSubWorkflow.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -63,7 +65,7 @@ if (!is_object($subworkflow)) { $folder = $document->getFolder(); /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'version'=>$version, 'subworkflow'=>$subworkflow)); diff --git a/out/out.Search.php b/out/out.Search.php index ed84007cf..cb9d59164 100644 --- a/out/out.Search.php +++ b/out/out.Search.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -394,10 +396,10 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"]) { if(count($entries) == 1) { $entry = $entries[0]; - if(get_class($entry) == 'SeedDMS_Core_Document') { + if(get_class($entry) == $dms->getClassname('document')) { header('Location: ../out/out.ViewDocument.php?documentid='.$entry->getID()); exit; - } elseif(get_class($entry) == 'SeedDMS_Core_Folder') { + } elseif(get_class($entry) == $dms->getClassname('folder')) { header('Location: ../out/out.ViewFolder.php?folderid='.$entry->getID()); exit; } diff --git a/out/out.SearchForm.php b/out/out.SearchForm.php index fa0961c70..6e4b42274 100644 --- a/out/out.SearchForm.php +++ b/out/out.SearchForm.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.SetExpires.php b/out/out.SetExpires.php index 5b6856179..df3c1b878 100644 --- a/out/out.SetExpires.php +++ b/out/out.SetExpires.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -42,7 +44,7 @@ if ($document->getAccessMode($user) < M_READWRITE) { $folder = $document->getFolder(); /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document)); diff --git a/out/out.SetReviewersApprovers.php b/out/out.SetReviewersApprovers.php index 1f2500fb1..dd181da1b 100644 --- a/out/out.SetReviewersApprovers.php +++ b/out/out.SetReviewersApprovers.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -48,12 +50,12 @@ if (!is_object($content)) { UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("invalid_version")); } +// control for document state. Must correspond to check in +// SeedDMS_AccessOperation::maySetReviewersApprovers() if(!$settings->_enableVersionModification) { UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("no_version_modification")); } -// control for document state. Must correspond to check in -// SeedDMS_AccessOperation::maySetReviewersApprovers() $overallStatus = $content->getStatus(); if ($overallStatus["status"]!=S_DRAFT_REV && $overallStatus["status"]!=S_DRAFT_APP) { UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("cannot_assign_invalid_state")); @@ -62,7 +64,7 @@ if ($overallStatus["status"]!=S_DRAFT_REV && $overallStatus["status"]!=S_DRAFT_A $folder = $document->getFolder(); /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'version'=>$content, 'enableadminrevapp'=>$settings->_enableAdminRevApp, 'enableownerrevapp'=>$settings->_enableOwnerRevApp, 'enableselfrevapp'=>$settings->_enableSelfRevApp)); diff --git a/out/out.SetWorkflow.php b/out/out.SetWorkflow.php index 445f3991b..0b6aa6216 100644 --- a/out/out.SetWorkflow.php +++ b/out/out.SetWorkflow.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -49,7 +51,7 @@ if (!is_object($version)) { $folder = $document->getFolder(); /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'version'=>$version)); diff --git a/out/out.Settings.php b/out/out.Settings.php index 61357dd26..459ddf509 100644 --- a/out/out.Settings.php +++ b/out/out.Settings.php @@ -17,8 +17,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); @@ -31,7 +33,7 @@ if(!trim($settings->_encryptionKey)) $settings->_encryptionKey = md5(uniqid()); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'settings'=>$settings, 'currenttab'=>(isset($_GET['currenttab']) ? $_GET['currenttab'] : ''))); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'settings'=>$settings, 'currenttab'=>(isset($_REQUEST['currenttab']) ? $_REQUEST['currenttab'] : ''))); if($view) { $view->show(); exit; diff --git a/out/out.Statistic.php b/out/out.Statistic.php index 8a81151e1..7c390d1c0 100644 --- a/out/out.Statistic.php +++ b/out/out.Statistic.php @@ -17,9 +17,11 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Utils.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.SubstituteUser.php b/out/out.SubstituteUser.php index 9dac363fa..159af1394 100644 --- a/out/out.SubstituteUser.php +++ b/out/out.SubstituteUser.php @@ -18,8 +18,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.Timeline.php b/out/out.Timeline.php index 5ef48a368..221726fd7 100644 --- a/out/out.Timeline.php +++ b/out/out.Timeline.php @@ -17,9 +17,11 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Utils.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.TriggerWorkflow.php b/out/out.TriggerWorkflow.php index 020ccf556..4c8a2de7b 100644 --- a/out/out.TriggerWorkflow.php +++ b/out/out.TriggerWorkflow.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -59,7 +61,7 @@ if (!is_object($transition)) { $folder = $document->getFolder(); /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'version'=>$version, 'transition'=>$transition)); diff --git a/out/out.UpdateDocument.php b/out/out.UpdateDocument.php index a79873ded..e1ee91a71 100644 --- a/out/out.UpdateDocument.php +++ b/out/out.UpdateDocument.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -56,7 +58,7 @@ if($settings->_quota > 0) { $folder = $document->getFolder(); /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'strictformcheck'=>$settings->_strictFormCheck, 'enablelargefileupload'=>$settings->_enableLargeFileUpload, 'enableadminrevapp'=>$settings->_enableAdminRevApp, 'enableownerrevapp'=>$settings->_enableOwnerRevApp, 'enableselfrevapp'=>$settings->_enableSelfRevApp, 'dropfolderdir'=>$settings->_dropFolderDir, 'workflowmode'=>$settings->_workflowMode, 'presetexpiration'=>$settings->_presetExpirationDate)); diff --git a/out/out.UpdateDocument2.php b/out/out.UpdateDocument2.php index 1e45a0826..a7198a7ac 100644 --- a/out/out.UpdateDocument2.php +++ b/out/out.UpdateDocument2.php @@ -21,8 +21,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); @@ -43,6 +45,11 @@ if ($document->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied")); } +$remain = checkQuota($user); +if ($remain < 0) { + UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("quota_exceeded", array('bytes'=>SeedDMS_Core_File::format_filesize(abs($remain))))); +} + $folder = $document->getFolder(); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); diff --git a/out/out.UserDefaultKeywords.php b/out/out.UserDefaultKeywords.php index ed9e589c7..1c2ac0e61 100644 --- a/out/out.UserDefaultKeywords.php +++ b/out/out.UserDefaultKeywords.php @@ -18,8 +18,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.UserImage.php b/out/out.UserImage.php index 0a3684f2c..6d06f55a0 100644 --- a/out/out.UserImage.php +++ b/out/out.UserImage.php @@ -18,6 +18,8 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); include("../inc/inc.DBInit.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.UserList.php b/out/out.UserList.php index c7395d356..518eba4d8 100644 --- a/out/out.UserList.php +++ b/out/out.UserList.php @@ -17,8 +17,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); include("../inc/inc.ClassPasswordStrength.php"); diff --git a/out/out.UsrMgr.php b/out/out.UsrMgr.php index 1abbddab2..e8fc46e81 100644 --- a/out/out.UsrMgr.php +++ b/out/out.UsrMgr.php @@ -19,8 +19,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.UsrView.php b/out/out.UsrView.php index 6d83b36fe..f57b54d37 100644 --- a/out/out.UsrView.php +++ b/out/out.UsrView.php @@ -17,8 +17,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.ViewDocument.php b/out/out.ViewDocument.php index 361a63d8f..f60d6898f 100644 --- a/out/out.ViewDocument.php +++ b/out/out.ViewDocument.php @@ -21,8 +21,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); @@ -47,7 +49,7 @@ if (!is_object($document)) { } /* Create object for checking access to certain operations */ -$accessop = new SeedDMS_AccessOperation($document, $user, $settings); +$accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings); $folder = $document->getFolder(); diff --git a/out/out.ViewEvent.php b/out/out.ViewEvent.php index 4e26cd1f0..fc245e741 100644 --- a/out/out.ViewEvent.php +++ b/out/out.ViewEvent.php @@ -17,8 +17,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Calendar.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.ViewFolder.php b/out/out.ViewFolder.php index f42e6baf0..5d8cb72f8 100644 --- a/out/out.ViewFolder.php +++ b/out/out.ViewFolder.php @@ -20,8 +20,10 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.Authentication.php"); include("../inc/inc.ClassUI.php"); @@ -60,6 +62,7 @@ if($view) { $view->setParam('enableDropUpload', $settings->_enableDropUpload); $view->setParam('expandFolderTree', $settings->_expandFolderTree); $view->setParam('showtree', showtree()); + $view->setParam('settings', $settings); $view->setParam('cachedir', $settings->_cacheDir); $view->setParam('workflowmode', $settings->_workflowMode); $view->setParam('enableRecursiveCount', $settings->_enableRecursiveCount); diff --git a/out/out.WorkflowActionsMgr.php b/out/out.WorkflowActionsMgr.php index 42184244e..c6980c0d9 100644 --- a/out/out.WorkflowActionsMgr.php +++ b/out/out.WorkflowActionsMgr.php @@ -20,8 +20,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.WorkflowGraph.php b/out/out.WorkflowGraph.php index 55f548500..6a4f523d9 100644 --- a/out/out.WorkflowGraph.php +++ b/out/out.WorkflowGraph.php @@ -20,8 +20,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.WorkflowMgr.php b/out/out.WorkflowMgr.php index a46bb952b..ae50f0e95 100644 --- a/out/out.WorkflowMgr.php +++ b/out/out.WorkflowMgr.php @@ -20,8 +20,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.WorkflowStatesMgr.php b/out/out.WorkflowStatesMgr.php index c7ef54271..cb4e55f33 100644 --- a/out/out.WorkflowStatesMgr.php +++ b/out/out.WorkflowStatesMgr.php @@ -20,8 +20,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/out/out.WorkflowSummary.php b/out/out.WorkflowSummary.php index c45889051..1e59569c8 100644 --- a/out/out.WorkflowSummary.php +++ b/out/out.WorkflowSummary.php @@ -20,8 +20,10 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include("../inc/inc.Settings.php"); -include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.Authentication.php"); diff --git a/styles/bootstrap/application.css b/styles/bootstrap/application.css index 9817043ba..b1ab5ff61 100644 --- a/styles/bootstrap/application.css +++ b/styles/bootstrap/application.css @@ -45,6 +45,14 @@ ul.tree, ul.tree ul { margin-left: 20px; } +ul.jqtree-tree li.jqtree-selected > .jqtree-element, +ul.jqtree-tree li.jqtree-selected > .jqtree-element:hover { + background-color: #fff; + background: none; + text-shadow: none; + font-weight: bold; +} + .wordbreak { word-break: break-word; } diff --git a/styles/bootstrap/application.js b/styles/bootstrap/application.js index c6ce33cef..968eaf58e 100644 --- a/styles/bootstrap/application.js +++ b/styles/bootstrap/application.js @@ -22,7 +22,7 @@ $(document).ready( function() { }); $(".chzn-select").chosen({width: "95%"}); - $(".chzn-select-deselect").chosen({allow_single_deselect:true}); + $(".chzn-select-deselect").chosen({width: "95%", allow_single_deselect:true}); /* change the color and length of the bar graph showing the password * strength on each change to the passwod field. @@ -233,6 +233,25 @@ $(document).ready( function() { 'json' ); }); + $('a.sendtestmail').click(function(ev){ + ev.preventDefault(); + $.ajax({url: '../op/op.Ajax.php', + type: 'GET', + dataType: "json", + data: {command: 'testmail'}, + success: function(data) { + console.log(data); + noty({ + text: data.msg, + type: (data.error) ? 'error' : 'success', + dismissQueue: true, + layout: 'topRight', + theme: 'defaultTheme', + timeout: 1500, + }); + } + }); + }); $('a.movefolder').click(function(ev){ ev.preventDefault(); diff --git a/utils/xmldump.php b/utils/xmldump.php index af51ca072..f872a5e19 100644 --- a/utils/xmldump.php +++ b/utils/xmldump.php @@ -443,6 +443,7 @@ if($users) { echo " ".$user->isHidden()."\n"; echo " ".$user->isDisabled()."\n"; echo " ".$user->getPwdExpiration()."\n"; + echo " ".$user->getHomeFolder()."\n"; if($image = $user->getImage()) { echo " \n"; echo " ".$image['mimeType']."\n"; diff --git a/utils/xmlimport.php b/utils/xmlimport.php index cc7c874e6..25d48f1c9 100644 --- a/utils/xmlimport.php +++ b/utils/xmlimport.php @@ -94,6 +94,23 @@ function insert_user($user) { /* {{{ */ return $newUser; } /* }}} */ +function set_homefolders() { /* {{{ */ + global $dms, $debug, $defaultUser, $users, $objmap; + + foreach($users as $user) { + if(isset($user['attributes']['homefolder']) && $user['attributes']['homefolder']) { + if(array_key_exists($user['id'], $objmap['users'])) { + $userobj = $dms->getUser($objmap['users'][$user['id']]); + if(!array_key_exists((int) $user['attributes']['homefolder'], $objmap['folders'])) { + echo "Warning: homefolder ".$user['attributes']['homefolder']." cannot be found\n"; + } else { + $userobj->setHomeFolder($objmap['folders'][(int) $user['attributes']['homefolder']]); + } + } + } + } +} /* }}} */ + function insert_group($group) { /* {{{ */ global $dms, $debug, $objmap, $sections, $users; @@ -1254,6 +1271,8 @@ while ($data = fread($fp, 65535)) { resolve_links(); +set_homefolders(); + if($exportmapping) { if($fp = fopen($exportmapping, 'w')) { fputcsv($fp, array('object type', 'old id', 'new id')); diff --git a/views/bootstrap/class.AddDocument.php b/views/bootstrap/class.AddDocument.php index 425e1d071..e7dfe6aee 100644 --- a/views/bootstrap/class.AddDocument.php +++ b/views/bootstrap/class.AddDocument.php @@ -149,12 +149,20 @@ $(document).ready(function() { $attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_document, SeedDMS_Core_AttributeDefinition::objtype_all)); if($attrdefs) { foreach($attrdefs as $attrdef) { + $arr = $this->callHook('editDocumentAttribute', null, $attrdef); + if(is_array($arr)) { + echo ""; + echo "".$arr[0].":"; + echo "".$arr[1].""; + echo ""; + } else { ?> getName()); ?> printAttributeEditField($attrdef, '') ?> getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_all)); if($attrdefs) { foreach($attrdefs as $attrdef) { + $arr = $this->callHook('editDocumentAttribute', null, $attrdef); + if(is_array($arr)) { + echo ""; + echo "".$arr[0].":"; + echo "".$arr[1].""; + echo ""; + } else { ?> getName()); ?> printAttributeEditField($attrdef, '', 'attributes_version') ?>
-
+
+

diff --git a/views/bootstrap/class.AttributeMgr.php b/views/bootstrap/class.AttributeMgr.php index b39c2d09c..fd8794472 100644 --- a/views/bootstrap/class.AttributeMgr.php +++ b/views/bootstrap/class.AttributeMgr.php @@ -88,7 +88,30 @@ function showAttributeDefinitions(selectObj) { $ot = getMLText("version"); break; } - print "