Commit 073fd6e6a70aa780d745cabb4ae8c8bf52db74fc
1 parent
1b3be7a4
Merged in from DEV trunk...
KTS-1417 "The "Root Folder" is not supposed to have a name, and thus it should disappear." Updated. Committed By: Kevin Reviewed By: Conrad KTS-1281 "Transaction History Messages" Updated i18n strings. Committed By: Kevin Reviewed By: Conrad KTS-123 "Add Document: Uploading file > PHP POST limit" Updated .htaccess file. This fix may help with some other warning issues popping up recently. KTS-1388 "KnowledgeTree pre-3.0 upgrade problems" Updated. Committed By: Kevin Reviewed By: Conrad KTS-1099 "When Uploading a zipped batch of PDF's it fails with the following error." Added better error checking. Committed By: Kevin Reviewed By: Conrad git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@6649 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
11 changed files
with
153 additions
and
146 deletions
.htaccess
| ... | ... | @@ -72,6 +72,7 @@ php_value post_max_size 2000M |
| 72 | 72 | php_value memory_limit -1 |
| 73 | 73 | php_value max_input_time -1 |
| 74 | 74 | php_value max_execution_time 0 |
| 75 | +php_value error_reporting 5 | |
| 75 | 76 | </IfModule> |
| 76 | 77 | <IfModule sapi_apache2.c> |
| 77 | 78 | php_value upload_max_filesize -1 |
| ... | ... | @@ -79,6 +80,7 @@ php_value post_max_size 2000M |
| 79 | 80 | php_value memory_limit -1 |
| 80 | 81 | php_value max_input_time -1 |
| 81 | 82 | php_value max_execution_time 0 |
| 83 | +php_value error_reporting 5 | |
| 82 | 84 | </IfModule> |
| 83 | 85 | |
| 84 | 86 | ... | ... |
lib/documentmanagement/Document.inc
| 1 | -<?php /* vim: set expandtab softtabstop=4 shiftwidth=4 foldmethod=marker: */ | |
| 1 | +<?php | |
| 2 | 2 | /** |
| 3 | 3 | * $Id$ |
| 4 | 4 | * |
| ... | ... | @@ -26,13 +26,6 @@ |
| 26 | 26 | * (C) 2007 The Jam Warehouse Software (Pty) Ltd; |
| 27 | 27 | * All Rights Reserved. |
| 28 | 28 | * Contributor( s): ______________________________________ |
| 29 | - * | |
| 30 | - * | |
| 31 | - * ------------------------------------------------------------------------- | |
| 32 | - * | |
| 33 | - * Represents a document as per the documents database table. | |
| 34 | - * | |
| 35 | - * @author Neil Blakey-Milner, Jam Warehouse (Pty) Ltd, South Africa | |
| 36 | 29 | */ |
| 37 | 30 | |
| 38 | 31 | // document statuses |
| ... | ... | @@ -537,6 +530,9 @@ class Document { |
| 537 | 530 | function startNewMetadataVersion($oUser) { |
| 538 | 531 | $iUserId = KTUtil::getId($oUser); |
| 539 | 532 | $this->_oDocumentMetadataVersion =& $this->_oDocumentMetadataVersion->newCopy(); |
| 533 | + if (PEAR::isError($this->_oDocumentMetadataVersion)) { | |
| 534 | + return $this->_oDocumentMetadataVersion; | |
| 535 | + } | |
| 540 | 536 | $this->_oDocumentMetadataVersion->bumpMetadataVersion(); |
| 541 | 537 | $this->_oDocumentMetadataVersion->setVersionCreated(getCurrentDateTime()); |
| 542 | 538 | $this->_oDocumentMetadataVersion->setVersionCreatorId($iUserId); |
| ... | ... | @@ -554,6 +550,12 @@ class Document { |
| 554 | 550 | $iUserId = KTUtil::getId($oUser); |
| 555 | 551 | $this->_oDocumentContentVersion =& $this->_oDocumentContentVersion->newCopy(); |
| 556 | 552 | $this->_oDocumentMetadataVersion =& $this->_oDocumentMetadataVersion->newCopy(); |
| 553 | + if (PEAR::isError($this->_oDocumentContentVersion)) { | |
| 554 | + return $this->_oDocumentContentVersion; | |
| 555 | + } | |
| 556 | + if (PEAR::isError($this->_oDocumentMetadataVersion)) { | |
| 557 | + return $this->_oDocumentMetadataVersion; | |
| 558 | + } | |
| 557 | 559 | $this->_oDocumentMetadataVersion->bumpMetadataVersion(); |
| 558 | 560 | $this->_oDocumentMetadataVersion->setVersionCreated(getCurrentDateTime()); |
| 559 | 561 | $this->_oDocumentMetadataVersion->setVersionCreatorId($iUserId); | ... | ... |
lib/documentmanagement/documentutil.inc.php
| ... | ... | @@ -45,9 +45,9 @@ require_once(KT_LIB_DIR . '/storage/storagemanager.inc.php'); |
| 45 | 45 | require_once(KT_LIB_DIR . '/filelike/filelikeutil.inc.php'); |
| 46 | 46 | require_once(KT_LIB_DIR . '/metadata/metadatautil.inc.php'); |
| 47 | 47 | require_once(KT_LIB_DIR . '/metadata/fieldset.inc.php'); |
| 48 | -require_once(KT_LIB_DIR . "/subscriptions/subscriptions.inc.php"); | |
| 48 | +require_once(KT_LIB_DIR . '/subscriptions/subscriptions.inc.php'); | |
| 49 | 49 | require_once(KT_LIB_DIR . '/triggers/triggerregistry.inc.php'); |
| 50 | -require_once(KT_LIB_DIR . "/foldermanagement/Folder.inc"); | |
| 50 | +require_once(KT_LIB_DIR . '/foldermanagement/Folder.inc'); | |
| 51 | 51 | |
| 52 | 52 | // WORKFLOW |
| 53 | 53 | require_once(KT_LIB_DIR . '/workflow/workflowutil.inc.php'); |
| ... | ... | @@ -67,7 +67,7 @@ class KTDocumentUtil { |
| 67 | 67 | KTDocumentUtil::copyMetadata($oDocument, $iPreviousMetadataVersion); |
| 68 | 68 | |
| 69 | 69 | if (!$oStorage->upload($oDocument, $sFilename)) { |
| 70 | - return PEAR::raiseError(_kt("An error occurred while storing the new file")); | |
| 70 | + return PEAR::raiseError(_kt('An error occurred while storing the new file')); | |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $oDocument->setLastModifiedDate(getCurrentDateTime()); |
| ... | ... | @@ -89,7 +89,7 @@ class KTDocumentUtil { |
| 89 | 89 | if(strlen($sFilename)) { |
| 90 | 90 | global $default; |
| 91 | 91 | $oDocument->setFileName($sFilename); |
| 92 | - $default->log->info("renamed document " . $oDocument->getId() . " to " . $sFilename); | |
| 92 | + $default->log->info('renamed document ' . $oDocument->getId() . ' to ' . $sFilename); | |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
| ... | ... | @@ -102,7 +102,7 @@ class KTDocumentUtil { |
| 102 | 102 | if (PEAR::isError($bSuccess)) { |
| 103 | 103 | return $bSuccess; |
| 104 | 104 | } |
| 105 | - return PEAR::raiseError(_kt("An error occurred while storing this document in the database")); | |
| 105 | + return PEAR::raiseError(_kt('An error occurred while storing this document in the database')); | |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // create the document transaction record |
| ... | ... | @@ -152,7 +152,7 @@ class KTDocumentUtil { |
| 152 | 152 | |
| 153 | 153 | $oDocument->setIsCheckedOut(true); |
| 154 | 154 | $oDocument->setCheckedOutUserID($oUser->getId()); |
| 155 | - if (!$oDocument->update()) { return PEAR::raiseError(_kt("There was a problem checking out the document.")); } | |
| 155 | + if (!$oDocument->update()) { return PEAR::raiseError(_kt('There was a problem checking out the document.')); } | |
| 156 | 156 | |
| 157 | 157 | $oKTTriggerRegistry = KTTriggerRegistry::getSingleton(); |
| 158 | 158 | $aTriggers = $oKTTriggerRegistry->getTriggers('checkout', 'postValidate'); |
| ... | ... | @@ -160,7 +160,7 @@ class KTDocumentUtil { |
| 160 | 160 | $sTrigger = $aTrigger[0]; |
| 161 | 161 | $oTrigger = new $sTrigger; |
| 162 | 162 | $aInfo = array( |
| 163 | - "document" => $oDocument, | |
| 163 | + 'document' => $oDocument, | |
| 164 | 164 | ); |
| 165 | 165 | $oTrigger->setInfo($aInfo); |
| 166 | 166 | $ret = $oTrigger->postValidate(); |
| ... | ... | @@ -195,7 +195,7 @@ class KTDocumentUtil { |
| 195 | 195 | } else { |
| 196 | 196 | $iDocumentTypeId = 1; |
| 197 | 197 | } |
| 198 | - $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt("Creating database entry"))); | |
| 198 | + $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt('Creating database entry'))); | |
| 199 | 199 | $oDocument =& Document::createFromArray(array( |
| 200 | 200 | 'name' => $sDescription, |
| 201 | 201 | 'description' => $sDescription, |
| ... | ... | @@ -209,13 +209,13 @@ class KTDocumentUtil { |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | if (is_null($oContents)) { |
| 212 | - $res = KTDocumentUtil::setIncomplete($oDocument, "contents"); | |
| 212 | + $res = KTDocumentUtil::setIncomplete($oDocument, 'contents'); | |
| 213 | 213 | if (PEAR::isError($res)) { |
| 214 | 214 | $oDocument->delete(); |
| 215 | 215 | return $res; |
| 216 | 216 | } |
| 217 | 217 | } else { |
| 218 | - // $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt("Storing contents"))); | |
| 218 | + // $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt('Storing contents'))); | |
| 219 | 219 | $res = KTDocumentUtil::storeContents($oDocument, $oContents, $aOptions); |
| 220 | 220 | if (PEAR::isError($res)) { |
| 221 | 221 | $oDocument->delete(); |
| ... | ... | @@ -224,13 +224,13 @@ class KTDocumentUtil { |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | if (is_null($aMetadata)) { |
| 227 | - $res = KTDocumentUtil::setIncomplete($oDocument, "metadata"); | |
| 227 | + $res = KTDocumentUtil::setIncomplete($oDocument, 'metadata'); | |
| 228 | 228 | if (PEAR::isError($res)) { |
| 229 | 229 | $oDocument->delete(); |
| 230 | 230 | return $res; |
| 231 | 231 | } |
| 232 | 232 | } else { |
| 233 | - // $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt("Saving metadata"))); | |
| 233 | + // $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt('Saving metadata'))); | |
| 234 | 234 | $res = KTDocumentUtil::saveMetadata($oDocument, $aMetadata, $aOptions); |
| 235 | 235 | if (PEAR::isError($res)) { |
| 236 | 236 | $oDocument->delete(); |
| ... | ... | @@ -267,7 +267,7 @@ class KTDocumentUtil { |
| 267 | 267 | if ($oField->getIsMandatory() && !$isRealConditional) { |
| 268 | 268 | if (empty($v)) { |
| 269 | 269 | // XXX: What I'd do for a setdefault... |
| 270 | - $aFailed["field"][$oField->getId()] = 1; | |
| 270 | + $aFailed['field'][$oField->getId()] = 1; | |
| 271 | 271 | } |
| 272 | 272 | } |
| 273 | 273 | if (!empty($v)) { |
| ... | ... | @@ -280,7 +280,7 @@ class KTDocumentUtil { |
| 280 | 280 | if ($res) { |
| 281 | 281 | foreach ($res as $aMDSet) { |
| 282 | 282 | if ($aMDSet['field']->getIsMandatory()) { |
| 283 | - $aFailed["fieldset"][$oFieldset->getId()] = 1; | |
| 283 | + $aFailed['fieldset'][$oFieldset->getId()] = 1; | |
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | } |
| ... | ... | @@ -295,7 +295,7 @@ class KTDocumentUtil { |
| 295 | 295 | |
| 296 | 296 | // {{{ saveMetadata |
| 297 | 297 | function saveMetadata(&$oDocument, $aMetadata, $aOptions = null) { |
| 298 | - $table = "document_fields_link"; | |
| 298 | + $table = 'document_fields_link'; | |
| 299 | 299 | $bNoValidate = KTUtil::arrayGet($aOptions, 'novalidate', false); |
| 300 | 300 | if ($bNoValidate !== true) { |
| 301 | 301 | $res = KTDocumentUtil::validateMetadata($oDocument, $aMetadata); |
| ... | ... | @@ -317,15 +317,15 @@ class KTDocumentUtil { |
| 317 | 317 | continue; |
| 318 | 318 | } |
| 319 | 319 | $res = DBUtil::autoInsert($table, array( |
| 320 | - "metadata_version_id" => $iMetadataVersionId, | |
| 321 | - "document_field_id" => $oMetadata->getID(), | |
| 322 | - "value" => $sValue, | |
| 320 | + 'metadata_version_id' => $iMetadataVersionId, | |
| 321 | + 'document_field_id' => $oMetadata->getID(), | |
| 322 | + 'value' => $sValue, | |
| 323 | 323 | )); |
| 324 | 324 | if (PEAR::isError($res)) { |
| 325 | 325 | return $res; |
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | - KTDocumentUtil::setComplete($oDocument, "metadata"); | |
| 328 | + KTDocumentUtil::setComplete($oDocument, 'metadata'); | |
| 329 | 329 | KTDocumentUtil::updateSearchableText($oDocument); |
| 330 | 330 | DocumentFieldLink::clearAllCaches(); |
| 331 | 331 | return true; |
| ... | ... | @@ -347,14 +347,14 @@ class KTDocumentUtil { |
| 347 | 347 | // {{{ setIncomplete |
| 348 | 348 | function setIncomplete(&$oDocument, $reason) { |
| 349 | 349 | $oDocument->setStatusID(STATUS_INCOMPLETE); |
| 350 | - $table = "document_incomplete"; | |
| 350 | + $table = 'document_incomplete'; | |
| 351 | 351 | $iId = $oDocument->getId(); |
| 352 | 352 | $aIncomplete = DBUtil::getOneResult(array("SELECT * FROM $table WHERE id = ?", array($iId))); |
| 353 | 353 | if (PEAR::isError($aIncomplete)) { |
| 354 | 354 | return $aIncomplete; |
| 355 | 355 | } |
| 356 | 356 | if (is_null($aIncomplete)) { |
| 357 | - $aIncomplete = array("id" => $iId); | |
| 357 | + $aIncomplete = array('id' => $iId); | |
| 358 | 358 | } |
| 359 | 359 | $aIncomplete[$reason] = true; |
| 360 | 360 | $res = DBUtil::autoDelete($table, $iId); |
| ... | ... | @@ -371,7 +371,7 @@ class KTDocumentUtil { |
| 371 | 371 | |
| 372 | 372 | // {{{ setComplete |
| 373 | 373 | function setComplete(&$oDocument, $reason) { |
| 374 | - $table = "document_incomplete"; | |
| 374 | + $table = 'document_incomplete'; | |
| 375 | 375 | $iId = $oDocument->getID(); |
| 376 | 376 | $aIncomplete = DBUtil::getOneResult(array("SELECT * FROM $table WHERE id = ?", array($iId))); |
| 377 | 377 | if (PEAR::isError($aIncomplete)) { |
| ... | ... | @@ -388,7 +388,7 @@ class KTDocumentUtil { |
| 388 | 388 | $bIncomplete = false; |
| 389 | 389 | |
| 390 | 390 | foreach ($aIncomplete as $k => $v) { |
| 391 | - if ($k === "id") { continue; } | |
| 391 | + if ($k === 'id') { continue; } | |
| 392 | 392 | |
| 393 | 393 | if ($v) { |
| 394 | 394 | $bIncomplete = true; |
| ... | ... | @@ -428,12 +428,12 @@ class KTDocumentUtil { |
| 428 | 428 | if (KTDocumentUtil::fileExists($oFolder, $sFilename)) { |
| 429 | 429 | $oDoc = Document::getByFilenameAndFolder($sFilename, $oFolder->getId()); |
| 430 | 430 | if (PEAR::isError($oDoc)) { |
| 431 | - return PEAR::raiseError(_kt("Document with that filename already exists in this folder, and appears to be invalid. Please contact the system administrator.")); | |
| 431 | + return PEAR::raiseError(_kt('Document with that filename already exists in this folder, and appears to be invalid. Please contact the system administrator.')); | |
| 432 | 432 | } else { |
| 433 | 433 | if ($oDoc->getStatusID() != LIVE) { |
| 434 | - $sError = _kt("Document with that filename already exists in this folder, but it has been archived or deleted and is still available for restoration. To prevent it being overwritten, you are not allowed to add a document with the same title or filename."); | |
| 434 | + $sError = _kt('Document with that filename already exists in this folder, but it has been archived or deleted and is still available for restoration. To prevent it being overwritten, you are not allowed to add a document with the same title or filename.'); | |
| 435 | 435 | } else { |
| 436 | - $sError = _kt("Document with that filename already exists in this folder."); | |
| 436 | + $sError = _kt('Document with that filename already exists in this folder.'); | |
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | $sError .= _kt(' Document') . ': ' . $oDoc->getName() . ' (ID:' . $oDoc->getId() . ')'; |
| ... | ... | @@ -444,12 +444,12 @@ class KTDocumentUtil { |
| 444 | 444 | if (KTDocumentUtil::nameExists($oFolder, $sName)) { |
| 445 | 445 | $oDoc = Document::getByNameAndFolder($sName, $oFolder->getId()); |
| 446 | 446 | if (PEAR::isError($oDoc)) { |
| 447 | - return PEAR::raiseError(_kt("Document with that title already exists in this folder, and appears to be invalid. Please contact the system administrator.")); | |
| 447 | + return PEAR::raiseError(_kt('Document with that title already exists in this folder, and appears to be invalid. Please contact the system administrator.')); | |
| 448 | 448 | } else { |
| 449 | 449 | if ($oDoc->getStatusID != LIVE) { |
| 450 | - return PEAR::raiseError(_kt("Document with that title already exists in this folder, but it has been archived or deleted and is still available for restoration. To prevent it being overwritten, you are not allowed to add a document with the same title or filename.")); | |
| 450 | + return PEAR::raiseError(_kt('Document with that title already exists in this folder, but it has been archived or deleted and is still available for restoration. To prevent it being overwritten, you are not allowed to add a document with the same title or filename.')); | |
| 451 | 451 | } else { |
| 452 | - return PEAR::raiseError(_kt("Document with that title already exists in this folder.")); | |
| 452 | + return PEAR::raiseError(_kt('Document with that title already exists in this folder.')); | |
| 453 | 453 | } |
| 454 | 454 | } |
| 455 | 455 | |
| ... | ... | @@ -458,12 +458,12 @@ class KTDocumentUtil { |
| 458 | 458 | $oUploadChannel =& KTUploadChannel::getSingleton(); |
| 459 | 459 | $oUploadChannel->sendMessage(new KTUploadNewFile($sFilename)); |
| 460 | 460 | $oDocument =& KTDocumentUtil::_add($oFolder, $sFilename, $oUser, $aOptions); |
| 461 | - // $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt("Document created"))); | |
| 461 | + // $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt('Document created'))); | |
| 462 | 462 | if (PEAR::isError($oDocument)) { |
| 463 | 463 | return $oDocument; |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | - // $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt("Scanning file"))); | |
| 466 | + // $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt('Scanning file'))); | |
| 467 | 467 | $oKTTriggerRegistry = KTTriggerRegistry::getSingleton(); |
| 468 | 468 | $aTriggers = $oKTTriggerRegistry->getTriggers('content', 'scan'); |
| 469 | 469 | $iTrigger = 0; |
| ... | ... | @@ -479,7 +479,7 @@ class KTDocumentUtil { |
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | - $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt("Transforming file"))); | |
| 482 | + $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt('Transforming file'))); | |
| 483 | 483 | $oKTTriggerRegistry = KTTriggerRegistry::getSingleton(); |
| 484 | 484 | $aTriggers = $oKTTriggerRegistry->getTriggers('content', 'transform'); |
| 485 | 485 | foreach ($aTriggers as $aTrigger) { |
| ... | ... | @@ -493,7 +493,7 @@ class KTDocumentUtil { |
| 493 | 493 | $oTrigger->transform(); |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | - // $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt("Creating transaction"))); | |
| 496 | + // $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt('Creating transaction'))); | |
| 497 | 497 | $aOptions = array('user' => $oUser); |
| 498 | 498 | //create the document transaction record |
| 499 | 499 | $oDocumentTransaction = & new DocumentTransaction($oDocument, _kt('Document created'), 'ktcore.transactions.create', $aOptions); |
| ... | ... | @@ -503,7 +503,7 @@ class KTDocumentUtil { |
| 503 | 503 | return $res; |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | - // $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt("Sending subscriptions"))); | |
| 506 | + // $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt('Sending subscriptions'))); | |
| 507 | 507 | // fire subscription alerts for the checked in document |
| 508 | 508 | $oSubscriptionEvent = new SubscriptionEvent(); |
| 509 | 509 | $oFolder = Folder::get($oDocument->getFolderID()); |
| ... | ... | @@ -516,7 +516,7 @@ class KTDocumentUtil { |
| 516 | 516 | $sTrigger = $aTrigger[0]; |
| 517 | 517 | $oTrigger = new $sTrigger; |
| 518 | 518 | $aInfo = array( |
| 519 | - "document" => $oDocument, | |
| 519 | + 'document' => $oDocument, | |
| 520 | 520 | 'aOptions' => $aOrigOptions, |
| 521 | 521 | ); |
| 522 | 522 | $oTrigger->setInfo($aInfo); |
| ... | ... | @@ -525,7 +525,7 @@ class KTDocumentUtil { |
| 525 | 525 | } |
| 526 | 526 | KTDocumentUtil::updateSearchableText($oDocument, true); |
| 527 | 527 | |
| 528 | - $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt("All done..."))); | |
| 528 | + $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt('All done...'))); | |
| 529 | 529 | |
| 530 | 530 | return $oDocument; |
| 531 | 531 | } |
| ... | ... | @@ -555,7 +555,7 @@ class KTDocumentUtil { |
| 555 | 555 | $oStorage =& KTStorageManagerUtil::getSingleton(); |
| 556 | 556 | |
| 557 | 557 | $oKTConfig =& KTConfig::getSingleton(); |
| 558 | - $sBasedir = $oKTConfig->get("urls/tmpDirectory"); | |
| 558 | + $sBasedir = $oKTConfig->get('urls/tmpDirectory'); | |
| 559 | 559 | |
| 560 | 560 | $sFilename = tempnam($sBasedir, 'kt_storecontents'); |
| 561 | 561 | $oOutputFile = new KTFSFileLike($sFilename); |
| ... | ... | @@ -570,12 +570,12 @@ class KTDocumentUtil { |
| 570 | 570 | $oDocument->setMimeTypeId($iMimeTypeId); |
| 571 | 571 | $res = $oStorage->upload($oDocument, $sFilename); |
| 572 | 572 | if ($res === false) { |
| 573 | - return PEAR::raiseError(sprintf(_kt("Couldn't store contents: %s"), _kt("No reason given"))); | |
| 573 | + return PEAR::raiseError(sprintf(_kt("Couldn't store contents: %s"), _kt('No reason given'))); | |
| 574 | 574 | } |
| 575 | 575 | if (PEAR::isError($res)) { |
| 576 | 576 | return PEAR::raiseError(sprintf(_kt("Couldn't store contents: %s"), $res->getMessage())); |
| 577 | 577 | } |
| 578 | - KTDocumentUtil::setComplete($oDocument, "contents"); | |
| 578 | + KTDocumentUtil::setComplete($oDocument, 'contents'); | |
| 579 | 579 | |
| 580 | 580 | if ($aOptions['cleanup_initial_file']) { |
| 581 | 581 | unlink($oContents->sFilename); |
| ... | ... | @@ -600,8 +600,8 @@ class KTDocumentUtil { |
| 600 | 600 | return $res; |
| 601 | 601 | } |
| 602 | 602 | $aInsert = array( |
| 603 | - "document_id" => $iDocumentId, | |
| 604 | - "document_text" => $sAllComments, | |
| 603 | + 'document_id' => $iDocumentId, | |
| 604 | + 'document_text' => $sAllComments, | |
| 605 | 605 | ); |
| 606 | 606 | return DBUtil::autoInsert($sTable, $aInsert, array('noid' => true)); |
| 607 | 607 | } |
| ... | ... | @@ -612,7 +612,7 @@ class KTDocumentUtil { |
| 612 | 612 | if (isset($GLOBALS['_IN_ADD']) && empty($bOverride)) { |
| 613 | 613 | return; |
| 614 | 614 | } |
| 615 | - $sMetadata = KTUtil::arrayGet( $_REQUEST, "metadata_2"); | |
| 615 | + $sMetadata = KTUtil::arrayGet( $_REQUEST, 'metadata_2'); | |
| 616 | 616 | $oDocument = KTUtil::getObject('Document', $oDocument); |
| 617 | 617 | $iDocumentId = $oDocument->getId(); |
| 618 | 618 | $sTable = KTUtil::getTableName('document_transaction_text'); |
| ... | ... | @@ -628,18 +628,18 @@ class KTDocumentUtil { |
| 628 | 628 | foreach ($aFieldLinks as $oFieldLink) { |
| 629 | 629 | $aFieldValues[] = $oFieldLink->getValue(); |
| 630 | 630 | } |
| 631 | - $sAllFieldText = join(" ", $aFieldValues); | |
| 631 | + $sAllFieldText = join(' ', $aFieldValues); | |
| 632 | 632 | $sDocumentFilename = $oDocument->getFilename(); |
| 633 | 633 | $sDocumentTitle = $oDocument->getName(); |
| 634 | - $sSearchableText = $sAllDocumentText . " " . $sAllFieldText . " " . $sAllComments . " " . $sDocumentFilename . " " . $sDocumentTitle . " " . $sMetadata; | |
| 634 | + $sSearchableText = $sAllDocumentText . ' ' . $sAllFieldText . ' ' . $sAllComments . ' ' . $sDocumentFilename . ' ' . $sDocumentTitle . ' ' . $sMetadata; | |
| 635 | 635 | $sTable = KTUtil::getTableName('document_searchable_text'); |
| 636 | 636 | $aDelete = array( |
| 637 | - "document_id" => $iDocumentId, | |
| 637 | + 'document_id' => $iDocumentId, | |
| 638 | 638 | ); |
| 639 | 639 | DBUtil::whereDelete($sTable, $aDelete); |
| 640 | 640 | $aInsert = array( |
| 641 | - "document_id" => $iDocumentId, | |
| 642 | - "document_text" => $sSearchableText, | |
| 641 | + 'document_id' => $iDocumentId, | |
| 642 | + 'document_text' => $sSearchableText, | |
| 643 | 643 | ); |
| 644 | 644 | return DBUtil::autoInsert($sTable, $aInsert, array('noid' => true)); |
| 645 | 645 | } |
| ... | ... | @@ -688,17 +688,17 @@ class KTDocumentUtil { |
| 688 | 688 | |
| 689 | 689 | if (PEAR::isError($res) || ($res == false)) { |
| 690 | 690 | DBUtil::rollback(); |
| 691 | - return PEAR::raiseError(_kt("There was a problem deleting the document from the database.")); | |
| 691 | + return PEAR::raiseError(_kt('There was a problem deleting the document from the database.')); | |
| 692 | 692 | } |
| 693 | 693 | |
| 694 | 694 | // now move the document to the delete folder |
| 695 | 695 | $res = $oStorageManager->delete($oDocument); |
| 696 | 696 | if (PEAR::isError($res) || ($res == false)) { |
| 697 | 697 | //could not delete the document from the file system |
| 698 | - $default->log->error("Deletion: Filesystem error deleting document " . | |
| 699 | - $oDocument->getFileName() . " from folder " . | |
| 698 | + $default->log->error('Deletion: Filesystem error deleting document ' . | |
| 699 | + $oDocument->getFileName() . ' from folder ' . | |
| 700 | 700 | Folder::getFolderPath($oDocument->getFolderID()) . |
| 701 | - " id=" . $oDocument->getFolderID()); | |
| 701 | + ' id=' . $oDocument->getFolderID()); | |
| 702 | 702 | |
| 703 | 703 | // we use a _real_ transaction here ... |
| 704 | 704 | |
| ... | ... | @@ -710,7 +710,7 @@ class KTDocumentUtil { |
| 710 | 710 | $oDocument->update(); |
| 711 | 711 | */ |
| 712 | 712 | |
| 713 | - return PEAR::raiseError(_kt("There was a problem deleting the document from storage.")); | |
| 713 | + return PEAR::raiseError(_kt('There was a problem deleting the document from storage.')); | |
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | $oDocumentTransaction = & new DocumentTransaction($oDocument, _kt('Document deleted: ') . $sReason, 'ktcore.transactions.delete'); |
| ... | ... | @@ -734,7 +734,7 @@ class KTDocumentUtil { |
| 734 | 734 | $sTrigger = $aTrigger[0]; |
| 735 | 735 | $oTrigger = new $sTrigger; |
| 736 | 736 | $aInfo = array( |
| 737 | - "document" => $oDocument, | |
| 737 | + 'document' => $oDocument, | |
| 738 | 738 | ); |
| 739 | 739 | $oTrigger->setInfo($aInfo); |
| 740 | 740 | $ret = $oTrigger->postValidate(); |
| ... | ... | @@ -888,7 +888,7 @@ class KTDocumentUtil { |
| 888 | 888 | $res = $oStorage->renameDocument($oDocument, $oOldContentVersion, $sNewFilename); |
| 889 | 889 | |
| 890 | 890 | if (!$res) { |
| 891 | - return PEAR::raiseError(_kt("An error occurred while storing the new file")); | |
| 891 | + return PEAR::raiseError(_kt('An error occurred while storing the new file')); | |
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | $oDocument->setLastModifiedDate(getCurrentDateTime()); |
| ... | ... | @@ -900,7 +900,7 @@ class KTDocumentUtil { |
| 900 | 900 | if (PEAR::isError($bSuccess)) { |
| 901 | 901 | return $bSuccess; |
| 902 | 902 | } |
| 903 | - return PEAR::raiseError(_kt("An error occurred while storing this document in the database")); | |
| 903 | + return PEAR::raiseError(_kt('An error occurred while storing this document in the database')); | |
| 904 | 904 | } |
| 905 | 905 | |
| 906 | 906 | // create the document transaction record |
| ... | ... | @@ -966,9 +966,9 @@ class KTDocumentUtil { |
| 966 | 966 | $sTrigger = $aTrigger[0]; |
| 967 | 967 | $oTrigger = new $sTrigger; |
| 968 | 968 | $aInfo = array( |
| 969 | - "document" => $oDocument, | |
| 970 | - "old_folder" => $oOriginalFolder, | |
| 971 | - "new_folder" => $oFolder, | |
| 969 | + 'document' => $oDocument, | |
| 970 | + 'old_folder' => $oOriginalFolder, | |
| 971 | + 'new_folder' => $oFolder, | |
| 972 | 972 | ); |
| 973 | 973 | $oTrigger->setInfo($aInfo); |
| 974 | 974 | $ret = $oTrigger->postValidate(); | ... | ... |
lib/foldermanagement/folderutil.inc.php
| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | */ |
| 32 | 32 | |
| 33 | 33 | require_once(KT_LIB_DIR . '/storage/storagemanager.inc.php'); |
| 34 | -require_once(KT_LIB_DIR . "/subscriptions/subscriptions.inc.php"); | |
| 34 | +require_once(KT_LIB_DIR . '/subscriptions/subscriptions.inc.php'); | |
| 35 | 35 | |
| 36 | 36 | require_once(KT_LIB_DIR . '/permissions/permission.inc.php'); |
| 37 | 37 | require_once(KT_LIB_DIR . '/permissions/permissionutil.inc.php'); |
| ... | ... | @@ -97,7 +97,7 @@ class KTFolderUtil { |
| 97 | 97 | |
| 98 | 98 | function move($oFolder, $oNewParentFolder, $oUser, $sReason=null) { |
| 99 | 99 | if (KTFolderUtil::exists($oNewParentFolder, $oFolder->getName())) { |
| 100 | - return PEAR::raiseError(_kt("Folder with the same name already exists in the new parent folder")); | |
| 100 | + return PEAR::raiseError(_kt('Folder with the same name already exists in the new parent folder')); | |
| 101 | 101 | } |
| 102 | 102 | $oStorage =& KTStorageManagerUtil::getSingleton(); |
| 103 | 103 | |
| ... | ... | @@ -106,13 +106,13 @@ class KTFolderUtil { |
| 106 | 106 | if (empty($iOriginalParentFolderId)) { |
| 107 | 107 | // If we have no parent, then we're the root. If we're the |
| 108 | 108 | // root - how do we move inside something? |
| 109 | - return PEAR::raiseError(_kt("Folder has no parent")); | |
| 109 | + return PEAR::raiseError(_kt('Folder has no parent')); | |
| 110 | 110 | } |
| 111 | 111 | $oOriginalParentFolder = Folder::get($iOriginalParentFolderId); |
| 112 | 112 | if (PEAR::isError($oOriginalParentFolder)) { |
| 113 | 113 | // If we have no parent, then we're the root. If we're the |
| 114 | 114 | // root - how do we move inside something? |
| 115 | - return PEAR::raiseError(_kt("Folder parent does not exist")); | |
| 115 | + return PEAR::raiseError(_kt('Folder parent does not exist')); | |
| 116 | 116 | } |
| 117 | 117 | $iOriginalParentPermissionObjectId = $oOriginalParentFolder->getPermissionObjectId(); |
| 118 | 118 | $iTargetPermissionObjectId = $oFolder->getPermissionObjectId(); |
| ... | ... | @@ -126,11 +126,11 @@ class KTFolderUtil { |
| 126 | 126 | |
| 127 | 127 | |
| 128 | 128 | // First, deal with SQL, as it, at least, is guaranteed to be atomic |
| 129 | - $table = "folders"; | |
| 129 | + $table = 'folders'; | |
| 130 | 130 | |
| 131 | 131 | if ($oNewParentFolder->getId() == 1) { |
| 132 | 132 | $sNewParentFolderPath = $oNewParentFolder->getName(); |
| 133 | - $sNewParentFolderIds = ""; | |
| 133 | + $sNewParentFolderIds = ''; | |
| 134 | 134 | } else { |
| 135 | 135 | $sNewParentFolderPath = sprintf("%s/%s", $oNewParentFolder->getFullPath(), $oNewParentFolder->getName()); |
| 136 | 136 | $sNewParentFolderIds = sprintf("%s,%s", $oNewParentFolder->getParentFolderIDs(), $oNewParentFolder->getID()); |
| ... | ... | @@ -175,7 +175,7 @@ class KTFolderUtil { |
| 175 | 175 | return $res; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $table = "documents"; | |
| 178 | + $table = 'documents'; | |
| 179 | 179 | $sQuery = "UPDATE $table SET full_path = CONCAT(?, SUBSTRING(full_path FROM ?)), parent_folder_ids = CONCAT(?, SUBSTRING(parent_folder_ids FROM ?)) WHERE full_path LIKE ?"; |
| 180 | 180 | $aParams = array( |
| 181 | 181 | sprintf("%s", $sNewParentFolderPath), |
| ... | ... | @@ -194,9 +194,9 @@ class KTFolderUtil { |
| 194 | 194 | return $res; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - $sComment = sprintf("Folder moved from %s to %s", $sOldPath, $sNewParentFolderPath); | |
| 197 | + $sComment = sprintf(_kt("Folder moved from %s to %s"), $sOldPath, $sNewParentFolderPath); | |
| 198 | 198 | if($sReason !== null) { |
| 199 | - $sComment .= sprintf(" (reason: %s)", $sReason); | |
| 199 | + $sComment .= sprintf(_kt(" (reason: %s)"), $sReason); | |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | $oTransaction = KTFolderTransaction::createFromArray(array( | ... | ... |
plugins/ktcore/KTDocumentActions.php
| ... | ... | @@ -1199,7 +1199,7 @@ class KTDocumentCopyAction extends KTDocumentAction { |
| 1199 | 1199 | } |
| 1200 | 1200 | |
| 1201 | 1201 | //$aOptions = array('user' => $oUser); |
| 1202 | - //$oDocumentTransaction = & new DocumentTransaction($oNewDoc, "Document copied from old version.", 'ktcore.transactions.create', $aOptions); | |
| 1202 | + //$oDocumentTransaction = & new DocumentTransaction($oNewDoc, 'Document copied from old version.', 'ktcore.transactions.create', $aOptions); | |
| 1203 | 1203 | //$res = $oDocumentTransaction->create(); |
| 1204 | 1204 | |
| 1205 | 1205 | $_SESSION['KTInfoMessage'][] = _kt('Document copied.'); | ... | ... |
plugins/ktcore/admin/deletedDocuments.php
| ... | ... | @@ -37,8 +37,8 @@ require_once(KT_LIB_DIR . '/browse/browseutil.inc.php'); |
| 37 | 37 | require_once(KT_LIB_DIR . '/documentmanagement/Document.inc'); |
| 38 | 38 | require_once(KT_LIB_DIR . '/documentmanagement/DocumentTransaction.inc'); |
| 39 | 39 | |
| 40 | -require_once(KT_LIB_DIR . "/widgets/fieldWidgets.php"); | |
| 41 | -require_once(KT_LIB_DIR . "/templating/kt3template.inc.php"); | |
| 40 | +require_once(KT_LIB_DIR . '/widgets/fieldWidgets.php'); | |
| 41 | +require_once(KT_LIB_DIR . '/templating/kt3template.inc.php'); | |
| 42 | 42 | |
| 43 | 43 | class DeletedDocumentsDispatcher extends KTAdminDispatcher { |
| 44 | 44 | var $sHelpPage = 'ktcore/admin/deleted documents.html'; |
| ... | ... | @@ -47,7 +47,7 @@ var $sHelpPage = 'ktcore/admin/deleted documents.html'; |
| 47 | 47 | |
| 48 | 48 | $this->oPage->setBreadcrumbDetails(_kt('view')); |
| 49 | 49 | |
| 50 | - $aDocuments =& Document::getList("status_id=" . DELETED); | |
| 50 | + $aDocuments =& Document::getList('status_id=' . DELETED); | |
| 51 | 51 | |
| 52 | 52 | if(!empty($aDocuments)){ |
| 53 | 53 | $items = count($aDocuments); |
| ... | ... | @@ -160,7 +160,7 @@ var $sHelpPage = 'ktcore/admin/deleted documents.html'; |
| 160 | 160 | |
| 161 | 161 | if (!$oStorage->expunge($oDoc)) { $aErrorDocuments[] = $oDoc->getDisplayPath(); } |
| 162 | 162 | else { |
| 163 | - $oDocumentTransaction = & new DocumentTransaction($oDoc, "Document expunged", 'ktcore.transactions.expunge'); | |
| 163 | + $oDocumentTransaction = & new DocumentTransaction($oDoc, _kt('Document expunged'), 'ktcore.transactions.expunge'); | |
| 164 | 164 | $oDocumentTransaction->create(); |
| 165 | 165 | |
| 166 | 166 | // delete this from the db now |
| ... | ... | @@ -259,7 +259,8 @@ var $sHelpPage = 'ktcore/admin/deleted documents.html'; |
| 259 | 259 | |
| 260 | 260 | // create a doc-transaction. |
| 261 | 261 | // FIXME does this warrant a transaction-type? |
| 262 | - $oTransaction = new DocumentTransaction($oDoc, _kt('Restored from deleted state by ') . $this->oUser->getName(), 'ktcore.transactions.update'); | |
| 262 | + $oTransaction = new DocumentTransaction($oDoc, sprintf(_kt("Restored from deleted state by %s"), $this->oUser->getName()), 'ktcore.transactions.update'); | |
| 263 | + | |
| 263 | 264 | if (!$oTransaction->create()) { |
| 264 | 265 | ; // do nothing? the state of physicaldocumentmanager... |
| 265 | 266 | } | ... | ... |
plugins/ktcore/admin/documentCheckout.php
| ... | ... | @@ -44,15 +44,15 @@ class KTCheckoutAdminDispatcher extends KTAdminDispatcher { |
| 44 | 44 | |
| 45 | 45 | function do_main() { |
| 46 | 46 | $this->aBreadcrumbs[] = array('name' => _kt('Document Checkout')); |
| 47 | - $this->oPage->setBreadcrumbDetails(_kt("list checked out documents")); | |
| 47 | + $this->oPage->setBreadcrumbDetails(_kt('list checked out documents')); | |
| 48 | 48 | |
| 49 | - $aDocuments = Document::getList("is_checked_out = 1"); | |
| 49 | + $aDocuments = Document::getList('is_checked_out = 1'); | |
| 50 | 50 | |
| 51 | 51 | $oTemplating =& KTTemplating::getSingleton(); |
| 52 | 52 | $oTemplate = $oTemplating->loadTemplate('ktcore/document/admin/checkoutlisting'); |
| 53 | 53 | $oTemplate->setData(array( |
| 54 | - "context" => $this, | |
| 55 | - "documents" => $aDocuments, | |
| 54 | + 'context' => $this, | |
| 55 | + 'documents' => $aDocuments, | |
| 56 | 56 | )); |
| 57 | 57 | return $oTemplate; |
| 58 | 58 | } |
| ... | ... | @@ -60,7 +60,7 @@ class KTCheckoutAdminDispatcher extends KTAdminDispatcher { |
| 60 | 60 | |
| 61 | 61 | function do_confirm() { |
| 62 | 62 | $this->aBreadcrumbs[] = array('name' => _kt('Document Checkout')); |
| 63 | - $this->oPage->setBreadcrumbDetails(_kt("confirm forced check-in")); | |
| 63 | + $this->oPage->setBreadcrumbDetails(_kt('confirm forced check-in')); | |
| 64 | 64 | |
| 65 | 65 | $document_id = KTUtil::arrayGet($_REQUEST, 'fDocumentId'); |
| 66 | 66 | if (empty($document_id)) { |
| ... | ... | @@ -82,9 +82,9 @@ class KTCheckoutAdminDispatcher extends KTAdminDispatcher { |
| 82 | 82 | $oTemplating =& KTTemplating::getSingleton(); |
| 83 | 83 | $oTemplate = $oTemplating->loadTemplate('ktcore/document/admin/force_checkin_confirm'); |
| 84 | 84 | $oTemplate->setData(array( |
| 85 | - "context" => $this, | |
| 86 | - "document" => $oDocument, | |
| 87 | - "checkout_user" => $oUser, | |
| 85 | + 'context' => $this, | |
| 86 | + 'document' => $oDocument, | |
| 87 | + 'checkout_user' => $oUser, | |
| 88 | 88 | )); |
| 89 | 89 | return $oTemplate; |
| 90 | 90 | ... | ... |
plugins/ktcore/document/edit.php
plugins/ktcore/folder/Rename.php
| ... | ... | @@ -47,7 +47,6 @@ class KTFolderRenameAction extends KTFolderAction { |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | function getInfo() { |
| 50 | - if ($this->oFolder->getId() == 1) { return null; } | |
| 51 | 50 | return parent::getInfo(); |
| 52 | 51 | } |
| 53 | 52 | |
| ... | ... | @@ -76,15 +75,17 @@ class KTFolderRenameAction extends KTFolderAction { |
| 76 | 75 | $sFolderName = $this->oValidator->validateString($sFolderName, $aErrorOptions); |
| 77 | 76 | $sOldFolderName = $this->oFolder->getName(); |
| 78 | 77 | |
| 79 | - $oParentFolder =& Folder::get($this->oFolder->getParentID()); | |
| 80 | - if(PEAR::isError($oParentFolder)) { | |
| 81 | - $this->errorRedirectToMain(_kt('Unable to retrieve parent folder.'), $aErrorOptions['redirect_to'][1]); | |
| 82 | - exit(0); | |
| 83 | - } | |
| 78 | + if ($this->oFolder->getId() != 1) { | |
| 79 | + $oParentFolder =& Folder::get($this->oFolder->getParentID()); | |
| 80 | + if(PEAR::isError($oParentFolder)) { | |
| 81 | + $this->errorRedirectToMain(_kt('Unable to retrieve parent folder.'), $aErrorOptions['redirect_to'][1]); | |
| 82 | + exit(0); | |
| 83 | + } | |
| 84 | 84 | |
| 85 | - if(KTFolderUtil::exists($oParentFolder, $sFolderName)) { | |
| 86 | - $this->errorRedirectToMain(_kt('A folder with that name already exists.'), $aErrorOptions['redirect_to'][1]); | |
| 87 | - exit(0); | |
| 85 | + if(KTFolderUtil::exists($oParentFolder, $sFolderName)) { | |
| 86 | + $this->errorRedirectToMain(_kt('A folder with that name already exists.'), $aErrorOptions['redirect_to'][1]); | |
| 87 | + exit(0); | |
| 88 | + } | |
| 88 | 89 | } |
| 89 | 90 | |
| 90 | 91 | $res = KTFolderUtil::rename($this->oFolder, $sFolderName, $this->oUser); | ... | ... |
plugins/ktstandard/KTEmail.php
| ... | ... | @@ -31,16 +31,16 @@ |
| 31 | 31 | |
| 32 | 32 | require_once(KT_LIB_DIR . '/actions/actionregistry.inc.php'); |
| 33 | 33 | |
| 34 | -require_once(KT_LIB_DIR . "/email/Email.inc"); | |
| 35 | -require_once(KT_LIB_DIR . "/users/User.inc"); | |
| 36 | -require_once(KT_LIB_DIR . "/groups/Group.inc"); | |
| 37 | -require_once(KT_LIB_DIR . "/documentmanagement/DocumentTransaction.inc"); | |
| 38 | -require_once(KT_LIB_DIR . "/documentmanagement/Document.inc"); | |
| 34 | +require_once(KT_LIB_DIR . '/email/Email.inc'); | |
| 35 | +require_once(KT_LIB_DIR . '/users/User.inc'); | |
| 36 | +require_once(KT_LIB_DIR . '/groups/Group.inc'); | |
| 37 | +require_once(KT_LIB_DIR . '/documentmanagement/DocumentTransaction.inc'); | |
| 38 | +require_once(KT_LIB_DIR . '/documentmanagement/Document.inc'); | |
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * Sends emails to the selected groups |
| 42 | 42 | */ |
| 43 | -function sendGroupEmails($aGroupIDs, $oDocument, $sComment = "", $bAttachDocument, &$aEmailErrors) { | |
| 43 | +function sendGroupEmails($aGroupIDs, $oDocument, $sComment = '', $bAttachDocument, &$aEmailErrors) { | |
| 44 | 44 | global $default; |
| 45 | 45 | |
| 46 | 46 | // loop through groups |
| ... | ... | @@ -55,7 +55,7 @@ function sendGroupEmails($aGroupIDs, $oDocument, $sComment = "", $bAttachDocumen |
| 55 | 55 | } |
| 56 | 56 | $aDestinationGroups[] = $oDestGroup; |
| 57 | 57 | |
| 58 | - $default->log->info("sendingEmail to group " . $oDestGroup->getName()); | |
| 58 | + $default->log->info('sendingEmail to group ' . $oDestGroup->getName()); | |
| 59 | 59 | // for each group, retrieve all the users |
| 60 | 60 | foreach($aDestinationGroups as $oGroup){ |
| 61 | 61 | $aUsers = array_merge($aUsers, $oGroup->getUsers()); |
| ... | ... | @@ -63,21 +63,21 @@ function sendGroupEmails($aGroupIDs, $oDocument, $sComment = "", $bAttachDocumen |
| 63 | 63 | |
| 64 | 64 | // FIXME: this should send one email with multiple To: users |
| 65 | 65 | for ($j=0; $j<count($aUsers); $j++) { |
| 66 | - $default->log->info("sendingEmail to group-member " . $aUsers[$j]->getName() . " with email " . $aUsers[$j]->getEmail()); | |
| 66 | + $default->log->info('sendingEmail to group-member ' . $aUsers[$j]->getName() . ' with email ' . $aUsers[$j]->getEmail()); | |
| 67 | 67 | // the user has an email address and has email notification enabled |
| 68 | 68 | if (strlen($aUsers[$j]->getEmail())>0 && $aUsers[$j]->getEmailNotification()) { |
| 69 | 69 | //if the to address is valid, send the mail |
| 70 | 70 | if (validateEmailAddress($aUsers[$j]->getEmail())) { |
| 71 | 71 | sendEmail($aUsers[$j]->getEmail(), $aUsers[$j]->getName(), $oDocument->getID(), $oDocument->getName(), $sComment, $bAttachDocument, $aEmailErrors); |
| 72 | 72 | } else { |
| 73 | - $default->log->error("email validation failed for " . $aUsers[$j]->getEmail()); | |
| 73 | + $default->log->error('email validation failed for ' . $aUsers[$j]->getEmail()); | |
| 74 | 74 | } |
| 75 | 75 | } else { |
| 76 | - $default->log->info("either " . $aUsers[$j]->getUserName() . " has no email address, or notification is not enabled"); | |
| 76 | + $default->log->info('either ' . $aUsers[$j]->getUserName() . ' has no email address, or notification is not enabled'); | |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | } else { |
| 80 | - $default->log->info("filtered group id=" . $aGroupIDs[$i]); | |
| 80 | + $default->log->info('filtered group id=' . $aGroupIDs[$i]); | |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | } |
| ... | ... | @@ -85,14 +85,14 @@ function sendGroupEmails($aGroupIDs, $oDocument, $sComment = "", $bAttachDocumen |
| 85 | 85 | /** |
| 86 | 86 | * Sends emails to the selected users |
| 87 | 87 | */ |
| 88 | -function sendUserEmails($aUserIDs, $oDocument, $sComment = "", $bAttachDocument, &$aEmailErrors) { | |
| 88 | +function sendUserEmails($aUserIDs, $oDocument, $sComment = '', $bAttachDocument, &$aEmailErrors) { | |
| 89 | 89 | global $default; |
| 90 | 90 | |
| 91 | 91 | // loop through users |
| 92 | 92 | for ($i=0; $i<count($aUserIDs); $i++) { |
| 93 | 93 | if ($aUserIDs[$i] > 0) { |
| 94 | 94 | $oDestUser = User::get($aUserIDs[$i]); |
| 95 | - $default->log->info("sendingEmail to user " . $oDestUser->getName() . " with email " . $oDestUser->getEmail()); | |
| 95 | + $default->log->info('sendingEmail to user ' . $oDestUser->getName() . ' with email ' . $oDestUser->getEmail()); | |
| 96 | 96 | // the user has an email address and has email notification enabled |
| 97 | 97 | if (strlen($oDestUser->getEmail())>0 && $oDestUser->getEmailNotification()) { |
| 98 | 98 | //if the to address is valid, send the mail |
| ... | ... | @@ -100,10 +100,10 @@ function sendUserEmails($aUserIDs, $oDocument, $sComment = "", $bAttachDocument, |
| 100 | 100 | sendEmail($oDestUser->getEmail(), $oDestUser->getName(), $oDocument->getID(), $oDocument->getName(), $sComment, $bAttachDocument, $aEmailErrors); |
| 101 | 101 | } |
| 102 | 102 | } else { |
| 103 | - $default->log->info("either " . $oDestUser->getUserName() . " has no email address, or notification is not enabled"); | |
| 103 | + $default->log->info('either ' . $oDestUser->getUserName() . ' has no email address, or notification is not enabled'); | |
| 104 | 104 | } |
| 105 | 105 | } else { |
| 106 | - $default->log->info("filtered user id=" . $aUserIDs[$i]); | |
| 106 | + $default->log->info('filtered user id=' . $aUserIDs[$i]); | |
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | } |
| ... | ... | @@ -111,12 +111,12 @@ function sendUserEmails($aUserIDs, $oDocument, $sComment = "", $bAttachDocument, |
| 111 | 111 | /** |
| 112 | 112 | * Sends emails to the manually entered email addresses |
| 113 | 113 | */ |
| 114 | -function sendManualEmails($aEmailAddresses, $oDocument, $sComment = "", $bAttachDocument, &$aEmailErrors) { | |
| 114 | +function sendManualEmails($aEmailAddresses, $oDocument, $sComment = '', $bAttachDocument, &$aEmailErrors) { | |
| 115 | 115 | global $default; |
| 116 | 116 | |
| 117 | 117 | // loop through users |
| 118 | 118 | foreach ($aEmailAddresses as $sEmailAddress) { |
| 119 | - $default->log->info("sendingEmail to address " . $sEmailAddress); | |
| 119 | + $default->log->info('sendingEmail to address ' . $sEmailAddress); | |
| 120 | 120 | if (validateEmailAddress($sEmailAddress)) { |
| 121 | 121 | sendEmail($sEmailAddress, $sEmailAddress, $oDocument->getID(), $oDocument->getName(), $sComment, $bAttachDocument, $aEmailErrors); |
| 122 | 122 | } |
| ... | ... | @@ -136,12 +136,12 @@ function sendEmail($sDestEmailAddress, $sDestUserName, $iDocumentID, $sDocumentN |
| 136 | 136 | |
| 137 | 137 | function sendEmailDocument($sDestEmailAddress, $sDestUserName, $iDocumentID, $sDocumentName, $sComment, &$aEmailErrors) { |
| 138 | 138 | global $default; |
| 139 | - $oSendingUser = User::get($_SESSION["userID"]); | |
| 139 | + $oSendingUser = User::get($_SESSION['userID']); | |
| 140 | 140 | |
| 141 | 141 | $sMessage .= sprintf(_kt("Your colleague, %s, wishes you to view the attached document entitled '%s'."), $oSendingUser->getName(), $sDocumentName); |
| 142 | 142 | $sMessage .= "\n\n"; |
| 143 | 143 | if (strlen($sComment) > 0) { |
| 144 | - $sMessage .= "<br><br>" . _kt("Comments:") . "<br>" . $sComment; | |
| 144 | + $sMessage .= '<br><br>' . _kt('Comments:') . '<br>' . $sComment; | |
| 145 | 145 | } |
| 146 | 146 | $sTitle = sprintf(_kt("Document: %s from %s"), $sDocumentName, $oSendingUser->getName()); |
| 147 | 147 | |
| ... | ... | @@ -179,7 +179,7 @@ function sendEmailDocument($sDestEmailAddress, $sDestUserName, $iDocumentID, $sD |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | // emailed link transaction |
| 182 | - $oDocumentTransaction = & new DocumentTransaction($oDocument, _kt('Document copy emailed to ') . $sDestEmailAddress, 'ktcore.transactions.email_attachment'); | |
| 182 | + $oDocumentTransaction = & new DocumentTransaction($oDocument, sprintf(_kt("Document copy emailed to %s"), $sDestEmailAddress), 'ktcore.transactions.email_attachement'); | |
| 183 | 183 | if ($oDocumentTransaction->create()) { |
| 184 | 184 | $default->log->debug("emailBL.php created email link document transaction for document ID=$iDocumentID"); |
| 185 | 185 | } else { |
| ... | ... | @@ -189,22 +189,22 @@ function sendEmailDocument($sDestEmailAddress, $sDestUserName, $iDocumentID, $sD |
| 189 | 189 | |
| 190 | 190 | function sendEmailHyperlink($sDestEmailAddress, $sDestUserName, $iDocumentID, $sDocumentName, $sComment, &$aEmailErrors) { |
| 191 | 191 | global $default; |
| 192 | - $oSendingUser = User::get($_SESSION["userID"]); | |
| 192 | + $oSendingUser = User::get($_SESSION['userID']); | |
| 193 | 193 | |
| 194 | - $sMessage = "<font face=\"arial\" size=\"2\">"; | |
| 194 | + $sMessage = '<font face="arial" size="2">'; | |
| 195 | 195 | if ($sDestUserName) { |
| 196 | - $sMessage .= $sDestUserName . ",<br><br>"; | |
| 196 | + $sMessage .= $sDestUserName . ',<br><br>'; | |
| 197 | 197 | } |
| 198 | 198 | $sMessage .= sprintf(_kt("Your colleague, %s, wishes you to view the document entitled '%s'."), $oSendingUser->getName(), $sDocumentName); |
| 199 | 199 | $sMessage .= " \n"; |
| 200 | - $sMessage .= _kt("Click on the hyperlink below to view it."); | |
| 200 | + $sMessage .= _kt('Click on the hyperlink below to view it.'); | |
| 201 | 201 | // add the link to the document to the mail |
| 202 | - $sMessage .= "<br>" . generateControllerLink("viewDocument", "fDocumentID=$iDocumentID", $sDocumentName, true); | |
| 202 | + $sMessage .= '<br>' . generateControllerLink('viewDocument', "fDocumentID=$iDocumentID", $sDocumentName, true); | |
| 203 | 203 | // add optional comment |
| 204 | 204 | if (strlen($sComment) > 0) { |
| 205 | - $sMessage .= "<br><br>" . _kt("Comments:") . "<br>" . $sComment; | |
| 205 | + $sMessage .= '<br><br>' . _kt('Comments:') . '<br>' . $sComment; | |
| 206 | 206 | } |
| 207 | - $sMessage .= "</font>"; | |
| 207 | + $sMessage .= '</font>'; | |
| 208 | 208 | $sTitle = sprintf(_kt("Link: %s from %s"), $sDocumentName, $oSendingUser->getName()); |
| 209 | 209 | //email the hyperlink |
| 210 | 210 | // |
| ... | ... | @@ -234,8 +234,9 @@ function sendEmailHyperlink($sDestEmailAddress, $sDestUserName, $iDocumentID, $s |
| 234 | 234 | // need a document to do this. |
| 235 | 235 | $oDocument =& Document::get($iDocumentID); |
| 236 | 236 | |
| 237 | - $oDocumentTransaction = & new DocumentTransaction($oDocument, _kt('Document link emailed to ') . $sDestEmailAddress, 'ktcore.transactions.email_link'); | |
| 238 | - if ($oDocumentTransaction->create()) { | |
| 237 | + $oDocumentTransaction = & new DocumentTransaction($oDocument, sprintf(_kt("Document link emailed to %s"), $sDestEmailAddress), 'ktcore.transactions.email_link'); | |
| 238 | + | |
| 239 | + if ($oDocumentTransaction->create()) { | |
| 239 | 240 | $default->log->debug("emailBL.php created email link document transaction for document ID=$iDocumentID"); |
| 240 | 241 | } else { |
| 241 | 242 | $default->log->error("emailBL.php couldn't create email link document transaction for document ID=$iDocumentID"); |
| ... | ... | @@ -244,8 +245,8 @@ function sendEmailHyperlink($sDestEmailAddress, $sDestUserName, $iDocumentID, $s |
| 244 | 245 | |
| 245 | 246 | function validateEmailAddress($sEmailAddress) { |
| 246 | 247 | $aEmailAddresses = array(); |
| 247 | - if (strpos($sEmailAddress, ";")) { | |
| 248 | - $aEmailAddresses = explode(";", $sEmailAddress); | |
| 248 | + if (strpos($sEmailAddress, ';')) { | |
| 249 | + $aEmailAddresses = explode(';', $sEmailAddress); | |
| 249 | 250 | } else { |
| 250 | 251 | $aEmailAddresses[] = $sEmailAddress; |
| 251 | 252 | } |
| ... | ... | @@ -302,20 +303,20 @@ class KTDocumentEmailAction extends KTDocumentAction { |
| 302 | 303 | |
| 303 | 304 | |
| 304 | 305 | if ($bAttachment) { |
| 305 | - $fields[] = new KTCheckboxWidget(_kt("Attach document"), | |
| 306 | - _kt("By default, documents are sent as links into the document management system. Select this option if you want the document contents to be sent as an attachment in the email."), | |
| 306 | + $fields[] = new KTCheckboxWidget(_kt('Attach document'), | |
| 307 | + _kt('By default, documents are sent as links into the document management system. Select this option if you want the document contents to be sent as an attachment in the email.'), | |
| 307 | 308 | 'fAttachDocument', null, $this->oPage); |
| 308 | 309 | } |
| 309 | 310 | if ($bEmailAddresses) { |
| 310 | - $fields[] = new KTTextWidget(_kt("Email addresses"), | |
| 311 | - _kt("Add extra email addresses here"), | |
| 312 | - 'fEmailAddresses', "", $this->oPage, | |
| 311 | + $fields[] = new KTTextWidget(_kt('Email addresses'), | |
| 312 | + _kt('Add extra email addresses here'), | |
| 313 | + 'fEmailAddresses', '', $this->oPage, | |
| 313 | 314 | false, null, null, array('cols' => 60, 'rows' => 5)); |
| 314 | 315 | } |
| 315 | 316 | |
| 316 | - $fields[] = new KTTextWidget(_kt("Comment"), | |
| 317 | - _kt("A message for those who receive the document"), | |
| 318 | - 'fComment', "", $this->oPage, | |
| 317 | + $fields[] = new KTTextWidget(_kt('Comment'), | |
| 318 | + _kt('A message for those who receive the document'), | |
| 319 | + 'fComment', '', $this->oPage, | |
| 319 | 320 | true, null, null, array('cols' => 60, 'rows' => 5)); |
| 320 | 321 | |
| 321 | 322 | |
| ... | ... | @@ -406,13 +407,13 @@ class KTDocumentEmailAction extends KTDocumentAction { |
| 406 | 407 | $aUserIDs = array(); |
| 407 | 408 | $aEmailAddresses = array(); |
| 408 | 409 | if (!empty($groupNewRight)) { |
| 409 | - $aGroupIDs = explode(",", $groupNewRight); | |
| 410 | + $aGroupIDs = explode(',', $groupNewRight); | |
| 410 | 411 | } |
| 411 | 412 | if (!empty($userNewRight)) { |
| 412 | - $aUserIDs = explode(",", $userNewRight); | |
| 413 | + $aUserIDs = explode(',', $userNewRight); | |
| 413 | 414 | } |
| 414 | 415 | if (!empty($fEmailAddresses)) { |
| 415 | - $aEmailAddresses = explode(" ", $fEmailAddresses); | |
| 416 | + $aEmailAddresses = explode(' ', $fEmailAddresses); | |
| 416 | 417 | } |
| 417 | 418 | |
| 418 | 419 | $oConfig = KTConfig::getSingleton(); |
| ... | ... | @@ -443,17 +444,17 @@ class KTDocumentEmailAction extends KTDocumentAction { |
| 443 | 444 | sendManualEmails($aEmailAddresses, $this->oDocument, $fComment, (boolean)$fAttachDocument, $aEmailErrors); |
| 444 | 445 | |
| 445 | 446 | if (count($aEmailErrors)) { |
| 446 | - $_SESSION['KTErrorMessage'][] = join("<br />\n", $aEmailErrors); | |
| 447 | + $_SESSION['KTErrorMessage'][] = join('<br />\n', $aEmailErrors); | |
| 447 | 448 | } |
| 448 | 449 | |
| 449 | - $_SESSION['KTInfoMessage'][] = _kt("Email sent"); | |
| 450 | + $_SESSION['KTInfoMessage'][] = _kt('Email sent'); | |
| 450 | 451 | //go back to the document view page |
| 451 | - controllerRedirect("viewDocument", sprintf("fDocumentId=%d", $this->oDocument->getId())); | |
| 452 | + controllerRedirect('viewDocument', sprintf("fDocumentId=%d", $this->oDocument->getId())); | |
| 452 | 453 | } |
| 453 | 454 | } |
| 454 | 455 | |
| 455 | 456 | class KTEmailPlugin extends KTPlugin { |
| 456 | - var $sNamespace = "ktstandard.email.plugin"; | |
| 457 | + var $sNamespace = 'ktstandard.email.plugin'; | |
| 457 | 458 | |
| 458 | 459 | function KTEmailPlugin($sFilename = null) { |
| 459 | 460 | $res = parent::KTPlugin($sFilename); | ... | ... |
sql/mysql/upgrade/2.0.9/storagemanager.sql
| 1 | 1 | ALTER TABLE `documents` ADD `storage_path` VARCHAR( 250 ) ; |
| 2 | 2 | ALTER TABLE `documents` ADD INDEX ( `storage_path` ) ; |
| 3 | -UPDATE `documents` SET storage_path = CONCAT(full_path, "/", filename) WHERE storage_path IS NULL; | |
| 3 | +UPDATE `documents` d SET storage_path = (select CONCAT(CONCAT(CONCAT(CONCAT(f.full_path, "/"), f.name), "/"), filename) from folders f where f.id=d.folder_id) WHERE storage_path IS NULL; | |
| 4 | +UPDATE `documents` d SET storage_path=CONCAT(CONCAT(CONCAT("Deleted/", d.id), "-"), d.filename) where status_id=3; | ... | ... |