Commit 84722d23bbedd129a669d459ff7c72f253746ec7
1 parent
8816835e
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@7166 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
5 changed files
with
95 additions
and
92 deletions
lib/actions/actionregistry.inc.php
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | * License Version 1.1.2 ("License"); You may not use this file except in |
| 7 | 7 | * compliance with the License. You may obtain a copy of the License at |
| 8 | 8 | * http://www.knowledgetree.com/KPL |
| 9 | - * | |
| 9 | + * | |
| 10 | 10 | * Software distributed under the License is distributed on an "AS IS" |
| 11 | 11 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. |
| 12 | 12 | * See the License for the specific language governing rights and |
| ... | ... | @@ -17,9 +17,9 @@ |
| 17 | 17 | * (ii) the KnowledgeTree copyright notice |
| 18 | 18 | * in the same form as they appear in the distribution. See the License for |
| 19 | 19 | * requirements. |
| 20 | - * | |
| 20 | + * | |
| 21 | 21 | * The Original Code is: KnowledgeTree Open Source |
| 22 | - * | |
| 22 | + * | |
| 23 | 23 | * The Initial Developer of the Original Code is The Jam Warehouse Software |
| 24 | 24 | * (Pty) Ltd, trading as KnowledgeTree. |
| 25 | 25 | * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright |
| ... | ... | @@ -31,14 +31,15 @@ |
| 31 | 31 | |
| 32 | 32 | class KTActionRegistry { |
| 33 | 33 | var $actions = array(); |
| 34 | - // {{{ getSingleton | |
| 35 | - function &getSingleton () { | |
| 36 | - if (!KTUtil::arrayGet($GLOBALS['_KT_PLUGIN'], 'oKTActionRegistry')) { | |
| 37 | - $GLOBALS['_KT_PLUGIN']['oKTActionRegistry'] = new KTActionRegistry; | |
| 38 | - } | |
| 39 | - return $GLOBALS['_KT_PLUGIN']['oKTActionRegistry']; | |
| 34 | + | |
| 35 | + static function &getSingleton () { | |
| 36 | + static $singleton=null; | |
| 37 | + if (is_null($singleton)) | |
| 38 | + { | |
| 39 | + $singleton = new KTActionRegistry(); | |
| 40 | + } | |
| 41 | + return $singleton; | |
| 40 | 42 | } |
| 41 | - // }}} | |
| 42 | 43 | |
| 43 | 44 | function registerAction($slot, $name, $nsname, $path = '', $sPlugin = null) { |
| 44 | 45 | $this->actions[$slot] = KTUtil::arrayGet($this->actions, $slot, array()); |
| ... | ... | @@ -62,11 +63,11 @@ class KTActionRegistry { |
| 62 | 63 | |
| 63 | 64 | $oPluginRegistry =& KTPluginRegistry::getSingleton(); |
| 64 | 65 | $oPlugin =& $oPluginRegistry->getPlugin($sPlugin); |
| 65 | - $oAction =& new $sClassName($oUser, $oPlugin); | |
| 66 | + $oAction =new $sClassName($oUser, $oPlugin); | |
| 66 | 67 | |
| 67 | 68 | return $oAction; |
| 68 | 69 | } |
| 69 | - | |
| 70 | + | |
| 70 | 71 | |
| 71 | 72 | } |
| 72 | 73 | ... | ... |
lib/actions/bulkaction.php
| ... | ... | @@ -7,7 +7,7 @@ |
| 7 | 7 | * License Version 1.1.2 ("License"); You may not use this file except in |
| 8 | 8 | * compliance with the License. You may obtain a copy of the License at |
| 9 | 9 | * http://www.knowledgetree.com/KPL |
| 10 | - * | |
| 10 | + * | |
| 11 | 11 | * Software distributed under the License is distributed on an "AS IS" |
| 12 | 12 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. |
| 13 | 13 | * See the License for the specific language governing rights and |
| ... | ... | @@ -18,9 +18,9 @@ |
| 18 | 18 | * (ii) the KnowledgeTree copyright notice |
| 19 | 19 | * in the same form as they appear in the distribution. See the License for |
| 20 | 20 | * requirements. |
| 21 | - * | |
| 21 | + * | |
| 22 | 22 | * The Original Code is: KnowledgeTree Open Source |
| 23 | - * | |
| 23 | + * | |
| 24 | 24 | * The Initial Developer of the Original Code is The Jam Warehouse Software |
| 25 | 25 | * (Pty) Ltd, trading as KnowledgeTree. |
| 26 | 26 | * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright |
| ... | ... | @@ -49,7 +49,7 @@ class KTBulkAction extends KTStandardDispatcher { |
| 49 | 49 | |
| 50 | 50 | var $_sDisablePermission; |
| 51 | 51 | var $bAllowInAdminMode = false; |
| 52 | - var $sHelpPage = 'ktcore/browse.html'; | |
| 52 | + var $sHelpPage = 'ktcore/browse.html'; | |
| 53 | 53 | |
| 54 | 54 | var $sSection = 'view_details'; |
| 55 | 55 | |
| ... | ... | @@ -71,7 +71,7 @@ class KTBulkAction extends KTStandardDispatcher { |
| 71 | 71 | $this->aBreadcrumbs = array( |
| 72 | 72 | array('action' => 'browse', 'name' => _kt('Browse')), |
| 73 | 73 | ); |
| 74 | - | |
| 74 | + | |
| 75 | 75 | $this->persistParams('fEntityListCode'); |
| 76 | 76 | parent::KTStandardDispatcher(); |
| 77 | 77 | } |
| ... | ... | @@ -115,7 +115,7 @@ class KTBulkAction extends KTStandardDispatcher { |
| 115 | 115 | 'url' => $url, |
| 116 | 116 | 'icon_class' => $this->sIconClass, |
| 117 | 117 | ); |
| 118 | - | |
| 118 | + | |
| 119 | 119 | $aInfo = $this->customiseInfo($aInfo); |
| 120 | 120 | return $aInfo; |
| 121 | 121 | } |
| ... | ... | @@ -159,7 +159,7 @@ class KTBulkAction extends KTStandardDispatcher { |
| 159 | 159 | $iFolderId = KTUtil::arrayGet($_REQUEST, 'fFolderId', 1); |
| 160 | 160 | $this->oFolder = Folder::get($iFolderId); |
| 161 | 161 | //$this->oFolder =& $this->oValidator->validateFolder($_REQUEST['fFolderId']); |
| 162 | - | |
| 162 | + | |
| 163 | 163 | $aOptions = array( |
| 164 | 164 | 'final' => false, |
| 165 | 165 | 'documentaction' => 'viewDocument', |
| ... | ... | @@ -172,7 +172,7 @@ class KTBulkAction extends KTStandardDispatcher { |
| 172 | 172 | return true; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - | |
| 175 | + | |
| 176 | 176 | // check the entire entity list. this needn't be overrided at any point |
| 177 | 177 | function check_entities() { |
| 178 | 178 | $aFailed = array('documents' => array(), 'folders' => array()); |
| ... | ... | @@ -184,7 +184,7 @@ class KTBulkAction extends KTStandardDispatcher { |
| 184 | 184 | |
| 185 | 185 | foreach($this->oEntityList->getDocumentIds() as $iId) { |
| 186 | 186 | $oDocument =& Document::get($iId); |
| 187 | - | |
| 187 | + | |
| 188 | 188 | if(PEAR::isError($oDocument)) { |
| 189 | 189 | $aFailed['documents'][] = array($iId, _kt('No such document')); |
| 190 | 190 | } else { |
| ... | ... | @@ -207,10 +207,10 @@ class KTBulkAction extends KTStandardDispatcher { |
| 207 | 207 | |
| 208 | 208 | foreach($this->oEntityList->getFolderIds() as $iId) { |
| 209 | 209 | $oFolder =& Folder::get($iId); |
| 210 | - | |
| 210 | + | |
| 211 | 211 | if(PEAR::isError($oFolder)) { |
| 212 | 212 | $aFailed['folders'][] = array($iId, _kt('No such folder')); |
| 213 | - } else { | |
| 213 | + } else { | |
| 214 | 214 | $res = $this->check_entity($oFolder); |
| 215 | 215 | |
| 216 | 216 | if(PEAR::isError($res)) { |
| ... | ... | @@ -221,7 +221,7 @@ class KTBulkAction extends KTStandardDispatcher { |
| 221 | 221 | $aSucceeded['folders'][] = $oFolder->getId(); |
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | - } | |
| 224 | + } | |
| 225 | 225 | $this->oActiveEntityList = new KTEntityList($aSucceeded['documents'], $aSucceeded['folders']); |
| 226 | 226 | $this->aFailed = $aFailed; |
| 227 | 227 | |
| ... | ... | @@ -242,7 +242,7 @@ class KTBulkAction extends KTStandardDispatcher { |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | $res = $this->perform_action($oDocument); |
| 245 | - | |
| 245 | + | |
| 246 | 246 | if(PEAR::isError($res)) { |
| 247 | 247 | $this->aActionResults['documents'][] = array($sName, $res->getMessage()); |
| 248 | 248 | } else { |
| ... | ... | @@ -259,12 +259,12 @@ class KTBulkAction extends KTStandardDispatcher { |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | $res = $this->perform_action($oFolder); |
| 262 | - | |
| 262 | + | |
| 263 | 263 | if(PEAR::isError($res)) { |
| 264 | 264 | $this->aActionResults['folders'][] = array($sName, $res->getMessage()); |
| 265 | 265 | } else { |
| 266 | 266 | $this->aActionResults['folders'][] = array($sName, _kt('Success')); |
| 267 | - } | |
| 267 | + } | |
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | |
| ... | ... | @@ -284,7 +284,7 @@ class KTBulkAction extends KTStandardDispatcher { |
| 284 | 284 | function store_lists() { |
| 285 | 285 | $this->persistParams(array('fListCode', 'fActiveListCode', 'fFolderId', 'fReturnData', 'fReturnAction')); |
| 286 | 286 | } |
| 287 | - | |
| 287 | + | |
| 288 | 288 | |
| 289 | 289 | |
| 290 | 290 | |
| ... | ... | @@ -302,7 +302,7 @@ class KTBulkAction extends KTStandardDispatcher { |
| 302 | 302 | 'action' => 'collectinfo', |
| 303 | 303 | 'fail_action' => 'main', |
| 304 | 304 | 'noframe' => true, |
| 305 | - 'extraargs' => array('fListCode' => $sListCode, | |
| 305 | + 'extraargs' => array('fListCode' => $sListCode, | |
| 306 | 306 | 'fActiveListCode' => $sActiveListCode, |
| 307 | 307 | 'fFolderId' => $this->oFolder->getId(), |
| 308 | 308 | 'fReturnAction' => KTUtil::arrayGet($_REQUEST, 'fReturnAction'), |
| ... | ... | @@ -323,7 +323,7 @@ class KTBulkAction extends KTStandardDispatcher { |
| 323 | 323 | if ($sReturnData == '') |
| 324 | 324 | { |
| 325 | 325 | $sReturnData = KTUtil::arrayGet($_REQUEST, 'fFolderId'); |
| 326 | - } | |
| 326 | + } | |
| 327 | 327 | $sTargetUrl = KTBrowseUtil::getUrlForFolder(Folder::get($sReturnData)); |
| 328 | 328 | } else if($sReturnAction == 'simpleSearch') { |
| 329 | 329 | $sTargetUrl = KTBrowseUtil::getSimpleSearchBaseUrl(); |
| ... | ... | @@ -356,13 +356,13 @@ class KTBulkAction extends KTStandardDispatcher { |
| 356 | 356 | $this->oEntityList = new KTEntityList($aDocuments, $aFolders); |
| 357 | 357 | |
| 358 | 358 | // gives us $this->aFailed |
| 359 | - $iActiveCount = $this->check_entities(); | |
| 359 | + $iActiveCount = $this->check_entities(); | |
| 360 | 360 | |
| 361 | 361 | $oTemplating =& KTTemplating::getSingleton(); |
| 362 | 362 | $oTemplate = $oTemplating->loadTemplate('ktcore/bulk_action_listing'); |
| 363 | - | |
| 364 | - $this->store_lists(); | |
| 365 | - | |
| 363 | + | |
| 364 | + $this->store_lists(); | |
| 365 | + | |
| 366 | 366 | return $oTemplate->render(array('context' => $this, |
| 367 | 367 | 'form' => $this->form_listing(), |
| 368 | 368 | 'failed' => $this->aFailed, |
| ... | ... | @@ -411,7 +411,7 @@ class KTBulkAction extends KTStandardDispatcher { |
| 411 | 411 | // parent implementation |
| 412 | 412 | function check_entity($oEntity) { |
| 413 | 413 | $oPermission =& KTPermission::getByName($this->_sPermission); |
| 414 | - if(PEAR::isError($oPermission)) { | |
| 414 | + if(PEAR::isError($oPermission)) { | |
| 415 | 415 | return true; |
| 416 | 416 | } |
| 417 | 417 | |
| ... | ... | @@ -419,7 +419,7 @@ class KTBulkAction extends KTStandardDispatcher { |
| 419 | 419 | |
| 420 | 420 | // TODO: check if this is appropriate |
| 421 | 421 | // should probably store the 'equivalent' action (ie. document.delete) |
| 422 | - // and check that, rather than add a new list of actions to the workflow | |
| 422 | + // and check that, rather than add a new list of actions to the workflow | |
| 423 | 423 | // section |
| 424 | 424 | if(is_a($oEntity, 'Document')) { |
| 425 | 425 | if(!KTWorkflowUtil::actionEnabledForDocument($oEntity, $this->sName)) { |
| ... | ... | @@ -430,14 +430,14 @@ class KTBulkAction extends KTStandardDispatcher { |
| 430 | 430 | return PEAR::raiseError(_kt('Document is archived or deleted')); |
| 431 | 431 | } |
| 432 | 432 | } |
| 433 | - | |
| 433 | + | |
| 434 | 434 | // admin check |
| 435 | 435 | if($this->bAllowInAdminMode) { |
| 436 | 436 | if(KTBrowseUtil::inAdminMode($this->oUser, null)) { |
| 437 | 437 | return true; |
| 438 | 438 | } |
| 439 | 439 | } |
| 440 | - | |
| 440 | + | |
| 441 | 441 | if(!KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPermission, $oEntity)) { |
| 442 | 442 | return PEAR::raiseError(_kt('You do not have the required permissions')); |
| 443 | 443 | } |
| ... | ... | @@ -452,7 +452,7 @@ class KTBulkDocumentAction extends KTBulkAction { |
| 452 | 452 | function check_entity($oEntity) { |
| 453 | 453 | if(!is_a($oEntity, 'Document')) { |
| 454 | 454 | return false; |
| 455 | - } | |
| 455 | + } | |
| 456 | 456 | return parent::check_entity($oEntity); |
| 457 | 457 | } |
| 458 | 458 | } |
| ... | ... | @@ -461,7 +461,7 @@ class KTBulkFolderAction extends KTBulkAction { |
| 461 | 461 | function check_entity($oEntity) { |
| 462 | 462 | if(!is_a($oEntity, 'Folder')) { |
| 463 | 463 | return false; |
| 464 | - } | |
| 464 | + } | |
| 465 | 465 | return parent::check_entity($oEntity); |
| 466 | 466 | } |
| 467 | 467 | } |
| ... | ... | @@ -486,7 +486,7 @@ class KTBulkActionUtil { |
| 486 | 486 | if (!empty($sPath)) { |
| 487 | 487 | require_once($sPath); |
| 488 | 488 | } |
| 489 | - $aObjects[] =& new $sClassName(null, null, $oPlugin); | |
| 489 | + $aObjects[] = new $sClassName(null, null, $oPlugin); | |
| 490 | 490 | } |
| 491 | 491 | return $aObjects; |
| 492 | 492 | } |
| ... | ... | @@ -503,7 +503,7 @@ class KTBulkActionUtil { |
| 503 | 503 | if (!empty($sPath)) { |
| 504 | 504 | require_once($sPath); |
| 505 | 505 | } |
| 506 | - $aObjects[] =& new $sClassName(null, $oUser, $oPlugin); | |
| 506 | + $aObjects[] = new $sClassName(null, $oUser, $oPlugin); | |
| 507 | 507 | } |
| 508 | 508 | return $aObjects; |
| 509 | 509 | } | ... | ... |
lib/actions/documentaction.inc.php
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | * License Version 1.1.2 ("License"); You may not use this file except in |
| 7 | 7 | * compliance with the License. You may obtain a copy of the License at |
| 8 | 8 | * http://www.knowledgetree.com/KPL |
| 9 | - * | |
| 9 | + * | |
| 10 | 10 | * Software distributed under the License is distributed on an "AS IS" |
| 11 | 11 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. |
| 12 | 12 | * See the License for the specific language governing rights and |
| ... | ... | @@ -17,9 +17,9 @@ |
| 17 | 17 | * (ii) the KnowledgeTree copyright notice |
| 18 | 18 | * in the same form as they appear in the distribution. See the License for |
| 19 | 19 | * requirements. |
| 20 | - * | |
| 20 | + * | |
| 21 | 21 | * The Original Code is: KnowledgeTree Open Source |
| 22 | - * | |
| 22 | + * | |
| 23 | 23 | * The Initial Developer of the Original Code is The Jam Warehouse Software |
| 24 | 24 | * (Pty) Ltd, trading as KnowledgeTree. |
| 25 | 25 | * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright |
| ... | ... | @@ -42,13 +42,13 @@ class KTDocumentAction extends KTStandardDispatcher { |
| 42 | 42 | var $_sShowPermission = 'ktcore.permissions.read'; |
| 43 | 43 | var $_sDisablePermission; |
| 44 | 44 | var $bAllowInAdminMode = false; |
| 45 | - var $sHelpPage = 'ktcore/browse.html'; | |
| 45 | + var $sHelpPage = 'ktcore/browse.html'; | |
| 46 | 46 | |
| 47 | 47 | var $sSection = 'view_details'; |
| 48 | 48 | |
| 49 | 49 | var $_bMutator = false; |
| 50 | 50 | var $_bMutationAllowedByAdmin = true; |
| 51 | - | |
| 51 | + | |
| 52 | 52 | var $sIconClass; |
| 53 | 53 | |
| 54 | 54 | function KTDocumentAction($oDocument = null, $oUser = null, $oPlugin = null) { |
| ... | ... | @@ -58,7 +58,7 @@ class KTDocumentAction extends KTStandardDispatcher { |
| 58 | 58 | $this->aBreadcrumbs = array( |
| 59 | 59 | array('action' => 'browse', 'name' => _kt('Browse')), |
| 60 | 60 | ); |
| 61 | - | |
| 61 | + | |
| 62 | 62 | $this->persistParams('fDocumentId'); |
| 63 | 63 | |
| 64 | 64 | parent::KTStandardDispatcher(); |
| ... | ... | @@ -87,7 +87,7 @@ class KTDocumentAction extends KTStandardDispatcher { |
| 87 | 87 | return false; |
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | - | |
| 90 | + | |
| 91 | 91 | if ($this->_bAdminAlwaysAvailable) { |
| 92 | 92 | if (Permission::userIsSystemAdministrator($this->oUser->getId())) { |
| 93 | 93 | return true; |
| ... | ... | @@ -105,13 +105,13 @@ class KTDocumentAction extends KTStandardDispatcher { |
| 105 | 105 | } |
| 106 | 106 | // be nasty in archive/delete status. |
| 107 | 107 | $status = $this->oDocument->getStatusID(); |
| 108 | - if (($status == DELETED) || ($status == ARCHIVED)) { return false; } | |
| 108 | + if (($status == DELETED) || ($status == ARCHIVED)) { return false; } | |
| 109 | 109 | if ($this->bAllowInAdminMode) { |
| 110 | 110 | // check if this user is in admin mode |
| 111 | - if (KTBrowseUtil::inAdminMode($this->oUser, $oFolder)) { | |
| 112 | - return true; | |
| 113 | - } | |
| 114 | - } | |
| 111 | + if (KTBrowseUtil::inAdminMode($this->oUser, $oFolder)) { | |
| 112 | + return true; | |
| 113 | + } | |
| 114 | + } | |
| 115 | 115 | return KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPermission, $this->oDocument); |
| 116 | 116 | } |
| 117 | 117 | |
| ... | ... | @@ -142,7 +142,7 @@ class KTDocumentAction extends KTStandardDispatcher { |
| 142 | 142 | 'url' => $url, |
| 143 | 143 | 'icon_class' => $this->sIconClass, |
| 144 | 144 | ); |
| 145 | - | |
| 145 | + | |
| 146 | 146 | $aInfo = $this->customiseInfo($aInfo); |
| 147 | 147 | return $aInfo; |
| 148 | 148 | } |
| ... | ... | @@ -169,7 +169,7 @@ class KTDocumentAction extends KTStandardDispatcher { |
| 169 | 169 | $this->oDocument =& $this->oValidator->validateDocument($_REQUEST['fDocumentId']); |
| 170 | 170 | |
| 171 | 171 | if (!$this->_show()) { return false; } |
| 172 | - | |
| 172 | + | |
| 173 | 173 | $aOptions = array('final' => false, |
| 174 | 174 | 'documentaction' => 'viewDocument', |
| 175 | 175 | 'folderaction' => 'browse', |
| ... | ... | @@ -180,15 +180,15 @@ class KTDocumentAction extends KTStandardDispatcher { |
| 180 | 180 | $actions = KTDocumentActionUtil::getDocumentActionsForDocument($this->oDocument, $this->oUser, 'documentinfo'); |
| 181 | 181 | $oPortlet = new KTActionPortlet(sprintf(_kt('Document info'))); |
| 182 | 182 | $oPortlet->setActions($actions, $this->sName); |
| 183 | - $this->oPage->addPortlet($oPortlet); | |
| 183 | + $this->oPage->addPortlet($oPortlet); | |
| 184 | 184 | |
| 185 | 185 | $actions = KTDocumentActionUtil::getDocumentActionsForDocument($this->oDocument, $this->oUser); |
| 186 | 186 | $oPortlet = new KTActionPortlet(sprintf(_kt('Document actions'))); |
| 187 | 187 | $oPortlet->setActions($actions, $this->sName); |
| 188 | - $this->oPage->addPortlet($oPortlet); | |
| 189 | - | |
| 190 | - $this->oPage->setSecondaryTitle($this->oDocument->getName()); | |
| 191 | - | |
| 188 | + $this->oPage->addPortlet($oPortlet); | |
| 189 | + | |
| 190 | + $this->oPage->setSecondaryTitle($this->oDocument->getName()); | |
| 191 | + | |
| 192 | 192 | return true; |
| 193 | 193 | } |
| 194 | 194 | |
| ... | ... | @@ -212,7 +212,7 @@ class KTDocumentActionUtil { |
| 212 | 212 | if (!empty($sPath)) { |
| 213 | 213 | require_once($sPath); |
| 214 | 214 | } |
| 215 | - $aObjects[] =& new $sClassName($oDocument, $oUser, $oPlugin); | |
| 215 | + $aObjects[] = new $sClassName($oDocument, $oUser, $oPlugin); | |
| 216 | 216 | } |
| 217 | 217 | return $aObjects; |
| 218 | 218 | } |
| ... | ... | @@ -228,7 +228,7 @@ class KTDocumentActionUtil { |
| 228 | 228 | if (!empty($sPath)) { |
| 229 | 229 | require_once($sPath); |
| 230 | 230 | } |
| 231 | - $aObjects[] =& new $sClassName($oDocument, $oUser, $oPlugin); | |
| 231 | + $aObjects[] = new $sClassName($oDocument, $oUser, $oPlugin); | |
| 232 | 232 | } |
| 233 | 233 | return $aObjects; |
| 234 | 234 | } |
| ... | ... | @@ -245,7 +245,7 @@ class KTDocumentActionUtil { |
| 245 | 245 | if (!empty($sPath)) { |
| 246 | 246 | require_once($sPath); |
| 247 | 247 | } |
| 248 | - $aObjects[] =& new $sClassName($oDocument, $oUser, $oPlugin); | |
| 248 | + $aObjects[] = new $sClassName($oDocument, $oUser, $oPlugin); | |
| 249 | 249 | } |
| 250 | 250 | return $aObjects; |
| 251 | 251 | } | ... | ... |
lib/actions/folderaction.inc.php
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | * License Version 1.1.2 ("License"); You may not use this file except in |
| 7 | 7 | * compliance with the License. You may obtain a copy of the License at |
| 8 | 8 | * http://www.knowledgetree.com/KPL |
| 9 | - * | |
| 9 | + * | |
| 10 | 10 | * Software distributed under the License is distributed on an "AS IS" |
| 11 | 11 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. |
| 12 | 12 | * See the License for the specific language governing rights and |
| ... | ... | @@ -17,9 +17,9 @@ |
| 17 | 17 | * (ii) the KnowledgeTree copyright notice |
| 18 | 18 | * in the same form as they appear in the distribution. See the License for |
| 19 | 19 | * requirements. |
| 20 | - * | |
| 20 | + * | |
| 21 | 21 | * The Original Code is: KnowledgeTree Open Source |
| 22 | - * | |
| 22 | + * | |
| 23 | 23 | * The Initial Developer of the Original Code is The Jam Warehouse Software |
| 24 | 24 | * (Pty) Ltd, trading as KnowledgeTree. |
| 25 | 25 | * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright |
| ... | ... | @@ -40,14 +40,14 @@ class KTFolderAction extends KTStandardDispatcher { |
| 40 | 40 | |
| 41 | 41 | var $_sShowPermission = 'ktcore.permissions.folder_details'; |
| 42 | 42 | var $_sDisablePermission; |
| 43 | - var $sHelpPage = 'ktcore/browse.html'; | |
| 44 | - | |
| 43 | + var $sHelpPage = 'ktcore/browse.html'; | |
| 44 | + | |
| 45 | 45 | var $_bAdminAlwaysAvailable = false; |
| 46 | 46 | |
| 47 | 47 | var $sSection = 'browse'; |
| 48 | 48 | |
| 49 | 49 | function KTFolderAction($oFolder = null, $oUser = null, $oPlugin = null) { |
| 50 | - parent::KTStandardDispatcher(); | |
| 50 | + parent::KTStandardDispatcher(); | |
| 51 | 51 | $this->oFolder =& $oFolder; |
| 52 | 52 | $this->oUser =& $oUser; |
| 53 | 53 | $this->oPlugin =& $oPlugin; |
| ... | ... | @@ -80,7 +80,7 @@ class KTFolderAction extends KTStandardDispatcher { |
| 80 | 80 | return true; |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | - | |
| 83 | + | |
| 84 | 84 | return KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPermission, $this->oFolder); |
| 85 | 85 | } |
| 86 | 86 | |
| ... | ... | @@ -131,9 +131,9 @@ class KTFolderAction extends KTStandardDispatcher { |
| 131 | 131 | |
| 132 | 132 | function check() { |
| 133 | 133 | $this->oFolder =& $this->oValidator->validateFolder($_REQUEST['fFolderId']); |
| 134 | - | |
| 134 | + | |
| 135 | 135 | if (!$this->_show()) { return false; } |
| 136 | - | |
| 136 | + | |
| 137 | 137 | $aOptions = array( |
| 138 | 138 | 'final' => false, |
| 139 | 139 | 'documentaction' => 'viewDocument', |
| ... | ... | @@ -143,15 +143,15 @@ class KTFolderAction extends KTStandardDispatcher { |
| 143 | 143 | KTBrowseUtil::breadcrumbsForFolder($this->oFolder, $aOptions)); |
| 144 | 144 | |
| 145 | 145 | $portlet = new KTActionPortlet(sprintf(_kt('About this folder'))); |
| 146 | - $aActions = KTFolderActionUtil::getFolderInfoActionsForFolder($this->oFolder, $this->oUser); | |
| 146 | + $aActions = KTFolderActionUtil::getFolderInfoActionsForFolder($this->oFolder, $this->oUser); | |
| 147 | 147 | $portlet->setActions($aActions,$this->sName); |
| 148 | - $this->oPage->addPortlet($portlet); | |
| 148 | + $this->oPage->addPortlet($portlet); | |
| 149 | 149 | |
| 150 | 150 | $portlet = new KTActionPortlet(sprintf(_kt('Actions on this folder'))); |
| 151 | - $aActions = KTFolderActionUtil::getFolderActionsForFolder($this->oFolder, $this->oUser); | |
| 151 | + $aActions = KTFolderActionUtil::getFolderActionsForFolder($this->oFolder, $this->oUser); | |
| 152 | 152 | $portlet->setActions($aActions,$this->sName); |
| 153 | - $this->oPage->addPortlet($portlet); | |
| 154 | - | |
| 153 | + $this->oPage->addPortlet($portlet); | |
| 154 | + | |
| 155 | 155 | if (KTPermissionUtil::userHasPermissionOnItem($this->oUser, 'ktcore.permissions.folder_details', $this->oFolder)) { |
| 156 | 156 | $this->oPage->setSecondaryTitle($this->oFolder->getName()); |
| 157 | 157 | } else { |
| ... | ... | @@ -161,7 +161,7 @@ class KTFolderAction extends KTStandardDispatcher { |
| 161 | 161 | $this->oPage->setSecondaryTitle('...'); |
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | - | |
| 164 | + | |
| 165 | 165 | return true; |
| 166 | 166 | } |
| 167 | 167 | |
| ... | ... | @@ -179,7 +179,7 @@ class KTFolderActionUtil { |
| 179 | 179 | function getFolderInfoActions() { |
| 180 | 180 | $oRegistry =& KTActionRegistry::getSingleton(); |
| 181 | 181 | return $oRegistry->getActions('folderinfo'); |
| 182 | - } | |
| 182 | + } | |
| 183 | 183 | function &getFolderActionsForFolder($oFolder, $oUser) { |
| 184 | 184 | $aObjects = array(); |
| 185 | 185 | foreach (KTFolderActionUtil::getFolderActions() as $aAction) { |
| ... | ... | @@ -189,7 +189,7 @@ class KTFolderActionUtil { |
| 189 | 189 | if (!empty($sPath)) { |
| 190 | 190 | require_once($sPath); |
| 191 | 191 | } |
| 192 | - $aObjects[] =& new $sClassName($oFolder, $oUser, $oPlugin); | |
| 192 | + $aObjects[] =new $sClassName($oFolder, $oUser, $oPlugin); | |
| 193 | 193 | } |
| 194 | 194 | return $aObjects; |
| 195 | 195 | } |
| ... | ... | @@ -202,10 +202,10 @@ class KTFolderActionUtil { |
| 202 | 202 | if (!empty($sPath)) { |
| 203 | 203 | require_once($sPath); |
| 204 | 204 | } |
| 205 | - $aObjects[] =& new $sClassName($oFolder, $oUser, $oPlugin); | |
| 205 | + $aObjects[] =new $sClassName($oFolder, $oUser, $oPlugin); | |
| 206 | 206 | } |
| 207 | 207 | return $aObjects; |
| 208 | - } | |
| 208 | + } | |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | ?> | ... | ... |
lib/actions/portletregistry.inc.php
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | * License Version 1.1.2 ("License"); You may not use this file except in |
| 7 | 7 | * compliance with the License. You may obtain a copy of the License at |
| 8 | 8 | * http://www.knowledgetree.com/KPL |
| 9 | - * | |
| 9 | + * | |
| 10 | 10 | * Software distributed under the License is distributed on an "AS IS" |
| 11 | 11 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. |
| 12 | 12 | * See the License for the specific language governing rights and |
| ... | ... | @@ -17,9 +17,9 @@ |
| 17 | 17 | * (ii) the KnowledgeTree copyright notice |
| 18 | 18 | * in the same form as they appear in the distribution. See the License for |
| 19 | 19 | * requirements. |
| 20 | - * | |
| 20 | + * | |
| 21 | 21 | * The Original Code is: KnowledgeTree Open Source |
| 22 | - * | |
| 22 | + * | |
| 23 | 23 | * The Initial Developer of the Original Code is The Jam Warehouse Software |
| 24 | 24 | * (Pty) Ltd, trading as KnowledgeTree. |
| 25 | 25 | * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright |
| ... | ... | @@ -32,11 +32,13 @@ |
| 32 | 32 | class KTPortletRegistry { |
| 33 | 33 | var $actions = array(); |
| 34 | 34 | // {{{ getSingleton |
| 35 | - function &getSingleton () { | |
| 36 | - if (!KTUtil::arrayGet($GLOBALS['_KT_PLUGIN'], 'oKTPortletRegistry')) { | |
| 37 | - $GLOBALS['_KT_PLUGIN']['oKTPortletRegistry'] =& new KTPortletRegistry; | |
| 38 | - } | |
| 39 | - return $GLOBALS['_KT_PLUGIN']['oKTPortletRegistry']; | |
| 35 | + static function &getSingleton () { | |
| 36 | + static $singleton=null; | |
| 37 | + if (is_null($singleton)) | |
| 38 | + { | |
| 39 | + $singleton = new KTPortletRegistry(); | |
| 40 | + } | |
| 41 | + return $singleton; | |
| 40 | 42 | } |
| 41 | 43 | // }}} |
| 42 | 44 | |
| ... | ... | @@ -84,7 +86,7 @@ class KTPortletRegistry { |
| 84 | 86 | if (file_exists($sPortletFile)) { |
| 85 | 87 | require_once($sPortletFile); |
| 86 | 88 | } |
| 87 | - $oPortlet =& new $sPortletClass; | |
| 89 | + $oPortlet =new $sPortletClass; | |
| 88 | 90 | $oPortlet->setPlugin($oPlugin); |
| 89 | 91 | array_push($aReturn, $oPortlet); |
| 90 | 92 | } | ... | ... |