Commit 1f009d1f4220148eed7e0d57e143d3ebacd5d0aa

Authored by Conrad Vermeulen
1 parent 78072abe

KTS-2358

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

Committed By: Conrad Vermeulen
Reviewed By: Kevin Fourie

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7188 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/subscriptions/Subscription.inc
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 * License Version 1.1.2 ("License"); You may not use this file except in 4 * License Version 1.1.2 ("License"); You may not use this file except in
5 * compliance with the License. You may obtain a copy of the License at 5 * compliance with the License. You may obtain a copy of the License at
6 * http://www.knowledgetree.com/KPL 6 * http://www.knowledgetree.com/KPL
7 - * 7 + *
8 * Software distributed under the License is distributed on an "AS IS" 8 * Software distributed under the License is distributed on an "AS IS"
9 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 9 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
10 * See the License for the specific language governing rights and 10 * See the License for the specific language governing rights and
@@ -15,9 +15,9 @@ @@ -15,9 +15,9 @@
15 * (ii) the KnowledgeTree copyright notice 15 * (ii) the KnowledgeTree copyright notice
16 * in the same form as they appear in the distribution. See the License for 16 * in the same form as they appear in the distribution. See the License for
17 * requirements. 17 * requirements.
18 - * 18 + *
19 * The Original Code is: KnowledgeTree Open Source 19 * The Original Code is: KnowledgeTree Open Source
20 - * 20 + *
21 * The Initial Developer of the Original Code is The Jam Warehouse Software 21 * The Initial Developer of the Original Code is The Jam Warehouse Software
22 * (Pty) Ltd, trading as KnowledgeTree. 22 * (Pty) Ltd, trading as KnowledgeTree.
23 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright 23 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
@@ -66,7 +66,7 @@ class Subscription extends KTEntity { @@ -66,7 +66,7 @@ class Subscription extends KTEntity {
66 /** 66 /**
67 * Creates a new subscription object 67 * Creates a new subscription object
68 * 68 *
69 - * @param integer the user ID 69 + * @param integer the user ID
70 * @param integer the external ID 70 * @param integer the external ID
71 * @param integer the subscription type 71 * @param integer the subscription type
72 * @param bool whether alerted or not 72 * @param bool whether alerted or not
@@ -157,7 +157,7 @@ class Subscription extends KTEntity { @@ -157,7 +157,7 @@ class Subscription extends KTEntity {
157 return Folder::getFolderDisplayPath($this->iExternalID); 157 return Folder::getFolderDisplayPath($this->iExternalID);
158 } 158 }
159 } 159 }
160 - 160 +
161 /** 161 /**
162 * Returns the link to view the subscription content 162 * Returns the link to view the subscription content
163 */ 163 */
@@ -180,14 +180,14 @@ class Subscription extends KTEntity { @@ -180,14 +180,14 @@ class Subscription extends KTEntity {
180 return generateControllerUrl("browse", "fBrowseType=folder&fFolderId=$this->iExternalID"); 180 return generateControllerUrl("browse", "fBrowseType=folder&fFolderId=$this->iExternalID");
181 } 181 }
182 } 182 }
183 - 183 +
184 function isValid() { 184 function isValid() {
185 if ($this->iSubscriptionType == SubscriptionConstants::subscriptionType("DocumentSubscription")) { 185 if ($this->iSubscriptionType == SubscriptionConstants::subscriptionType("DocumentSubscription")) {
186 return !PEAR::isError(Document::get($this->iExternalID)); 186 return !PEAR::isError(Document::get($this->iExternalID));
187 } else if ($this->iSubscriptionType == SubscriptionConstants::subscriptionType("FolderSubscription")) { 187 } else if ($this->iSubscriptionType == SubscriptionConstants::subscriptionType("FolderSubscription")) {
188 return !PEAR::isError(Folder::get($this->iExternalID)); 188 return !PEAR::isError(Folder::get($this->iExternalID));
189 } 189 }
190 - } 190 + }
191 191
192 function getAlertLink() { 192 function getAlertLink() {
193 global $default; 193 global $default;
@@ -200,7 +200,7 @@ class Subscription extends KTEntity { @@ -200,7 +200,7 @@ class Subscription extends KTEntity {
200 return generateControllerLink("viewAlert", $sViewAlertParams, "<img src=\"" . imgSrc("widgets/subsc.gif") . "\" border=\"0\"/>&nbsp;" . Folder::getFolderDisplayPath($this->iExternalID)); 200 return generateControllerLink("viewAlert", $sViewAlertParams, "<img src=\"" . imgSrc("widgets/subsc.gif") . "\" border=\"0\"/>&nbsp;" . Folder::getFolderDisplayPath($this->iExternalID));
201 } 201 }
202 } 202 }
203 - 203 +
204 function getSubscriptionTypeName() { 204 function getSubscriptionTypeName() {
205 if ($this->iSubscriptionType == SubscriptionConstants::subscriptionType("DocumentSubscription")) { 205 if ($this->iSubscriptionType == SubscriptionConstants::subscriptionType("DocumentSubscription")) {
206 return "document"; 206 return "document";
@@ -220,7 +220,7 @@ class Subscription extends KTEntity { @@ -220,7 +220,7 @@ class Subscription extends KTEntity {
220 function _table () { 220 function _table () {
221 return $this->sTableName; 221 return $this->sTableName;
222 } 222 }
223 - 223 +
224 /** 224 /**
225 * Static function. 225 * Static function.
226 * Given a subscription primary key will create a subscription object and populate it with the corresponding 226 * Given a subscription primary key will create a subscription object and populate it with the corresponding
@@ -235,21 +235,21 @@ class Subscription extends KTEntity { @@ -235,21 +235,21 @@ class Subscription extends KTEntity {
235 $sQuery = "SELECT * FROM " . Subscription::getTableName($iSubscriptionType) . " WHERE id = ?";/*ok*/ 235 $sQuery = "SELECT * FROM " . Subscription::getTableName($iSubscriptionType) . " WHERE id = ?";/*ok*/
236 $aParams = array($iSubscriptionID); 236 $aParams = array($iSubscriptionID);
237 $res = DBUtil::getOneResult(array($sQuery, $aParams)); 237 $res = DBUtil::getOneResult(array($sQuery, $aParams));
238 - 238 +
239 if (PEAR::isError($res)) { 239 if (PEAR::isError($res)) {
240 return false; // return $res; 240 return false; // return $res;
241 } 241 }
242 - 242 +
243 if (empty($res)) { 243 if (empty($res)) {
244 return false; // return PEAR::raiseError(_kt('No such Subscription ID')) 244 return false; // return PEAR::raiseError(_kt('No such Subscription ID'))
245 } 245 }
246 246
247 - $oSubscription = & new Subscription($res["user_id"], 247 + $oSubscription = new Subscription($res["user_id"],
248 $res[Subscription::getIdFieldName($iSubscriptionType)], 248 $res[Subscription::getIdFieldName($iSubscriptionType)],
249 $iSubscriptionType, 249 $iSubscriptionType,
250 $res["is_alerted"]); 250 $res["is_alerted"]);
251 $oSubscription->iId = $iSubscriptionID; 251 $oSubscription->iId = $iSubscriptionID;
252 - return $oSubscription; 252 + return $oSubscription;
253 } 253 }
254 254
255 /** 255 /**
@@ -257,9 +257,9 @@ class Subscription extends KTEntity { @@ -257,9 +257,9 @@ class Subscription extends KTEntity {
257 * Given a subscription's values will create a subscription object and populate it with the corresponding 257 * Given a subscription's values will create a subscription object and populate it with the corresponding
258 * primary key 258 * primary key
259 * 259 *
260 - * @param integer the user ID 260 + * @param integer the user ID
261 * @param integer the external ID 261 * @param integer the external ID
262 - * @param integer the type of subscription 262 + * @param integer the type of subscription
263 * @return object subscription object on successful retrieval, false otherwise and set $_SESSION["errorMessage"] 263 * @return object subscription object on successful retrieval, false otherwise and set $_SESSION["errorMessage"]
264 */ 264 */
265 function getByIDs($iUserID, $iExternalID, $iSubscriptionType) { 265 function getByIDs($iUserID, $iExternalID, $iSubscriptionType) {
@@ -270,12 +270,12 @@ class Subscription extends KTEntity { @@ -270,12 +270,12 @@ class Subscription extends KTEntity {
270 if (PEAR::isError($res)) { 270 if (PEAR::isError($res)) {
271 return false; // return $res; 271 return false; // return $res;
272 } 272 }
273 - 273 +
274 if (empty($res)) { 274 if (empty($res)) {
275 return false; // return PEAR::raiseError(_kt('No such Subscription ID')) 275 return false; // return PEAR::raiseError(_kt('No such Subscription ID'))
276 } 276 }
277 277
278 - $oSubscription = & new Subscription($res["user_id"], 278 + $oSubscription = new Subscription($res["user_id"],
279 $res[Subscription::getIdFieldName($iSubscriptionType)], 279 $res[Subscription::getIdFieldName($iSubscriptionType)],
280 $iSubscriptionType, 280 $iSubscriptionType,
281 $res["is_alerted"]); 281 $res["is_alerted"]);
@@ -286,7 +286,7 @@ class Subscription extends KTEntity { @@ -286,7 +286,7 @@ class Subscription extends KTEntity {
286 /** 286 /**
287 * Checks if a given subscription already exists using the external and user ids 287 * Checks if a given subscription already exists using the external and user ids
288 * 288 *
289 - * @param integer the user ID 289 + * @param integer the user ID
290 * @param integer the external ID 290 * @param integer the external ID
291 * @param integer the subscription type 291 * @param integer the subscription type
292 * @return true if the document subscription exists, false otherwise 292 * @return true if the document subscription exists, false otherwise
@@ -294,9 +294,9 @@ class Subscription extends KTEntity { @@ -294,9 +294,9 @@ class Subscription extends KTEntity {
294 function exists($iUserID, $iExternalID, $iSubscriptionType) { 294 function exists($iUserID, $iExternalID, $iSubscriptionType) {
295 $sQuery = "SELECT count(*) AS `subcount` FROM " . Subscription::getTableName($iSubscriptionType) . " WHERE " . Subscription::getIdFieldName($iSubscriptionType) . " = ? AND user_id = ?"; 295 $sQuery = "SELECT count(*) AS `subcount` FROM " . Subscription::getTableName($iSubscriptionType) . " WHERE " . Subscription::getIdFieldName($iSubscriptionType) . " = ? AND user_id = ?";
296 $aParams = array($iExternalID, $iUserID); 296 $aParams = array($iExternalID, $iUserID);
297 - 297 +
298 $res = DBUtil::getOneResultKey(array($sQuery, $aParams), 'subcount'); 298 $res = DBUtil::getOneResultKey(array($sQuery, $aParams), 'subcount');
299 - 299 +
300 if (PEAR::isError($res)) { 300 if (PEAR::isError($res)) {
301 return false; 301 return false;
302 } else { 302 } else {