Commit ac69880992a4f694e8aaf1d34f1fbaee16d18a18

Authored by Conrad Vermeulen
1 parent 2c3d6516

KTS-2358

"php5 migration"
Updated. Removed & from &new. Added statics.

Committed By: Conrad Vermeulen
Reviewed By: Kevin Fourie

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7181 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/documentmanagement/DocumentLink.inc
1 -<?php 1 +<?php
2 /** 2 /**
3 * 3 *
4 * Represents a document link as per the database document_link table. 4 * Represents a document link as per the database document_link table.
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 * License Version 1.1.2 ("License"); You may not use this file except in 9 * License Version 1.1.2 ("License"); You may not use this file except in
10 * compliance with the License. You may obtain a copy of the License at 10 * compliance with the License. You may obtain a copy of the License at
11 * http://www.knowledgetree.com/KPL 11 * http://www.knowledgetree.com/KPL
12 - * 12 + *
13 * Software distributed under the License is distributed on an "AS IS" 13 * Software distributed under the License is distributed on an "AS IS"
14 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 14 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
15 * See the License for the specific language governing rights and 15 * See the License for the specific language governing rights and
@@ -20,9 +20,9 @@ @@ -20,9 +20,9 @@
20 * (ii) the KnowledgeTree copyright notice 20 * (ii) the KnowledgeTree copyright notice
21 * in the same form as they appear in the distribution. See the License for 21 * in the same form as they appear in the distribution. See the License for
22 * requirements. 22 * requirements.
23 - * 23 + *
24 * The Original Code is: KnowledgeTree Open Source 24 * The Original Code is: KnowledgeTree Open Source
25 - * 25 + *
26 * The Initial Developer of the Original Code is The Jam Warehouse Software 26 * The Initial Developer of the Original Code is The Jam Warehouse Software
27 * (Pty) Ltd, trading as KnowledgeTree. 27 * (Pty) Ltd, trading as KnowledgeTree.
28 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright 28 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
@@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
32 * 32 *
33 * 33 *
34 * @author Bryn Divey, Jam Warehouse (Pty) Ltd, South Africa 34 * @author Bryn Divey, Jam Warehouse (Pty) Ltd, South Africa
35 - * @package lib.documentmanagement 35 + * @package lib.documentmanagement
36 */ 36 */
37 class DocumentLink extends KTEntity { 37 class DocumentLink extends KTEntity {
38 38
@@ -40,7 +40,7 @@ class DocumentLink extends KTEntity { @@ -40,7 +40,7 @@ class DocumentLink extends KTEntity {
40 var $iId; 40 var $iId;
41 /** primary key of user responsible for creating document */ 41 /** primary key of user responsible for creating document */
42 var $iParentDocumentId; 42 var $iParentDocumentId;
43 - /** document title name */ 43 + /** document title name */
44 var $iChildDocumentId; 44 var $iChildDocumentId;
45 /** type of link */ 45 /** type of link */
46 var $iLinkTypeId; 46 var $iLinkTypeId;
@@ -82,14 +82,14 @@ class DocumentLink extends KTEntity { @@ -82,14 +82,14 @@ class DocumentLink extends KTEntity {
82 /** 82 /**
83 * Helper getters 83 * Helper getters
84 */ 84 */
85 - 85 +
86 /** 86 /**
87 * get parent document 87 * get parent document
88 */ 88 */
89 function & getParentDocument() { 89 function & getParentDocument() {
90 return Document::get($this->getParentDocumentId()); 90 return Document::get($this->getParentDocumentId());
91 } 91 }
92 - 92 +
93 /** 93 /**
94 * get child document 94 * get child document
95 */ 95 */
@@ -97,7 +97,7 @@ class DocumentLink extends KTEntity { @@ -97,7 +97,7 @@ class DocumentLink extends KTEntity {
97 $oDocument = Document::get($this->getChildDocumentId()); 97 $oDocument = Document::get($this->getChildDocumentId());
98 return $oDocument; 98 return $oDocument;
99 } 99 }
100 - 100 +
101 /** 101 /**
102 * get link type 102 * get link type
103 */ 103 */
@@ -124,12 +124,12 @@ class DocumentLink extends KTEntity { @@ -124,12 +124,12 @@ class DocumentLink extends KTEntity {
124 // static boilerplate 124 // static boilerplate
125 function & get($iDocumentLinkID) { 125 function & get($iDocumentLinkID) {
126 global $default; 126 global $default;
127 - 127 +
128 $sql = $default->db; 128 $sql = $default->db;
129 $result = $sql->query(array("SELECT * FROM $default->document_link_table WHERE id = ?", $iDocumentLinkID));/*ok*/ 129 $result = $sql->query(array("SELECT * FROM $default->document_link_table WHERE id = ?", $iDocumentLinkID));/*ok*/
130 if ($result) { 130 if ($result) {
131 if ($sql->next_record()) { 131 if ($sql->next_record()) {
132 - $oDocumentLink = & new DocumentLink($sql->f("parent_document_id"), $sql->f("child_document_id"), $sql->f("link_type_id")); 132 + $oDocumentLink = new DocumentLink($sql->f("parent_document_id"), $sql->f("child_document_id"), $sql->f("link_type_id"));
133 $oDocumentLink->iId = $sql->f("id"); 133 $oDocumentLink->iId = $sql->f("id");
134 return $oDocumentLink; 134 return $oDocumentLink;
135 } 135 }
@@ -155,7 +155,7 @@ class DocumentLink extends KTEntity { @@ -155,7 +155,7 @@ class DocumentLink extends KTEntity {
155 function getLinksFromDocument($iDocumentId) { 155 function getLinksFromDocument($iDocumentId) {
156 return KTEntityUtil::getList2('DocumentLink', sprintf("parent_document_id = %d", $iDocumentId)); 156 return KTEntityUtil::getList2('DocumentLink', sprintf("parent_document_id = %d", $iDocumentId));
157 } 157 }
158 - 158 +
159 /** 159 /**
160 * Static function 160 * Static function
161 * Get a list of DocumentLinks where iDocumentId is the child 161 * Get a list of DocumentLinks where iDocumentId is the child
lib/documentmanagement/DocumentTransaction.inc
@@ -3,14 +3,14 @@ @@ -3,14 +3,14 @@
3 * $Id$ 3 * $Id$
4 * 4 *
5 * Represents a document transaction as per the database table document_transaction. 5 * Represents a document transaction as per the database table document_transaction.
6 - * No delete or update functions are provided. Once a transaction has been stored 6 + * No delete or update functions are provided. Once a transaction has been stored
7 * in the database it may not be changed. 7 * in the database it may not be changed.
8 * 8 *
9 * The contents of this file are subject to the KnowledgeTree Public 9 * The contents of this file are subject to the KnowledgeTree Public
10 * License Version 1.1.2 ("License"); You may not use this file except in 10 * License Version 1.1.2 ("License"); You may not use this file except in
11 * compliance with the License. You may obtain a copy of the License at 11 * compliance with the License. You may obtain a copy of the License at
12 * http://www.knowledgetree.com/KPL 12 * http://www.knowledgetree.com/KPL
13 - * 13 + *
14 * Software distributed under the License is distributed on an "AS IS" 14 * Software distributed under the License is distributed on an "AS IS"
15 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 15 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
16 * See the License for the specific language governing rights and 16 * See the License for the specific language governing rights and
@@ -21,9 +21,9 @@ @@ -21,9 +21,9 @@
21 * (ii) the KnowledgeTree copyright notice 21 * (ii) the KnowledgeTree copyright notice
22 * in the same form as they appear in the distribution. See the License for 22 * in the same form as they appear in the distribution. See the License for
23 * requirements. 23 * requirements.
24 - * 24 + *
25 * The Original Code is: KnowledgeTree Open Source 25 * The Original Code is: KnowledgeTree Open Source
26 - * 26 + *
27 * The Initial Developer of the Original Code is The Jam Warehouse Software 27 * The Initial Developer of the Original Code is The Jam Warehouse Software
28 * (Pty) Ltd, trading as KnowledgeTree. 28 * (Pty) Ltd, trading as KnowledgeTree.
29 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright 29 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
@@ -33,15 +33,15 @@ @@ -33,15 +33,15 @@
33 */ 33 */
34 34
35 require_once(KT_LIB_DIR . "/documentmanagement/documentutil.inc.php"); 35 require_once(KT_LIB_DIR . "/documentmanagement/documentutil.inc.php");
36 -  
37 -require_once(KT_LIB_DIR . '/users/User.inc');  
38 -require_once(KT_LIB_DIR . '/documentmanagement/DocumentTransactionType.inc.php');  
39 -  
40 -require_once(KT_LIB_DIR . '/foldermanagement/Folder.inc');  
41 -require_once(KT_LIB_DIR . '/browse/browseutil.inc.php');  
42 - 36 +
  37 +require_once(KT_LIB_DIR . '/users/User.inc');
  38 +require_once(KT_LIB_DIR . '/documentmanagement/DocumentTransactionType.inc.php');
  39 +
  40 +require_once(KT_LIB_DIR . '/foldermanagement/Folder.inc');
  41 +require_once(KT_LIB_DIR . '/browse/browseutil.inc.php');
  42 +
43 class DocumentTransaction extends KTEntity { 43 class DocumentTransaction extends KTEntity {
44 - 44 +
45 /** primary key of document transaction */ 45 /** primary key of document transaction */
46 var $iId = -1; 46 var $iId = -1;
47 var $iDocumentID; 47 var $iDocumentID;
@@ -53,14 +53,14 @@ class DocumentTransaction extends KTEntity { @@ -53,14 +53,14 @@ class DocumentTransaction extends KTEntity {
53 var $sComment; 53 var $sComment;
54 var $sTransactionNS; 54 var $sTransactionNS;
55 var $bAdminMode = 0; 55 var $bAdminMode = 0;
56 - 56 +
57 /** 57 /**
58 * Constructor 58 * Constructor
59 * 59 *
60 * @param Primary key of document on which transaction was performed 60 * @param Primary key of document on which transaction was performed
61 * @param User comment associated with transaction 61 * @param User comment associated with transaction
62 * @param Primary key of transaction type 62 * @param Primary key of transaction type
63 - * 63 + *
64 */ 64 */
65 function DocumentTransaction($oDocument, $sNewComment, $sTransactionNS, $aOptions = null) { 65 function DocumentTransaction($oDocument, $sNewComment, $sTransactionNS, $aOptions = null) {
66 if (is_null($aOptions)) { 66 if (is_null($aOptions)) {
@@ -68,7 +68,7 @@ class DocumentTransaction extends KTEntity { @@ -68,7 +68,7 @@ class DocumentTransaction extends KTEntity {
68 } 68 }
69 //object not stored yet, id = -1 69 //object not stored yet, id = -1
70 $this->iId = -1; 70 $this->iId = -1;
71 - 71 +
72 $this->iDocumentID = $oDocument->getID(); 72 $this->iDocumentID = $oDocument->getID();
73 $this->sComment = $sNewComment; 73 $this->sComment = $sNewComment;
74 $this->sTransactionNS = $sTransactionNS; 74 $this->sTransactionNS = $sTransactionNS;
@@ -78,19 +78,19 @@ class DocumentTransaction extends KTEntity { @@ -78,19 +78,19 @@ class DocumentTransaction extends KTEntity {
78 if (PEAR::isError($oFolder) || ($oFolder == false)) { 78 if (PEAR::isError($oFolder) || ($oFolder == false)) {
79 $this->sFileName = '.../' . $oDocument->getName(); 79 $this->sFileName = '.../' . $oDocument->getName();
80 } else { 80 } else {
81 - $this->sFileName = addslashes($oFolder->sFullPath . "/" . $oFolder->getName() . "/" . $oDocument->getName()); 81 + $this->sFileName = addslashes($oFolder->sFullPath . "/" . $oFolder->getName() . "/" . $oDocument->getName());
82 } 82 }
83 - 83 +
84 $this->iUserID = $_SESSION["userID"]; 84 $this->iUserID = $_SESSION["userID"];
85 $this->iSessionId = $_SESSION["sessionID"]; 85 $this->iSessionId = $_SESSION["sessionID"];
86 $oUser = KTUtil::arrayGet($aOptions, 'user'); 86 $oUser = KTUtil::arrayGet($aOptions, 'user');
87 - 87 +
88 if (!(PEAR::isError($oUser) || ($oUser == false))) { 88 if (!(PEAR::isError($oUser) || ($oUser == false))) {
89 $this->iUserID = $oUser->getID(); 89 $this->iUserID = $oUser->getID();
90 } 90 }
91 - $this->dDateTime = getCurrentDateTime(); 91 + $this->dDateTime = getCurrentDateTime();
92 $this->sIP = KTUtil::arrayGet($_SERVER, "REMOTE_ADDR", '0.0.0.0'); 92 $this->sIP = KTUtil::arrayGet($_SERVER, "REMOTE_ADDR", '0.0.0.0');
93 - 93 +
94 $oFolder = Folder::get($oDocument->getFolderID()); 94 $oFolder = Folder::get($oDocument->getFolderID());
95 // head off the certain breakage down the line. 95 // head off the certain breakage down the line.
96 if (PEAR::isError($oFolder) || ($oFolder === false)) { 96 if (PEAR::isError($oFolder) || ($oFolder === false)) {
@@ -100,14 +100,14 @@ class DocumentTransaction extends KTEntity { @@ -100,14 +100,14 @@ class DocumentTransaction extends KTEntity {
100 $this->bAdminMode = 1; 100 $this->bAdminMode = 1;
101 } else { 101 } else {
102 $this->bAdminMode = 0; 102 $this->bAdminMode = 0;
103 - } 103 + }
104 } 104 }
105 } 105 }
106 - 106 +
107 function getVersion() { return $this->sVersion; } 107 function getVersion() { return $this->sVersion; }
108 function getComment() { return $this->sComment; } 108 function getComment() { return $this->sComment; }
109 function _table() { return KTUtil::getTableName('document_transactions'); } 109 function _table() { return KTUtil::getTableName('document_transactions'); }
110 - 110 +
111 // some of these can throw a PEAR::error 111 // some of these can throw a PEAR::error
112 function & getUser() { return User::get($this->iUserID); } 112 function & getUser() { return User::get($this->iUserID); }
113 function getFilename() { return $this->sFileName; } 113 function getFilename() { return $this->sFileName; }
@@ -117,10 +117,10 @@ class DocumentTransaction extends KTEntity { @@ -117,10 +117,10 @@ class DocumentTransaction extends KTEntity {
117 $oType = $this->getTransactionType(); 117 $oType = $this->getTransactionType();
118 $action = _kt('Unknown Action'); 118 $action = _kt('Unknown Action');
119 if (!PEAR::isError($oType)) { $action = $oType->getName(); } 119 if (!PEAR::isError($oType)) { $action = $oType->getName(); }
120 - 120 +
121 return $action; 121 return $action;
122 } 122 }
123 - 123 +
124 /** 124 /**
125 * Create the document transaction in the database 125 * Create the document transaction in the database
126 * 126 *
@@ -158,9 +158,9 @@ class DocumentTransaction extends KTEntity { @@ -158,9 +158,9 @@ class DocumentTransaction extends KTEntity {
158 $_SESSION["errorMessage"] = $lang_err_object_exists; 158 $_SESSION["errorMessage"] = $lang_err_object_exists;
159 return false; 159 return false;
160 } 160 }
161 - 161 +
162 } 162 }
163 - 163 +
164 function delete() { 164 function delete() {
165 global $default, $lang_err_database, $lang_err_object_key; 165 global $default, $lang_err_database, $lang_err_object_key;
166 if ($this->iId >= 0) { 166 if ($this->iId >= 0) {
@@ -177,7 +177,7 @@ class DocumentTransaction extends KTEntity { @@ -177,7 +177,7 @@ class DocumentTransaction extends KTEntity {
177 $_SESSION["errorMessage"] = $lang_err_object_key; 177 $_SESSION["errorMessage"] = $lang_err_object_key;
178 return false; 178 return false;
179 } 179 }
180 - 180 +
181 /** 181 /**
182 * Static function. Given a document transaction primary key will create 182 * Static function. Given a document transaction primary key will create
183 * a document transaction object and populate it with the corresponding 183 * a document transaction object and populate it with the corresponding
@@ -190,12 +190,12 @@ class DocumentTransaction extends KTEntity { @@ -190,12 +190,12 @@ class DocumentTransaction extends KTEntity {
190 if (strlen($iDocumentTransactionID) > 0) { 190 if (strlen($iDocumentTransactionID) > 0) {
191 $sql = $default->db; 191 $sql = $default->db;
192 $sql->query(array("SELECT * FROM $default->document_transactions_table WHERE id = ?", $iDocumentTransactionID));/*ok*/ 192 $sql->query(array("SELECT * FROM $default->document_transactions_table WHERE id = ?", $iDocumentTransactionID));/*ok*/
193 - if ($sql->next_record()) {  
194 - $oDocumentTransaction = & new DocumentTransaction(Document::get($sql->f("document_id")), $sql->f("comment"), $sql->f("transaction_namespace"));  
195 - $oDocumentTransaction->iId = $sql->f("id"); 193 + if ($sql->next_record()) {
  194 + $oDocumentTransaction = new DocumentTransaction(Document::get($sql->f("document_id")), $sql->f("comment"), $sql->f("transaction_namespace"));
  195 + $oDocumentTransaction->iId = $sql->f("id");
196 $oDocumentTransaction->sVersion = $sql->f("version"); 196 $oDocumentTransaction->sVersion = $sql->f("version");
197 $oDocumentTransaction->iUserID = $sql->f("user_id"); 197 $oDocumentTransaction->iUserID = $sql->f("user_id");
198 - $oDocumentTransaction->dDateTime = $sql->f("datetime"); 198 + $oDocumentTransaction->dDateTime = $sql->f("datetime");
199 $oDocumentTransaction->sIP = $sql->f("ip"); 199 $oDocumentTransaction->sIP = $sql->f("ip");
200 $oDocumentTransaction->sFileName = $sql->f("filename"); 200 $oDocumentTransaction->sFileName = $sql->f("filename");
201 $oDocumentTransaction->bAdminMode = $sql->f("admin_mode"); 201 $oDocumentTransaction->bAdminMode = $sql->f("admin_mode");
lib/documentmanagement/DocumentType.inc
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 * License Version 1.1.2 ("License"); You may not use this file except in 8 * License Version 1.1.2 ("License"); You may not use this file except in
9 * compliance with the License. You may obtain a copy of the License at 9 * compliance with the License. You may obtain a copy of the License at
10 * http://www.knowledgetree.com/KPL 10 * http://www.knowledgetree.com/KPL
11 - * 11 + *
12 * Software distributed under the License is distributed on an "AS IS" 12 * Software distributed under the License is distributed on an "AS IS"
13 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 13 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
14 * See the License for the specific language governing rights and 14 * See the License for the specific language governing rights and
@@ -19,9 +19,9 @@ @@ -19,9 +19,9 @@
19 * (ii) the KnowledgeTree copyright notice 19 * (ii) the KnowledgeTree copyright notice
20 * in the same form as they appear in the distribution. See the License for 20 * in the same form as they appear in the distribution. See the License for
21 * requirements. 21 * requirements.
22 - * 22 + *
23 * The Original Code is: KnowledgeTree Open Source 23 * The Original Code is: KnowledgeTree Open Source
24 - * 24 + *
25 * The Initial Developer of the Original Code is The Jam Warehouse Software 25 * The Initial Developer of the Original Code is The Jam Warehouse Software
26 * (Pty) Ltd, trading as KnowledgeTree. 26 * (Pty) Ltd, trading as KnowledgeTree.
27 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright 27 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 require_once(KT_LIB_DIR . "/util/sanitize.inc"); 33 require_once(KT_LIB_DIR . "/util/sanitize.inc");
34 34
35 class DocumentType extends KTEntity { 35 class DocumentType extends KTEntity {
36 - 36 +
37 /** primary key value */ 37 /** primary key value */
38 var $iId; 38 var $iId;
39 /** document type name */ 39 /** document type name */
@@ -46,7 +46,7 @@ class DocumentType extends KTEntity { @@ -46,7 +46,7 @@ class DocumentType extends KTEntity {
46 'sName' => 'name', 46 'sName' => 'name',
47 'bDisabled' => 'disabled' 47 'bDisabled' => 'disabled'
48 ); 48 );
49 - 49 +
50 /** 50 /**
51 * Default constructor 51 * Default constructor
52 * 52 *
@@ -60,7 +60,7 @@ class DocumentType extends KTEntity { @@ -60,7 +60,7 @@ class DocumentType extends KTEntity {
60 $this->sName = $sNewName; 60 $this->sName = $sNewName;
61 $this->bDisabled = false; 61 $this->bDisabled = false;
62 } 62 }
63 - 63 +
64 function getID() { return $this->iId; } 64 function getID() { return $this->iId; }
65 function getName() { return sanitizeForSQLtoHTML($this->sName); } 65 function getName() { return sanitizeForSQLtoHTML($this->sName); }
66 function setName($sNewValue) { $this->sName = sanitizeForSQL($sNewValue); } 66 function setName($sNewValue) { $this->sName = sanitizeForSQL($sNewValue); }
@@ -75,7 +75,7 @@ class DocumentType extends KTEntity { @@ -75,7 +75,7 @@ class DocumentType extends KTEntity {
75 } 75 }
76 76
77 function _table () { return KTUtil::getTableName('document_types'); } 77 function _table () { return KTUtil::getTableName('document_types'); }
78 - 78 +
79 function delete() { 79 function delete() {
80 if ($this->isUsed()) { 80 if ($this->isUsed()) {
81 return PEAR::raiseError(_kt('Document type still in use')); 81 return PEAR::raiseError(_kt('Document type still in use'));
@@ -98,7 +98,7 @@ class DocumentType extends KTEntity { @@ -98,7 +98,7 @@ class DocumentType extends KTEntity {
98 return false; 98 return false;
99 } 99 }
100 100
101 - /* 101 + /*
102 Get the fieldsets associated with this document type. 102 Get the fieldsets associated with this document type.
103 Simplifies listing associated fieldsets in doctypes displays. 103 Simplifies listing associated fieldsets in doctypes displays.
104 */ 104 */
@@ -106,7 +106,7 @@ class DocumentType extends KTEntity { @@ -106,7 +106,7 @@ class DocumentType extends KTEntity {
106 function &getFieldsets() { 106 function &getFieldsets() {
107 return KTFieldset::getForDocumentType($this); 107 return KTFieldset::getForDocumentType($this);
108 } 108 }
109 - 109 +
110 /** 110 /**
111 * Get the document types associated with a document 111 * Get the document types associated with a document
112 */ 112 */
@@ -114,17 +114,17 @@ class DocumentType extends KTEntity { @@ -114,17 +114,17 @@ class DocumentType extends KTEntity {
114 $sTable = KTUtil::getTableName('document_metadata_version'); 114 $sTable = KTUtil::getTableName('document_metadata_version');
115 $sQuery = "SELECT DISTINCT(document_type_id) FROM {$sTable}"; 115 $sQuery = "SELECT DISTINCT(document_type_id) FROM {$sTable}";
116 $aDocTypes = DBUtil::getResultArray($sQuery); 116 $aDocTypes = DBUtil::getResultArray($sQuery);
117 - 117 +
118 $aTypes = array(); 118 $aTypes = array();
119 if(!empty($aDocTypes)){ 119 if(!empty($aDocTypes)){
120 foreach($aDocTypes as $type){ 120 foreach($aDocTypes as $type){
121 $aTypes[] = $type['document_type_id']; 121 $aTypes[] = $type['document_type_id'];
122 } 122 }
123 } 123 }
124 - 124 +
125 return $aTypes; 125 return $aTypes;
126 } 126 }
127 - 127 +
128 /** 128 /**
129 * Check if a type is associated with any documents 129 * Check if a type is associated with any documents
130 */ 130 */
@@ -135,7 +135,7 @@ class DocumentType extends KTEntity { @@ -135,7 +135,7 @@ class DocumentType extends KTEntity {
135 return TRUE; 135 return TRUE;
136 } 136 }
137 } 137 }
138 - 138 +
139 /** 139 /**
140 * Static- Get a list document types; 140 * Static- Get a list document types;
141 * 141 *
@@ -148,7 +148,7 @@ class DocumentType extends KTEntity { @@ -148,7 +148,7 @@ class DocumentType extends KTEntity {
148 $aOptions = array('orderby' => 'name'); 148 $aOptions = array('orderby' => 'name');
149 return KTEntityUtil::getList2('DocumentType', $sWhereClause, $aOptions); 149 return KTEntityUtil::getList2('DocumentType', $sWhereClause, $aOptions);
150 } 150 }
151 - 151 +
152 /* alternative for use in creation: delegate for user and location */ 152 /* alternative for use in creation: delegate for user and location */
153 function &getListForUserAndFolder($oUser, $oFolder) { 153 function &getListForUserAndFolder($oUser, $oFolder) {
154 $src =& KTDocumentTypeManager::getSingleton(); 154 $src =& KTDocumentTypeManager::getSingleton();
@@ -158,10 +158,10 @@ class DocumentType extends KTEntity { @@ -158,10 +158,10 @@ class DocumentType extends KTEntity {
158 function &createFromArray($aArray) { 158 function &createFromArray($aArray) {
159 return KTEntityUtil::createFromArray('DocumentType', $aArray); 159 return KTEntityUtil::createFromArray('DocumentType', $aArray);
160 } 160 }
161 - 161 +
162 function &get($iId) { return KTEntityUtil::get('DocumentType', $iId); } 162 function &get($iId) { return KTEntityUtil::get('DocumentType', $iId); }
163 -  
164 - 163 +
  164 +
165 165
166 } 166 }
167 167
@@ -176,7 +176,7 @@ class DocumentType extends KTEntity { @@ -176,7 +176,7 @@ class DocumentType extends KTEntity {
176 * @return User user object 176 * @return User user object
177 */ 177 */
178 function & documenttypeCreateFromArray($aParameters) { 178 function & documenttypeCreateFromArray($aParameters) {
179 - $oDocType = & new DocumentType($aParameters[0], $aParameters[1], $aParameters[2], $aParameters[3], $aParameters[4], $aParameters[5], $aParameters[6], $aParameters[7], $aParameters[8], $aParameters[9], $aParameters[10]); 179 + $oDocType = new DocumentType($aParameters[0], $aParameters[1], $aParameters[2], $aParameters[3], $aParameters[4], $aParameters[5], $aParameters[6], $aParameters[7], $aParameters[8], $aParameters[9], $aParameters[10]);
180 return $oDocType; 180 return $oDocType;
181 } 181 }
182 182
@@ -184,11 +184,11 @@ function &amp; documenttypeCreateFromArray($aParameters) { @@ -184,11 +184,11 @@ function &amp; documenttypeCreateFromArray($aParameters) {
184 class DemoDelegation { 184 class DemoDelegation {
185 var $handler_ns = 'brad.oddhandler'; 185 var $handler_ns = 'brad.oddhandler';
186 var $handler_name = null; 186 var $handler_name = null;
187 - 187 +
188 function DemoDelegation() { 188 function DemoDelegation() {
189 $this->handler_name = _kt('Demo Delegator'); 189 $this->handler_name = _kt('Demo Delegator');
190 } 190 }
191 - 191 +
192 function &getListForUserAndFolder($oUser, $oFolder) { 192 function &getListForUserAndFolder($oUser, $oFolder) {
193 $list =& DocumentType::getList(); 193 $list =& DocumentType::getList();
194 $finallist = array(); 194 $finallist = array();
@@ -213,7 +213,7 @@ class KTDocumentTypeManager { @@ -213,7 +213,7 @@ class KTDocumentTypeManager {
213 } 213 }
214 return $GLOBALS['oKTDocumentTypeManager']; 214 return $GLOBALS['oKTDocumentTypeManager'];
215 } 215 }
216 - 216 +
217 function &getListForUserAndFolder($oUser, $oFolder) { 217 function &getListForUserAndFolder($oUser, $oFolder) {
218 $this->checkActiveHandler(); 218 $this->checkActiveHandler();
219 if (is_null($this->_active_handler)) { 219 if (is_null($this->_active_handler)) {
@@ -222,7 +222,7 @@ class KTDocumentTypeManager { @@ -222,7 +222,7 @@ class KTDocumentTypeManager {
222 } else { 222 } else {
223 $l = (array) $this->_active_handler->getListForUserAndFolder($oUser, $oFolder); 223 $l = (array) $this->_active_handler->getListForUserAndFolder($oUser, $oFolder);
224 } 224 }
225 - 225 +
226 $final = array(); 226 $final = array();
227 foreach ($l as $oType) { 227 foreach ($l as $oType) {
228 if (PEAR::isError($oType) || ($oType->getDisabled())) { 228 if (PEAR::isError($oType) || ($oType->getDisabled())) {
@@ -232,12 +232,12 @@ class KTDocumentTypeManager { @@ -232,12 +232,12 @@ class KTDocumentTypeManager {
232 } 232 }
233 return $final; 233 return $final;
234 } 234 }
235 - 235 +
236 function checkActiveHandler() { 236 function checkActiveHandler() {
237 if ($this->_checked) { return ; } 237 if ($this->_checked) { return ; }
238 // not perfect - see workflow-delegator for explanation. 238 // not perfect - see workflow-delegator for explanation.
239 $res = KTUtil::getSystemSetting('documenttypehandler'); 239 $res = KTUtil::getSystemSetting('documenttypehandler');
240 - 240 +
241 if (empty($res) || PEAR::isError($res)) { // just fail silently - don't degrade the system 241 if (empty($res) || PEAR::isError($res)) { // just fail silently - don't degrade the system
242 $this->_active_handler = null; 242 $this->_active_handler = null;
243 } else { 243 } else {
@@ -245,10 +245,10 @@ class KTDocumentTypeManager { @@ -245,10 +245,10 @@ class KTDocumentTypeManager {
245 $this->_active_handler = KTUtil::arrayGet($this->_handlers, $ns); 245 $this->_active_handler = KTUtil::arrayGet($this->_handlers, $ns);
246 } 246 }
247 $this->_checked = true; 247 $this->_checked = true;
248 - 248 +
249 return ; 249 return ;
250 } 250 }
251 - 251 +
252 function registerHandler($oHandler) { 252 function registerHandler($oHandler) {
253 $this->_handlers[$oHandler->handler_ns] = $oHandler; 253 $this->_handlers[$oHandler->handler_ns] = $oHandler;
254 } 254 }
lib/documentmanagement/LinkType.inc
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 * License Version 1.1.2 ("License"); You may not use this file except in 8 * License Version 1.1.2 ("License"); You may not use this file except in
9 * compliance with the License. You may obtain a copy of the License at 9 * compliance with the License. You may obtain a copy of the License at
10 * http://www.knowledgetree.com/KPL 10 * http://www.knowledgetree.com/KPL
11 - * 11 + *
12 * Software distributed under the License is distributed on an "AS IS" 12 * Software distributed under the License is distributed on an "AS IS"
13 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 13 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
14 * See the License for the specific language governing rights and 14 * See the License for the specific language governing rights and
@@ -19,9 +19,9 @@ @@ -19,9 +19,9 @@
19 * (ii) the KnowledgeTree copyright notice 19 * (ii) the KnowledgeTree copyright notice
20 * in the same form as they appear in the distribution. See the License for 20 * in the same form as they appear in the distribution. See the License for
21 * requirements. 21 * requirements.
22 - * 22 + *
23 * The Original Code is: KnowledgeTree Open Source 23 * The Original Code is: KnowledgeTree Open Source
24 - * 24 + *
25 * The Initial Developer of the Original Code is The Jam Warehouse Software 25 * The Initial Developer of the Original Code is The Jam Warehouse Software
26 * (Pty) Ltd, trading as KnowledgeTree. 26 * (Pty) Ltd, trading as KnowledgeTree.
27 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright 27 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
@@ -36,7 +36,7 @@ require_once(KT_LIB_DIR . &quot;/util/sanitize.inc&quot;); @@ -36,7 +36,7 @@ require_once(KT_LIB_DIR . &quot;/util/sanitize.inc&quot;);
36 class LinkType extends KTEntity { 36 class LinkType extends KTEntity {
37 var $sName; 37 var $sName;
38 var $sDescription; 38 var $sDescription;
39 - 39 +
40 var $_aFieldToSelect = array( 40 var $_aFieldToSelect = array(
41 'iId' => 'id', 41 'iId' => 'id',
42 'sName' => 'name', 42 'sName' => 'name',
@@ -48,35 +48,35 @@ class LinkType extends KTEntity { @@ -48,35 +48,35 @@ class LinkType extends KTEntity {
48 $this->sName = $sName; 48 $this->sName = $sName;
49 $this->sDescription = $sDescription; 49 $this->sDescription = $sDescription;
50 } 50 }
51 - 51 +
52 function getDescription() { 52 function getDescription() {
53 return sanitizeForSQLtoHTML($this->sDescription); 53 return sanitizeForSQLtoHTML($this->sDescription);
54 } 54 }
55 - 55 +
56 function setDescription($sNewValue) { 56 function setDescription($sNewValue) {
57 $this->sDescription = sanitizeForSQL($sNewValue); 57 $this->sDescription = sanitizeForSQL($sNewValue);
58 } 58 }
59 - 59 +
60 function getName() { 60 function getName() {
61 return sanitizeForSQLtoHTML($this->sName); 61 return sanitizeForSQLtoHTML($this->sName);
62 } 62 }
63 - 63 +
64 function setName($sNewValue) { 64 function setName($sNewValue) {
65 $this->sName = sanitizeForSQL($sNewValue); 65 $this->sName = sanitizeForSQL($sNewValue);
66 } 66 }
67 - 67 +
68 function _fieldValues () { 68 function _fieldValues () {
69 return array( 69 return array(
70 'name' => sanitizeForSQLtoHTML($this->sName), 70 'name' => sanitizeForSQLtoHTML($this->sName),
71 'description' => sanitizeForSQLtoHTML($this->sDescription), 71 'description' => sanitizeForSQLtoHTML($this->sDescription),
72 ); 72 );
73 } 73 }
74 - 74 +
75 function _table () { 75 function _table () {
76 global $default; 76 global $default;
77 return $default->document_link_types_table; 77 return $default->document_link_types_table;
78 } 78 }
79 - 79 +
80 function getList($sWhereClause = null) { 80 function getList($sWhereClause = null) {
81 return KTEntityUtil::getList(LinkType::_table(), 'LinkType', $sWhereClause); 81 return KTEntityUtil::getList(LinkType::_table(), 'LinkType', $sWhereClause);
82 } 82 }
@@ -93,7 +93,7 @@ class LinkType extends KTEntity { @@ -93,7 +93,7 @@ class LinkType extends KTEntity {
93 // XXX: No such key exception type 93 // XXX: No such key exception type
94 return $res; 94 return $res;
95 } 95 }
96 - $oLinkType =& new LinkType($res['name'], $res['description']); 96 + $oLinkType =new LinkType($res['name'], $res['description']);
97 $oLinkType->iId = $res['id']; 97 $oLinkType->iId = $res['id'];
98 return $oLinkType; 98 return $oLinkType;
99 } 99 }
@@ -107,7 +107,7 @@ class LinkType extends KTEntity { @@ -107,7 +107,7 @@ class LinkType extends KTEntity {
107 } 107 }
108 108
109 function &linktypecreateFromArray($aParameters) { 109 function &linktypecreateFromArray($aParameters) {
110 - $oLinkType = & new LinkType($aParameters[0], $aParameters[1], $aParameters[2], $aParameters[3], $aParameters[4], $aParameters[5], $aParameters[6], $aParameters[7], $aParameters[8], $aParameters[9], $aParameters[10]); 110 + $oLinkType = new LinkType($aParameters[0], $aParameters[1], $aParameters[2], $aParameters[3], $aParameters[4], $aParameters[5], $aParameters[6], $aParameters[7], $aParameters[8], $aParameters[9], $aParameters[10]);
111 return $oLinkType; 111 return $oLinkType;
112 } 112 }
113 113
lib/documentmanagement/MetaData.inc
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 * License Version 1.1.2 ("License"); You may not use this file except in 8 * License Version 1.1.2 ("License"); You may not use this file except in
9 * compliance with the License. You may obtain a copy of the License at 9 * compliance with the License. You may obtain a copy of the License at
10 * http://www.knowledgetree.com/KPL 10 * http://www.knowledgetree.com/KPL
11 - * 11 + *
12 * Software distributed under the License is distributed on an "AS IS" 12 * Software distributed under the License is distributed on an "AS IS"
13 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 13 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
14 * See the License for the specific language governing rights and 14 * See the License for the specific language governing rights and
@@ -19,9 +19,9 @@ @@ -19,9 +19,9 @@
19 * (ii) the KnowledgeTree copyright notice 19 * (ii) the KnowledgeTree copyright notice
20 * in the same form as they appear in the distribution. See the License for 20 * in the same form as they appear in the distribution. See the License for
21 * requirements. 21 * requirements.
22 - * 22 + *
23 * The Original Code is: KnowledgeTree Open Source 23 * The Original Code is: KnowledgeTree Open Source
24 - * 24 + *
25 * The Initial Developer of the Original Code is The Jam Warehouse Software 25 * The Initial Developer of the Original Code is The Jam Warehouse Software
26 * (Pty) Ltd, trading as KnowledgeTree. 26 * (Pty) Ltd, trading as KnowledgeTree.
27 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright 27 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 require_once(KT_LIB_DIR . "/util/sanitize.inc"); 33 require_once(KT_LIB_DIR . "/util/sanitize.inc");
34 34
35 class MetaData extends KTEntity { 35 class MetaData extends KTEntity {
36 - 36 +
37 /** primary key value */ 37 /** primary key value */
38 var $iId = -1; 38 var $iId = -1;
39 //document field id 39 //document field id
@@ -58,7 +58,7 @@ class MetaData extends KTEntity { @@ -58,7 +58,7 @@ class MetaData extends KTEntity {
58 'bDisabled' => 'disabled', 58 'bDisabled' => 'disabled',
59 'bIsStuck' => 'is_stuck', 59 'bIsStuck' => 'is_stuck',
60 ); 60 );
61 - 61 +
62 /** 62 /**
63 * Default constructor 63 * Default constructor
64 * 64 *
@@ -72,7 +72,7 @@ class MetaData extends KTEntity { @@ -72,7 +72,7 @@ class MetaData extends KTEntity {
72 $this->sName = $sNewName; 72 $this->sName = $sNewName;
73 $this->iTreeParent = $iNewParent; 73 $this->iTreeParent = $iNewParent;
74 } 74 }
75 - 75 +
76 function getID() { return $this->iId; } 76 function getID() { return $this->iId; }
77 function getName() { return sanitizeForSQLtoHTML($this->sName); } 77 function getName() { return sanitizeForSQLtoHTML($this->sName); }
78 function setName($sNewValue) { $this->sName = sanitizeForSQL($sNewValue); } 78 function setName($sNewValue) { $this->sName = sanitizeForSQL($sNewValue); }
@@ -89,23 +89,23 @@ class MetaData extends KTEntity { @@ -89,23 +89,23 @@ class MetaData extends KTEntity {
89 global $default; 89 global $default;
90 return $default->metadata_table; 90 return $default->metadata_table;
91 } 91 }
92 - 92 +
93 function & get($iId) { 93 function & get($iId) {
94 return KTEntityUtil::get('MetaData', $iId); 94 return KTEntityUtil::get('MetaData', $iId);
95 } 95 }
96 - 96 +
97 // FIXME this function makes no sense. 97 // FIXME this function makes no sense.
98 function setMetaDataID($iDocFieldId, $sMetaDataName) 98 function setMetaDataID($iDocFieldId, $sMetaDataName)
99 { 99 {
100 $sTable = KTUtil::getTableName('metadata'); 100 $sTable = KTUtil::getTableName('metadata');
101 $sQuery = "SELECT id FROM $sTable WHERE document_field_id = ? and name = ?"; 101 $sQuery = "SELECT id FROM $sTable WHERE document_field_id = ? and name = ?";
102 - $aParams = array($iDocFieldId, $sMetaDataName); 102 + $aParams = array($iDocFieldId, $sMetaDataName);
103 $res = DBUtil::getResultArray(array($sQuery, $aParams)); 103 $res = DBUtil::getResultArray(array($sQuery, $aParams));
104 - 104 +
105 if (PEAR::isError($res)) { 105 if (PEAR::isError($res)) {
106 return false; // return $res; 106 return false; // return $res;
107 - }  
108 - 107 + }
  108 +
109 if (count($res) != 0) { 109 if (count($res) != 0) {
110 $this->iId = $id; 110 $this->iId = $id;
111 return $res[0]['id']; 111 return $res[0]['id'];
@@ -144,7 +144,7 @@ class MetaData extends KTEntity { @@ -144,7 +144,7 @@ class MetaData extends KTEntity {
144 'multi' => 'true', 144 'multi' => 'true',
145 'ids' => true, 145 'ids' => true,
146 'idfield' => 'name', 146 'idfield' => 'name',
147 - 'orderby' => 'name ASC', 147 + 'orderby' => 'name ASC',
148 )); 148 ));
149 } 149 }
150 150
@@ -159,7 +159,7 @@ class MetaData extends KTEntity { @@ -159,7 +159,7 @@ class MetaData extends KTEntity {
159 'disabled' => false, 159 'disabled' => false,
160 ), array( 160 ), array(
161 'multi' => 'true', 161 'multi' => 'true',
162 - 'orderby' => 'name ASC', 162 + 'orderby' => 'name ASC',
163 )); 163 ));
164 } 164 }
165 165
@@ -170,7 +170,7 @@ class MetaData extends KTEntity { @@ -170,7 +170,7 @@ class MetaData extends KTEntity {
170 'disabled' => true, 170 'disabled' => true,
171 ), array( 171 ), array(
172 'multi' => true, 172 'multi' => true,
173 - 'orderby' => 'name ASC', 173 + 'orderby' => 'name ASC',
174 )); 174 ));
175 } 175 }
176 176
@@ -183,7 +183,7 @@ class MetaData extends KTEntity { @@ -183,7 +183,7 @@ class MetaData extends KTEntity {
183 'multi' => 'true', 183 'multi' => 'true',
184 'ids' => true, 184 'ids' => true,
185 'idfield' => 'name', 185 'idfield' => 'name',
186 - 'orderby' => 'name ASC', 186 + 'orderby' => 'name ASC',
187 )); 187 ));
188 } 188 }
189 189
@@ -196,7 +196,7 @@ class MetaData extends KTEntity { @@ -196,7 +196,7 @@ class MetaData extends KTEntity {
196 'multi' => 'true', 196 'multi' => 'true',
197 'ids' => true, 197 'ids' => true,
198 'idfield' => 'name', 198 'idfield' => 'name',
199 - 'orderby' => 'name ASC', 199 + 'orderby' => 'name ASC',
200 )); 200 ));
201 } 201 }
202 202
@@ -223,7 +223,7 @@ class MetaData extends KTEntity { @@ -223,7 +223,7 @@ class MetaData extends KTEntity {
223 * @return User user object 223 * @return User user object
224 */ 224 */
225 function & metadataCreateFromArray($aParameters) { 225 function & metadataCreateFromArray($aParameters) {
226 - $oMetaData = & new MetaData($aParameters[0], $aParameters[1], $aParameters[2], $aParameters[3], $aParameters[4], $aParameters[5], $aParameters[6], $aParameters[7], $aParameters[8], $aParameters[9], $aParameters[10]); 226 + $oMetaData = new MetaData($aParameters[0], $aParameters[1], $aParameters[2], $aParameters[3], $aParameters[4], $aParameters[5], $aParameters[6], $aParameters[7], $aParameters[8], $aParameters[9], $aParameters[10]);
227 return $oMetaData; 227 return $oMetaData;
228 } 228 }
229 229
lib/documentmanagement/PhysicalDocumentManager.inc
@@ -376,7 +376,7 @@ class PhysicalDocumentManager { @@ -376,7 +376,7 @@ class PhysicalDocumentManager {
376 */ 376 */
377 function & createDocumentFromUploadedFile($aFileArray, $iFolderID) { 377 function & createDocumentFromUploadedFile($aFileArray, $iFolderID) {
378 //get the uploaded document information and put it into a document object 378 //get the uploaded document information and put it into a document object
379 - $oDocument = & new Document($aFileArray['name'], $aFileArray['name'], $aFileArray['size'], $_SESSION["userID"], KTMime::getMimeTypeID($aFileArray['type'], $aFileArray['name']), $iFolderID); 379 + $oDocument = new Document($aFileArray['name'], $aFileArray['name'], $aFileArray['size'], $_SESSION["userID"], KTMime::getMimeTypeID($aFileArray['type'], $aFileArray['name']), $iFolderID);
380 return $oDocument; 380 return $oDocument;
381 } 381 }
382 } 382 }