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