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