diff options
author | Robin Appelman <robin@icewind.nl> | 2021-02-16 21:38:18 +0300 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2021-02-16 21:38:18 +0300 |
commit | 07c3a252bca2d4ee63b08a7f54f05a6ea68cfaf0 (patch) | |
tree | 7686bb05878d668b84576955cfea0c33785118fe | |
parent | ea1abdde11d0b594d7a62d140c441e5f62f68654 (diff) |
format php
70 files changed, 307 insertions, 218 deletions
diff --git a/appinfo/app.php b/appinfo/app.php index 2d3f02a..c66cea0 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -1,4 +1,5 @@ <?php + use OCA\DocumentServer\AppInfo\Application; (\OC::$server->query(Application::class))->register(); diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 116717f..2a99a5c 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -21,8 +21,6 @@ namespace OCA\DocumentServer\AppInfo; -use OC\AppFramework\Middleware\MiddlewareDispatcher; -use OCA\DocumentServer\CSPMiddleware; use OCA\DocumentServer\IPC\DatabaseIPCFactory; use OCA\DocumentServer\IPC\IIPCFactory; use OCA\DocumentServer\IPC\IPCFactory; diff --git a/lib/BackgroundJob/Cleanup.php b/lib/BackgroundJob/Cleanup.php index 4d1bb41..be4bfb6 100644 --- a/lib/BackgroundJob/Cleanup.php +++ b/lib/BackgroundJob/Cleanup.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/Channel/Channel.php b/lib/Channel/Channel.php index 3d61ba0..3bd40cd 100644 --- a/lib/Channel/Channel.php +++ b/lib/Channel/Channel.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -23,16 +25,15 @@ namespace OCA\DocumentServer\Channel; use OCA\DocumentServer\XHRCommand\CommandDispatcher; use OCP\Files\NotFoundException; -use OCP\IMemcache; use OCA\DocumentServer\IPC\IIPCChannel; class Channel { - const TYPE_OPEN = 'o'; - const TYPE_HEARTBEAT = 'h'; - const TYPE_ARRAY = 'a'; - const TYPE_CLOSE = 'c'; + public const TYPE_OPEN = 'o'; + public const TYPE_HEARTBEAT = 'h'; + public const TYPE_ARRAY = 'a'; + public const TYPE_CLOSE = 'c'; - const TIMEOUT = 25; + public const TIMEOUT = 25; private $sessionId; private $documentId; diff --git a/lib/Channel/ChannelFactory.php b/lib/Channel/ChannelFactory.php index cbf666d..8c8bfc5 100644 --- a/lib/Channel/ChannelFactory.php +++ b/lib/Channel/ChannelFactory.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -22,7 +24,6 @@ namespace OCA\DocumentServer\Channel; use OCA\DocumentServer\XHRCommand\CommandDispatcher; -use OCP\ICacheFactory; use OCA\DocumentServer\IPC\IIPCFactory; class ChannelFactory { diff --git a/lib/Channel/IPCMulticast.php b/lib/Channel/IPCMulticast.php index 29afa68..30acad0 100644 --- a/lib/Channel/IPCMulticast.php +++ b/lib/Channel/IPCMulticast.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/Channel/Session.php b/lib/Channel/Session.php index 570f627..580fe04 100644 --- a/lib/Channel/Session.php +++ b/lib/Channel/Session.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/Channel/SessionManager.php b/lib/Channel/SessionManager.php index 7fa0365..f4277fa 100644 --- a/lib/Channel/SessionManager.php +++ b/lib/Channel/SessionManager.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/Command/FlushChanges.php b/lib/Command/FlushChanges.php index 15c12aa..a4bdc09 100644 --- a/lib/Command/FlushChanges.php +++ b/lib/Command/FlushChanges.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -74,6 +76,6 @@ class FlushChanges extends Base { $this->logger->logException($e, ['app' => 'documentserver_community', 'message' => 'Error while applying changes for document ' . $documentId]); } } - } + } } } diff --git a/lib/Command/Fonts.php b/lib/Command/Fonts.php index 37cc6e5..9bd9610 100644 --- a/lib/Command/Fonts.php +++ b/lib/Command/Fonts.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2020 Robin Appelman <robin@icewind.nl> * diff --git a/lib/Controller/CoAuthoringController.php b/lib/Controller/CoAuthoringController.php index 23e24c1..b3bd06f 100644 --- a/lib/Controller/CoAuthoringController.php +++ b/lib/Controller/CoAuthoringController.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/Controller/ConvertController.php b/lib/Controller/ConvertController.php index fec5257..9dd4043 100644 --- a/lib/Controller/ConvertController.php +++ b/lib/Controller/ConvertController.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -25,7 +27,6 @@ use OCA\DocumentServer\Document\DocumentStore; use OCA\DocumentServer\OnlyOffice\URLDecoder; use OCA\DocumentServer\XMLResponse; use OCP\AppFramework\Controller; -use OCP\AppFramework\Http\DataResponse; use OCP\IURLGenerator; class ConvertController extends Controller { diff --git a/lib/Controller/DocumentController.php b/lib/Controller/DocumentController.php index c0f578c..8ac7792 100644 --- a/lib/Controller/DocumentController.php +++ b/lib/Controller/DocumentController.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -43,7 +45,7 @@ use OCP\IURLGenerator; use OCP\Security\ISecureRandom; class DocumentController extends SessionController { - const COMMAND_HANDLERS = [ + public const COMMAND_HANDLERS = [ AuthCommand::class, IsSaveLock::class, SaveChangesCommand::class, @@ -53,7 +55,7 @@ class DocumentController extends SessionController { OpenDocument::class, ]; - const IDLE_HANDLERS = [ + public const IDLE_HANDLERS = [ SessionDisconnect::class, LockExpire::class, ]; diff --git a/lib/Controller/SessionController.php b/lib/Controller/SessionController.php index c856975..3efc8fb 100644 --- a/lib/Controller/SessionController.php +++ b/lib/Controller/SessionController.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/Controller/StaticController.php b/lib/Controller/StaticController.php index e7d8297..3c0f17e 100644 --- a/lib/Controller/StaticController.php +++ b/lib/Controller/StaticController.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -25,7 +27,6 @@ use OC\ForbiddenException; use OC\Security\CSP\ContentSecurityPolicy; use OC\Security\CSP\ContentSecurityPolicyNonceManager; use OCA\DocumentServer\Channel\SessionManager; -use OCA\DocumentServer\Document\ConverterBinary; use OCA\DocumentServer\FileResponse; use OCA\DocumentServer\SetupCheck; use OCP\AppFramework\Controller; @@ -92,7 +93,7 @@ class StaticController extends Controller { $rawContent = file_get_contents($localPath); $content = str_replace('__HINT__', addcslashes($hint, "'"), $rawContent); return $this->createFileResponseWithContent($localPath, $content, false); - } else if ($this->sessionManager->getSessionCount() >= 20) { + } elseif ($this->sessionManager->getSessionCount() >= 20) { $localPath = __DIR__ . '/../../js/sessionlimit.js'; } } @@ -101,7 +102,6 @@ class StaticController extends Controller { } private function createFileResponse($path) { - if (!file_exists($path)) { return new NotFoundResponse(); } @@ -156,4 +156,3 @@ class StaticController extends Controller { return "[]"; } } - diff --git a/lib/Document/Change.php b/lib/Document/Change.php index 66aa060..8e2e372 100644 --- a/lib/Document/Change.php +++ b/lib/Document/Change.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/Document/ChangeStore.php b/lib/Document/ChangeStore.php index 5c3ef56..c179ba8 100644 --- a/lib/Document/ChangeStore.php +++ b/lib/Document/ChangeStore.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/Document/ConvertCommand.php b/lib/Document/ConvertCommand.php index d746753..b19fa80 100644 --- a/lib/Document/ConvertCommand.php +++ b/lib/Document/ConvertCommand.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -89,7 +91,7 @@ class ConvertCommand implements XmlSerializable { $this->fileTo = $fileTo; } - function xmlSerialize(Writer $writer) { + public function xmlSerialize(Writer $writer) { $xsiNS = "{http://www.w3.org/2001/XMLSchema-instance}"; $keyMap = [ "m_sFileFrom" => "fileFrom", diff --git a/lib/Document/ConverterBinary.php b/lib/Document/ConverterBinary.php index 98bf763..afc1af7 100644 --- a/lib/Document/ConverterBinary.php +++ b/lib/Document/ConverterBinary.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -24,7 +26,7 @@ namespace OCA\DocumentServer\Document; use OCP\ILogger; class ConverterBinary { - const BINARY_DIRECTORY = __DIR__ . '/../../3rdparty/onlyoffice/documentserver/server/FileConverter/bin'; + public const BINARY_DIRECTORY = __DIR__ . '/../../3rdparty/onlyoffice/documentserver/server/FileConverter/bin'; private $logger; diff --git a/lib/Document/DocumentConversionException.php b/lib/Document/DocumentConversionException.php index 8a91b2a..a51c133 100644 --- a/lib/Document/DocumentConversionException.php +++ b/lib/Document/DocumentConversionException.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -22,5 +24,4 @@ namespace OCA\DocumentServer\Document; class DocumentConversionException extends \Exception { - } diff --git a/lib/Document/DocumentFormat.php b/lib/Document/DocumentFormat.php index a0ca62f..c40e062 100644 --- a/lib/Document/DocumentFormat.php +++ b/lib/Document/DocumentFormat.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2020 Robin Appelman <robin@icewind.nl> * @@ -21,89 +23,88 @@ namespace OCA\DocumentServer\Document; - class DocumentFormat { - const AVS_OFFICESTUDIO_FILE_UNKNOWN = 0x0000; - const AVS_OFFICESTUDIO_FILE_DOCUMENT = 0x0040; - const AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0001; - const AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0002; - const AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0003; - const AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0004; - const AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0005; - const AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0006; - const AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0007; - const AVS_OFFICESTUDIO_FILE_DOCUMENT_EPUB = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0008; - const AVS_OFFICESTUDIO_FILE_DOCUMENT_FB2 = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0009; - const AVS_OFFICESTUDIO_FILE_DOCUMENT_MOBI = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000a; - const AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000b; - const AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000c; - const AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000d; - const AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT_FLAT = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000e; - const AVS_OFFICESTUDIO_FILE_DOCUMENT_OTT = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000f; - const AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC_FLAT = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0010; - const AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML_IN_CONTAINER = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0011; - const AVS_OFFICESTUDIO_FILE_PRESENTATION = 0x0080; - const AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX = self::AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0001; - const AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT = self::AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0002; - const AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP = self::AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0003; - const AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX = self::AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0004; - const AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM = self::AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0005; - const AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM = self::AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0006; - const AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX = self::AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0007; - const AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM = self::AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0008; - const AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP_FLAT = self::AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0009; - const AVS_OFFICESTUDIO_FILE_PRESENTATION_OTP = self::AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x000a; - const AVS_OFFICESTUDIO_FILE_SPREADSHEET = 0x0100; - const AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX = self::AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0001; - const AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS = self::AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0002; - const AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS = self::AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0003; - const AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV = self::AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0004; - const AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM = self::AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0005; - const AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX = self::AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0006; - const AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM = self::AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0007; - const AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS_FLAT = self::AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0008; - const AVS_OFFICESTUDIO_FILE_SPREADSHEET_OTS = self::AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0009; - const AVS_OFFICESTUDIO_FILE_CROSSPLATFORM = 0x0200; - const AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF = self::AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0001; - const AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_SWF = self::AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0002; - const AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU = self::AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0003; - const AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS = self::AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0004; - const AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_SVG = self::AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0005; - const AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_HTMLR = self::AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0006; - const AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_HTMLR_MENU = self::AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0007; - const AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_HTMLR_CANVAS = self::AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0008; - const AVS_OFFICESTUDIO_FILE_IMAGE = 0x0400; - const AVS_OFFICESTUDIO_FILE_IMAGE_JPG = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x0001; - const AVS_OFFICESTUDIO_FILE_IMAGE_TIFF = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x0002; - const AVS_OFFICESTUDIO_FILE_IMAGE_TGA = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x0003; - const AVS_OFFICESTUDIO_FILE_IMAGE_GIF = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x0004; - const AVS_OFFICESTUDIO_FILE_IMAGE_PNG = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x0005; - const AVS_OFFICESTUDIO_FILE_IMAGE_EMF = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x0006; - const AVS_OFFICESTUDIO_FILE_IMAGE_WMF = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x0007; - const AVS_OFFICESTUDIO_FILE_IMAGE_BMP = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x0008; - const AVS_OFFICESTUDIO_FILE_IMAGE_CR2 = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x0009; - const AVS_OFFICESTUDIO_FILE_IMAGE_PCX = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x000a; - const AVS_OFFICESTUDIO_FILE_IMAGE_RAS = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x000b; - const AVS_OFFICESTUDIO_FILE_IMAGE_PSD = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x000c; - const AVS_OFFICESTUDIO_FILE_IMAGE_ICO = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x000d; - const AVS_OFFICESTUDIO_FILE_OTHER = 0x0800; - const AVS_OFFICESTUDIO_FILE_OTHER_EXTRACT_IMAGE = self::AVS_OFFICESTUDIO_FILE_OTHER + 0x0001; - const AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO = self::AVS_OFFICESTUDIO_FILE_OTHER + 0x0002; - const AVS_OFFICESTUDIO_FILE_OTHER_HTMLZIP = self::AVS_OFFICESTUDIO_FILE_OTHER + 0x0003; - const AVS_OFFICESTUDIO_FILE_OTHER_OLD_DOCUMENT = self::AVS_OFFICESTUDIO_FILE_OTHER + 0x0004; - const AVS_OFFICESTUDIO_FILE_OTHER_OLD_PRESENTATION = self::AVS_OFFICESTUDIO_FILE_OTHER + 0x0005; - const AVS_OFFICESTUDIO_FILE_OTHER_OLD_DRAWING = self::AVS_OFFICESTUDIO_FILE_OTHER + 0x0006; - const AVS_OFFICESTUDIO_FILE_OTHER_TEAMLAB_INNER = self::AVS_OFFICESTUDIO_FILE_OTHER + 0x0007; - const AVS_OFFICESTUDIO_FILE_OTHER_JSON = self::AVS_OFFICESTUDIO_FILE_OTHER + 0x0008; // Для mail-merge - const AVS_OFFICESTUDIO_FILE_OTHER_PDFA = self::AVS_OFFICESTUDIO_FILE_OTHER + 0x0101; - const AVS_OFFICESTUDIO_FILE_TEAMLAB = 0x1000; - const AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY = self::AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0001; - const AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY = self::AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0002; - const AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY = self::AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0003; - const AVS_OFFICESTUDIO_FILE_CANVAS = 0x2000; - const AVS_OFFICESTUDIO_FILE_CANVAS_WORD = self::AVS_OFFICESTUDIO_FILE_CANVAS + 0x0001; - const AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET = self::AVS_OFFICESTUDIO_FILE_CANVAS + 0x0002; - const AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION = self::AVS_OFFICESTUDIO_FILE_CANVAS + 0x0003; + public const AVS_OFFICESTUDIO_FILE_UNKNOWN = 0x0000; + public const AVS_OFFICESTUDIO_FILE_DOCUMENT = 0x0040; + public const AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0001; + public const AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0002; + public const AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0003; + public const AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0004; + public const AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0005; + public const AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0006; + public const AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0007; + public const AVS_OFFICESTUDIO_FILE_DOCUMENT_EPUB = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0008; + public const AVS_OFFICESTUDIO_FILE_DOCUMENT_FB2 = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0009; + public const AVS_OFFICESTUDIO_FILE_DOCUMENT_MOBI = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000a; + public const AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000b; + public const AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000c; + public const AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000d; + public const AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT_FLAT = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000e; + public const AVS_OFFICESTUDIO_FILE_DOCUMENT_OTT = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000f; + public const AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC_FLAT = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0010; + public const AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML_IN_CONTAINER = self::AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0011; + public const AVS_OFFICESTUDIO_FILE_PRESENTATION = 0x0080; + public const AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX = self::AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0001; + public const AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT = self::AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0002; + public const AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP = self::AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0003; + public const AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX = self::AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0004; + public const AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM = self::AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0005; + public const AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM = self::AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0006; + public const AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX = self::AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0007; + public const AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM = self::AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0008; + public const AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP_FLAT = self::AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0009; + public const AVS_OFFICESTUDIO_FILE_PRESENTATION_OTP = self::AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x000a; + public const AVS_OFFICESTUDIO_FILE_SPREADSHEET = 0x0100; + public const AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX = self::AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0001; + public const AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS = self::AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0002; + public const AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS = self::AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0003; + public const AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV = self::AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0004; + public const AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM = self::AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0005; + public const AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX = self::AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0006; + public const AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM = self::AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0007; + public const AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS_FLAT = self::AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0008; + public const AVS_OFFICESTUDIO_FILE_SPREADSHEET_OTS = self::AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0009; + public const AVS_OFFICESTUDIO_FILE_CROSSPLATFORM = 0x0200; + public const AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF = self::AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0001; + public const AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_SWF = self::AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0002; + public const AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU = self::AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0003; + public const AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS = self::AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0004; + public const AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_SVG = self::AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0005; + public const AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_HTMLR = self::AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0006; + public const AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_HTMLR_MENU = self::AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0007; + public const AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_HTMLR_CANVAS = self::AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0008; + public const AVS_OFFICESTUDIO_FILE_IMAGE = 0x0400; + public const AVS_OFFICESTUDIO_FILE_IMAGE_JPG = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x0001; + public const AVS_OFFICESTUDIO_FILE_IMAGE_TIFF = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x0002; + public const AVS_OFFICESTUDIO_FILE_IMAGE_TGA = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x0003; + public const AVS_OFFICESTUDIO_FILE_IMAGE_GIF = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x0004; + public const AVS_OFFICESTUDIO_FILE_IMAGE_PNG = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x0005; + public const AVS_OFFICESTUDIO_FILE_IMAGE_EMF = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x0006; + public const AVS_OFFICESTUDIO_FILE_IMAGE_WMF = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x0007; + public const AVS_OFFICESTUDIO_FILE_IMAGE_BMP = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x0008; + public const AVS_OFFICESTUDIO_FILE_IMAGE_CR2 = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x0009; + public const AVS_OFFICESTUDIO_FILE_IMAGE_PCX = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x000a; + public const AVS_OFFICESTUDIO_FILE_IMAGE_RAS = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x000b; + public const AVS_OFFICESTUDIO_FILE_IMAGE_PSD = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x000c; + public const AVS_OFFICESTUDIO_FILE_IMAGE_ICO = self::AVS_OFFICESTUDIO_FILE_IMAGE + 0x000d; + public const AVS_OFFICESTUDIO_FILE_OTHER = 0x0800; + public const AVS_OFFICESTUDIO_FILE_OTHER_EXTRACT_IMAGE = self::AVS_OFFICESTUDIO_FILE_OTHER + 0x0001; + public const AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO = self::AVS_OFFICESTUDIO_FILE_OTHER + 0x0002; + public const AVS_OFFICESTUDIO_FILE_OTHER_HTMLZIP = self::AVS_OFFICESTUDIO_FILE_OTHER + 0x0003; + public const AVS_OFFICESTUDIO_FILE_OTHER_OLD_DOCUMENT = self::AVS_OFFICESTUDIO_FILE_OTHER + 0x0004; + public const AVS_OFFICESTUDIO_FILE_OTHER_OLD_PRESENTATION = self::AVS_OFFICESTUDIO_FILE_OTHER + 0x0005; + public const AVS_OFFICESTUDIO_FILE_OTHER_OLD_DRAWING = self::AVS_OFFICESTUDIO_FILE_OTHER + 0x0006; + public const AVS_OFFICESTUDIO_FILE_OTHER_TEAMLAB_INNER = self::AVS_OFFICESTUDIO_FILE_OTHER + 0x0007; + public const AVS_OFFICESTUDIO_FILE_OTHER_JSON = self::AVS_OFFICESTUDIO_FILE_OTHER + 0x0008; // Для mail-merge + public const AVS_OFFICESTUDIO_FILE_OTHER_PDFA = self::AVS_OFFICESTUDIO_FILE_OTHER + 0x0101; + public const AVS_OFFICESTUDIO_FILE_TEAMLAB = 0x1000; + public const AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY = self::AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0001; + public const AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY = self::AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0002; + public const AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY = self::AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0003; + public const AVS_OFFICESTUDIO_FILE_CANVAS = 0x2000; + public const AVS_OFFICESTUDIO_FILE_CANVAS_WORD = self::AVS_OFFICESTUDIO_FILE_CANVAS + 0x0001; + public const AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET = self::AVS_OFFICESTUDIO_FILE_CANVAS + 0x0002; + public const AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION = self::AVS_OFFICESTUDIO_FILE_CANVAS + 0x0003; public static function getFormatFromExtension(string $extension): int { switch (strtolower($extension)) { diff --git a/lib/Document/DocumentStore.php b/lib/Document/DocumentStore.php index 2bf8457..b5905ef 100644 --- a/lib/Document/DocumentStore.php +++ b/lib/Document/DocumentStore.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -114,7 +116,6 @@ class DocumentStore { $files[] = 'media/' . $mediaFile->getName(); } } catch (NotFoundException $e) { - } return $files; @@ -229,7 +230,6 @@ class DocumentStore { try { $docFolder->getFile($title)->delete(); } catch (\Exception $e) { - } $this->localAppData->getReadWriteLocalPath($docFolder, function (string $localPath) use ($title, $cmd, $sourceFile) { diff --git a/lib/Document/FontManager.php b/lib/Document/FontManager.php index 4e92bfc..49a66e0 100644 --- a/lib/Document/FontManager.php +++ b/lib/Document/FontManager.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2020 Robin Appelman <robin@icewind.nl> * diff --git a/lib/Document/Lock.php b/lib/Document/Lock.php index 6a73f7c..8a1ffe9 100644 --- a/lib/Document/Lock.php +++ b/lib/Document/Lock.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -21,7 +23,6 @@ namespace OCA\DocumentServer\Document; - class Lock implements \JsonSerializable { private $lockId; private $documentId; diff --git a/lib/Document/LockStore.php b/lib/Document/LockStore.php index 0bec96b..5f0dcc5 100644 --- a/lib/Document/LockStore.php +++ b/lib/Document/LockStore.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -21,13 +23,12 @@ namespace OCA\DocumentServer\Document; - use OCP\AppFramework\Utility\ITimeFactory; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; class LockStore { - const TIMEOUT = 60; + public const TIMEOUT = 60; private $connection; private $timeFactory; diff --git a/lib/Document/PasswordRequiredException.php b/lib/Document/PasswordRequiredException.php index 1cecda8..f8eaca2 100644 --- a/lib/Document/PasswordRequiredException.php +++ b/lib/Document/PasswordRequiredException.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2020 Robin Appelman <robin@icewind.nl> * diff --git a/lib/Document/SaveHandler.php b/lib/Document/SaveHandler.php index bff807e..bc520f0 100644 --- a/lib/Document/SaveHandler.php +++ b/lib/Document/SaveHandler.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/DocumentConverter.php b/lib/DocumentConverter.php index a0bcc2b..babed28 100644 --- a/lib/DocumentConverter.php +++ b/lib/DocumentConverter.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -94,7 +96,7 @@ class DocumentConverter { /** @var SplFileInfo $fileInfo */ if ($fileInfo->isLink()) { unlink($fileInfo->getPathname()); - } else if ($fileInfo->isDir()) { + } elseif ($fileInfo->isDir()) { rmdir($fileInfo->getRealPath()); } else { unlink($fileInfo->getRealPath()); diff --git a/lib/FileResponse.php b/lib/FileResponse.php index c3cdd03..4d4a4a0 100644 --- a/lib/FileResponse.php +++ b/lib/FileResponse.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -59,7 +61,6 @@ class FileResponse extends Response implements ICallbackResponse { } public function setDownload() { - $encodedName = rawurlencode(basename($this->name)); $this->addHeader( 'Content-Disposition', diff --git a/lib/IPC/DatabaseIPCBackend.php b/lib/IPC/DatabaseIPCBackend.php index 6c7a179..e64f5b7 100644 --- a/lib/IPC/DatabaseIPCBackend.php +++ b/lib/IPC/DatabaseIPCBackend.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -26,7 +28,7 @@ use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; class DatabaseIPCBackend implements IIPCBackend { - const TIMEOUT = 120; + public const TIMEOUT = 120; private $connection; private $timeFactory; @@ -89,4 +91,3 @@ class DatabaseIPCBackend implements IIPCBackend { $query->execute(); } } - diff --git a/lib/IPC/DatabaseIPCFactory.php b/lib/IPC/DatabaseIPCFactory.php index a39de6b..43d80ac 100644 --- a/lib/IPC/DatabaseIPCFactory.php +++ b/lib/IPC/DatabaseIPCFactory.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/IPC/IIPCBackend.php b/lib/IPC/IIPCBackend.php index 4ab26c2..3b76afd 100644 --- a/lib/IPC/IIPCBackend.php +++ b/lib/IPC/IIPCBackend.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/IPC/IIPCBackendFactory.php b/lib/IPC/IIPCBackendFactory.php index fc3b6f6..e60221f 100644 --- a/lib/IPC/IIPCBackendFactory.php +++ b/lib/IPC/IIPCBackendFactory.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/IPC/IIPCChannel.php b/lib/IPC/IIPCChannel.php index c11bb34..e5fbaf5 100644 --- a/lib/IPC/IIPCChannel.php +++ b/lib/IPC/IIPCChannel.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/IPC/IIPCFactory.php b/lib/IPC/IIPCFactory.php index 9907394..f1e6fbe 100644 --- a/lib/IPC/IIPCFactory.php +++ b/lib/IPC/IIPCFactory.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/IPC/IPCChannel.php b/lib/IPC/IPCChannel.php index ea41787..7331461 100644 --- a/lib/IPC/IPCChannel.php +++ b/lib/IPC/IPCChannel.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/IPC/IPCFactory.php b/lib/IPC/IPCFactory.php index e65027f..943d3f9 100644 --- a/lib/IPC/IPCFactory.php +++ b/lib/IPC/IPCFactory.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -35,10 +37,10 @@ class IPCFactory implements IIPCFactory { */ private function getBackend() { /** @var IIPCBackendFactory[] $backends */ - $backends = array_filter($this->backendFactories, function(IIPCBackendFactory $backendFactory) { + $backends = array_filter($this->backendFactories, function (IIPCBackendFactory $backendFactory) { return $backendFactory->isAvailable(); }); - usort($backends, function(IIPCBackendFactory $a, IIPCBackendFactory $b) { + usort($backends, function (IIPCBackendFactory $a, IIPCBackendFactory $b) { return $a->getPriority() - $b->getPriority(); }); diff --git a/lib/IPC/MemcacheIPCBackend.php b/lib/IPC/MemcacheIPCBackend.php index eed3da8..f779e7e 100644 --- a/lib/IPC/MemcacheIPCBackend.php +++ b/lib/IPC/MemcacheIPCBackend.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/IPC/MemcacheIPCFactory.php b/lib/IPC/MemcacheIPCFactory.php index 5facc8c..2ff6eec 100644 --- a/lib/IPC/MemcacheIPCFactory.php +++ b/lib/IPC/MemcacheIPCFactory.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/IPC/RedisIPCBackend.php b/lib/IPC/RedisIPCBackend.php index 7d06b72..58e6b8c 100644 --- a/lib/IPC/RedisIPCBackend.php +++ b/lib/IPC/RedisIPCBackend.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/IPC/RedisIPCFactory.php b/lib/IPC/RedisIPCFactory.php index cd5df18..4ffb0a4 100644 --- a/lib/IPC/RedisIPCFactory.php +++ b/lib/IPC/RedisIPCFactory.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/JSSettingsHelper.php b/lib/JSSettingsHelper.php index 26c3ca5..51fcc7e 100644 --- a/lib/JSSettingsHelper.php +++ b/lib/JSSettingsHelper.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/LocalAppData.php b/lib/LocalAppData.php index b27ae56..be191e9 100644 --- a/lib/LocalAppData.php +++ b/lib/LocalAppData.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2020 Robin Appelman <robin@icewind.nl> * @@ -112,7 +114,7 @@ class LocalAppData { if ($node instanceof Folder) { @mkdir($localNodePath); $this->copyToLocal($node, $localNodePath); - } else if ($node instanceof File) { + } elseif ($node instanceof File) { file_put_contents($localNodePath, $node->fopen('r')); } } diff --git a/lib/Migration/RebuildFonts.php b/lib/Migration/RebuildFonts.php index d65169e..46a0b27 100644 --- a/lib/Migration/RebuildFonts.php +++ b/lib/Migration/RebuildFonts.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2020 Robin Appelman <robin@icewind.nl> * diff --git a/lib/Migration/Version001000Date20190806104527.php b/lib/Migration/Version001000Date20190806104527.php index 54e2328..c9ca5e5 100644 --- a/lib/Migration/Version001000Date20190806104527.php +++ b/lib/Migration/Version001000Date20190806104527.php @@ -6,7 +6,6 @@ namespace OCA\DocumentServer\Migration; use Closure; use Doctrine\DBAL\Schema\Schema; -use OCP\DB\ISchemaWrapper; use OCP\Migration\SimpleMigrationStep; use OCP\Migration\IOutput; diff --git a/lib/Migration/Version001000Date20191217135318.php b/lib/Migration/Version001000Date20191217135318.php index 1507137..f7b38e5 100644 --- a/lib/Migration/Version001000Date20191217135318.php +++ b/lib/Migration/Version001000Date20191217135318.php @@ -10,7 +10,6 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version001000Date20191217135318 extends SimpleMigrationStep { - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var Schema $schema */ $schema = $schemaClosure(); diff --git a/lib/Migration/Version001000Date20200107143228.php b/lib/Migration/Version001000Date20200107143228.php index 3c0d04e..0d57693 100644 --- a/lib/Migration/Version001000Date20200107143228.php +++ b/lib/Migration/Version001000Date20200107143228.php @@ -6,7 +6,6 @@ namespace OCA\DocumentServer\Migration; use Closure; use Doctrine\DBAL\Schema\Schema; -use OCP\DB\ISchemaWrapper; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; diff --git a/lib/Migration/Version001400Date20200129140530.php b/lib/Migration/Version001400Date20200129140530.php index 3372176..4bd61b3 100644 --- a/lib/Migration/Version001400Date20200129140530.php +++ b/lib/Migration/Version001400Date20200129140530.php @@ -6,12 +6,10 @@ namespace OCA\DocumentServer\Migration; use Closure; use Doctrine\DBAL\Schema\Schema; -use OCP\DB\ISchemaWrapper; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version001400Date20200129140530 extends SimpleMigrationStep { - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var Schema $schema */ $schema = $schemaClosure(); diff --git a/lib/OnlyOffice/URLDecoder.php b/lib/OnlyOffice/URLDecoder.php index fb2e677..72ce1d0 100644 --- a/lib/OnlyOffice/URLDecoder.php +++ b/lib/OnlyOffice/URLDecoder.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -21,8 +23,6 @@ namespace OCA\DocumentServer\OnlyOffice; - -use Behat\Testwork\Suite\Exception\ParameterNotFoundException; use OCP\Files\IRootFolder; use OCP\Files\File; use OCA\Onlyoffice\Crypt; @@ -69,7 +69,7 @@ class URLDecoder { $fileId = $hashData->fileId; - if(isset($hashData->shareToken)) { + if (isset($hashData->shareToken)) { $share = $this->shareManager->getShareByToken($hashData->shareToken); $node = $share->getNode(); @@ -87,9 +87,9 @@ class URLDecoder { } else { if ($this->userSession->isLoggedIn()) { $userId = $this->userSession->getUser()->getUID(); - } else if (isset($hashData->ownerId)) { + } elseif (isset($hashData->ownerId)) { $userId = $hashData->ownerId; - } else if (isset($hashData->userId)) { + } elseif (isset($hashData->userId)) { $userId = $hashData->userId; } else { throw new \Exception("Can't get owner id from document url"); diff --git a/lib/OnlyOffice/WebVersion.php b/lib/OnlyOffice/WebVersion.php index 0c36caf..5bfa1a4 100644 --- a/lib/OnlyOffice/WebVersion.php +++ b/lib/OnlyOffice/WebVersion.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/SetupCheck.php b/lib/SetupCheck.php index c3f00e4..1727d0f 100644 --- a/lib/SetupCheck.php +++ b/lib/SetupCheck.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2020 Robin Appelman <robin@icewind.nl> * @@ -38,13 +40,13 @@ class SetupCheck { $x2t = ConverterBinary::BINARY_DIRECTORY . '/x2t'; if (!is_callable('proc_open')) { return "'proc_open' needs to be enabled"; - } else if (!is_callable('proc_close')) { + } elseif (!is_callable('proc_close')) { return "'proc_close' needs to be enabled"; - } else if (!file_exists($x2t)) { + } elseif (!file_exists($x2t)) { return "x2t binary missing, please try removing and re-installing the app"; - } else if (PHP_INT_SIZE === 4) { + } elseif (PHP_INT_SIZE === 4) { return "32 bit setups are not supported"; - } else if (PHP_OS_FAMILY !== "Linux") { + } elseif (PHP_OS_FAMILY !== "Linux") { return "only linux based servers are supported"; } @@ -55,9 +57,9 @@ class SetupCheck { $ldError = $this->lddError(); if (strpos($ldError, 'ld-linux') !== false) { return "using a musl libc based distribution is not supported"; - } else if (strpos($ldError, 'version `GLIBC_') !== false) { + } elseif (strpos($ldError, 'version `GLIBC_') !== false) { return "glibc version 2.17 or higher is required"; - } else if ($ldError) { + } elseif ($ldError) { return "one or more dependencies are missing or outdated"; } diff --git a/lib/XHRCommand/AuthCommand.php b/lib/XHRCommand/AuthCommand.php index ed9912e..4baaf60 100644 --- a/lib/XHRCommand/AuthCommand.php +++ b/lib/XHRCommand/AuthCommand.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -25,17 +27,12 @@ use OCA\DocumentServer\Channel\Session; use OCA\DocumentServer\Channel\SessionManager; use OCA\DocumentServer\Document\Change; use OCA\DocumentServer\Document\ChangeStore; -use OCA\DocumentServer\Document\DocumentStore; use OCA\DocumentServer\Document\LockStore; -use OCA\DocumentServer\Document\PasswordRequiredException; -use OCA\DocumentServer\OnlyOffice\URLDecoder; use OCA\DocumentServer\IPC\IIPCChannel; use OCA\DocumentServer\OnlyOffice\WebVersion; -use OCP\IURLGenerator; -use function Sabre\HTTP\encodePathSegment; class AuthCommand implements ICommandHandler { - const MAX_CONNECTIONS = 20; + public const MAX_CONNECTIONS = 20; private $changeStore; private $sessionManager; diff --git a/lib/XHRCommand/CommandDispatcher.php b/lib/XHRCommand/CommandDispatcher.php index 93cad35..7b4f311 100644 --- a/lib/XHRCommand/CommandDispatcher.php +++ b/lib/XHRCommand/CommandDispatcher.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/XHRCommand/CursorCommand.php b/lib/XHRCommand/CursorCommand.php index a856568..05ef99f 100644 --- a/lib/XHRCommand/CursorCommand.php +++ b/lib/XHRCommand/CursorCommand.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/XHRCommand/GetLock.php b/lib/XHRCommand/GetLock.php index cb8e521..5129ced 100644 --- a/lib/XHRCommand/GetLock.php +++ b/lib/XHRCommand/GetLock.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/XHRCommand/ICommandHandler.php b/lib/XHRCommand/ICommandHandler.php index 8a62fef..6d3cb09 100644 --- a/lib/XHRCommand/ICommandHandler.php +++ b/lib/XHRCommand/ICommandHandler.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/XHRCommand/IIdleHandler.php b/lib/XHRCommand/IIdleHandler.php index 0715435..d6bdaa1 100644 --- a/lib/XHRCommand/IIdleHandler.php +++ b/lib/XHRCommand/IIdleHandler.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/XHRCommand/IsSaveLock.php b/lib/XHRCommand/IsSaveLock.php index 7993297..9a10d4e 100644 --- a/lib/XHRCommand/IsSaveLock.php +++ b/lib/XHRCommand/IsSaveLock.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/XHRCommand/LockExpire.php b/lib/XHRCommand/LockExpire.php index 9e94f57..6dc46ae 100644 --- a/lib/XHRCommand/LockExpire.php +++ b/lib/XHRCommand/LockExpire.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -39,7 +41,7 @@ class LockExpire implements IIdleHandler { if ($released) { $locksMessage = json_encode([ "type" => "releaseLock", - "locks" => array_map(function(Lock $lock) { + "locks" => array_map(function (Lock $lock) { $data = $lock->jsonSerialize(); $data['changes'] = null; return $data; diff --git a/lib/XHRCommand/OpenDocument.php b/lib/XHRCommand/OpenDocument.php index d74fdd6..2e27982 100644 --- a/lib/XHRCommand/OpenDocument.php +++ b/lib/XHRCommand/OpenDocument.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2020 Robin Appelman <robin@icewind.nl> * @@ -21,15 +23,11 @@ namespace OCA\DocumentServer\XHRCommand; - -use Icewind\Streams\Path; -use Icewind\Streams\PathWrapper; use OCA\DocumentServer\Channel\Session; use OCA\DocumentServer\Document\DocumentStore; use OCA\DocumentServer\Document\PasswordRequiredException; use OCA\DocumentServer\IPC\IIPCChannel; use OCA\DocumentServer\OnlyOffice\URLDecoder; -use OCP\Image; use OCP\ISession; use OCP\IURLGenerator; @@ -80,12 +78,11 @@ class OpenDocument implements ICommandHandler { ]); $sessionChannel->pushMessage($message); - } else if ($type === 'reopen' || $type === 'open') { + } elseif ($type === 'reopen' || $type === 'open') { $this->openDocument($command['message'], $sessionChannel); - } else if ($type === 'imgurls') { + } elseif ($type === 'imgurls') { $this->imageUrls($command['message'], $session, $sessionChannel, $documentChannel); } - } public function openDocument(array $openCmd, IIPCChannel $sessionChannel) { diff --git a/lib/XHRCommand/SaveChangesCommand.php b/lib/XHRCommand/SaveChangesCommand.php index caa1173..a2e9a5b 100644 --- a/lib/XHRCommand/SaveChangesCommand.php +++ b/lib/XHRCommand/SaveChangesCommand.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -55,7 +57,8 @@ class SaveChangesCommand implements ICommandHandler { $this->changeStore->addChangesForDocument($session->getDocumentId(), $changes, $session->getUserId(), $session->getUserOriginal()); - $changeIndex = $this->changeStore->getMaxChangeIndexForDocument($session->getDocumentId());; + $changeIndex = $this->changeStore->getMaxChangeIndexForDocument($session->getDocumentId()); + ; $documentChannel->pushMessage(json_encode([ 'type' => 'saveChanges', diff --git a/lib/XHRCommand/SessionDisconnect.php b/lib/XHRCommand/SessionDisconnect.php index d111e0d..b05f771 100644 --- a/lib/XHRCommand/SessionDisconnect.php +++ b/lib/XHRCommand/SessionDisconnect.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -21,7 +23,6 @@ namespace OCA\DocumentServer\XHRCommand; - use OCA\DocumentServer\Channel\Session; use OCA\DocumentServer\Channel\SessionManager; use OCA\DocumentServer\IPC\IIPCChannel; diff --git a/lib/XHRCommand/UnlockDocument.php b/lib/XHRCommand/UnlockDocument.php index 97b7260..24da804 100644 --- a/lib/XHRCommand/UnlockDocument.php +++ b/lib/XHRCommand/UnlockDocument.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/lib/XHRResponse.php b/lib/XHRResponse.php index 4f01d18..6983c4a 100644 --- a/lib/XHRResponse.php +++ b/lib/XHRResponse.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -27,7 +29,6 @@ use OCP\AppFramework\Http\IOutput; use OCP\AppFramework\Http\Response; class XHRResponse extends Response implements ICallbackResponse { - private $type; private $data; @@ -47,8 +48,6 @@ class XHRResponse extends Response implements ICallbackResponse { public function callback(IOutput $output) { if ($output->getHttpResponseCode() !== Http::STATUS_NOT_MODIFIED) { - - if ($this->data) { $encodedData = json_encode($this->data); $escapedData = \GuzzleHttp\json_encode($encodedData); diff --git a/lib/XMLResponse.php b/lib/XMLResponse.php index 0c8d052..b2a31e5 100644 --- a/lib/XMLResponse.php +++ b/lib/XMLResponse.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -57,6 +59,4 @@ class XMLResponse extends Response { public function getData() { return $this->data; } - } - diff --git a/tests/Channel/SessionManagerTest.php b/tests/Channel/SessionManagerTest.php index ba08c9e..876dfd7 100644 --- a/tests/Channel/SessionManagerTest.php +++ b/tests/Channel/SessionManagerTest.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -46,7 +48,7 @@ class SessionManagerTest extends TestCase { $this->connection = \OC::$server->getDatabaseConnection(); $this->timeFactory = $this->createMock(ITimeFactory::class); $this->timeFactory->method('getTime') - ->willReturnCallback(function() { + ->willReturnCallback(function () { return $this->time; }); diff --git a/tests/IPC/BackendTest.php b/tests/IPC/BackendTest.php index 4e7fa93..31465bb 100644 --- a/tests/IPC/BackendTest.php +++ b/tests/IPC/BackendTest.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * diff --git a/tests/IPC/DatabaseIPCBackendTest.php b/tests/IPC/DatabaseIPCBackendTest.php index 1f7a15a..60cafc1 100644 --- a/tests/IPC/DatabaseIPCBackendTest.php +++ b/tests/IPC/DatabaseIPCBackendTest.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -21,7 +23,6 @@ namespace OCA\DocumentServer\Tests\IPC; - use OCA\DocumentServer\IPC\IIPCBackend; use OCA\DocumentServer\IPC\DatabaseIPCBackend; use OCP\AppFramework\Utility\ITimeFactory; diff --git a/tests/IPC/MemcacheIPCBackendTest.php b/tests/IPC/MemcacheIPCBackendTest.php index 45f1b58..786795a 100644 --- a/tests/IPC/MemcacheIPCBackendTest.php +++ b/tests/IPC/MemcacheIPCBackendTest.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * @@ -24,7 +26,6 @@ namespace OCA\DocumentServer\Tests\IPC; use OCA\DocumentServer\IPC\IIPCBackend; use OCA\DocumentServer\IPC\MemcacheIPCBackend; use OC\Memcache\ArrayCache; -use Test\TestCase; class MemcacheIPCBackendTest extends BackendTest { /** @var ArrayCache */ diff --git a/tests/IPC/RedisIPCBackendTest.php b/tests/IPC/RedisIPCBackendTest.php index 0051bbd..26d365d 100644 --- a/tests/IPC/RedisIPCBackendTest.php +++ b/tests/IPC/RedisIPCBackendTest.php @@ -1,4 +1,6 @@ -<?php declare(strict_types=1); +<?php + +declare(strict_types=1); /** * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> * |