mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-28 12:38:00 +00:00
Merge branch 'seeddms-5.0.x'
This commit is contained in:
commit
d81f946446
12
CHANGELOG
12
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
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
|
20
Makefile
20
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
|
||||
|
||||
|
|
53
README.Extensions
Normal file
53
README.Extensions
Normal file
|
@ -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.
|
||||
|
|
@ -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; }
|
||||
|
||||
} /* }}} */
|
||||
?>
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
} /* }}} */
|
||||
|
||||
}
|
||||
} /* }}} */
|
||||
?>
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
<email>uwe@steinmann.cx</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<date>2016-01-21</date>
|
||||
<time>07:12:53</time>
|
||||
<date>2016-01-22</date>
|
||||
<time>09:28:28</time>
|
||||
<version>
|
||||
<release>4.3.23</release>
|
||||
<api>4.3.23</api>
|
||||
<release>5.0.0</release>
|
||||
<api>5.0.0</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
|
@ -24,8 +24,8 @@
|
|||
</stability>
|
||||
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||
<notes>
|
||||
- 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
|
||||
</notes>
|
||||
<contents>
|
||||
<dir baseinstalldir="SeedDMS" name="/">
|
||||
|
@ -926,5 +926,22 @@ by a group or user right
|
|||
- pass some more information for timeline
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<date>2016-01-21</date>
|
||||
<time>07:12:53</time>
|
||||
<version>
|
||||
<release>4.3.23</release>
|
||||
<api>4.3.23</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||
<notes>
|
||||
- new method SeedDMS_Core_DMS::createDump()
|
||||
- minor improvements int SeedDMS_Core_Document::getReadAccessList()
|
||||
</notes>
|
||||
</release>
|
||||
</changelog>
|
||||
</package>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
-->
|
||||
<edition
|
||||
strictFormCheck = "false"
|
||||
viewOnlineFileTypes = ".txt;.text;.html;.htm;.pdf;.gif;.png;.jpg;.jpeg;.mp4"
|
||||
viewOnlineFileTypes = ".txt;.text;.html;.htm;.xml;.pdf;.gif;.png;.jpg;.jpeg;.mp4"
|
||||
enableConverting = "true"
|
||||
enableEmail = "true"
|
||||
enableUsersView = "true"
|
||||
|
|
46
controllers/class.Download.php
Normal file
46
controllers/class.Download.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* Implementation of Download controller
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @license GPL 2
|
||||
* @version @version@
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @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 <uwe@steinmann.cx>
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
}
|
130
controllers/class.EditFolder.php
Normal file
130
controllers/class.EditFolder.php
Normal file
|
@ -0,0 +1,130 @@
|
|||
<?php
|
||||
/**
|
||||
* Implementation of EditFolder controller
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @license GPL 2
|
||||
* @version @version@
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @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 <uwe@steinmann.cx>
|
||||
* @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;
|
||||
}
|
||||
}
|
34
controllers/class.Login.php
Normal file
34
controllers/class.Login.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Implementation of Login controller
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @license GPL 2
|
||||
* @version @version@
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @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 <uwe@steinmann.cx>
|
||||
* @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')) {
|
||||
}
|
||||
}
|
||||
}
|
34
controllers/class.Logout.php
Normal file
34
controllers/class.Logout.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Implementation of Logout controller
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @license GPL 2
|
||||
* @version @version@
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @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 <uwe@steinmann.cx>
|
||||
* @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')) {
|
||||
}
|
||||
}
|
||||
}
|
64
controllers/class.RemoveDocument.php
Normal file
64
controllers/class.RemoveDocument.php
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
/**
|
||||
* Implementation of RemoveDocument controller
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @license GPL 2
|
||||
* @version @version@
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @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 <uwe@steinmann.cx>
|
||||
* @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;
|
||||
}
|
||||
}
|
71
controllers/class.RemoveFolder.php
Normal file
71
controllers/class.RemoveFolder.php
Normal file
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
/**
|
||||
* Implementation of RemoveFolder controller
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @license GPL 2
|
||||
* @version @version@
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @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 <uwe@steinmann.cx>
|
||||
* @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;
|
||||
}
|
||||
}
|
50
controllers/class.ViewOnline.php
Normal file
50
controllers/class.ViewOnline.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* Implementation of ViewOnline controller
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @license GPL 2
|
||||
* @version @version@
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @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 <uwe@steinmann.cx>
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
}
|
115
ext/example/class.example.php
Normal file
115
ext/example/class.example.php
Normal file
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2013 Uwe Steinmann <uwe@steinmann.cx>
|
||||
* 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 <uwe@steinmann.cx>
|
||||
* @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 <uwe@steinmann.cx>
|
||||
* @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 <uwe@steinmann.cx>
|
||||
* @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");
|
||||
} /* }}} */
|
||||
|
||||
}
|
||||
|
||||
?>
|
32
ext/example/conf.php
Normal file
32
ext/example/conf.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
$EXT_CONF['example'] = array(
|
||||
'title' => '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',
|
||||
),
|
||||
);
|
||||
?>
|
BIN
ext/example/icon.png
Normal file
BIN
ext/example/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 845 B |
5
ext/example/lang.php
Normal file
5
ext/example/lang.php
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
$__lang['de_DE'] = array(
|
||||
'folder_contents' => 'Dies war mal "Ordner enthält". Wurde von sample Extension geändert.',
|
||||
);
|
||||
?>
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
67
inc/inc.ClassController.php
Normal file
67
inc/inc.ClassController.php
Normal file
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
// SeedDMS. Document Management System
|
||||
// Copyright (C) 2013 Uwe Steinmann
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
require_once('inc.ClassControllerCommon.php');
|
||||
|
||||
class Controller {
|
||||
/**
|
||||
* Create a controller from a class
|
||||
*
|
||||
* This method will check for a class file in the controller directory
|
||||
* and returns an instance of it.
|
||||
*
|
||||
* @param string $class name of controller class
|
||||
* @param array $params parameter passed to constructor of controller class
|
||||
* @return object an object of a class implementing the view
|
||||
*/
|
||||
static function factory($class, $params=array()) { /* {{{ */
|
||||
global $settings, $session, $dms, $user, $EXT_CONF;
|
||||
if(!$class) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$classname = "SeedDMS_Controller_".$class;
|
||||
$filename = '';
|
||||
foreach($EXT_CONF as $extname=>$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;
|
||||
} /* }}} */
|
||||
|
||||
}
|
158
inc/inc.ClassControllerCommon.php
Normal file
158
inc/inc.ClassControllerCommon.php
Normal file
|
@ -0,0 +1,158 @@
|
|||
<?php
|
||||
// SeedDMS. Document Management System
|
||||
// Copyright (C) 2013 Uwe Steinmann
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
class SeedDMS_Controller_Common {
|
||||
/**
|
||||
* @var array $params list of parameters
|
||||
* @access protected
|
||||
*/
|
||||
protected $params;
|
||||
|
||||
/**
|
||||
* @var integer $error error number of last run
|
||||
* @access protected
|
||||
*/
|
||||
protected $error;
|
||||
|
||||
/**
|
||||
* @var string $errormsg error message of last run
|
||||
* @access protected
|
||||
*/
|
||||
protected $errormsg;
|
||||
|
||||
function __construct($params) {
|
||||
$this->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;
|
||||
} /* }}} */
|
||||
|
||||
}
|
|
@ -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()) { /* {{{ */
|
||||
|
|
34
inc/inc.ClassExtBase.php
Normal file
34
inc/inc.ClassExtBase.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2013 Uwe Steinmann <uwe@steinmann.cx>
|
||||
* 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 <uwe@steinmann.cx>
|
||||
* @package SeedDMS
|
||||
*/
|
||||
class SeedDMS_ExtBase {
|
||||
}
|
||||
|
||||
?>
|
93
inc/inc.ClassExtensionMgr.php
Normal file
93
inc/inc.ClassExtensionMgr.php
Normal file
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
/**
|
||||
* Implementation of an extension management.
|
||||
*
|
||||
* SeedDMS can be extended by extensions. Extension usually implement
|
||||
* hook.
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @license GPL 2
|
||||
* @version @version@
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @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 <uwe@steinmann.cx>
|
||||
* @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;
|
||||
} /* }}} */
|
||||
}
|
|
@ -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());
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <code>
|
||||
* <?php
|
||||
* $hookObjs = $this->getHookObjects();
|
||||
* foreach($hookObjs as $hookObj) {
|
||||
* if (method_exists($hookObj, $hook)) {
|
||||
* $ret = $hookObj->$hook($this, ...);
|
||||
* ...
|
||||
* }
|
||||
* }
|
||||
* ?>
|
||||
* </code>
|
||||
*
|
||||
* @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;
|
||||
} /* }}} */
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
50
inc/inc.Extension.php
Normal file
50
inc/inc.Extension.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* Initialize extensions
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @license GPL 2
|
||||
* @version @version@
|
||||
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
25
inc/inc.Init.php
Normal file
25
inc/inc.Init.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
// MyDMS. Document Management System
|
||||
// Copyright (C) 2002-2005 Markus Westphal
|
||||
// Copyright (C) 2006-2008 Malcolm Cowe
|
||||
// Copyright (C) 2010 Matteo Lucarelli
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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');
|
||||
|
|
@ -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 = '<form style="display: inline-block;" accept-charset="UTF-8" action="http://translate.seeddms.org/connector/index" target="_blank" method="post"><input type="hidden" value="" name="oTranceKeys['.$key.']"><input type="submit" value="submit" class="btn btn-mini"/></form>';
|
||||
}
|
||||
|
||||
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)
|
||||
|
|
|
@ -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'));
|
||||
|
||||
?>
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
class SeedDMS_Version {
|
||||
|
||||
public $_number = "4.3.23";
|
||||
public $_number = "5.0.0";
|
||||
private $_string = "SeedDMS";
|
||||
|
||||
function SeedDMS_Version() {
|
||||
|
|
|
@ -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, '');
|
||||
|
|
|
@ -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, '');
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
-->
|
||||
<edition
|
||||
strictFormCheck = "false"
|
||||
viewOnlineFileTypes = ".txt;.text;.html;.htm;.pdf;.gif;.png;.jpg;.jpeg"
|
||||
viewOnlineFileTypes = ".txt;.text;.html;.htm;.xml;.pdf;.gif;.png;.jpg;.jpeg"
|
||||
enableConverting = "true"
|
||||
enableEmail = "true"
|
||||
enableUsersView = "true"
|
||||
|
|
9
install/update-5.0.0/update-sqlite3.sql
Normal file
9
install/update-5.0.0/update-sqlite3.sql
Normal file
|
@ -0,0 +1,9 @@
|
|||
BEGIN;
|
||||
|
||||
ALTER TABLE tblUsers ADD COLUMN `homefolder` INTEGER DEFAULT NULL REFERENCES `tblFolders` (`id`);
|
||||
|
||||
UPDATE tblVersion set major=5, minor=0, subminor=0;
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
9
install/update-5.0.0/update.sql
Normal file
9
install/update-5.0.0/update.sql
Normal file
|
@ -0,0 +1,9 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `tblUsers` ADD COLUMN `homefolder` INTEGER DEFAULT NULL;
|
||||
ALTER TABLE `tblUsers` ADD CONSTRAINT `tblUsers_homefolder` FOREIGN KEY (`homefolder`) REFERENCES `tblFolders` (`id`);
|
||||
|
||||
UPDATE tblVersion set major=5, minor=0, subminor=0;
|
||||
|
||||
COMMIT;
|
||||
|
|
@ -21,10 +21,12 @@
|
|||
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.Authentication.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
|
||||
/* Check if the form data comes for a trusted request */
|
||||
if(!checkFormKey('adddocument')) {
|
||||
|
@ -274,6 +276,14 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
|
|||
}
|
||||
}
|
||||
|
||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['addDocument'])) {
|
||||
foreach($GLOBALS['SEEDDMS_HOOKS']['addDocument'] as $hookObj) {
|
||||
if (method_exists($hookObj, 'pretAddDocument')) {
|
||||
$hookObj->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<count($_FILES["userfile"]["tmp_name"]);$file_num++){
|
|||
UI::exitError(getMLText("folder_title", array("foldername" => $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);
|
||||
}
|
||||
|
|
|
@ -1,66 +1,68 @@
|
|||
<?php
|
||||
// MyDMS. Document Management System
|
||||
// Copyright (C) 2002-2005 Markus Westphal
|
||||
// Copyright (C) 2006-2008 Malcolm Cowe
|
||||
// Copyright (C) 2010 Matteo Lucarelli
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
include("../inc/inc.Settings.php");
|
||||
include("../inc/inc.Utils.php");
|
||||
<?php
|
||||
// MyDMS. Document Management System
|
||||
// Copyright (C) 2002-2005 Markus Westphal
|
||||
// Copyright (C) 2006-2008 Malcolm Cowe
|
||||
// Copyright (C) 2010 Matteo Lucarelli
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
include("../inc/inc.Settings.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.Language.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
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"));
|
||||
}
|
||||
|
||||
$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). " / <a href=\"../out/out.ViewDocument.php?documentid=".$documentid."\">".$document->getName()."</a>";
|
||||
|
||||
|
||||
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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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']);
|
||||
|
|
|
@ -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). " / <a href=\"../out/out.ViewDocument.php?documentid=".$documentid."\">".$document->getName()."</a>";
|
||||
|
||||
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()){
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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();
|
||||
?>
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
43
op/op.ExtensionMgr.php
Normal file
43
op/op.ExtensionMgr.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
// SeedDMS. Document Management System
|
||||
// Copyright (C) 2013 Uwe Steinmann
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// 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.LogInit.php");
|
||||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
require "../inc/inc.ClassExtensionMgr.php";
|
||||
|
||||
if (!$user->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");
|
||||
?>
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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"),
|
||||
|
|
|
@ -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");
|
||||
?>
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -1,46 +1,48 @@
|
|||
<?php
|
||||
// MyDMS. Document Management System
|
||||
// Copyright (C) 2010 Matteo Lucarelli
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
include("../inc/inc.Settings.php");
|
||||
include("../inc/inc.LogInit.php");
|
||||
<?php
|
||||
// MyDMS. Document Management System
|
||||
// Copyright (C) 2010 Matteo Lucarelli
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
include("../inc/inc.Settings.php");
|
||||
include("../inc/inc.LogInit.php");
|
||||
include("../inc/inc.Language.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");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
if (!$user->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");
|
||||
|
||||
?>
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,39 +1,41 @@
|
|||
<?php
|
||||
// MyDMS. Document Management System
|
||||
// Copyright (C) 2002-2005 Markus Westphal
|
||||
// Copyright (C) 2006-2008 Malcolm Cowe
|
||||
// Copyright (C) 2010 Matteo Lucarelli
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
include("../inc/inc.Settings.php");
|
||||
include("../inc/inc.LogInit.php");
|
||||
include("../inc/inc.Utils.php");
|
||||
<?php
|
||||
// MyDMS. Document Management System
|
||||
// Copyright (C) 2002-2005 Markus Westphal
|
||||
// Copyright (C) 2006-2008 Malcolm Cowe
|
||||
// Copyright (C) 2010 Matteo Lucarelli
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// 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.Language.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");
|
||||
include("../inc/inc.Calendar.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
include("../inc/inc.Calendar.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
/* Check if the form data comes for a trusted request */
|
||||
if(!checkFormKey('removeevent')) {
|
||||
UI::exitError(getMLText("edit_event"),getMLText("invalid_request_token"));
|
||||
}
|
||||
|
||||
if (!isset($_POST["eventid"]) || !is_numeric($_POST["eventid"]) || intval($_POST["eventid"])<1) {
|
||||
UI::exitError(getMLText("edit_event"),getMLText("error_occured"));
|
||||
if (!isset($_POST["eventid"]) || !is_numeric($_POST["eventid"]) || intval($_POST["eventid"])<1) {
|
||||
UI::exitError(getMLText("edit_event"),getMLText("error_occured"));
|
||||
}
|
||||
|
||||
$event=getEvent($_POST["eventid"]);
|
||||
|
@ -43,15 +45,15 @@ if (($user->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"]);
|
||||
|
||||
?>
|
||||
|
|
|
@ -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);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user