diff --git a/inc/inc.ClassDocument.php b/inc/inc.ClassDocument.php index 6b74b830a..45198ab71 100644 --- a/inc/inc.ClassDocument.php +++ b/inc/inc.ClassDocument.php @@ -24,16 +24,9 @@ define("S_RELEASED", 2); define("S_REJECTED", -1); define("S_OBSOLETE", -2); define("S_EXPIRED", -3); - -function getDocument($id) -{ - return LetoDMS_Document::getDocument($id); -} - // these are the document information (all versions) -class LetoDMS_Document -{ +class LetoDMS_Document { /* {{{ */ var $_id; var $_name; var $_comment; @@ -45,6 +38,8 @@ class LetoDMS_Document var $_locked; var $_keywords; var $_sequence; + var $_notifier; + var $_dms; function LetoDMS_Document($id, $name, $comment, $date, $expires, $ownerID, $folderID, $inheritAccess, $defaultAccess, $locked, $keywords, $sequence) { @@ -60,10 +55,19 @@ class LetoDMS_Document $this->_locked = ($locked == null || $locked == '' ? -1 : $locked); $this->_keywords = $keywords; $this->_sequence = $sequence; + $this->_notifier = null; + $this->_dms = null; } - - function getDocument($id) - { + + /** + * Return a document by its id + * + * This function retrieves a document from the database by its id. + * + * @param integer $id internal id of document + * @return object instance of LetoDMS_Document or false + */ + function getDocument($id) { /* {{{ */ GLOBAL $db; if (!is_numeric($id)) return false; @@ -89,7 +93,7 @@ class LetoDMS_Document } return new LetoDMS_Document($resArr["id"], $resArr["name"], $resArr["comment"], $resArr["date"], $resArr["expires"], $resArr["owner"], $resArr["folder"], $resArr["inheritAccess"], $resArr["defaultAccess"], $lock, $resArr["keywords"], $resArr["sequence"]); - } + } /* }}} */ /* * Search the database for documents @@ -264,9 +268,16 @@ class LetoDMS_Document return(array('totalDocs'=>$totalDocs, 'totalPages'=>$totalPages, 'docs'=>$docs)); } + function setDMS($dms) { + $this->_dms = $dms; + } + + function setNotifier($notifier) { + $this->_notifier = $notifier; + } + function getDir() { - global $settings; - return $settings->_contentOffsetDir."/".$this->_id."/"; + return $this->_dms->contentOffsetDir."/".$this->_id."/"; } @@ -275,34 +286,36 @@ class LetoDMS_Document function getName() { return $this->_name; } function setName($newName) { - GLOBAL $db, $user, $settings; + GLOBAL $db, $user; $queryStr = "UPDATE tblDocuments SET name = '" . $newName . "' WHERE id = ". $this->_id; if (!$db->getResult($queryStr)) return false; - // Send notification to subscribers. $this->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_name." - ".getMLText("document_renamed_email"); - $message = getMLText("document_renamed_email")."\r\n"; - $message .= - getMLText("old").": ".$this->_name."\r\n". - getMLText("new").": ".$newName."\r\n". - getMLText("folder").": ".getFolderPathPlain($this->getFolder())."\r\n". - getMLText("comment").": ".$this->getComment()."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->_id."\r\n"; + // Send notification to subscribers. + if($this->_notifier) { + $subject = "###SITENAME###: ".$this->_name." - ".getMLText("document_renamed_email"); + $message = getMLText("document_renamed_email")."\r\n"; + $message .= + getMLText("old").": ".$this->_name."\r\n". + getMLText("new").": ".$newName."\r\n". + getMLText("folder").": ".getFolderPathPlain($this->getFolder())."\r\n". + getMLText("comment").": ".$this->getComment()."\r\n". + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->_id."\r\n"; - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - LetoDMS_Email::toList($user, $this->_notifyList["users"], $subject, $message); - foreach ($this->_notifyList["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + $this->_notifier->toList($user, $this->_notifyList["users"], $subject, $message); + foreach ($this->_notifyList["groups"] as $grp) { + $this->_notifier->toGroup($user, $grp, $subject, $message); + } + + // if user is not owner send notification to owner + if ($user->getID()!= $this->_ownerID) + $this->_notifier->toIndividual($user, $this->getOwner(), $subject, $message); } - - // if user is not owner send notification to owner - if ($user->getID()!= $this->_ownerID) - LetoDMS_Email::toIndividual($user, $this->getOwner(), $subject, $message); $this->_name = $newName; return true; @@ -311,34 +324,39 @@ class LetoDMS_Document function getComment() { return $this->_comment; } function setComment($newComment) { - GLOBAL $db, $user, $settings; + GLOBAL $db, $user; $queryStr = "UPDATE tblDocuments SET comment = '" . $newComment . "' WHERE id = ". $this->_id; if (!$db->getResult($queryStr)) return false; - // Send notification to subscribers. $this->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_name." - ".getMLText("comment_changed_email"); - $message = getMLText("comment_changed_email")."\r\n"; - $message .= - getMLText("document").": ".$this->_name."\r\n". - getMLText("folder").": ".getFolderPathPlain($this->getFolder())."\r\n". - getMLText("comment").": ".$newComment."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->_id."\r\n"; + // Send notification to subscribers. + if($this->_notifier) { + $subject = "###SITENAME###: ".$this->_name." - ".getMLText("comment_changed_email"); + $message = getMLText("comment_changed_email")."\r\n"; + $message .= + getMLText("document").": ".$this->_name."\r\n". + getMLText("folder").": ".getFolderPathPlain($this->getFolder())."\r\n". + getMLText("comment").": ".$newComment."\r\n". + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->_id."\r\n"; - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - LetoDMS_Email::toList($user, $this->_notifyList["users"], $subject, $message); - foreach ($this->_notifyList["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); - } + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + $this->_notifier->toList($user, $this->_notifyList["users"], $subject, $message); + foreach ($this->_notifyList["groups"] as $grp) { + $this->_notifier->toGroup($user, $grp, $subject, $message); + } + // if user is not owner send notification to owner + if ($user->getID()!= $this->_ownerID) + $this->_notifier->toIndividual($user, $this->getOwner(), $subject, $message); + } $this->_comment = $newComment; return true; } - + function getKeywords() { return $this->_keywords; } function setKeywords($newKeywords) @@ -367,7 +385,7 @@ class LetoDMS_Document function setFolder($newFolder) { - GLOBAL $db, $user, $settings; + GLOBAL $db, $user; $queryStr = "UPDATE tblDocuments SET folder = " . $newFolder->getID() . " WHERE id = ". $this->_id; if (!$db->getResult($queryStr)) @@ -388,28 +406,30 @@ class LetoDMS_Document if (!$db->getResult($queryStr)) return false; - // Send notification to subscribers. $this->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_name." - ".getMLText("document_moved_email"); - $message = getMLText("document_moved_email")."\r\n"; - $message .= - getMLText("document").": ".$this->_name."\r\n". - getMLText("folder").": ".getFolderPathPlain($this->getFolder())."\r\n". - getMLText("comment").": ".$newComment."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->_id."\r\n"; + // Send notification to subscribers. + if($this->_notifier) { + $subject = "###SITENAME###: ".$this->_name." - ".getMLText("document_moved_email"); + $message = getMLText("document_moved_email")."\r\n"; + $message .= + getMLText("document").": ".$this->_name."\r\n". + getMLText("folder").": ".getFolderPathPlain($this->getFolder())."\r\n". + getMLText("comment").": ".$newComment."\r\n". + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->_id."\r\n"; - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - LetoDMS_Email::toList($user, $this->_notifyList["users"], $subject, $message); - foreach ($this->_notifyList["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + $this->_notifier->toList($user, $this->_notifyList["users"], $subject, $message); + foreach ($this->_notifyList["groups"] as $grp) { + $this->_notifier->toGroup($user, $grp, $subject, $message); + } + + // if user is not owner send notification to owner + if ($user->getID()!= $this->_ownerID) + $this->_notifier->toIndividual($user, $this->getOwner(), $subject, $message); } - - // if user is not owner send notification to owner - if ($user->getID()!= $this->_ownerID) - LetoDMS_Email::toIndividual($user, $this->getOwner(), $subject, $message); - + return true; } @@ -420,7 +440,7 @@ class LetoDMS_Document } function setOwner($newOwner) { - GLOBAL $db, $user, $settings; + GLOBAL $db, $user; $oldOwner = $this->getOwner(); @@ -428,27 +448,29 @@ class LetoDMS_Document if (!$db->getResult($queryStr)) return false; - // Send notification to subscribers. $this->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_name." - ".getMLText("ownership_changed_email"); - $message = getMLText("ownership_changed_email")."\r\n"; - $message .= - getMLText("document").": ".$this->_name."\r\n". - getMLText("old").": ".$oldOwner->getFullName()."\r\n". - getMLText("new").": ".$newOwner->getFullName()."\r\n". - getMLText("folder").": ".getFolderPathPlain($this->getFolder())."\r\n". - getMLText("comment").": ".$this->_comment."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->_id."\r\n"; + // Send notification to subscribers. + if($this->_notifier) { + $subject = "###SITENAME###: ".$this->_name." - ".getMLText("ownership_changed_email"); + $message = getMLText("ownership_changed_email")."\r\n"; + $message .= + getMLText("document").": ".$this->_name."\r\n". + getMLText("old").": ".$oldOwner->getFullName()."\r\n". + getMLText("new").": ".$newOwner->getFullName()."\r\n". + getMLText("folder").": ".getFolderPathPlain($this->getFolder())."\r\n". + getMLText("comment").": ".$this->_comment."\r\n". + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->_id."\r\n"; - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - LetoDMS_Email::toList($user, $this->_notifyList["users"], $subject, $message); - foreach ($this->_notifyList["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); - } - // Send notification to previous owner. - LetoDMS_Email::toIndividual($user, $oldOwner, $subject, $message); + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + $this->_notifier->toList($user, $this->_notifyList["users"], $subject, $message); + foreach ($this->_notifyList["groups"] as $grp) { + $this->_notifier->toGroup($user, $grp, $subject, $message); + } + // Send notification to previous owner. + $this->_notifier->toIndividual($user, $oldOwner, $subject, $message); + } $this->_ownerID = $newOwner->getID(); $this->_owner = $newOwner; @@ -467,29 +489,31 @@ class LetoDMS_Document } function setDefaultAccess($mode) { - GLOBAL $db, $user, $settings; + GLOBAL $db, $user; $queryStr = "UPDATE tblDocuments set defaultAccess = " . $mode . " WHERE id = " . $this->_id; if (!$db->getResult($queryStr)) return false; - // Send notification to subscribers. $this->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_name." - ".getMLText("access_permission_changed_email"); - $message = getMLText("access_permission_changed_email")."\r\n"; - $message .= - getMLText("document").": ".$this->_name."\r\n". - getMLText("folder").": ".getFolderPathPlain($this->getFolder())."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->_id."\r\n"; + if($this->_notifier) { + // Send notification to subscribers. + $subject = "###SITENAME###: ".$this->_name." - ".getMLText("access_permission_changed_email"); + $message = getMLText("access_permission_changed_email")."\r\n"; + $message .= + getMLText("document").": ".$this->_name."\r\n". + getMLText("folder").": ".getFolderPathPlain($this->getFolder())."\r\n". + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->_id."\r\n"; + + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + $this->_notifier->toList($user, $this->_notifyList["users"], $subject, $message); + foreach ($this->_notifyList["groups"] as $grp) { + $this->_notifier->toGroup($user, $grp, $subject, $message); + } + } - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - LetoDMS_Email::toList($user, $this->_notifyList["users"], $subject, $message); - foreach ($this->_notifyList["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); - } - $this->_defaultAccess = $mode; // If any of the notification subscribers no longer have read access, @@ -511,7 +535,7 @@ class LetoDMS_Document function inheritsAccess() { return $this->_inheritAccess; } function setInheritAccess($inheritAccess) { - GLOBAL $db, $user, $settings; + GLOBAL $db, $user; $queryStr = "UPDATE tblDocuments SET inheritAccess = " . ($inheritAccess ? "1" : "0") . " WHERE id = " . $this->_id; if (!$db->getResult($queryStr)) @@ -519,23 +543,25 @@ class LetoDMS_Document $this->_inheritAccess = ($inheritAccess ? "1" : "0"); - // Send notification to subscribers. $this->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_name." - ".getMLText("access_permission_changed_email"); - $message = getMLText("access_permission_changed_email")."\r\n"; - $message .= - getMLText("document").": ".$this->_name."\r\n". - getMLText("folder").": ".getFolderPathPlain($this->getFolder())."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->_id."\r\n"; + if($this->_notifier) { + // Send notification to subscribers. + $subject = "###SITENAME###: ".$this->_name." - ".getMLText("access_permission_changed_email"); + $message = getMLText("access_permission_changed_email")."\r\n"; + $message .= + getMLText("document").": ".$this->_name."\r\n". + getMLText("folder").": ".getFolderPathPlain($this->getFolder())."\r\n". + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->_id."\r\n"; + + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + $this->_notifier->toList($user, $this->_notifyList["users"], $subject, $message); + foreach ($this->_notifyList["groups"] as $grp) { + $this->_notifier->toGroup($user, $grp, $subject, $message); + } + } - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - LetoDMS_Email::toList($user, $this->_notifyList["users"], $subject, $message); - foreach ($this->_notifyList["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); - } - // If any of the notification subscribers no longer have read access, // remove their subscription. foreach ($this->_notifyList["users"] as $u) { @@ -569,7 +595,7 @@ class LetoDMS_Document } function setExpires($expires) { - GLOBAL $db, $user, $settings; + GLOBAL $db, $user; $expires = (!$expires) ? 0 : $expires; @@ -582,23 +608,25 @@ class LetoDMS_Document if (!$db->getResult($queryStr)) return false; - // Send notification to subscribers. $this->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_name." - ".getMLText("expiry_changed_email"); - $message = getMLText("expiry_changed_email")."\r\n"; - $message .= - getMLText("document").": ".$this->_name."\r\n". - getMLText("folder").": ".getFolderPathPlain($this->getFolder())."\r\n". - getMLText("comment").": ".$this->getComment()."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->_id."\r\n"; + if($this->_notifier) { + // Send notification to subscribers. + $subject = "###SITENAME###: ".$this->_name." - ".getMLText("expiry_changed_email"); + $message = getMLText("expiry_changed_email")."\r\n"; + $message .= + getMLText("document").": ".$this->_name."\r\n". + getMLText("folder").": ".getFolderPathPlain($this->getFolder())."\r\n". + getMLText("comment").": ".$this->getComment()."\r\n". + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->_id."\r\n"; - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - LetoDMS_Email::toList($user, $this->_notifyList["users"], $subject, $message); - foreach ($this->_notifyList["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); - } + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + $this->_notifier->toList($user, $this->_notifyList["users"], $subject, $message); + foreach ($this->_notifyList["groups"] as $grp) { + $this->_notifier->toGroup($user, $grp, $subject, $message); + } + } $this->_expires = $expires; return true; @@ -998,7 +1026,7 @@ class LetoDMS_Document return -4; // Email user / group, informing them of subscription. - if ($send_email){ + if ($send_email && $this->_notifier){ $path=""; $folder = $this->getFolder(); $folderPath = $folder->getPath(); @@ -1007,22 +1035,22 @@ class LetoDMS_Document if ($i +1 < count($folderPath)) $path .= " / "; } - $subject = $settings->_siteName.": ".$this->getName()." - ".getMLText("notify_added_email"); + $subject = "###SITENAME###: ".$this->getName()." - ".getMLText("notify_added_email"); $message = getMLText("notify_added_email")."\r\n"; $message .= getMLText("document").": ".$this->getName()."\r\n". getMLText("folder").": ".$path."\r\n". getMLText("comment").": ".$this->getComment()."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->_id."\r\n"; + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->_id."\r\n"; $subject=mydmsDecodeString($subject); $message=mydmsDecodeString($message); if ($isUser) { - LetoDMS_Email::toIndividual($user, $obj, $subject, $message); + $this->_notifier->toIndividual($user, $obj, $subject, $message); } else { - LetoDMS_Email::toGroup($user, $obj, $subject, $message); + $this->_notifier->toGroup($user, $obj, $subject, $message); } } @@ -1097,23 +1125,25 @@ class LetoDMS_Document if ($i +1 < count($folderPath)) $path .= " / "; } - $subject = $settings->_siteName.": ".$this->getName()." - ".getMLText("notify_deleted_email"); - $message = getMLText("notify_deleted_email")."\r\n"; - $message .= - getMLText("document").": ".$this->getName()."\r\n". - getMLText("folder").": ".$path."\r\n". - getMLText("comment").": ".$this->getComment()."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->_id."\r\n"; + if($this->_notifier) { + $subject = "###SITENAME###: ".$this->getName()." - ".getMLText("notify_deleted_email"); + $message = getMLText("notify_deleted_email")."\r\n"; + $message .= + getMLText("document").": ".$this->getName()."\r\n". + getMLText("folder").": ".$path."\r\n". + getMLText("comment").": ".$this->getComment()."\r\n". + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->_id."\r\n"; - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - if ($isUser) { - LetoDMS_Email::toIndividual($user, $obj, $subject, $message); - } - else { - LetoDMS_Email::toGroup($user, $obj, $subject, $message); - } + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + if ($isUser) { + $this->_notifier->toIndividual($user, $obj, $subject, $message); + } + else { + $this->_notifier->toGroup($user, $obj, $subject, $message); + } + } unset($this->_notifyList); return 0; @@ -1144,12 +1174,12 @@ class LetoDMS_Document } // copy file - if (!makeDir($settings->_contentDir . $dir)) return false; - if (!copyFile($tmpFile, $settings->_contentDir . $dir . $version . $fileType)) return false; + if (!makeDir($this->_dms->contentDir . $dir)) return false; + if (!copyFile($tmpFile, $this->_dms->contentDir . $dir . $version . $fileType)) return false; unset($this->_content); unset($this->_latestContent); - $docResultSet = new LetoDMS_AddContentResultSet(new LetoDMS_DocumentContent($this->_id, $version, $comment, $date, $user->getID(), $dir, $orgFileName, $fileType, $mimeType)); + $docResultSet = new LetoDMS_AddContentResultSet(new LetoDMS_DocumentContent($this, $version, $comment, $date, $user->getID(), $dir, $orgFileName, $fileType, $mimeType)); // TODO - verify if ($settings->_enableConverting && in_array($docResultSet->_content->getFileType(), array_keys($settings->_convertFileTypes))) @@ -1219,29 +1249,29 @@ class LetoDMS_Document $docResultSet->setStatus($status,$comment,$user); + $this->getNotifyList(); // Send notification to subscribers. - if ($send_email){ - $this->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_name." - ".getMLText("document_updated_email"); + if ($send_email && $this->_notifier){ + $subject = "###SITENAME###: ".$this->_name." - ".getMLText("document_updated_email"); $message = getMLText("document_updated_email")."\r\n"; $message .= getMLText("document").": ".$this->_name."\r\n". getMLText("folder").": ".getFolderPathPlain($this->getFolder())."\r\n". getMLText("comment").": ".$this->getComment()."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->_id."\r\n"; + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->_id."\r\n"; $subject=mydmsDecodeString($subject); $message=mydmsDecodeString($message); - LetoDMS_Email::toList($user, $this->_notifyList["users"], $subject, $message); + $this->_notifier->toList($user, $this->_notifyList["users"], $subject, $message); foreach ($this->_notifyList["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); + $this->_notifier->toGroup($user, $grp, $subject, $message); } - } - // if user is not owner send notification to owner - if ($user->getID()!= $this->_ownerID) - LetoDMS_Email::toIndividual($user, $this->getOwner(), $subject, $message); + // if user is not owner send notification to owner + if ($user->getID()!= $this->_ownerID) + $this->_notifier->toIndividual($user, $this->getOwner(), $subject, $message); + } return $docResultSet; } @@ -1259,7 +1289,7 @@ class LetoDMS_Document $this->_content = array(); foreach ($resArr as $row) - array_push($this->_content, new LetoDMS_DocumentContent($row["document"], $row["version"], $row["comment"], $row["date"], $row["createdBy"], $row["dir"], $row["orgFileName"], $row["fileType"], $row["mimeType"])); + array_push($this->_content, new LetoDMS_DocumentContent($this, $row["version"], $row["comment"], $row["date"], $row["createdBy"], $row["dir"], $row["orgFileName"], $row["fileType"], $row["mimeType"])); } return $this->_content; @@ -1288,7 +1318,7 @@ class LetoDMS_Document return false; $resArr = $resArr[0]; - return new LetoDMS_DocumentContent($resArr["document"], $resArr["version"], $resArr["comment"], $resArr["date"], $resArr["createdBy"], $resArr["dir"], $resArr["orgFileName"], $resArr["fileType"], $resArr["mimeType"]); + return new LetoDMS_DocumentContent($this, $resArr["version"], $resArr["comment"], $resArr["date"], $resArr["createdBy"], $resArr["dir"], $resArr["orgFileName"], $resArr["fileType"], $resArr["mimeType"]); } function getLatestContent() @@ -1304,11 +1334,28 @@ class LetoDMS_Document return false; $resArr = $resArr[0]; - $this->_latestContent = new LetoDMS_DocumentContent($resArr["document"], $resArr["version"], $resArr["comment"], $resArr["date"], $resArr["createdBy"], $resArr["dir"], $resArr["orgFileName"], $resArr["fileType"], $resArr["mimeType"]); + $this->_latestContent = new LetoDMS_DocumentContent($this, $resArr["version"], $resArr["comment"], $resArr["date"], $resArr["createdBy"], $resArr["dir"], $resArr["orgFileName"], $resArr["fileType"], $resArr["mimeType"]); } return $this->_latestContent; } + function getDocumentLink($linkID) { + + GLOBAL $db; + + if (!is_numeric($linkID)) return false; + + $queryStr = "SELECT * FROM tblDocumentLinks WHERE document = " . $this->_id ." AND id = " . $linkID; + $resArr = $db->getResultArray($queryStr); + if ((is_bool($resArr) && !$resArr) || count($resArr)==0) + return false; + + $resArr = $resArr[0]; + $document = $this->_dms->getDocument($resArr["document"]); + $target = $this->_dms->getDocument($resArr["target"]); + return new LetoDMS_DocumentLink($resArr["id"], $document, $target, $resArr["userID"], $resArr["public"]); + } + function getDocumentLinks() { if (!isset($this->_documentLinks)) @@ -1321,8 +1368,10 @@ class LetoDMS_Document return false; $this->_documentLinks = array(); - foreach ($resArr as $row) - array_push($this->_documentLinks, new LetoDMS_DocumentLink($row["id"], $row["document"], $row["target"], $row["userID"], $row["public"])); + foreach ($resArr as $row) { + $target = $this->_dms->getDocument($row["target"]); + array_push($this->_documentLinks, new LetoDMS_DocumentLink($row["id"], $this, $target, $row["userID"], $row["public"])); + } } return $this->_documentLinks; } @@ -1345,12 +1394,25 @@ class LetoDMS_Document { GLOBAL $db; - $queryStr = "DELETE FROM tblDocumentLinks WHERE id = " . $linkID; + $queryStr = "DELETE FROM tblDocumentLinks WHERE document = " . $this->_id ." AND id = " . $linkID; if (!$db->getResult($queryStr)) return false; unset ($this->_documentLinks); return true; } + function getDocumentFile($ID) { + GLOBAL $db; + + if (!is_numeric($ID)) return false; + + $queryStr = "SELECT * FROM tblDocumentFiles WHERE document = " . $this->_id ." AND id = " . $ID; + $resArr = $db->getResultArray($queryStr); + if ((is_bool($resArr) && !$resArr) || count($resArr)==0) return false; + + $resArr = $resArr[0]; + return new LetoDMS_DocumentFile($resArr["id"], $this, $resArr["userID"], $resArr["comment"], $resArr["date"], $resArr["dir"], $resArr["fileType"], $resArr["mimeType"], $resArr["orgFileName"], $resArr["name"]); + } + function getDocumentFiles() { if (!isset($this->_documentFiles)) @@ -1363,17 +1425,18 @@ class LetoDMS_Document $this->_documentFiles = array(); - foreach ($resArr as $row) - array_push($this->_documentFiles, new LetoDMS_DocumentFile($row["id"], $row["document"], $row["userID"], $row["comment"], $row["date"], $row["dir"], $row["fileType"], $row["mimeType"], $row["orgFileName"], $row["name"])); + foreach ($resArr as $row) { + array_push($this->_documentFiles, new LetoDMS_DocumentFile($row["id"], $this, $row["userID"], $row["comment"], $row["date"], $row["dir"], $row["fileType"], $row["mimeType"], $row["orgFileName"], $row["name"])); + } } return $this->_documentFiles; } function addDocumentFile($name, $comment, $user, $tmpFile, $orgFileName,$fileType, $mimeType ) { - GLOBAL $db, $settings; + GLOBAL $db; - $dir = $settings->_contentOffsetDir."/".$this->_id."/"; + $dir = $this->getDir(); $queryStr = "INSERT INTO tblDocumentFiles (comment, date, dir, document, fileType, mimeType, orgFileName, userID, name) VALUES ". "('".$comment."', '".mktime()."', '" . $dir ."', " . $this->_id.", '".$fileType."', '".$mimeType."', '".$orgFileName."',".$user->getID().",'".$name."')"; @@ -1381,29 +1444,31 @@ class LetoDMS_Document $id = $db->getInsertID(); - $file = getDocumentFile($id); + $file = $this->getDocumentFile($id); if (is_bool($file) && !$file) return false; // copy file - if (!makeDir($settings->_contentDir . $dir)) return false; - if (!copyFile($tmpFile, $settings->_contentDir . $file->getPath() )) return false; + if (!makeDir($this->_dms->contentDir . $dir)) return false; + if (!copyFile($tmpFile, $this->_dms->contentDir . $file->getPath() )) return false; - // Send notification to subscribers. $this->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_name." - ".getMLText("new_file_email"); - $message = getMLText("new_file_email")."\r\n"; - $message .= - getMLText("name").": ".$name."\r\n". - getMLText("comment").": ".$comment."\r\n". - getMLText("user").": ".$user->getFullName()." <". $user->getEmail() .">\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->getID()."\r\n"; + // Send notification to subscribers. + if($this->_notifier) { + $subject = "###SITENAME###: ".$this->_name." - ".getMLText("new_file_email"); + $message = getMLText("new_file_email")."\r\n"; + $message .= + getMLText("name").": ".$name."\r\n". + getMLText("comment").": ".$comment."\r\n". + getMLText("user").": ".$user->getFullName()." <". $user->getEmail() .">\r\n". + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->getID()."\r\n"; - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - LetoDMS_Email::toList($user, $this->_notifyList["users"], $subject, $message); - foreach ($this->_notifyList["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + $this->_notifier->toList($user, $this->_notifyList["users"], $subject, $message); + foreach ($this->_notifyList["groups"] as $grp) { + $this->_notifier->toGroup($user, $grp, $subject, $message); + } } return true; @@ -1411,47 +1476,51 @@ class LetoDMS_Document function removeDocumentFile($ID) { - global $settings,$user; + global $db, $user; - $file=getDocumentFile($ID); + $file = $this->getDocumentFile($ID); if (is_bool($file) && !$file) return false; - if (file_exists( $settings->_contentDir . $file->getPath() )){ - if (!removeFile( $settings->_contentDir . $file->getPath() )) + if (file_exists( $this->_dms->contentDir . $file->getPath() )){ + if (!removeFile( $this->_dms->contentDir . $file->getPath() )) return false; } $name=$file->getName(); $comment=$file->getcomment(); - $file->remove(); - + $queryStr = "DELETE FROM tblDocumentFiles WHERE document = " . $this->getID() . " AND id = " . $ID; + if (!$db->getResult($queryStr)) + return false; + unset ($this->_documentFiles); - // Send notification to subscribers. $this->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_name." - ".getMLText("removed_file_email"); - $message = getMLText("removed_file_email")."\r\n"; - $message .= - getMLText("name").": ".$name."\r\n". - getMLText("comment").": ".$comment."\r\n". - getMLText("user").": ".$user->getFullName()." <". $user->getEmail() .">\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->getID()."\r\n"; + if($this->_notifier) { + // Send notification to subscribers. + $subject = "###SITENAME###: ".$this->_name." - ".getMLText("removed_file_email"); + $message = getMLText("removed_file_email")."\r\n"; + $message .= + getMLText("name").": ".$name."\r\n". + getMLText("comment").": ".$comment."\r\n". + getMLText("user").": ".$user->getFullName()." <". $user->getEmail() .">\r\n". + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->getID()."\r\n"; - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - LetoDMS_Email::toList($user, $this->_notifyList["users"], $subject, $message); - foreach ($this->_notifyList["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + $this->_notifier->toList($user, $this->_notifyList["users"], $subject, $message); + foreach ($this->_notifyList["groups"] as $grp) { + $this->_notifier->toGroup($user, $grp, $subject, $message); + } } - + return true; } function remove($send_email=TRUE) { - GLOBAL $db, $user, $settings; + GLOBAL $db, $user; $res = $this->getContent(); if (is_bool($res) && !$res) return false; @@ -1470,8 +1539,8 @@ class LetoDMS_Document // TODO: versioning file? - if (file_exists( $settings->_contentDir . $this->getDir() )) - if (!removeDir( $settings->_contentDir . $this->getDir() )) + if (file_exists( $this->_dms->contentDir . $this->getDir() )) + if (!removeDir( $this->_dms->contentDir . $this->getDir() )) return false; $queryStr = "DELETE FROM tblDocuments WHERE id = " . $this->_id; @@ -1499,9 +1568,10 @@ class LetoDMS_Document $path .= " / "; } - if ($send_email){ + $this->getNotifyList(); + if ($send_email && $this->_notifier){ - $subject = $settings->_siteName.": ".$this->getName()." - ".getMLText("document_deleted_email"); + $subject = "###SITENAME###: ".$this->getName()." - ".getMLText("document_deleted_email"); $message = getMLText("document_deleted_email")."\r\n"; $message .= getMLText("document").": ".$this->getName()."\r\n". @@ -1513,10 +1583,9 @@ class LetoDMS_Document $message=mydmsDecodeString($message); // Send notification to subscribers. - $this->getNotifyList(); - LetoDMS_Email::toList($user, $this->_notifyList["users"], $subject, $message); + $this->_notifier->toList($user, $this->_notifyList["users"], $subject, $message); foreach ($this->_notifyList["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); + $this->_notifier->toGroup($user, $grp, $subject, $message); } } @@ -1632,10 +1701,10 @@ class LetoDMS_Document } return $this->_approversList; } -} - - /* ---------------------------------------------------------------------------------------------------- */ - +} /* }}} */ + + /* --------------------------------------------------------------------- */ + /** * Die Datei wird als "data.ext" (z.b. data.txt) gespeichert. Getrennt davon wird in der DB der ursprüngliche * Dateiname festgehalten (-> $orgFileName). Die Datei wird deshalb nicht unter diesem ursprünglichen Namen @@ -1645,8 +1714,7 @@ class LetoDMS_Document */ // these are the version information -class LetoDMS_DocumentContent -{ +class LetoDMS_DocumentContent { /* {{{ */ // if status is released and there are reviewers set status draft_rev // if status is released or draft_rev and there are approves set status draft_app @@ -1685,9 +1753,9 @@ class LetoDMS_DocumentContent else $this->setStatus(S_RELEASED,"",$user); } - function LetoDMS_DocumentContent($documentID, $version, $comment, $date, $userID, $dir, $orgFileName, $fileType, $mimeType) + function LetoDMS_DocumentContent($document, $version, $comment, $date, $userID, $dir, $orgFileName, $fileType, $mimeType) { - $this->_documentID = $documentID; + $this->_document = $document; $this->_version = $version; $this->_comment = $comment; $this->_date = $date; @@ -1696,8 +1764,13 @@ class LetoDMS_DocumentContent $this->_orgFileName = $orgFileName; $this->_fileType = $fileType; $this->_mimeType = $mimeType; + $this->_notifier = null; } + function setNotifier($notifier) { + $this->_notifier = $notifier; + } + function getVersion() { return $this->_version; } function getComment() { return $this->_comment; } function getDate() { return $this->_date; } @@ -1716,36 +1789,33 @@ class LetoDMS_DocumentContent function setComment($newComment) { - GLOBAL $db, $user, $settings; + GLOBAL $db, $user; - $queryStr = "UPDATE tblDocumentContent SET comment = '" . $newComment . "' WHERE `document` = " . $this->_documentID . " AND `version` = " . $this->_version; + $queryStr = "UPDATE tblDocumentContent SET comment = '" . $newComment . "' WHERE `document` = " . $this->_document->getID() . " AND `version` = " . $this->_version; if (!$db->getResult($queryStr)) return false; $this->_comment = $newComment; - // Send notification to subscribers. - if (!isset($this->_document)) { - $this->_document = getDocument($this->_documentID); - } - $nl=$this->_document->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_document->getName().", v.".$this->_version." - ".getMLText("comment_changed_email"); - $message = getMLText("comment_changed_email")."\r\n"; - $message .= - getMLText("document").": ".$this->_document->getName()."\r\n". - getMLText("version").": ".$this->_version."\r\n". - getMLText("comment").": ".$newComment."\r\n". - getMLText("user").": ".$user->getFullName()." <". $user->getEmail() .">\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->_documentID."&version=".$this->_version."\r\n"; + if($this->_notifier) { + $subject = "###SITENAME###: ".$this->_document->getName().", v.".$this->_version." - ".getMLText("comment_changed_email"); + $message = getMLText("comment_changed_email")."\r\n"; + $message .= + getMLText("document").": ".$this->_document->getName()."\r\n". + getMLText("version").": ".$this->_version."\r\n". + getMLText("comment").": ".$newComment."\r\n". + getMLText("user").": ".$user->getFullName()." <". $user->getEmail() .">\r\n". + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->_document->getID()."&version=".$this->_version."\r\n"; - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - LetoDMS_Email::toList($user, $nl["users"], $subject, $message); - foreach ($nl["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + LetoDMS_Email::toList($user, $nl["users"], $subject, $message); + foreach ($nl["groups"] as $grp) { + LetoDMS_Email::toGroup($user, $grp, $subject, $message); + } } return true; @@ -1756,14 +1826,14 @@ class LetoDMS_DocumentContent { GLOBAL $settings; - if (file_exists($settings->_contentDir . $this->_dir . "index.html")) + if (file_exists($this->_document->dms->contentDir . $this->_dir . "index.html")) return true; if (!in_array($this->_fileType, array_keys($settings->_convertFileTypes))) return false; - $source = $settings->_contentDir . $this->_dir . $this->getFileName(); - $target = $settings->_contentDir . $this->_dir . "index.html"; + $source = $this->_document->dms->contentDir . $this->_dir . $this->getFileName(); + $target = $this->_document->dms->contentDir . $this->_dir . "index.html"; // $source = str_replace("/", "\\", $source); // $target = str_replace("/", "\\", $target); @@ -1799,13 +1869,10 @@ class LetoDMS_DocumentContent return false; } - function wasConverted() - { - GLOBAL $settings; - - return file_exists($settings->_contentDir . $this->_dir . "index.html"); - } - + function wasConverted() { + return file_exists($this->_document->dms->contentDir . $this->_dir . "index.html"); + } + function getURL() { GLOBAL $settings; @@ -1813,28 +1880,28 @@ class LetoDMS_DocumentContent if (!$this->viewOnline())return false; if (in_array(strtolower($this->_fileType), $settings->_viewOnlineFileTypes)) - return "/" . $this->_documentID . "/" . $this->_version . "/" . $this->getOriginalFileName(); + return "/" . $this->_document->getID() . "/" . $this->_version . "/" . $this->getOriginalFileName(); else - return "/" . $this->_documentID . "/" . $this->_version . "/index.html"; + return "/" . $this->_document->getID() . "/" . $this->_version . "/index.html"; } // $send_email=FALSE is used when removing entire document // to avoid one email for every version function remove($send_email=TRUE) { - GLOBAL $settings, $db, $user; + GLOBAL $db, $user; $emailList = array(); $emailList[] = $this->_userID; - if (file_exists( $settings->_contentDir.$this->getPath() )) - if (!removeFile( $settings->_contentDir.$this->getPath() )) + if (file_exists( $this->_document->_dms->contentDir.$this->getPath() )) + if (!removeFile( $this->_document->_dms->contentDir.$this->getPath() )) return false; $status = $this->getStatus(); $stID = $status["statusID"]; - $queryStr = "DELETE FROM tblDocumentContent WHERE `document` = " . $this->_documentID . " AND `version` = " . $this->_version; + $queryStr = "DELETE FROM tblDocumentContent WHERE `document` = " . $this->_document->getID() . " AND `version` = " . $this->_version; if (!$db->getResult($queryStr)) return false; @@ -1842,7 +1909,7 @@ class LetoDMS_DocumentContent if (!$db->getResult($queryStr)) return false; - $queryStr = "DELETE FROM `tblDocumentStatus` WHERE `documentID` = '". $this->_documentID ."' AND `version` = '" . $this->_version."'"; + $queryStr = "DELETE FROM `tblDocumentStatus` WHERE `documentID` = '". $this->_document->getID() ."' AND `version` = '" . $this->_version."'"; if (!$db->getResult($queryStr)) return false; @@ -1859,7 +1926,7 @@ class LetoDMS_DocumentContent if (!$db->getResult($queryStr)) return false; } - $queryStr = "DELETE FROM `tblDocumentReviewers` WHERE `documentID` = '". $this->_documentID ."' AND `version` = '" . $this->_version."'"; + $queryStr = "DELETE FROM `tblDocumentReviewers` WHERE `documentID` = '". $this->_document->getID() ."' AND `version` = '" . $this->_version."'"; if (!$db->getResult($queryStr)) return false; $status = $this->getApprovalStatus(); @@ -1875,23 +1942,19 @@ class LetoDMS_DocumentContent if (!$db->getResult($queryStr)) return false; } - $queryStr = "DELETE FROM `tblDocumentApprovers` WHERE `documentID` = '". $this->_documentID ."' AND `version` = '" . $this->_version."'"; + $queryStr = "DELETE FROM `tblDocumentApprovers` WHERE `documentID` = '". $this->_document->getID() ."' AND `version` = '" . $this->_version."'"; if (!$db->getResult($queryStr)) return false; // Notify affected users. - if ($send_email){ + if ($send_email && $this->_notifier){ - if (!isset($this->_document)) { - $this->_document = getDocument($this->_documentID); - } - $recipients = array(); foreach ($emailList as $eID) { $eU = getUser($eID); $recipients[] = $eU; } - $subject = $settings->_siteName.": ".$this->_document->getName().", v.".$this->_version." - ".getMLText("version_deleted_email"); + $subject = "###SITENAME###: ".$this->_document->getName().", v.".$this->_version." - ".getMLText("version_deleted_email"); $message = getMLText("version_deleted_email")."\r\n"; $message .= getMLText("document").": ".$this->_document->getName()."\r\n". @@ -1931,7 +1994,7 @@ class LetoDMS_DocumentContent "LEFT JOIN `tblDocumentStatusLog` USING (`statusID`) ". "LEFT JOIN `ttstatid` ON `ttstatid`.`maxLogID` = `tblDocumentStatusLog`.`statusLogID` ". "WHERE `ttstatid`.`maxLogID`=`tblDocumentStatusLog`.`statusLogID` ". - "AND `tblDocumentStatus`.`documentID` = '". $this->_documentID ."' ". + "AND `tblDocumentStatus`.`documentID` = '". $this->_document->getID() ."' ". "AND `tblDocumentStatus`.`version` = '". $this->_version ."' "; $res = $db->getResultArray($queryStr); if (is_bool($res) && !$res) @@ -1967,28 +2030,27 @@ class LetoDMS_DocumentContent if (is_bool($res) && !$res) return false; - // Send notification to subscribers. - if (!isset($this->_document)) { - $this->_document = getDocument($this->_documentID); - } $nl=$this->_document->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_document->_name." - ".getMLText("document_status_changed_email"); - $message = getMLText("document_status_changed_email")."\r\n"; - $message .= - getMLText("document").": ".$this->_document->_name."\r\n". - getMLText("status").": ".getOverallStatusText($status)."\r\n". - getMLText("folder").": ".getFolderPathPlain($this->_document->getFolder())."\r\n". - getMLText("comment").": ".$this->_document->getComment()."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->_documentID."&version=".$this->_version."\r\n"; + // Send notification to subscribers. + if($this->_notifier) { + $subject = "###SITENAME###: ".$this->_document->_name." - ".getMLText("document_status_changed_email"); + $message = getMLText("document_status_changed_email")."\r\n"; + $message .= + getMLText("document").": ".$this->_document->_name."\r\n". + getMLText("status").": ".getOverallStatusText($status)."\r\n". + getMLText("folder").": ".getFolderPathPlain($this->_document->getFolder())."\r\n". + getMLText("comment").": ".$this->_document->getComment()."\r\n". + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->_document->getID()."&version=".$this->_version."\r\n"; - $uu = (is_null($updateUser) ? getUser($settings->_adminID) : $updateUser); + $uu = (is_null($updateUser) ? getUser($settings->_adminID) : $updateUser); - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - LetoDMS_Email::toList($uu, $nl["users"], $subject, $message); - foreach ($nl["groups"] as $grp) { - LetoDMS_Email::toGroup($uu, $grp, $subject, $message); + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + LetoDMS_Email::toList($uu, $nl["users"], $subject, $message); + foreach ($nl["groups"] as $grp) { + LetoDMS_Email::toGroup($uu, $grp, $subject, $message); + } } // TODO: if user os not owner send notification to owner @@ -2014,7 +2076,7 @@ class LetoDMS_DocumentContent "LEFT JOIN `tblUsers` on `tblUsers`.`id` = `tblDocumentReviewers`.`required`". "LEFT JOIN `tblGroups` on `tblGroups`.`id` = `tblDocumentReviewers`.`required`". "WHERE `ttreviewid`.`maxLogID`=`tblDocumentReviewLog`.`reviewLogID` ". - "AND `tblDocumentReviewers`.`documentID` = '". $this->_documentID ."' ". + "AND `tblDocumentReviewers`.`documentID` = '". $this->_document->getID() ."' ". "AND `tblDocumentReviewers`.`version` = '". $this->_version ."' "; $res = $db->getResultArray($queryStr); if (is_bool($res) && !$res) @@ -2044,7 +2106,7 @@ class LetoDMS_DocumentContent "LEFT JOIN `tblUsers` on `tblUsers`.`id` = `tblDocumentApprovers`.`required`". "LEFT JOIN `tblGroups` on `tblGroups`.`id` = `tblDocumentApprovers`.`required`". "WHERE `ttapproveid`.`maxLogID`=`tblDocumentApproveLog`.`approveLogID` ". - "AND `tblDocumentApprovers`.`documentID` = '". $this->_documentID ."' ". + "AND `tblDocumentApprovers`.`documentID` = '". $this->_document->getID() ."' ". "AND `tblDocumentApprovers`.`version` = '". $this->_version ."'"; $res = $db->getResultArray($queryStr); if (is_bool($res) && !$res) @@ -2056,12 +2118,9 @@ class LetoDMS_DocumentContent function addIndReviewer($user, $requestUser, $sendEmail=false) { - GLOBAL $db, $settings; + GLOBAL $db; $userID = $user->getID(); - if (!isset($this->_document)) { - $this->_document = getDocument($this->_documentID); - } // Get the list of users and groups with write access to this document. if (!isset($this->_approversList)) { @@ -2079,7 +2138,7 @@ class LetoDMS_DocumentContent } // Check to see if the user has already been added to the review list. - $reviewStatus = $user->getReviewStatus($this->_documentID, $this->_version); + $reviewStatus = $user->getReviewStatus($this->_document->getID(), $this->_version); if (is_bool($reviewStatus) && !$reviewStatus) { return -1; } @@ -2091,7 +2150,7 @@ class LetoDMS_DocumentContent // Add the user into the review database. if (! isset($reviewStatus["indstatus"][0]["status"])|| (isset($reviewStatus["indstatus"][0]["status"]) && $reviewStatus["indstatus"][0]["status"]!=-2)) { $queryStr = "INSERT INTO `tblDocumentReviewers` (`documentID`, `version`, `type`, `required`) ". - "VALUES ('". $this->_documentID ."', '". $this->_version ."', '0', '". $userID ."')"; + "VALUES ('". $this->_document->getID() ."', '". $this->_version ."', '0', '". $userID ."')"; $res = $db->getResult($queryStr); if (is_bool($res) && !$res) { return -1; @@ -2113,15 +2172,15 @@ class LetoDMS_DocumentContent //$this->_document->addNotify($userID, true); // Send an email notification to the new reviewer. - if ($sendEmail) { - $subject = $settings->_siteName.": ".$this->_document->getName().", v.".$this->_version." - ".getMLText("review_request_email"); + if ($sendEmail && $this->_notifier) { + $subject = "###SITENAME###: ".$this->_document->getName().", v.".$this->_version." - ".getMLText("review_request_email"); $message = getMLText("review_request_email")."\r\n"; $message .= getMLText("document").": ".$this->_document->getName()."\r\n". getMLText("version").": ".$this->_version."\r\n". getMLText("comment").": ".$this->getComment()."\r\n". getMLText("user").": ".$requestUser->getFullName()." <". $requestUser->getEmail() .">\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->_documentID."&version=".$this->_version."\r\n"; + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->_document->getID()."&version=".$this->_version."\r\n"; $subject=mydmsDecodeString($subject); $message=mydmsDecodeString($message); @@ -2132,12 +2191,9 @@ class LetoDMS_DocumentContent } function addGrpReviewer($group, $requestUser, $sendEmail=false) { - GLOBAL $db, $settings; + GLOBAL $db; $groupID = $group->getID(); - if (!isset($this->_document)) { - $this->_document = getDocument($this->_documentID); - } // Get the list of users and groups with write access to this document. if (!isset($this->_approversList)) { @@ -2156,7 +2212,7 @@ class LetoDMS_DocumentContent } // Check to see if the group has already been added to the review list. - $reviewStatus = $group->getReviewStatus($this->_documentID, $this->_version); + $reviewStatus = $group->getReviewStatus($this->_document->getID(), $this->_version); if (is_bool($reviewStatus) && !$reviewStatus) { return -1; } @@ -2168,7 +2224,7 @@ class LetoDMS_DocumentContent // Add the group into the review database. if (!isset($reviewStatus[0]["status"]) || (isset($reviewStatus[0]["status"]) && $reviewStatus[0]["status"]!=-2)) { $queryStr = "INSERT INTO `tblDocumentReviewers` (`documentID`, `version`, `type`, `required`) ". - "VALUES ('". $this->_documentID ."', '". $this->_version ."', '1', '". $groupID ."')"; + "VALUES ('". $this->_document->getID() ."', '". $this->_version ."', '1', '". $groupID ."')"; $res = $db->getResult($queryStr); if (is_bool($res) && !$res) { return -1; @@ -2190,15 +2246,15 @@ class LetoDMS_DocumentContent //$this->_document->addNotify($groupID, false); // Send an email notification to the new reviewer. - if ($sendEmail) { - $subject = $settings->_siteName.": ".$this->_document->getName().", v.".$this->_version." - ".getMLText("review_request_email"); + if ($sendEmail && $this->_notifier) { + $subject = "###SITENAME###: ".$this->_document->getName().", v.".$this->_version." - ".getMLText("review_request_email"); $message = getMLText("review_request_email")."\r\n"; $message .= getMLText("document").": ".$this->_document->getName()."\r\n". getMLText("version").": ".$this->_version."\r\n". getMLText("comment").": ".$this->getComment()."\r\n". getMLText("user").": ".$requestUser->getFullName()." <". $requestUser->getEmail() .">\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->_documentID."&version=".$this->_version."\r\n"; + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->_document->getID()."&version=".$this->_version."\r\n"; $subject=mydmsDecodeString($subject); $message=mydmsDecodeString($message); @@ -2209,13 +2265,10 @@ class LetoDMS_DocumentContent } function addIndApprover($user, $requestUser, $sendEmail=false) { - GLOBAL $db, $settings; + GLOBAL $db; $userID = $user->getID(); - if (!isset($this->_document)) { - $this->_document = getDocument($this->_documentID); - } - + // Get the list of users and groups with write access to this document. if (!isset($this->_approversList)) { // TODO: error checking. @@ -2233,7 +2286,7 @@ class LetoDMS_DocumentContent } // Check to see if the user has already been added to the approvers list. - $approvalStatus = $user->getApprovalStatus($this->_documentID, $this->_version); + $approvalStatus = $user->getApprovalStatus($this->_document->getID(), $this->_version); if (is_bool($approvalStatus) && !$approvalStatus) { return -1; } @@ -2245,7 +2298,7 @@ class LetoDMS_DocumentContent if ( !isset($approvalStatus["indstatus"][0]["status"]) || (isset($approvalStatus["indstatus"][0]["status"]) && $approvalStatus["indstatus"][0]["status"]!=-2)) { // Add the user into the approvers database. $queryStr = "INSERT INTO `tblDocumentApprovers` (`documentID`, `version`, `type`, `required`) ". - "VALUES ('". $this->_documentID ."', '". $this->_version ."', '0', '". $userID ."')"; + "VALUES ('". $this->_document->getID() ."', '". $this->_version ."', '0', '". $userID ."')"; $res = $db->getResult($queryStr); if (is_bool($res) && !$res) { return -1; @@ -2264,15 +2317,15 @@ class LetoDMS_DocumentContent } // Send an email notification to the new approver. - if ($sendEmail) { - $subject = $settings->_siteName.": ".$this->_document->getName().", v.".$this->_version." - ".getMLText("approval_request_email"); + if ($sendEmail && $this->_notifier) { + $subject = "###SITENAME###: ".$this->_document->getName().", v.".$this->_version." - ".getMLText("approval_request_email"); $message = getMLText("approval_request_email")."\r\n"; $message .= getMLText("document").": ".$this->_document->getName()."\r\n". getMLText("version").": ".$this->_version."\r\n". getMLText("comment").": ".$this->getComment()."\r\n". getMLText("user").": ".$requestUser->getFullName()." <". $requestUser->getEmail() .">\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->_documentID."&version=".$this->_version."\r\n"; + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->_document->getID()."&version=".$this->_version."\r\n"; $subject=mydmsDecodeString($subject); $message=mydmsDecodeString($message); @@ -2283,13 +2336,10 @@ class LetoDMS_DocumentContent } function addGrpApprover($group, $requestUser, $sendEmail=false) { - GLOBAL $db, $settings; + GLOBAL $db; $groupID = $group->getID(); - if (!isset($this->_document)) { - $this->_document = getDocument($this->_documentID); - } - + // Get the list of users and groups with write access to this document. if (!isset($this->_approversList)) { // TODO: error checking. @@ -2307,7 +2357,7 @@ class LetoDMS_DocumentContent } // Check to see if the group has already been added to the approver list. - $approvalStatus = $group->getApprovalStatus($this->_documentID, $this->_version); + $approvalStatus = $group->getApprovalStatus($this->_document->getID(), $this->_version); if (is_bool($approvalStatus) && !$approvalStatus) { return -1; } @@ -2319,7 +2369,7 @@ class LetoDMS_DocumentContent // Add the group into the approver database. if (!isset($approvalStatus[0]["status"]) || (isset($approvalStatus[0]["status"]) && $approvalStatus[0]["status"]!=-2)) { $queryStr = "INSERT INTO `tblDocumentApprovers` (`documentID`, `version`, `type`, `required`) ". - "VALUES ('". $this->_documentID ."', '". $this->_version ."', '1', '". $groupID ."')"; + "VALUES ('". $this->_document->getID() ."', '". $this->_version ."', '1', '". $groupID ."')"; $res = $db->getResult($queryStr); if (is_bool($res) && !$res) { return -1; @@ -2341,15 +2391,15 @@ class LetoDMS_DocumentContent //$this->_document->addNotify($groupID, false); // Send an email notification to the new approver. - if ($sendEmail) { - $subject = $settings->_siteName.": ".$this->_document->getName().", v.".$this->_version." - ".getMLText("approval_request_email"); + if ($sendEmail && $this->_notifier) { + $subject = "###SITENAME###: ".$this->_document->getName().", v.".$this->_version." - ".getMLText("approval_request_email"); $message = getMLText("approval_request_email")."\r\n"; $message .= getMLText("document").": ".$this->_document->getName()."\r\n". getMLText("version").": ".$this->_version."\r\n". getMLText("comment").": ".$this->getComment()."\r\n". getMLText("user").": ".$requestUser->getFullName()." <". $requestUser->getEmail() .">\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->_documentID."&version=".$this->_version."\r\n"; + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->_document->getID()."&version=".$this->_version."\r\n"; $subject=mydmsDecodeString($subject); $message=mydmsDecodeString($message); @@ -2360,12 +2410,12 @@ class LetoDMS_DocumentContent } function delIndReviewer($user, $requestUser, $sendEmail=false) { - GLOBAL $db, $settings; + GLOBAL $db; $userID = $user->getID(); // Check to see if the user can be removed from the review list. - $reviewStatus = $user->getReviewStatus($this->_documentID, $this->_version); + $reviewStatus = $user->getReviewStatus($this->_document->getID(), $this->_version); if (is_bool($reviewStatus) && !$reviewStatus) { return -1; } @@ -2388,20 +2438,16 @@ class LetoDMS_DocumentContent } // Send an email notification to the reviewer. - if ($sendEmail) { + if ($sendEmail && $this->_notifier) { - if (!isset($this->_document)) { - $this->_document = getDocument($this->_documentID); - } - - $subject = $settings->_siteName.": ".$this->_document->getName().", v.".$this->_version." - ".getMLText("review_deletion_email"); + $subject = "###SITENAME###: ".$this->_document->getName().", v.".$this->_version." - ".getMLText("review_deletion_email"); $message = getMLText("review_deletion_email")."\r\n"; $message .= getMLText("document").": ".$this->_document->getName()."\r\n". getMLText("version").": ".$this->_version."\r\n". getMLText("comment").": ".$this->getComment()."\r\n". getMLText("user").": ".$requestUser->getFullName()." <". $requestUser->getEmail() .">\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->_documentID."\r\n"; + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->_document->getID()."\r\n"; $subject=mydmsDecodeString($subject); $message=mydmsDecodeString($message); @@ -2412,12 +2458,12 @@ class LetoDMS_DocumentContent } function delGrpReviewer($group, $requestUser, $sendEmail=false) { - GLOBAL $db, $settings; + GLOBAL $db; $groupID = $group->getID(); // Check to see if the user can be removed from the review list. - $reviewStatus = $group->getReviewStatus($this->_documentID, $this->_version); + $reviewStatus = $group->getReviewStatus($this->_document->getID(), $this->_version); if (is_bool($reviewStatus) && !$reviewStatus) { return -1; } @@ -2440,20 +2486,16 @@ class LetoDMS_DocumentContent } // Send an email notification to the review group. - if ($sendEmail) { + if ($sendEmail && $this->_notifier) { - if (!isset($this->_document)) { - $this->_document = getDocument($this->_documentID); - } - - $subject = $settings->_siteName.": ".$this->_document->getName().", v.".$this->_version." - ".getMLText("review_deletion_email"); + $subject = "###SITENAME###: ".$this->_document->getName().", v.".$this->_version." - ".getMLText("review_deletion_email"); $message = getMLText("review_deletion_email")."\r\n"; $message .= getMLText("document").": ".$this->_document->getName()."\r\n". getMLText("version").": ".$this->_version."\r\n". getMLText("comment").": ".$this->getComment()."\r\n". getMLText("user").": ".$requestUser->getFullName()." <". $requestUser->getEmail() .">\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->_documentID."\r\n"; + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->_document->getID()."\r\n"; $subject=mydmsDecodeString($subject); $message=mydmsDecodeString($message); @@ -2464,12 +2506,12 @@ class LetoDMS_DocumentContent } function delIndApprover($user, $requestUser, $sendEmail=false) { - GLOBAL $db, $settings; + GLOBAL $db; $userID = $user->getID(); // Check to see if the user can be removed from the approval list. - $approvalStatus = $user->getApprovalStatus($this->_documentID, $this->_version); + $approvalStatus = $user->getApprovalStatus($this->_document->getID(), $this->_version); if (is_bool($approvalStatus) && !$approvalStatus) { return -1; } @@ -2492,20 +2534,16 @@ class LetoDMS_DocumentContent } // Send an email notification to the approver. - if ($sendEmail) { + if ($sendEmail && $this->_notifier) { - if (!isset($this->_document)) { - $this->_document = getDocument($this->_documentID); - } - - $subject = $settings->_siteName.": ".$this->_document->getName().", v.".$this->_version." - ".getMLText("approval_deletion_email"); + $subject = "###SITENAME###: ".$this->_document->getName().", v.".$this->_version." - ".getMLText("approval_deletion_email"); $message = getMLText("approval_deletion_email")."\r\n"; $message .= getMLText("document").": ".$this->_document->getName()."\r\n". getMLText("version").": ".$this->_version."\r\n". getMLText("comment").": ".$this->getComment()."\r\n". getMLText("user").": ".$requestUser->getFullName()." <". $requestUser->getEmail() .">\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->_documentID."\r\n"; + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->_document->getID()."\r\n"; $subject=mydmsDecodeString($subject); $message=mydmsDecodeString($message); @@ -2516,12 +2554,12 @@ class LetoDMS_DocumentContent } function delGrpApprover($group, $requestUser, $sendEmail=false) { - GLOBAL $db, $settings; + GLOBAL $db; $groupID = $group->getID(); // Check to see if the user can be removed from the approver list. - $approvalStatus = $group->getApprovalStatus($this->_documentID, $this->_version); + $approvalStatus = $group->getApprovalStatus($this->_document->getID(), $this->_version); if (is_bool($approvalStatus) && !$approvalStatus) { return -1; } @@ -2544,20 +2582,16 @@ class LetoDMS_DocumentContent } // Send an email notification to the approval group. - if ($sendEmail) { + if ($sendEmail && $this->_notifier) { - if (!isset($this->_document)) { - $this->_document = getDocument($this->_documentID); - } - - $subject = $settings->_siteName.": ".$this->_document->getName().", v.".$this->_version." - ".getMLText("approval_deletion_email"); + $subject = "###SITENAME###: ".$this->_document->getName().", v.".$this->_version." - ".getMLText("approval_deletion_email"); $message = getMLText("approval_deletion_email")."\r\n"; $message .= getMLText("document").": ".$this->_document->getName()."\r\n". getMLText("version").": ".$this->_version."\r\n". getMLText("comment").": ".$this->getComment()."\r\n". getMLText("user").": ".$requestUser->getFullName()." <". $requestUser->getEmail() .">\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$this->_documentID."\r\n"; + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$this->_document->getID()."\r\n"; $subject=mydmsDecodeString($subject); $message=mydmsDecodeString($message); @@ -2565,16 +2599,12 @@ class LetoDMS_DocumentContent return (LetoDMS_Email::toGroup($requestUser, $group, $subject, $message) < 0 ? -4 : 0); } return 0; - } -} + } +} /* }}} */ /* ----------------------------------------------------------------------- */ -function getDocumentLink($linkID) { - return LetoDMS_DocumentLink::getDocumentLink($linkID); -} - function filterDocumentLinks($user, $links) { GLOBAL $settings; @@ -2586,51 +2616,31 @@ function filterDocumentLinks($user, $links) return $tmp; } -class LetoDMS_DocumentLink -{ +class LetoDMS_DocumentLink { /* {{{ */ var $_id; - var $_documentID; - var $_targetID; + var $_document; + var $_target; var $_userID; var $_public; - function LetoDMS_DocumentLink($id, $documentID, $targetID, $userID, $public) + function LetoDMS_DocumentLink($id, $document, $target, $userID, $public) { $this->_id = $id; - $this->_documentID = $documentID; - $this->_targetID = $targetID; + $this->_document = $document; + $this->_target = $target; $this->_userID = $userID; $this->_public = $public; } - function getDocumentLink($linkID) { - - GLOBAL $db; - - if (!is_numeric($linkID)) return false; - - $queryStr = "SELECT * FROM tblDocumentLinks WHERE id = " . $linkID; - $resArr = $db->getResultArray($queryStr); - if ((is_bool($resArr) && !$resArr) || count($resArr)==0) - return false; - - $resArr = $resArr[0]; - return new LetoDMS_DocumentLink($resArr["id"], $resArr["document"], $resArr["target"], $resArr["userID"], $resArr["public"]); - } - function getID() { return $this->_id; } function getDocument() { - if (!isset($this->_document)) - $this->_document = LetoDMS_Document::getDocument($this->_documentID); return $this->_document; } function getTarget() { - if (!isset($this->_target)) - $this->_target = LetoDMS_Document::getDocument($this->_targetID); return $this->_target; } @@ -2643,7 +2653,7 @@ class LetoDMS_DocumentLink function isPublic() { return $this->_public; } - function remove() + function __remove() // Do not use anymore { GLOBAL $db; @@ -2653,18 +2663,13 @@ class LetoDMS_DocumentLink return true; } -} +} /* }}} */ - /* ---------------------------------------------------------------------------------------------------- */ - -function getDocumentFile($ID) { - return LetoDMS_DocumentFile::getDocumentFile($ID); -} +/* ---------------------------------------------------------------------- */ -class LetoDMS_DocumentFile -{ +class LetoDMS_DocumentFile { /* {{{ */ var $_id; - var $_documentID; + var $_document; var $_userID; var $_comment; var $_date; @@ -2674,10 +2679,10 @@ class LetoDMS_DocumentFile var $_orgFileName; var $_name; - function LetoDMS_DocumentFile($id, $documentID, $userID, $comment, $date, $dir, $fileType, $mimeType, $orgFileName,$name) + function LetoDMS_DocumentFile($id, $document, $userID, $comment, $date, $dir, $fileType, $mimeType, $orgFileName,$name) { $this->_id = $id; - $this->_documentID = $documentID; + $this->_document = $document; $this->_userID = $userID; $this->_comment = $comment; $this->_date = $date; @@ -2688,21 +2693,8 @@ class LetoDMS_DocumentFile $this->_name = $name; } - function getDocumentFile($ID) { - GLOBAL $db; - - if (!is_numeric($ID)) return false; - - $queryStr = "SELECT * FROM tblDocumentFiles WHERE id = " . $ID; - $resArr = $db->getResultArray($queryStr); - if ((is_bool($resArr) && !$resArr) || count($resArr)==0) return false; - - $resArr = $resArr[0]; - return new LetoDMS_DocumentFile($resArr["id"], $resArr["document"], $resArr["userID"], $resArr["comment"], $resArr["date"], $resArr["dir"], $resArr["fileType"], $resArr["mimeType"], $resArr["orgFileName"], $resArr["name"]); - } - function getID() { return $this->_id; } - function getDocumentID() { return $this->_documentID; } + function getDocument() { return $this->_document; } function getUserID() { return $this->_userID; } function getComment() { return $this->_comment; } function getDate() { return $this->_date; } @@ -2724,30 +2716,30 @@ class LetoDMS_DocumentFile return $this->_dir . "f" .$this->_id . $this->_fileType; } - function remove() + function __remove() // do not use anymore, will be called from document->removeDocumentFile { - GLOBAL $db,$settings; + GLOBAL $db; - if (file_exists( $settings->_contentDir.$this->getPath() )) - if (!removeFile( $settings->_contentDir.$this->getPath() )) + if (file_exists( $this->_document->_dms->contentDir.$this->getPath() )) + if (!removeFile( $this->_document->_dms->contentDir.$this->getPath() )) return false; - $queryStr = "DELETE FROM tblDocumentFiles WHERE id = " . $this->_id; + $queryStr = "DELETE FROM tblDocumentFiles WHERE document = " . $this->_document->getID() . " AND id = " . $this->_id; if (!$db->getResult($queryStr)) return false; return true; } -} - +} /* }}} */ + // // Perhaps not the cleanest object ever devised, it exists to encapsulate all // of the data generated during the addition of new content to the database. // The object stores a copy of the new DocumentContent object, the newly assigned // reviewers and approvers and the status. // -class LetoDMS_AddContentResultSet { +class LetoDMS_AddContentResultSet { /* {{{ */ var $_indReviewers; var $_grpReviewers; @@ -2856,5 +2848,5 @@ class LetoDMS_AddContentResultSet { return ($this->_grpApprovers == null ? array() : $this->_grpApprovers); } } -} +} /* }}} */ ?> diff --git a/inc/inc.ClassEmail.php b/inc/inc.ClassEmail.php index 7f4f831f8..a2d2d815d 100644 --- a/inc/inc.ClassEmail.php +++ b/inc/inc.ClassEmail.php @@ -18,7 +18,9 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -class LetoDMS_Email { +require_once("inc.ClassNotify.php"); + +class LetoDMS_Email extends LetoDMS_Notify { function toIndividual($sender, $recipient, $subject, $message) { @@ -38,7 +40,7 @@ class LetoDMS_Email { $message = getMLText("email_header")."\r\n\r\n".$message; $message .= "\r\n\r\n".getMLText("email_footer"); - return (mail($recipient->getEmail(), $subject, $message, $header) ? 0 : -1); + return (mail($recipient->getEmail(), $this->replaceMarker($subject), $this->replaceMarker($message), $header) ? 0 : -1); } function toGroup($sender, $groupRecipient, $subject, $message) { @@ -68,7 +70,7 @@ class LetoDMS_Email { $message = getMLText("email_header")."\r\n\r\n".$message; $message .= "\r\n\r\n".getMLText("email_footer"); - return (mail($toList, $subject, $message, $header) ? 0 : -1); + return (mail($toList, parent::replaceMarker($subject), parent::replaceMarker($message), $header) ? 0 : -1); } function toList($sender, $recipients, $subject, $message) { @@ -100,7 +102,7 @@ class LetoDMS_Email { $message = getMLText("email_header")."\r\n\r\n".$message; $message .= "\r\n\r\n".getMLText("email_footer"); - return (mail($toList, $subject, $message, $header) ? 0 : -1); + return (mail($toList, $this->replaceMarker($subject), $this->replaceMarker($message), $header) ? 0 : -1); } } ?> diff --git a/inc/inc.ClassFolder.php b/inc/inc.ClassFolder.php index d396e4ee3..69ff97313 100644 --- a/inc/inc.ClassFolder.php +++ b/inc/inc.ClassFolder.php @@ -45,6 +45,8 @@ class LetoDMS_Folder var $_inheritAccess; var $_defaultAccess; var $_sequence; + var $_notifier; + var $_dms; function LetoDMS_Folder($id, $name, $parentID, $comment, $ownerID, $inheritAccess, $defaultAccess, $sequence) { @@ -56,6 +58,8 @@ class LetoDMS_Folder $this->_inheritAccess = $inheritAccess; $this->_defaultAccess = $defaultAccess; $this->_sequence = $sequence; + $this->_notifier = null; + $this->_dms = null; } function getFolder($id) @@ -76,35 +80,41 @@ class LetoDMS_Folder return new LetoDMS_Folder($resArr["id"], $resArr["name"], $resArr["parent"], $resArr["comment"], $resArr["owner"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["sequence"]); } + function setDMS($dms) { + $this->_dms = $dms; + } + function getID() { return $this->_id; } function getName() { return $this->_name; } function setName($newName) { - GLOBAL $db, $user, $settings; + GLOBAL $db, $user; $queryStr = "UPDATE tblFolders SET name = '" . $newName . "' WHERE id = ". $this->_id; if (!$db->getResult($queryStr)) return false; // Send notification to subscribers. - $this->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_name." - ".getMLText("folder_renamed_email"); - $message = getMLText("folder_renamed_email")."\r\n"; - $message .= - getMLText("old").": ".$this->_name."\r\n". - getMLText("new").": ".$newName."\r\n". - getMLText("folder").": ".getFolderPathPlain($this)."\r\n". - getMLText("comment").": ".$this->getComment()."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$this->_id."\r\n"; + if($this->_notifier) { + $this->getNotifyList(); + $subject = "###SITENAME###: ".$this->_name." - ".getMLText("folder_renamed_email"); + $message = getMLText("folder_renamed_email")."\r\n"; + $message .= + getMLText("old").": ".$this->_name."\r\n". + getMLText("new").": ".$newName."\r\n". + getMLText("folder").": ".$this->getFolderPathPlain()."\r\n". + getMLText("comment").": ".$this->getComment()."\r\n". + "URL: ###URL_PREFIX###out/out.ViewFolder.php?folderid=".$this->_id."\r\n"; - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - LetoDMS_Email::toList($user, $this->_notifyList["users"], $subject, $message); - foreach ($this->_notifyList["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); - } + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + $this->_notifier->toList($user, $this->_notifyList["users"], $subject, $message); + foreach ($this->_notifyList["groups"] as $grp) { + $this->_notifier->toGroup($user, $grp, $subject, $message); + } + } $this->_name = $newName; @@ -114,29 +124,31 @@ class LetoDMS_Folder function getComment() { return $this->_comment; } function setComment($newComment) { - GLOBAL $db, $user, $settings; + GLOBAL $db, $user; $queryStr = "UPDATE tblFolders SET comment = '" . $newComment . "' WHERE id = ". $this->_id; if (!$db->getResult($queryStr)) return false; // Send notification to subscribers. - $this->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_name." - ".getMLText("comment_changed_email"); - $message = getMLText("comment_changed_email")."\r\n"; - $message .= - getMLText("name").": ".$this->_name."\r\n". - getMLText("folder").": ".getFolderPathPlain($this)."\r\n". - getMLText("comment").": ".$newComment."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$this->_id."\r\n"; + if($this->_notifier) { + $this->getNotifyList(); + $subject = "###SITENAME###: ".$this->_name." - ".getMLText("comment_changed_email"); + $message = getMLText("comment_changed_email")."\r\n"; + $message .= + getMLText("name").": ".$this->_name."\r\n". + getMLText("folder").": ".$this->getFolderPathPlain()."\r\n". + getMLText("comment").": ".$newComment."\r\n". + "URL: ###URL_PREFIX###out/out.ViewFolder.php?folderid=".$this->_id."\r\n"; - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - LetoDMS_Email::toList($user, $this->_notifyList["users"], $subject, $message); - foreach ($this->_notifyList["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); - } + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + $this->_notifier->toList($user, $this->_notifyList["users"], $subject, $message); + foreach ($this->_notifyList["groups"] as $grp) { + $this->_notifier->toGroup($user, $grp, $subject, $message); + } + } $this->_comment = $newComment; return true; @@ -193,22 +205,24 @@ class LetoDMS_Folder } // Send notification to subscribers. - $this->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_name." - ".getMLText("folder_moved_email"); - $message = getMLText("folder_moved_email")."\r\n"; - $message .= - getMLText("name").": ".$this->_name."\r\n". - getMLText("folder").": ".getFolderPathPlain($this)."\r\n". - getMLText("comment").": ".$this->_comment."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$this->_id."\r\n"; + if($this->_notifier) { + $this->getNotifyList(); + $subject = "###SITENAME###: ".$this->_name." - ".getMLText("folder_moved_email"); + $message = getMLText("folder_moved_email")."\r\n"; + $message .= + getMLText("name").": ".$this->_name."\r\n". + getMLText("folder").": ".$this->getFolderPathPlain()."\r\n". + getMLText("comment").": ".$this->_comment."\r\n". + "URL: ###URL_PREFIX###out/out.ViewFolder.php?folderid=".$this->_id."\r\n"; - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - LetoDMS_Email::toList($user, $this->_notifyList["users"], $subject, $message); - foreach ($this->_notifyList["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); - } + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + $this->_notifier->toList($user, $this->_notifyList["users"], $subject, $message); + foreach ($this->_notifyList["groups"] as $grp) { + $this->_notifier->toGroup($user, $grp, $subject, $message); + } + } return true; } @@ -221,7 +235,7 @@ class LetoDMS_Folder } function setOwner($newOwner) { - GLOBAL $db, $user, $settings; + GLOBAL $db, $user; $oldOwner = $this->getOwner(); @@ -229,25 +243,27 @@ class LetoDMS_Folder if (!$db->getResult($queryStr)) return false; - // Send notification to subscribers. - $this->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_name." - ".getMLText("ownership_changed_email"); - $message = getMLText("ownership_changed_email")."\r\n"; - $message .= - getMLText("name").": ".$this->_name."\r\n". - getMLText("old").": ".$oldOwner->getFullName()."\r\n". - getMLText("new").": ".$newOwner->getFullName()."\r\n". - getMLText("folder").": ".getFolderPathPlain($this)."\r\n". - getMLText("comment").": ".$this->_comment."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$this->_id."\r\n"; + if($this->_notifier) { + // Send notification to subscribers. + $this->getNotifyList(); + $subject = "###SITENAME###: ".$this->_name." - ".getMLText("ownership_changed_email"); + $message = getMLText("ownership_changed_email")."\r\n"; + $message .= + getMLText("name").": ".$this->_name."\r\n". + getMLText("old").": ".$oldOwner->getFullName()."\r\n". + getMLText("new").": ".$newOwner->getFullName()."\r\n". + getMLText("folder").": ".$this->getFolderPathPlain()."\r\n". + getMLText("comment").": ".$this->_comment."\r\n". + "URL: ###URL_PREFIX###out/out.ViewFolder.php?folderid=".$this->_id."\r\n"; - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - LetoDMS_Email::toList($user, $this->_notifyList["users"], $subject, $message); - foreach ($this->_notifyList["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); - } + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + $this->_notifier->toList($user, $this->_notifyList["users"], $subject, $message); + foreach ($this->_notifyList["groups"] as $grp) { + $this->_notifier->toGroup($user, $grp, $subject, $message); + } + } $this->_ownerID = $newOwner->getID(); $this->_owner = $newOwner; @@ -267,28 +283,30 @@ class LetoDMS_Folder } function setDefaultAccess($mode) { - GLOBAL $db, $user, $settings; + GLOBAL $db, $user; $queryStr = "UPDATE tblFolders set defaultAccess = " . $mode . " WHERE id = " . $this->_id; if (!$db->getResult($queryStr)) return false; - // Send notification to subscribers. - $this->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_name." - ".getMLText("access_permission_changed_email"); - $message = getMLText("access_permission_changed_email")."\r\n"; - $message .= - getMLText("name").": ".$this->_name."\r\n". - getMLText("folder").": ".getFolderPathPlain($this)."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$this->_id."\r\n"; + if($this->_notifier) { + // Send notification to subscribers. + $this->getNotifyList(); + $subject = "###SITENAME###: ".$this->_name." - ".getMLText("access_permission_changed_email"); + $message = getMLText("access_permission_changed_email")."\r\n"; + $message .= + getMLText("name").": ".$this->_name."\r\n". + getMLText("folder").": ".$this->getFolderPathPlain()."\r\n". + "URL: ###URL_PREFIX###out/out.ViewFolder.php?folderid=".$this->_id."\r\n"; - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - LetoDMS_Email::toList($user, $this->_notifyList["users"], $subject, $message); - foreach ($this->_notifyList["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); - } + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + $this->_notifier->toList($user, $this->_notifyList["users"], $subject, $message); + foreach ($this->_notifyList["groups"] as $grp) { + $this->_notifier->toGroup($user, $grp, $subject, $message); + } + } $this->_defaultAccess = $mode; @@ -311,7 +329,7 @@ class LetoDMS_Folder function inheritsAccess() { return $this->_inheritAccess; } function setInheritAccess($inheritAccess) { - GLOBAL $db, $user, $settings; + GLOBAL $db, $user; $inheritAccess = ($inheritAccess) ? "1" : "0"; @@ -321,22 +339,24 @@ class LetoDMS_Folder $this->_inheritAccess = $inheritAccess; - // Send notification to subscribers. - $this->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_name." - ".getMLText("access_permission_changed_email"); - $message = getMLText("access_permission_changed_email")."\r\n"; - $message .= - getMLText("name").": ".$this->_name."\r\n". - getMLText("folder").": ".getFolderPathPlain($this)."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$this->_id."\r\n"; + if($this->_notifier) { + // Send notification to subscribers. + $this->getNotifyList(); + $subject = "###SITENAME###: ".$this->_name." - ".getMLText("access_permission_changed_email"); + $message = getMLText("access_permission_changed_email")."\r\n"; + $message .= + getMLText("name").": ".$this->_name."\r\n". + getMLText("folder").": ".$this->getFolderPathPlain()."\r\n". + "URL: ###URL_PREFIX###out/out.ViewFolder.php?folderid=".$this->_id."\r\n"; - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - LetoDMS_Email::toList($user, $this->_notifyList["users"], $subject, $message); - foreach ($this->_notifyList["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); - } + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + $this->_notifier->toList($user, $this->_notifyList["users"], $subject, $message); + foreach ($this->_notifyList["groups"] as $grp) { + $this->_notifier->toGroup($user, $grp, $subject, $message); + } + } // If any of the notification subscribers no longer have read access, // remove their subscription. @@ -388,7 +408,7 @@ class LetoDMS_Folder } function addSubFolder($name, $comment, $owner, $sequence) { - GLOBAL $db, $user, $settings; + GLOBAL $db, $user; //inheritAccess = true, defaultAccess = M_READ $queryStr = "INSERT INTO tblFolders (name, parent, comment, owner, inheritAccess, defaultAccess, sequence) ". @@ -399,23 +419,25 @@ class LetoDMS_Folder unset($this->_subFolders); // Send notification to subscribers. - $this->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_name." - ".getMLText("new_subfolder_email"); - $message = getMLText("new_subfolder_email")."\r\n"; - $message .= - getMLText("name").": ".$name."\r\n". - getMLText("folder").": ".getFolderPathPlain($newFolder)."\r\n". - getMLText("comment").": ".$comment."\r\n". - getMLText("user").": ".$owner->getFullName()."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$newFolder->getID()."\r\n"; + if($this->_notifier) { + $this->getNotifyList(); + $subject = "###SITENAME###: ".$this->_name." - ".getMLText("new_subfolder_email"); + $message = getMLText("new_subfolder_email")."\r\n"; + $message .= + getMLText("name").": ".$name."\r\n". + getMLText("folder").": ".$newFolder->getFolderPathPlain()."\r\n". + getMLText("comment").": ".$comment."\r\n". + getMLText("user").": ".$owner->getFullName()."\r\n". + "URL: ###URL_PREFIX###out/out.ViewFolder.php?folderid=".$newFolder->getID()."\r\n"; - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - LetoDMS_Email::toList($user, $this->_notifyList["users"], $subject, $message); - foreach ($this->_notifyList["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); - } + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + $this->_notifier->toList($user, $this->_notifyList["users"], $subject, $message); + foreach ($this->_notifyList["groups"] as $grp) { + $this->_notifier->toGroup($user, $grp, $subject, $message); + } + } return $newFolder; } @@ -510,7 +532,7 @@ class LetoDMS_Folder // $comment will be used for both document and version leaving empty the version_comment function addDocument($name, $comment, $expires, $owner, $keywords, $tmpFile, $orgFileName, $fileType, $mimeType, $sequence, $reviewers=array(), $approvers=array(),$reqversion,$version_comment="") { - GLOBAL $db, $user, $settings; + GLOBAL $db, $user; $expires = (!$expires) ? 0 : $expires; @@ -543,23 +565,25 @@ class LetoDMS_Folder } // Send notification to subscribers. - $this->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_name." - ".getMLText("new_document_email"); - $message = getMLText("new_document_email")."\r\n"; - $message .= - getMLText("name").": ".$name."\r\n". - getMLText("folder").": ".getFolderPathPlain($this)."\r\n". - getMLText("comment").": ".$comment."\r\n". - getMLText("comment_for_current_version").": ".$version_comment."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID()."\r\n"; + if($this->_notifier) { + $this->getNotifyList(); + $subject = "###SITENAME###: ".$this->_name." - ".getMLText("new_document_email"); + $message = getMLText("new_document_email")."\r\n"; + $message .= + getMLText("name").": ".$name."\r\n". + getMLText("folder").": ".getFolderPathPlain($this)."\r\n". + getMLText("comment").": ".$comment."\r\n". + getMLText("comment_for_current_version").": ".$version_comment."\r\n". + "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$document->getID()."\r\n"; - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - LetoDMS_Email::toList($user, $this->_notifyList["users"], $subject, $message); - foreach ($this->_notifyList["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); - } + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + $this->_notifier->toList($user, $this->_notifyList["users"], $subject, $message); + foreach ($this->_notifyList["groups"] as $grp) { + $this->_notifier->toGroup($user, $grp, $subject, $message); + } + } return array($document, $res); } @@ -600,23 +624,23 @@ class LetoDMS_Folder return false; // Send notification to subscribers. - if ($send_email){ + if ($send_email && $this->_notifier){ $this->getNotifyList(); - $subject = $settings->_siteName.": ".$this->_name." - ".getMLText("folder_deleted_email"); + $subject = "###SITENAME###: ".$this->_name." - ".getMLText("folder_deleted_email"); $message = getMLText("folder_deleted_email")."\r\n"; $message .= getMLText("name").": ".$this->_name."\r\n". getMLText("folder").": ".getFolderPathPlain($this)."\r\n". getMLText("comment").": ".$this->_comment."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$this->_id."\r\n"; + "URL: ###URL_PREFIX###out/out.ViewFolder.php?folderid=".$this->_id."\r\n"; $subject=mydmsDecodeString($subject); $message=mydmsDecodeString($message); - LetoDMS_Email::toList($user, $this->_notifyList["users"], $subject, $message); + $this->_notifier->toList($user, $this->_notifyList["users"], $subject, $message); foreach ($this->_notifyList["groups"] as $grp) { - LetoDMS_Email::toGroup($user, $grp, $subject, $message); + $this->_notifier->toGroup($user, $grp, $subject, $message); } } @@ -800,7 +824,6 @@ class LetoDMS_Folder } function getGroupAccessMode($group) { - GLOBAL $settings; $highestPrivileged = M_NONE; $foundInACL = false; @@ -959,24 +982,25 @@ class LetoDMS_Folder if ($i +1 < count($folderPath)) $path .= " / "; } - $subject = $settings->_siteName.": ".$this->getName()." - ".getMLText("notify_added_email"); - $message = getMLText("notify_added_email")."\r\n"; - $message .= - getMLText("name").": ".$this->getName()."\r\n". - getMLText("folder").": ".$path."\r\n". - getMLText("comment").": ".$this->getComment()."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$this->_id."\r\n"; - + if($this->_notifier) { + $subject = "###SITENAME###: ".$this->getName()." - ".getMLText("notify_added_email"); + $message = getMLText("notify_added_email")."\r\n"; + $message .= + getMLText("name").": ".$this->getName()."\r\n". + getMLText("folder").": ".$path."\r\n". + getMLText("comment").": ".$this->getComment()."\r\n". + "URL: ###URL_PREFIX###out/out.ViewFolder.php?folderid=".$this->_id."\r\n"; - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - if ($isUser) { - LetoDMS_Email::toIndividual($user, $obj, $subject, $message); - } - else { - LetoDMS_Email::toGroup($user, $obj, $subject, $message); - } + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + if ($isUser) { + $this->_notifier->toIndividual($user, $obj, $subject, $message); + } + else { + $this->_notifier->toGroup($user, $obj, $subject, $message); + } + } unset($this->_notifyList); return 0; @@ -1048,23 +1072,25 @@ class LetoDMS_Folder if ($i +1 < count($folderPath)) $path .= " / "; } - $subject = $settings->_siteName.": ".$this->getName()." - ".getMLText("notify_deleted_email"); - $message = getMLText("notify_deleted_email")."\r\n"; - $message .= - getMLText("name").": ".$this->getName()."\r\n". - getMLText("folder").": ".$path."\r\n". - getMLText("comment").": ".$this->getComment()."\r\n". - "URL: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$this->_id."\r\n"; + if($this->_notifier) { + $subject = "###SITENAME###: ".$this->getName()." - ".getMLText("notify_deleted_email"); + $message = getMLText("notify_deleted_email")."\r\n"; + $message .= + getMLText("name").": ".$this->getName()."\r\n". + getMLText("folder").": ".$path."\r\n". + getMLText("comment").": ".$this->getComment()."\r\n". + "URL: ###URL_PREFIX###out/out.ViewFolder.php?folderid=".$this->_id."\r\n"; - $subject=mydmsDecodeString($subject); - $message=mydmsDecodeString($message); - - if ($isUser) { - LetoDMS_Email::toIndividual($user, $obj, $subject, $message); - } - else { - LetoDMS_Email::toGroup($user, $obj, $subject, $message); - } + $subject=mydmsDecodeString($subject); + $message=mydmsDecodeString($message); + + if ($isUser) { + $this->_notifier->toIndividual($user, $obj, $subject, $message); + } + else { + $this->_notifier->toGroup($user, $obj, $subject, $message); + } + } unset($this->_notifyList); return 0; @@ -1173,5 +1199,5 @@ class LetoDMS_Folder return $this->_approversList; } } - + ?> diff --git a/inc/inc.DBInit.php b/inc/inc.DBInit.php index de4cdc0d6..6d0b9fa44 100644 --- a/inc/inc.DBInit.php +++ b/inc/inc.DBInit.php @@ -21,4 +21,5 @@ $db = new LetoDMS_DatabaseAccess($settings->_dbDriver, $settings->_dbHostname, $settings->_dbUser, $settings->_dbPass, $settings->_dbDatabase); $db->connect() or die ("Could not connect to db-server \"" . $settings->_dbHostname . "\""); +$dms = new LetoDMS_DMS($db, $settings->_contentDir, $settings->_contentOffsetDir); ?> diff --git a/inc/inc.Utils.php b/inc/inc.Utils.php index fc023b290..1d806d479 100644 --- a/inc/inc.Utils.php +++ b/inc/inc.Utils.php @@ -252,7 +252,7 @@ function showtree() global $settings; if (isset($_GET["showtree"])) return $_GET["showtree"]; - else if ($settings->_expandFolderTree==0) return 0; + else if ($settings->_enableFolderTree==0) return 0; return 1; } diff --git a/inc/inc.Version.php b/inc/inc.Version.php index 1de069272..410ae2bec 100644 --- a/inc/inc.Version.php +++ b/inc/inc.Version.php @@ -19,7 +19,7 @@ class LetoDMS_Version { - var $_number = "v2.0.1"; + var $_number = "v2.1.0"; var $_string = "LetoDMS"; function LetoDMS_Version() { diff --git a/op/op.AddDocument.php b/op/op.AddDocument.php index ad39aa857..206efa109 100644 --- a/op/op.AddDocument.php +++ b/op/op.AddDocument.php @@ -22,8 +22,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.ClassEmail.php"); @@ -39,13 +38,13 @@ if (!isset($_POST["folderid"]) || !is_numeric($_POST["folderid"]) || intval($_PO } $folderid = $_POST["folderid"]; -$folder = getFolder($folderid); +$folder = $dms->getFolder($folderid); if (!is_object($folder)) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } -$folderPathHTML = getFolderPathHTML($folder, true); +$folderPathHTML = $folder->getFolderPathHTML(true); if ($folder->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied")); diff --git a/op/op.AddDocumentLink.php b/op/op.AddDocumentLink.php index 7eb6984b8..ee81f3292 100644 --- a/op/op.AddDocumentLink.php +++ b/op/op.AddDocumentLink.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -38,14 +37,14 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ } $documentid = $_GET["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_READ) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); @@ -61,7 +60,7 @@ if (!isset($_GET["docidform1"]) || !is_numeric($_GET["docidform1"]) || intval($_ } $docid = $_GET["docidform1"]; -$doc = getDocument($docid); +$doc = $dms->getDocument($docid); if (!is_object($doc)) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_doc_id")); diff --git a/op/op.AddEvent.php b/op/op.AddEvent.php index 3353cb967..7261b4945 100644 --- a/op/op.AddEvent.php +++ b/op/op.AddEvent.php @@ -22,8 +22,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.ClassEmail.php"); diff --git a/op/op.AddFile.php b/op/op.AddFile.php index 6f2ced0c9..8ca502cda 100644 --- a/op/op.AddFile.php +++ b/op/op.AddFile.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.ClassEmail.php"); @@ -37,7 +36,7 @@ if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval( } $documentid = $_POST["documentid"]; -$document = getDocument($documentid); +$document = $dms->getDocument($documentid); if (!is_object($document)) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); diff --git a/op/op.AddSubFolder.php b/op/op.AddSubFolder.php index 11e93a5f4..768def7c2 100644 --- a/op/op.AddSubFolder.php +++ b/op/op.AddSubFolder.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -37,13 +36,13 @@ if (!isset($_POST["folderid"]) || !is_numeric($_POST["folderid"]) || intval($_PO UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } $folderid = $_POST["folderid"]; -$folder = getFolder($folderid); +$folder = $dms->getFolder($folderid); if (!is_object($folder)) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } -$folderPathHTML = getFolderPathHTML($folder, true); +$folderPathHTML = $folder->getFolderPathHTML(true); if ($folder->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied")); diff --git a/op/op.ApproveDocument.php b/op/op.ApproveDocument.php index 5d17f2ca8..fd49d670e 100644 --- a/op/op.ApproveDocument.php +++ b/op/op.ApproveDocument.php @@ -21,9 +21,8 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassEmail.php"); -include("../inc/inc.ClassFolder.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -39,14 +38,14 @@ if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval( } $documentid = $_POST["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_READ) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); diff --git a/op/op.CreateDump.php b/op/op.CreateDump.php index 3dff6dc6a..8e0459726 100644 --- a/op/op.CreateDump.php +++ b/op/op.CreateDump.php @@ -19,9 +19,8 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassEmail.php"); -include("../inc/inc.ClassFolder.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/op/op.CreateFolderArchive.php b/op/op.CreateFolderArchive.php index 1c8491893..5908372ee 100644 --- a/op/op.CreateFolderArchive.php +++ b/op/op.CreateFolderArchive.php @@ -19,9 +19,8 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassEmail.php"); -include("../inc/inc.ClassFolder.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/op/op.CreateStatusIndex.php b/op/op.CreateStatusIndex.php index aaff1e1b4..18c42a0d5 100644 --- a/op/op.CreateStatusIndex.php +++ b/op/op.CreateStatusIndex.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.ClassEmail.php"); diff --git a/op/op.CreateSubFolderIndex.php b/op/op.CreateSubFolderIndex.php index 591163528..69a14671b 100644 --- a/op/op.CreateSubFolderIndex.php +++ b/op/op.CreateSubFolderIndex.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/op/op.CreateVersioningFiles.php b/op/op.CreateVersioningFiles.php index d15416e23..14bfb0327 100644 --- a/op/op.CreateVersioningFiles.php +++ b/op/op.CreateVersioningFiles.php @@ -19,9 +19,8 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassEmail.php"); -include("../inc/inc.ClassFolder.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/op/op.DefaultKeywords.php b/op/op.DefaultKeywords.php index 5f344bd4d..414c6c580 100644 --- a/op/op.DefaultKeywords.php +++ b/op/op.DefaultKeywords.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.ClassKeywords.php"); diff --git a/op/op.DocumentAccess.php b/op/op.DocumentAccess.php index 044f3aa7e..347678338 100644 --- a/op/op.DocumentAccess.php +++ b/op/op.DocumentAccess.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -36,14 +35,14 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } $documentid = $_GET["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_ALL) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); diff --git a/op/op.DocumentNotify.php b/op/op.DocumentNotify.php index 9c4e2a497..a9aecae49 100644 --- a/op/op.DocumentNotify.php +++ b/op/op.DocumentNotify.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -37,7 +36,7 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ } $documentid = $_GET["documentid"]; -$document = getDocument($documentid); +$document = $dms->getDocument($documentid); if (!is_object($document)) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); diff --git a/op/op.Download.php b/op/op.Download.php index d6693ac18..3cdcb051a 100644 --- a/op/op.Download.php +++ b/op/op.Download.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -41,14 +40,14 @@ if (isset($_GET["version"])){ } $documentid = $_GET["documentid"]; - $document = getDocument($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(); - $docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; + $docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_READ) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); @@ -85,14 +84,14 @@ if (isset($_GET["version"])){ } $documentid = $_GET["documentid"]; - $document = getDocument($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(); - $docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; + $docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_READ) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); @@ -102,7 +101,7 @@ if (isset($_GET["version"])){ UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_file_id")); } $fileid = $_GET["file"]; - $file = getDocumentFile($fileid); + $file = $document->getDocumentFile($fileid); if (!is_object($file)) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_file_id")); diff --git a/op/op.EditComment.php b/op/op.EditComment.php index 649b5286a..51d0367ad 100644 --- a/op/op.EditComment.php +++ b/op/op.EditComment.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -38,14 +37,14 @@ if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval( } $documentid = $_POST["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML($folder, true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); diff --git a/op/op.EditDocument.php b/op/op.EditDocument.php index ab0e83f39..9d184c989 100644 --- a/op/op.EditDocument.php +++ b/op/op.EditDocument.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -37,19 +36,26 @@ if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval( } $documentid = $_POST["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); } - + +/* Create a notify object which is used to notify reporters, owners, etc. + * about changes on documents and folders + */ +$notifier = new LetoDMS_Email(); +$notifier->setSender($user); +$document->setNotifier($notifier); + $name = sanitizeString($_POST["name"]); $comment = sanitizeString($_POST["comment"]); $keywords = sanitizeString($_POST["keywords"]); diff --git a/op/op.EditEvent.php b/op/op.EditEvent.php index 9baf11351..715f387e0 100644 --- a/op/op.EditEvent.php +++ b/op/op.EditEvent.php @@ -22,8 +22,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.ClassEmail.php"); diff --git a/op/op.EditFolder.php b/op/op.EditFolder.php index 2fcea6c34..ef0a8d768 100644 --- a/op/op.EditFolder.php +++ b/op/op.EditFolder.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -37,13 +36,13 @@ if (!isset($_POST["folderid"]) || !is_numeric($_POST["folderid"]) || intval($_PO } $folderid = $_POST["folderid"]; -$folder = getFolder($folderid); +$folder = $dms->getFolder($folderid); if (!is_object($folder)) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } -$folderPathHTML = getFolderPathHTML($folder, true); +$folderPathHTML = $folder->getFolderPathHTML(true); if ($folder->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied")); diff --git a/op/op.EditUserData.php b/op/op.EditUserData.php index 39173d335..a8eb42534 100644 --- a/op/op.EditUserData.php +++ b/op/op.EditUserData.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/op/op.FolderAccess.php b/op/op.FolderAccess.php index 6b0de9bef..438248e81 100644 --- a/op/op.FolderAccess.php +++ b/op/op.FolderAccess.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -37,13 +36,13 @@ if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET[ } $folderid = $_GET["folderid"]; -$folder = getFolder($folderid); +$folder = $dms->getFolder($folderid); if (!is_object($folder)) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } -$folderPathHTML = getFolderPathHTML($folder, true); +$folderPathHTML = $folder->getFolderPathHTML(true); if ($folder->getAccessMode($user) < M_ALL) { UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied")); diff --git a/op/op.FolderNotify.php b/op/op.FolderNotify.php index 50e0f0b7a..eaed6ae48 100644 --- a/op/op.FolderNotify.php +++ b/op/op.FolderNotify.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -37,7 +36,7 @@ if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET[ } $folderid = $_GET["folderid"]; -$folder = getFolder($folderid); +$folder = $dms->getFolder($folderid); if (!is_object($folder)) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); @@ -64,7 +63,7 @@ if (isset($_GET["groupid"])&&$_GET["groupid"]!=-1){ UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied")); } -$folderPathHTML = getFolderPathHTML($folder, true); +$folderPathHTML = $folder->getFolderPathHTML(true); if ($folder->getAccessMode($user) < M_READ) { UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied")); diff --git a/op/op.GroupMgr.php b/op/op.GroupMgr.php index b36e13e13..5eb84f7e9 100644 --- a/op/op.GroupMgr.php +++ b/op/op.GroupMgr.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/op/op.LockDocument.php b/op/op.LockDocument.php index aa9b3d60b..11cd8c0a7 100644 --- a/op/op.LockDocument.php +++ b/op/op.LockDocument.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -37,14 +36,14 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ } $documentid = $_GET["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); diff --git a/op/op.Login.php b/op/op.Login.php index fc7696b31..4d8c03c70 100644 --- a/op/op.Login.php +++ b/op/op.Login.php @@ -24,6 +24,7 @@ include("../inc/inc.DBAccess.php"); include("../inc/inc.DBInit.php"); include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassUser.php"); +include("../inc/inc.ClassEmail.php"); function _printMessage($heading, $message) { diff --git a/op/op.ManageNotify.php b/op/op.ManageNotify.php index f8a248ba7..4b3cd9ae7 100644 --- a/op/op.ManageNotify.php +++ b/op/op.ManageNotify.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -76,7 +75,7 @@ if ($_GET["type"]=="document"){ }else UI::exitError(getMLText("my_account"),getMLText("error_occured")); - $document = getDocument($documentid); + $document = $dms->getDocument($documentid); $userid=$user->getID(); @@ -97,7 +96,7 @@ if ($_GET["type"]=="document"){ }else UI::exitError(getMLText("my_account"),getMLText("error_occured")); - $folder = getFolder($folderid); + $folder = $dms->getFolder($folderid); $userid=$user->getID(); diff --git a/op/op.MoveDocument.php b/op/op.MoveDocument.php index 9592b8fa9..d68d72e56 100644 --- a/op/op.MoveDocument.php +++ b/op/op.MoveDocument.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -37,7 +36,7 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ } $documentid = $_GET["documentid"]; -$document = getDocument($documentid); +$document = $dms->getDocument($documentid); if (!is_object($document)) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); @@ -50,7 +49,7 @@ if (!isset($_GET["targetidform1"]) || !is_numeric($_GET["targetidform1"]) || $_G } $targetid = $_GET["targetidform1"]; -$targetFolder = getFolder($targetid); +$targetFolder = $dms->getFolder($targetid); if (!is_object($targetFolder)) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_target_folder")); diff --git a/op/op.MoveFolder.php b/op/op.MoveFolder.php index cb8a65a97..8ca4db495 100644 --- a/op/op.MoveFolder.php +++ b/op/op.MoveFolder.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -36,7 +35,7 @@ if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET[ UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } $folderid = $_GET["folderid"]; -$folder = getFolder($folderid); +$folder = $dms->getFolder($folderid); if (!is_object($folder)) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); @@ -51,7 +50,7 @@ if (!isset($_GET["targetidform1"]) || !is_numeric($_GET["targetidform1"]) || int } $targetid = $_GET["targetidform1"]; -$targetFolder = getFolder($targetid); +$targetFolder = $dms->getFolder($targetid); if (!is_object($targetFolder)) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); diff --git a/op/op.OverrideContentStatus.php b/op/op.OverrideContentStatus.php index 72fdc6ac1..53dc9e13f 100644 --- a/op/op.OverrideContentStatus.php +++ b/op/op.OverrideContentStatus.php @@ -20,9 +20,8 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassEmail.php"); -include("../inc/inc.ClassFolder.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -37,7 +36,7 @@ if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval( UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } $documentid = $_POST["documentid"]; -$document = getDocument($documentid); +$document = $dms->getDocument($documentid); if (!is_object($document)) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } diff --git a/op/op.RemoveArchive.php b/op/op.RemoveArchive.php index 0e102f081..d91d45911 100644 --- a/op/op.RemoveArchive.php +++ b/op/op.RemoveArchive.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/op/op.RemoveDocument.php b/op/op.RemoveDocument.php index a9fe21b65..bb383241e 100644 --- a/op/op.RemoveDocument.php +++ b/op/op.RemoveDocument.php @@ -20,9 +20,8 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassEmail.php"); -include("../inc/inc.ClassFolder.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -36,7 +35,7 @@ if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval( UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } $documentid = $_POST["documentid"]; -$document = getDocument($documentid); +$document = $dms->getDocument($documentid); if (!is_object($document)) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); diff --git a/op/op.RemoveDocumentFile.php b/op/op.RemoveDocumentFile.php index 2b5983437..b94531026 100644 --- a/op/op.RemoveDocumentFile.php +++ b/op/op.RemoveDocumentFile.php @@ -19,9 +19,8 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassEmail.php"); -include("../inc/inc.ClassFolder.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -36,7 +35,7 @@ if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval( } $documentid = $_POST["documentid"]; -$document = getDocument($documentid); +$document = $dms->getDocument($documentid); if (!is_object($document)) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); @@ -47,7 +46,7 @@ if (!isset($_POST["fileid"]) || !is_numeric($_POST["fileid"]) || intval($_POST[" } $fileid = $_POST["fileid"]; -$file = getDocumentFile($fileid); +$file = $document->getDocumentFile($fileid); if (!is_object($file)) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_file_id")); diff --git a/op/op.RemoveDocumentLink.php b/op/op.RemoveDocumentLink.php index 3b5498071..48aa491e5 100644 --- a/op/op.RemoveDocumentLink.php +++ b/op/op.RemoveDocumentLink.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -35,7 +34,7 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ } $documentid = $_GET["documentid"]; -$document = getDocument($documentid); +$document = $dms->getDocument($documentid); if (!is_object($document)) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); @@ -46,7 +45,7 @@ if (!isset($_GET["linkid"]) || !is_numeric($_GET["linkid"]) || intval($_GET["lin } $linkid = $_GET["linkid"]; -$link = getDocumentLink($linkid); +$link = $document->getDocumentLink($linkid); if (!is_object($link)) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_link_id")); diff --git a/op/op.RemoveDump.php b/op/op.RemoveDump.php index f5f67ac4a..d0082e9d1 100644 --- a/op/op.RemoveDump.php +++ b/op/op.RemoveDump.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/op/op.RemoveEvent.php b/op/op.RemoveEvent.php index 60a7a5ae0..175973703 100644 --- a/op/op.RemoveEvent.php +++ b/op/op.RemoveEvent.php @@ -22,8 +22,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.ClassEmail.php"); diff --git a/op/op.RemoveFolder.php b/op/op.RemoveFolder.php index 372e47889..a69d7bcc2 100644 --- a/op/op.RemoveFolder.php +++ b/op/op.RemoveFolder.php @@ -20,9 +20,8 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassEmail.php"); -include("../inc/inc.ClassFolder.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -36,7 +35,7 @@ if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET[ UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } $folderid = $_GET["folderid"]; -$folder = getFolder($folderid); +$folder = $dms->getFolder($folderid); if (!is_object($folder)) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); diff --git a/op/op.RemoveFolderFiles.php b/op/op.RemoveFolderFiles.php index b4eca47dd..838a97800 100644 --- a/op/op.RemoveFolderFiles.php +++ b/op/op.RemoveFolderFiles.php @@ -19,9 +19,8 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassEmail.php"); -include("../inc/inc.ClassFolder.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -57,7 +56,7 @@ if (!isset($_POST["folderid"]) || !is_numeric($_POST["folderid"]) || intval($_PO UI::exitError(getMLText("admin_tools"),getMLText("invalid_folder_id")); } $folderid = $_POST["folderid"]; -$folder = getFolder($folderid); +$folder = $dms->getFolder($folderid); if (!is_object($folder)) { UI::exitError(getMLText("admin_tools"),getMLText("invalid_folder_id")); diff --git a/op/op.RemoveLog.php b/op/op.RemoveLog.php index 868f8bbe1..2a5185f0a 100644 --- a/op/op.RemoveLog.php +++ b/op/op.RemoveLog.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/op/op.RemoveVersion.php b/op/op.RemoveVersion.php index 61eb1dea5..405711722 100644 --- a/op/op.RemoveVersion.php +++ b/op/op.RemoveVersion.php @@ -20,9 +20,8 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassEmail.php"); -include("../inc/inc.ClassFolder.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -36,7 +35,7 @@ if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval( UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } $documentid = $_POST["documentid"]; -$document = getDocument($documentid); +$document = $dms->getDocument($documentid); if (!is_object($document)) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); diff --git a/op/op.ReviewDocument.php b/op/op.ReviewDocument.php index d01cacec8..3659997ac 100644 --- a/op/op.ReviewDocument.php +++ b/op/op.ReviewDocument.php @@ -21,9 +21,8 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassEmail.php"); -include("../inc/inc.ClassFolder.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -38,7 +37,7 @@ if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval( UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } $documentid = $_POST["documentid"]; -$document = getDocument($documentid); +$document = $dms->getDocument($documentid); if (!is_object($document)) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); diff --git a/op/op.Search.php b/op/op.Search.php index 30e3e352b..49ee03f71 100644 --- a/op/op.Search.php +++ b/op/op.Search.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -141,11 +140,11 @@ if (count($searchin)==0) $searchin=array( 0, 1, 2, 3); // the folder hierarchy. if (isset($_GET["targetidform1"]) && is_numeric($_GET["targetidform1"]) && $_GET["targetidform1"]>0) { $targetid = $_GET["targetidform1"]; - $startFolder = getFolder($targetid); + $startFolder = $dms->getFolder($targetid); } else { $targetid = $settings->_rootFolderID; - $startFolder = getFolder($targetid); + $startFolder = $dms->getFolder($targetid); } if (!is_object($startFolder)) { UI::exitError(getMLText("search_results"),getMLText("invalid_folder_id")); @@ -153,7 +152,7 @@ if (!is_object($startFolder)) { // Now that the target folder has been identified, it is possible to create // the full navigation bar. -$folderPathHTML = getFolderPathHTML($startFolder, true); +$folderPathHTML = $startFolder->getFolderPathHTML(true); UI::htmlStartPage(getMLText("search_results")); UI::globalNavigation($startFolder); UI::pageNavigation($folderPathHTML, "", $startFolder); @@ -230,7 +229,7 @@ if (isset($_GET["pg"])) { // ------------------------------------- Suche starten -------------------------------------------- $startTime = getTime(); -$resArr = LetoDMS_Document::search($query, 25, ($pageNumber-1)*25, $mode, $searchin, $startFolder, $owner, $status, $startdate, $stopdate); +$resArr = $dms->search($query, 25, ($pageNumber-1)*25, $mode, $searchin, $startFolder, $owner, $status, $startdate, $stopdate); $searchTime = getTime() - $startTime; $searchTime = round($searchTime, 2); // ---------------------------------- Ausgabe der Ergebnisse -------------------------------------- diff --git a/op/op.SetExpires.php b/op/op.SetExpires.php index df49d290d..cb720cfea 100644 --- a/op/op.SetExpires.php +++ b/op/op.SetExpires.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -38,7 +37,7 @@ if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval( } $documentid = $_POST["documentid"]; -$document = getDocument($documentid); +$document = $dms->getDocument($documentid); if (!is_object($document)) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); diff --git a/op/op.SetReviewersApprovers.php b/op/op.SetReviewersApprovers.php index 18b2756a6..3cebf83f9 100644 --- a/op/op.SetReviewersApprovers.php +++ b/op/op.SetReviewersApprovers.php @@ -21,9 +21,8 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassEmail.php"); -include("../inc/inc.ClassFolder.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -39,7 +38,7 @@ if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval( } $documentid = $_POST["documentid"]; -$document = getDocument($documentid); +$document = $dms->getDocument($documentid); if (!is_object($document)) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); diff --git a/op/op.UnlockDocument.php b/op/op.UnlockDocument.php index 1e6a664db..7bc2a940e 100644 --- a/op/op.UnlockDocument.php +++ b/op/op.UnlockDocument.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -36,14 +35,14 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } $documentid = $_GET["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); diff --git a/op/op.UpdateDocument.php b/op/op.UpdateDocument.php index 10a2c735f..fb4d3ee0a 100644 --- a/op/op.UpdateDocument.php +++ b/op/op.UpdateDocument.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.ClassEmail.php"); @@ -37,7 +36,7 @@ if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval( } $documentid = $_POST["documentid"]; -$document = getDocument($documentid); +$document = $dms->getDocument($documentid); $folder = $document->getFolder(); if (!is_object($document)) { diff --git a/op/op.UserDefaultKeywords.php b/op/op.UserDefaultKeywords.php index 23d067f85..e1741adc9 100644 --- a/op/op.UserDefaultKeywords.php +++ b/op/op.UserDefaultKeywords.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.ClassKeywords.php"); diff --git a/op/op.UsrMgr.php b/op/op.UsrMgr.php index 245b5f6aa..1e2faa8b9 100644 --- a/op/op.UsrMgr.php +++ b/op/op.UsrMgr.php @@ -22,8 +22,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.Utils.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/op/op.ViewOnline.php b/op/op.ViewOnline.php index c898af01e..04c9ad9f6 100644 --- a/op/op.ViewOnline.php +++ b/op/op.ViewOnline.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -36,7 +35,7 @@ if (!isset($documentid) || !is_numeric($documentid) || intval($documentid)<1) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } -$document = getDocument($documentid); +$document = $dms->getDocument($documentid); if (!is_object($document)) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); diff --git a/out/out.AddDocument.php b/out/out.AddDocument.php index b537ef2fb..d7325a83a 100644 --- a/out/out.AddDocument.php +++ b/out/out.AddDocument.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -36,12 +35,12 @@ if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET[ UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } $folderid = $_GET["folderid"]; -$folder = getFolder($folderid); +$folder = $dms->getFolder($folderid); if (!is_object($folder)) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } -$folderPathHTML = getFolderPathHTML($folder, true); +$folderPathHTML = $folder->getFolderPathHTML(true); if ($folder->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied")); diff --git a/out/out.AddEvent.php b/out/out.AddEvent.php index 80b8efc6a..de53ec2fd 100644 --- a/out/out.AddEvent.php +++ b/out/out.AddEvent.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.AddFile.php b/out/out.AddFile.php index 7dad75021..98cf0bcc7 100644 --- a/out/out.AddFile.php +++ b/out/out.AddFile.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -37,14 +36,14 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ } $documentid = $_GET["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); diff --git a/out/out.AddSubFolder.php b/out/out.AddSubFolder.php index ca8cee59a..192b57d40 100644 --- a/out/out.AddSubFolder.php +++ b/out/out.AddSubFolder.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -36,12 +35,12 @@ if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET[ UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } $folderid = $_GET["folderid"]; -$folder = getFolder($folderid); +$folder = $dms->getFolder($folderid); if (!is_object($folder)) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } -$folderPathHTML = getFolderPathHTML($folder, true); +$folderPathHTML = $folder->getFolderPathHTML(true); if ($folder->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied")); diff --git a/out/out.AdminTools.php b/out/out.AdminTools.php index 980dd9051..01f3a7b69 100644 --- a/out/out.AdminTools.php +++ b/out/out.AdminTools.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.ApproveDocument.php b/out/out.ApproveDocument.php index b82e94db0..9d1bb6cd0 100644 --- a/out/out.ApproveDocument.php +++ b/out/out.ApproveDocument.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -38,14 +37,14 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ } $documentid = $_GET["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_READ) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); diff --git a/out/out.BackupTools.php b/out/out.BackupTools.php index 1137b113b..6a8507312 100644 --- a/out/out.BackupTools.php +++ b/out/out.BackupTools.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.Calendar.php b/out/out.Calendar.php index 14fc1ae7f..90bc7561f 100644 --- a/out/out.Calendar.php +++ b/out/out.Calendar.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.Calendar.php"); diff --git a/out/out.DefaultKeywords.php b/out/out.DefaultKeywords.php index 51c620119..e7caf4c1b 100644 --- a/out/out.DefaultKeywords.php +++ b/out/out.DefaultKeywords.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.ClassKeywords.php"); diff --git a/out/out.DocumentAccess.php b/out/out.DocumentAccess.php index 2cbd280a1..0f8fae5c0 100644 --- a/out/out.DocumentAccess.php +++ b/out/out.DocumentAccess.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassFolder.php"); -include("../inc/inc.ClassDocument.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -46,14 +45,14 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ } $documentid = $_GET["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_ALL) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); diff --git a/out/out.DocumentChooser.php b/out/out.DocumentChooser.php index 36e889b33..5abca1349 100644 --- a/out/out.DocumentChooser.php +++ b/out/out.DocumentChooser.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.ClassUI.php"); @@ -143,7 +142,7 @@ function documentSelected(id, name) { getFolder($folderid); UI::contentContainerStart(); printTree($folder->getPath()); UI::contentContainerEnd(); diff --git a/out/out.DocumentNotify.php b/out/out.DocumentNotify.php index c2c176c70..7fd469a4e 100644 --- a/out/out.DocumentNotify.php +++ b/out/out.DocumentNotify.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassFolder.php"); -include("../inc/inc.ClassDocument.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -37,7 +36,7 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ } $documentid = $_GET["documentid"]; -$document = getDocument($documentid); +$document = $dms->getDocument($documentid); if (!is_object($document)) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); diff --git a/out/out.DocumentVersionDetail.php b/out/out.DocumentVersionDetail.php index ba2c96e13..c2476586f 100644 --- a/out/out.DocumentVersionDetail.php +++ b/out/out.DocumentVersionDetail.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -38,14 +37,14 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ } $documentid = $_GET["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_READ) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); diff --git a/out/out.EditComment.php b/out/out.EditComment.php index 820d63bcc..edbb3bf7e 100644 --- a/out/out.EditComment.php +++ b/out/out.EditComment.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -36,12 +35,15 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } $documentid = $_GET["documentid"]; -$document = getDocument($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(); +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; + $versionid = $_GET["version"]; $version = $document->getContentByVersion($versionid); diff --git a/out/out.EditDocument.php b/out/out.EditDocument.php index 43e595da5..cf2f94b53 100644 --- a/out/out.EditDocument.php +++ b/out/out.EditDocument.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -35,14 +34,14 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } $documentid = $_GET["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); diff --git a/out/out.EditEvent.php b/out/out.EditEvent.php index dcdd5b306..b895da2e2 100644 --- a/out/out.EditEvent.php +++ b/out/out.EditEvent.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.EditFolder.php b/out/out.EditFolder.php index acd195a6d..692d85486 100644 --- a/out/out.EditFolder.php +++ b/out/out.EditFolder.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -36,13 +35,13 @@ if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET[ } $folderid = $_GET["folderid"]; -$folder = getFolder($folderid); +$folder = $dms->getFolder($folderid); if (!is_object($folder)) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } -$folderPathHTML = getFolderPathHTML($folder, true); +$folderPathHTML = $folder->getFolderPathHTML(true); if ($folder->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied")); diff --git a/out/out.EditUserData.php b/out/out.EditUserData.php index b4049b82b..7e7fb0e1f 100644 --- a/out/out.EditUserData.php +++ b/out/out.EditUserData.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.FolderAccess.php b/out/out.FolderAccess.php index c0db89ac3..d7b0c9caa 100644 --- a/out/out.FolderAccess.php +++ b/out/out.FolderAccess.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -45,13 +44,13 @@ if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET[ UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } $folderid = $_GET["folderid"]; -$folder = getFolder($folderid); +$folder = $dms->getFolder($folderid); if (!is_object($folder)) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } -$folderPathHTML = getFolderPathHTML($folder, true); +$folderPathHTML = $folder->getFolderPathHTML(true); if ($folder->getAccessMode($user) < M_ALL) { UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied")); diff --git a/out/out.FolderChooser.php b/out/out.FolderChooser.php index a6553b135..9e867e2ce 100644 --- a/out/out.FolderChooser.php +++ b/out/out.FolderChooser.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.ClassUI.php"); diff --git a/out/out.FolderNotify.php b/out/out.FolderNotify.php index 654728e5d..4deb02690 100644 --- a/out/out.FolderNotify.php +++ b/out/out.FolderNotify.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -36,13 +35,13 @@ if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET[ UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } $folderid = $_GET["folderid"]; -$folder = getFolder($folderid); +$folder = $dms->getFolder($folderid); if (!is_object($folder)) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } -$folderPathHTML = getFolderPathHTML($folder, true); +$folderPathHTML = $folder->getFolderPathHTML(true); if ($folder->getAccessMode($user) < M_READ) { UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied")); diff --git a/out/out.GroupMgr.php b/out/out.GroupMgr.php index 9c097cee5..99b2b397a 100644 --- a/out/out.GroupMgr.php +++ b/out/out.GroupMgr.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.GroupView.php b/out/out.GroupView.php index 041a21d5e..069c73c86 100644 --- a/out/out.GroupView.php +++ b/out/out.GroupView.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.Help.php b/out/out.Help.php index 79e34863b..4e67246b9 100644 --- a/out/out.Help.php +++ b/out/out.Help.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.Info.php b/out/out.Info.php index 25d48f141..2da2a4df1 100644 --- a/out/out.Info.php +++ b/out/out.Info.php @@ -22,8 +22,7 @@ include("../inc/inc.Version.php"); include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.KeywordChooser.php b/out/out.KeywordChooser.php index f2f41f0bb..b82e47b75 100644 --- a/out/out.KeywordChooser.php +++ b/out/out.KeywordChooser.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.ClassKeywords.php"); diff --git a/out/out.LogManagement.php b/out/out.LogManagement.php index 906c4d7cc..ad769e577 100644 --- a/out/out.LogManagement.php +++ b/out/out.LogManagement.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.ManageNotify.php b/out/out.ManageNotify.php index d3d40eb5d..b0960d002 100644 --- a/out/out.ManageNotify.php +++ b/out/out.ManageNotify.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassFolder.php"); -include("../inc/inc.ClassDocument.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.MoveDocument.php b/out/out.MoveDocument.php index f1f16c67e..1b5b49144 100644 --- a/out/out.MoveDocument.php +++ b/out/out.MoveDocument.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -36,14 +35,14 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ } $documentid = $_GET["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); diff --git a/out/out.MoveFolder.php b/out/out.MoveFolder.php index 3fb368ed0..0005a95e1 100644 --- a/out/out.MoveFolder.php +++ b/out/out.MoveFolder.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -37,13 +36,13 @@ if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET[ } $folderid = $_GET["folderid"]; -$folder = getFolder($folderid); +$folder = $dms->getFolder($folderid); if (!is_object($folder)) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } -$folderPathHTML = getFolderPathHTML($folder, true); +$folderPathHTML = $folder->getFolderPathHTML(true); if ($folderid == $settings->_rootFolderID || !$folder->getParent()) { UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("cannot_move_root")); diff --git a/out/out.MyAccount.php b/out/out.MyAccount.php index 5521571af..2169a284e 100644 --- a/out/out.MyAccount.php +++ b/out/out.MyAccount.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.MyDocuments.php b/out/out.MyDocuments.php index 12d584be6..0becb45f4 100644 --- a/out/out.MyDocuments.php +++ b/out/out.MyDocuments.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.OverrideContentStatus.php b/out/out.OverrideContentStatus.php index cbd6a0898..e050bc2dd 100644 --- a/out/out.OverrideContentStatus.php +++ b/out/out.OverrideContentStatus.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -38,14 +37,14 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ } $documentid = $_GET["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_ALL) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); diff --git a/out/out.RemoveArchive.php b/out/out.RemoveArchive.php index 227448043..5c310350d 100644 --- a/out/out.RemoveArchive.php +++ b/out/out.RemoveArchive.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.RemoveDocument.php b/out/out.RemoveDocument.php index ce8557fe8..86a2ed303 100644 --- a/out/out.RemoveDocument.php +++ b/out/out.RemoveDocument.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -36,14 +35,14 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } $documentid = $_GET["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_ALL) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); diff --git a/out/out.RemoveDocumentFile.php b/out/out.RemoveDocumentFile.php index 140e5c971..a009fb1ad 100644 --- a/out/out.RemoveDocumentFile.php +++ b/out/out.RemoveDocumentFile.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -35,21 +34,21 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ } $documentid = $_GET["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if (!isset($_GET["fileid"]) || !is_numeric($_GET["fileid"]) || intval($_GET["fileid"])<1) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_file_id")); } $fileid = $_GET["fileid"]; -$file = getDocumentFile($fileid); +$file = $document->getDocumentFile($fileid); if (!is_object($file)) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_file_id")); diff --git a/out/out.RemoveDump.php b/out/out.RemoveDump.php index ac011f972..26626c893 100644 --- a/out/out.RemoveDump.php +++ b/out/out.RemoveDump.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.RemoveEvent.php b/out/out.RemoveEvent.php index b265cfd43..632152719 100644 --- a/out/out.RemoveEvent.php +++ b/out/out.RemoveEvent.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.RemoveFolder.php b/out/out.RemoveFolder.php index 2d82a84b5..551094343 100644 --- a/out/out.RemoveFolder.php +++ b/out/out.RemoveFolder.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -36,13 +35,13 @@ if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET[ } $folderid = $_GET["folderid"]; -$folder = getFolder($folderid); +$folder = $dms->getFolder($folderid); if (!is_object($folder)) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } -$folderPathHTML = getFolderPathHTML($folder, true); +$folderPathHTML = $folder->getFolderPathHTML(true); if ($folderid == $settings->_rootFolderID || !$folder->getParent()) { UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("cannot_rm_root")); diff --git a/out/out.RemoveFolderFiles.php b/out/out.RemoveFolderFiles.php index 15fa6dca0..91f3a326f 100644 --- a/out/out.RemoveFolderFiles.php +++ b/out/out.RemoveFolderFiles.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -39,7 +38,7 @@ if (!isset($_GET["targetidform3"]) || !is_numeric($_GET["targetidform3"]) || int } $folderid = $_GET["targetidform3"]; -$folder = getFolder($folderid); +$folder = $dms->getFolder($folderid); if (!is_object($folder)) { UI::exitError(getMLText("admin_tools"),getMLText("invalid_folder_id")); diff --git a/out/out.RemoveGroup.php b/out/out.RemoveGroup.php index 8beca2092..49fa17e86 100644 --- a/out/out.RemoveGroup.php +++ b/out/out.RemoveGroup.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.RemoveLog.php b/out/out.RemoveLog.php index b3160ba09..47e0995d6 100644 --- a/out/out.RemoveLog.php +++ b/out/out.RemoveLog.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.RemoveUser.php b/out/out.RemoveUser.php index a9bbad5d0..167a6fa8a 100644 --- a/out/out.RemoveUser.php +++ b/out/out.RemoveUser.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.RemoveVersion.php b/out/out.RemoveVersion.php index 2b49a3e15..e481e115d 100644 --- a/out/out.RemoveVersion.php +++ b/out/out.RemoveVersion.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -37,14 +36,14 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ } $documentid = $_GET["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_ALL) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); diff --git a/out/out.ReviewDocument.php b/out/out.ReviewDocument.php index 87ef97982..68e80bd8d 100644 --- a/out/out.ReviewDocument.php +++ b/out/out.ReviewDocument.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -38,14 +37,14 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ } $documentid = $_GET["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_READ) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); diff --git a/out/out.ReviewSummary.php b/out/out.ReviewSummary.php index 18bb03682..dd03d3e48 100644 --- a/out/out.ReviewSummary.php +++ b/out/out.ReviewSummary.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.SearchForm.php b/out/out.SearchForm.php index 9d9603a16..41128a1e8 100644 --- a/out/out.SearchForm.php +++ b/out/out.SearchForm.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -33,17 +32,17 @@ include("../inc/inc.Authentication.php"); if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) { $folderid=$settings->_rootFolderID; - $folder = getFolder($folderid); + $folder = $dms->getFolder($folderid); } else { $folderid = $_GET["folderid"]; - $folder = getFolder($folderid); + $folder = $dms->getFolder($folderid); } if (!is_object($folder)) { UI::exitError(getMLText("search"),getMLText("invalid_folder_id")); } -$folderPathHTML = getFolderPathHTML($folder, true); +$folderPathHTML = $folder->getFolderPathHTML(true); UI::htmlStartPage(getMLText("search")); UI::globalNavigation($folder); diff --git a/out/out.SetExpires.php b/out/out.SetExpires.php index 04192af00..f9100c768 100644 --- a/out/out.SetExpires.php +++ b/out/out.SetExpires.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -36,14 +35,14 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } $documentid = $_GET["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); diff --git a/out/out.SetReviewersApprovers.php b/out/out.SetReviewersApprovers.php index 6db895917..acd680eae 100644 --- a/out/out.SetReviewersApprovers.php +++ b/out/out.SetReviewersApprovers.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -37,14 +36,14 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } $documentid = $_GET["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_ALL) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); diff --git a/out/out.Statistic.php b/out/out.Statistic.php index 1d39e9b06..945c5b118 100644 --- a/out/out.Statistic.php +++ b/out/out.Statistic.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.UpdateDocument.php b/out/out.UpdateDocument.php index 12c668b38..aed7fcca7 100644 --- a/out/out.UpdateDocument.php +++ b/out/out.UpdateDocument.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -37,14 +36,14 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } $documentid = $_GET["documentid"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; +$docPathHTML = $folder->getFolderPathHTML($folder, true). " / ".$document->getName().""; if ($document->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); diff --git a/out/out.UserDefaultKeywords.php b/out/out.UserDefaultKeywords.php index 8a6981cb0..d15f37ff1 100644 --- a/out/out.UserDefaultKeywords.php +++ b/out/out.UserDefaultKeywords.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.ClassKeywords.php"); diff --git a/out/out.UserImage.php b/out/out.UserImage.php index 2afba1903..517b381d3 100644 --- a/out/out.UserImage.php +++ b/out/out.UserImage.php @@ -20,8 +20,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.UserList.php b/out/out.UserList.php index 7eecd486d..d93ec7f2e 100644 --- a/out/out.UserList.php +++ b/out/out.UserList.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.UsrMgr.php b/out/out.UsrMgr.php index 3b51d9540..4d33f3da7 100644 --- a/out/out.UsrMgr.php +++ b/out/out.UsrMgr.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.UsrView.php b/out/out.UsrView.php index 68c696b0b..3d9094214 100644 --- a/out/out.UsrView.php +++ b/out/out.UsrView.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.ViewDocument.php b/out/out.ViewDocument.php index 6f0ba57d3..70bbb570a 100644 --- a/out/out.ViewDocument.php +++ b/out/out.ViewDocument.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -37,16 +36,16 @@ include("../inc/inc.ClassEmail.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"]; -$document = getDocument($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(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName(); +$docPathHTML = $folder->getFolderPathHTML(true). " / ".$document->getName(); if ($document->getAccessMode($user) < M_READ) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); diff --git a/out/out.ViewEvent.php b/out/out.ViewEvent.php index 55fcff35e..7ba8a5dc6 100644 --- a/out/out.ViewEvent.php +++ b/out/out.ViewEvent.php @@ -19,8 +19,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); diff --git a/out/out.ViewFolder.php b/out/out.ViewFolder.php index cb75bf985..765b2cabf 100644 --- a/out/out.ViewFolder.php +++ b/out/out.ViewFolder.php @@ -21,8 +21,7 @@ include("../inc/inc.Settings.php"); include("../inc/inc.AccessUtils.php"); include("../inc/inc.ClassAccess.php"); -include("../inc/inc.ClassDocument.php"); -include("../inc/inc.ClassFolder.php"); +include("../inc/inc.ClassDMS.php"); include("../inc/inc.ClassGroup.php"); include("../inc/inc.ClassUser.php"); include("../inc/inc.DBAccess.php"); @@ -38,7 +37,8 @@ if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET[ else { $folderid = $_GET["folderid"]; } -$folder = getFolder($folderid); + +$folder = $dms->getFolder($folderid); if (!is_object($folder)) { UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); } @@ -49,7 +49,7 @@ if (isset($_GET["orderby"]) && strlen($_GET["orderby"])==1 ) { $orderby=$_GET["orderby"]; }else $orderby=""; -$folderPathHTML = getFolderPathHTML($folder); +$folderPathHTML = $folder->getFolderPathHTML(); if ($folder->getAccessMode($user) < M_READ) { UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied"));