Commit 4588bab3a164ebd8d6eca135dd7ca52ced583da3

Authored by conradverm
1 parent a411c6c7

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