diff --git a/appinfo/application.php b/appinfo/application.php index 4fbb8b60..c59d1752 100644 --- a/appinfo/application.php +++ b/appinfo/application.php @@ -115,7 +115,7 @@ public function register(IRegistrationContext $context): void { } // Set the leeway for the JWT library in case the system clock is a second off - \Firebase\JWT\JWT::$leeway = $this->appConfig->GetJwtLeeway(); + \Firebase\JWT\JWT::$leeway = $this->appConfig->getJwtLeeway(); $context->registerService("L10N", function (ContainerInterface $c) { return $c->get("ServerContainer")->getL10N($c->get("AppName")); @@ -289,7 +289,7 @@ function (FileCreatedFromTemplateEvent $event) { $template = $event->getTemplate(); if ($template === null) { $targetFile = $event->getTarget(); - $templateEmpty = TemplateManager::GetEmptyTemplate($targetFile->getName()); + $templateEmpty = TemplateManager::getEmptyTemplate($targetFile->getName()); if ($templateEmpty) { $targetFile->putContent($templateEmpty); } @@ -305,8 +305,8 @@ function (FileCreatedFromTemplateEvent $event) { if (class_exists("OCP\Files\Template\TemplateFileCreator")) { $context->injectFn(function (ITemplateManager $templateManager, IL10N $trans, $appName) { - if (!empty($this->appConfig->GetDocumentServerUrl()) - && $this->appConfig->SettingsAreSuccessful() + if (!empty($this->appConfig->getDocumentServerUrl()) + && $this->appConfig->settingsAreSuccessful() && $this->appConfig->isUserAllowedToUse()) { $templateManager->registerTemplateFileCreator(function () use ($appName, $trans) { $wordTemplate = new TemplateFileCreator($appName, $trans->t("New document"), ".docx"); diff --git a/controller/callbackcontroller.php b/controller/callbackcontroller.php index e4b91d89..8c48d69b 100644 --- a/controller/callbackcontroller.php +++ b/controller/callbackcontroller.php @@ -204,7 +204,7 @@ public function __construct( */ public function download($doc) { - list($hashData, $error) = $this->crypt->ReadHash($doc); + list($hashData, $error) = $this->crypt->readHash($doc); if ($hashData === null) { $this->logger->error("Download with empty or not correct hash: $error", ["app" => $this->appName]); return new JSONResponse(["message" => $this->trans->t("Access denied")], Http::STATUS_FORBIDDEN); @@ -220,8 +220,8 @@ public function download($doc) { $template = isset($hashData->template) ? $hashData->template : false; $this->logger->debug("Download: $fileId ($version)" . ($changes ? " changes" : ""), ["app" => $this->appName]); - if (!empty($this->config->GetDocumentServerSecret())) { - $header = \OC::$server->getRequest()->getHeader($this->config->JwtHeader()); + if (!empty($this->config->getDocumentServerSecret())) { + $header = \OC::$server->getRequest()->getHeader($this->config->jwtHeader()); if (empty($header)) { $this->logger->error("Download without jwt", ["app" => $this->appName]); return new JSONResponse(["message" => $this->trans->t("Access denied")], Http::STATUS_FORBIDDEN); @@ -230,7 +230,7 @@ public function download($doc) { $header = substr($header, strlen("Bearer ")); try { - $decodedHeader = \Firebase\JWT\JWT::decode($header, new \Firebase\JWT\Key($this->config->GetDocumentServerSecret(), "HS256")); + $decodedHeader = \Firebase\JWT\JWT::decode($header, new \Firebase\JWT\Key($this->config->getDocumentServerSecret(), "HS256")); } catch (\UnexpectedValueException $e) { $this->logger->logException($e, ["message" => "Download with invalid jwt", "app" => $this->appName]); return new JSONResponse(["message" => $this->trans->t("Access denied")], Http::STATUS_FORBIDDEN); @@ -329,7 +329,7 @@ public function download($doc) { public function emptyfile($doc) { $this->logger->debug("Download empty", ["app" => $this->appName]); - list($hashData, $error) = $this->crypt->ReadHash($doc); + list($hashData, $error) = $this->crypt->readHash($doc); if ($hashData === null) { $this->logger->error("Download empty with empty or not correct hash: $error", ["app" => $this->appName]); return new JSONResponse(["message" => $this->trans->t("Access denied")], Http::STATUS_FORBIDDEN); @@ -339,8 +339,8 @@ public function emptyfile($doc) { return new JSONResponse(["message" => $this->trans->t("Invalid request")], Http::STATUS_BAD_REQUEST); } - if (!empty($this->config->GetDocumentServerSecret())) { - $header = \OC::$server->getRequest()->getHeader($this->config->JwtHeader()); + if (!empty($this->config->getDocumentServerSecret())) { + $header = \OC::$server->getRequest()->getHeader($this->config->jwtHeader()); if (empty($header)) { $this->logger->error("Download empty without jwt", ["app" => $this->appName]); return new JSONResponse(["message" => $this->trans->t("Access denied")], Http::STATUS_FORBIDDEN); @@ -349,14 +349,14 @@ public function emptyfile($doc) { $header = substr($header, strlen("Bearer ")); try { - $decodedHeader = \Firebase\JWT\JWT::decode($header, new \Firebase\JWT\Key($this->config->GetDocumentServerSecret(), "HS256")); + $decodedHeader = \Firebase\JWT\JWT::decode($header, new \Firebase\JWT\Key($this->config->getDocumentServerSecret(), "HS256")); } catch (\UnexpectedValueException $e) { $this->logger->logException($e, ["message" => "Download empty with invalid jwt", "app" => $this->appName]); return new JSONResponse(["message" => $this->trans->t("Access denied")], Http::STATUS_FORBIDDEN); } } - $templatePath = TemplateManager::GetEmptyTemplatePath("en", ".docx"); + $templatePath = TemplateManager::getEmptyTemplatePath("en", ".docx"); $template = file_get_contents($templatePath); if (!$template) { @@ -397,7 +397,7 @@ public function emptyfile($doc) { */ public function track($doc, $users, $key, $status, $url, $token, $history, $changesurl, $forcesavetype, $actions, $filetype) { - list($hashData, $error) = $this->crypt->ReadHash($doc); + list($hashData, $error) = $this->crypt->readHash($doc); if ($hashData === null) { $this->logger->error("Track with empty or not correct hash: $error", ["app" => $this->appName]); return new JSONResponse(["message" => $this->trans->t("Access denied")], Http::STATUS_FORBIDDEN); @@ -410,16 +410,16 @@ public function track($doc, $users, $key, $status, $url, $token, $history, $chan $fileId = $hashData->fileId; $this->logger->debug("Track: $fileId status $status", ["app" => $this->appName]); - if (!empty($this->config->GetDocumentServerSecret())) { + if (!empty($this->config->getDocumentServerSecret())) { if (!empty($token)) { try { - $payload = \Firebase\JWT\JWT::decode($token, new \Firebase\JWT\Key($this->config->GetDocumentServerSecret(), "HS256")); + $payload = \Firebase\JWT\JWT::decode($token, new \Firebase\JWT\Key($this->config->getDocumentServerSecret(), "HS256")); } catch (\UnexpectedValueException $e) { $this->logger->logException($e, ["message" => "Track with invalid jwt in body", "app" => $this->appName]); return new JSONResponse(["message" => $this->trans->t("Access denied")], Http::STATUS_FORBIDDEN); } } else { - $header = \OC::$server->getRequest()->getHeader($this->config->JwtHeader()); + $header = \OC::$server->getRequest()->getHeader($this->config->jwtHeader()); if (empty($header)) { $this->logger->error("Track without jwt", ["app" => $this->appName]); return new JSONResponse(["message" => $this->trans->t("Access denied")], Http::STATUS_FORBIDDEN); @@ -428,7 +428,7 @@ public function track($doc, $users, $key, $status, $url, $token, $history, $chan $header = substr($header, strlen("Bearer ")); try { - $decodedHeader = \Firebase\JWT\JWT::decode($header, new \Firebase\JWT\Key($this->config->GetDocumentServerSecret(), "HS256")); + $decodedHeader = \Firebase\JWT\JWT::decode($header, new \Firebase\JWT\Key($this->config->getDocumentServerSecret(), "HS256")); $payload = $decodedHeader->payload; } catch (\UnexpectedValueException $e) { @@ -521,7 +521,7 @@ public function track($doc, $users, $key, $status, $url, $token, $history, $chan } try { - $url = $this->config->ReplaceDocumentServerUrlToInternal($url); + $url = $this->config->replaceDocumentServerUrlToInternal($url); $prevVersion = $file->getFileInfo()->getMtime(); $fileName = $file->getName(); @@ -530,18 +530,18 @@ public function track($doc, $users, $key, $status, $url, $token, $history, $chan $documentService = new DocumentService($this->trans, $this->config); if ($downloadExt !== $curExt) { - $key = DocumentService::GenerateRevisionId($fileId . $url); + $key = DocumentService::generateRevisionId($fileId . $url); try { $this->logger->debug("Converted from $downloadExt to $curExt", ["app" => $this->appName]); - $url = $documentService->GetConvertedUri($url, $downloadExt, $curExt, $key); + $url = $documentService->getConvertedUri($url, $downloadExt, $curExt, $key); } catch (\Exception $e) { $this->logger->logException($e, ["message" => "Converted on save error", "app" => $this->appName]); return new JSONResponse(["message" => $e->getMessage()], Http::STATUS_INTERNAL_SERVER_ERROR); } } - $newData = $documentService->Request($url); + $newData = $documentService->request($url); $prevIsForcesave = KeyManager::wasForcesave($fileId); @@ -585,16 +585,16 @@ public function track($doc, $users, $key, $status, $url, $token, $history, $chan if (!$isForcesave && !$prevIsForcesave && $this->versionManager !== null - && $this->config->GetVersionHistory()) { + && $this->config->getVersionHistory()) { $changes = null; if (!empty($changesurl)) { - $changesurl = $this->config->ReplaceDocumentServerUrlToInternal($changesurl); - $changes = $documentService->Request($changesurl); + $changesurl = $this->config->replaceDocumentServerUrlToInternal($changesurl); + $changes = $documentService->request($changesurl); } FileVersions::saveHistory($file->getFileInfo(), $history, $changes, $prevVersion); } - if (!empty($user) && $this->config->GetVersionHistory()) { + if (!empty($user) && $this->config->getVersionHistory()) { FileVersions::saveAuthor($file->getFileInfo(), $user); } @@ -639,7 +639,7 @@ private function getFile($userId, $fileId, $filePath = null, $version = 0, $temp } try { - $folder = !$template ? $this->root->getUserFolder($userId) : TemplateManager::GetGlobalTemplateDir(); + $folder = !$template ? $this->root->getUserFolder($userId) : TemplateManager::getGlobalTemplateDir(); $files = $folder->getById($fileId); } catch (\Exception $e) { $this->logger->logException($e, ["message" => "getFile: $fileId", "app" => $this->appName]); @@ -780,7 +780,7 @@ private function getShare($shareToken) { * @return string */ private function parseUserId($userId) { - $instanceId = $this->config->GetSystemValue("instanceid", true); + $instanceId = $this->config->getSystemValue("instanceid", true); $instanceId = $instanceId . "_"; if (substr($userId, 0, strlen($instanceId)) === $instanceId) { diff --git a/controller/editorapicontroller.php b/controller/editorapicontroller.php index 60195173..6d341779 100644 --- a/controller/editorapicontroller.php +++ b/controller/editorapicontroller.php @@ -207,7 +207,7 @@ public function __construct( } } - if ($this->config->GetAdvanced() + if ($this->config->getAdvanced() && \OC::$server->getAppManager()->isInstalled("files_sharing")) { $this->extraPermissions = new ExtraPermissions($AppName, $logger, $shareManager, $config); } @@ -238,7 +238,7 @@ public function __construct( public function config($fileId, $filePath = null, $shareToken = null, $directToken = null, $version = 0, $inframe = false, $inviewer = false, $desktop = false, $guestName = null, $template = false, $anchor = null) { if (!empty($directToken)) { - list($directData, $error) = $this->crypt->ReadHash($directToken); + list($directData, $error) = $this->crypt->readHash($directToken); if ($directData === null) { $this->logger->error("Config for directEditor with empty or not correct hash: $error", ["app" => $this->appName]); return new JSONResponse(["error" => $this->trans->t("Not permitted")]); @@ -288,7 +288,7 @@ public function config($fileId, $filePath = null, $shareToken = null, $directTok $fileName = $file->getName(); $ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION)); - $format = !empty($ext) && array_key_exists($ext, $this->config->FormatsSetting()) ? $this->config->FormatsSetting()[$ext] : null; + $format = !empty($ext) && array_key_exists($ext, $this->config->formatsSetting()) ? $this->config->formatsSetting()[$ext] : null; if (!isset($format)) { $this->logger->info("Format is not supported for editing: $fileName", ["app" => $this->appName]); return new JSONResponse(["error" => $this->trans->t("Format is not supported")]); @@ -312,7 +312,7 @@ public function config($fileId, $filePath = null, $shareToken = null, $directTok if ($key === null) { $key = $this->fileUtility->getKey($file, true); } - $key = DocumentService::GenerateRevisionId($key); + $key = DocumentService::generateRevisionId($key); $params = [ "document" => [ @@ -323,7 +323,7 @@ public function config($fileId, $filePath = null, $shareToken = null, $directTok "url" => $fileUrl, "referenceData" => [ "fileKey" => $file->getId(), - "instanceId" => $this->config->GetSystemValue("instanceid", true), + "instanceId" => $this->config->getSystemValue("instanceid", true), ], ], "documentType" => $format["type"], @@ -333,7 +333,7 @@ public function config($fileId, $filePath = null, $shareToken = null, $directTok ] ]; - $permissions_modifyFilter = $this->config->GetSystemValue($this->config->_permissions_modifyFilter); + $permissions_modifyFilter = $this->config->getSystemValue($this->config->_permissions_modifyFilter); if (isset($permissions_modifyFilter)) { $params["document"]["permissions"]["modifyFilter"] = $permissions_modifyFilter; } @@ -426,7 +426,7 @@ public function config($fileId, $filePath = null, $shareToken = null, $directTok } $canProtect = true; - if ($this->config->GetProtection() === "owner") { + if ($this->config->getProtection() === "owner") { $canProtect = $ownerId === $userId; } $params["document"]["permissions"]["protect"] = $canProtect; @@ -436,11 +436,11 @@ public function config($fileId, $filePath = null, $shareToken = null, $directTok $params["document"]["permissions"]["protect"] = false; } - $hashCallback = $this->crypt->GetHash(["userId" => $userId, "ownerId" => $ownerId, "fileId" => $file->getId(), "filePath" => $filePath, "shareToken" => $shareToken, "action" => "track"]); + $hashCallback = $this->crypt->getHash(["userId" => $userId, "ownerId" => $ownerId, "fileId" => $file->getId(), "filePath" => $filePath, "shareToken" => $shareToken, "action" => "track"]); $callback = $this->urlGenerator->linkToRouteAbsolute($this->appName . ".callback.track", ["doc" => $hashCallback]); - if (!$this->config->UseDemo() && !empty($this->config->GetStorageUrl())) { - $callback = str_replace($this->urlGenerator->getAbsoluteURL("/"), $this->config->GetStorageUrl(), $callback); + if (!$this->config->useDemo() && !empty($this->config->getStorageUrl())) { + $callback = str_replace($this->urlGenerator->getAbsoluteURL("/"), $this->config->getStorageUrl(), $callback); } $params["editorConfig"]["callbackUrl"] = $callback; @@ -527,7 +527,7 @@ public function config($fileId, $filePath = null, $shareToken = null, $directTok $createUrl = $this->urlGenerator->linkToRouteAbsolute($this->appName . ".editor.create_new", $createParam); $params["editorConfig"]["createUrl"] = urldecode($createUrl); - $templatesList = TemplateManager::GetGlobalTemplates($file->getMimeType()); + $templatesList = TemplateManager::getGlobalTemplates($file->getMimeType()); if (!empty($templatesList)) { $templates = []; foreach ($templatesList as $templateItem) { @@ -551,13 +551,13 @@ public function config($fileId, $filePath = null, $shareToken = null, $directTok } if ($folderLink !== null - && $this->config->GetSystemValue($this->config->_customization_goback) !== false) { + && $this->config->getSystemValue($this->config->_customization_goback) !== false) { $params["editorConfig"]["customization"]["goback"] = [ "url" => $folderLink ]; if (!$desktop && !$inviewer) { - if ($this->config->GetSameTab()) { + if ($this->config->getSameTab()) { $params["editorConfig"]["customization"]["goback"]["blank"] = false; } @@ -581,8 +581,8 @@ public function config($fileId, $filePath = null, $shareToken = null, $directTok $params = $this->setWatermark($params, !empty($shareToken), $userId, $file); - if ($this->config->UseDemo()) { - $params["editorConfig"]["tenant"] = $this->config->GetSystemValue("instanceid", true); + if ($this->config->useDemo()) { + $params["editorConfig"]["tenant"] = $this->config->getSystemValue("instanceid", true); } if ($anchor !== null) { @@ -595,8 +595,8 @@ public function config($fileId, $filePath = null, $shareToken = null, $directTok } } - if (!empty($this->config->GetDocumentServerSecret())) { - $token = \Firebase\JWT\JWT::encode($params, $this->config->GetDocumentServerSecret(), "HS256"); + if (!empty($this->config->getDocumentServerSecret())) { + $token = \Firebase\JWT\JWT::encode($params, $this->config->getDocumentServerSecret(), "HS256"); $params["token"] = $token; } @@ -621,7 +621,7 @@ private function getFile($userId, $fileId, $filePath = null, $template = false) } try { - $folder = !$template ? $this->root->getUserFolder($userId) : TemplateManager::GetGlobalTemplateDir(); + $folder = !$template ? $this->root->getUserFolder($userId) : TemplateManager::getGlobalTemplateDir(); $files = $folder->getById($fileId); } catch (\Exception $e) { $this->logger->logException($e, ["message" => "getFile: $fileId", "app" => $this->appName]); @@ -689,12 +689,12 @@ private function getUrl($file, $user = null, $shareToken = null, $version = 0, $ $data["template"] = true; } - $hashUrl = $this->crypt->GetHash($data); + $hashUrl = $this->crypt->getHash($data); $fileUrl = $this->urlGenerator->linkToRouteAbsolute($this->appName . ".callback.download", ["doc" => $hashUrl]); - if (!$this->config->UseDemo() && !empty($this->config->GetStorageUrl())) { - $fileUrl = str_replace($this->urlGenerator->getAbsoluteURL("/"), $this->config->GetStorageUrl(), $fileUrl); + if (!$this->config->useDemo() && !empty($this->config->getStorageUrl())) { + $fileUrl = str_replace($this->urlGenerator->getAbsoluteURL("/"), $this->config->getStorageUrl(), $fileUrl); } return $fileUrl; @@ -708,7 +708,7 @@ private function getUrl($file, $user = null, $shareToken = null, $version = 0, $ * @return string */ private function buildUserId($userId) { - $instanceId = $this->config->GetSystemValue("instanceid", true); + $instanceId = $this->config->getSystemValue("instanceid", true); $userId = $instanceId . "_" . $userId; return $userId; } @@ -722,84 +722,84 @@ private function buildUserId($userId) { */ private function setCustomization($params) { //default is true - if ($this->config->GetCustomizationChat() === false) { + if ($this->config->getCustomizationChat() === false) { $params["editorConfig"]["customization"]["chat"] = false; } //default is false - if ($this->config->GetCustomizationCompactHeader() === true) { + if ($this->config->getCustomizationCompactHeader() === true) { $params["editorConfig"]["customization"]["compactHeader"] = true; } //default is false - if ($this->config->GetCustomizationFeedback() === true) { + if ($this->config->getCustomizationFeedback() === true) { $params["editorConfig"]["customization"]["feedback"] = true; } //default is false - if ($this->config->GetCustomizationForcesave() === true) { + if ($this->config->getCustomizationForcesave() === true) { $params["editorConfig"]["customization"]["forcesave"] = true; } //default is true - if ($this->config->GetCustomizationHelp() === false) { + if ($this->config->getCustomizationHelp() === false) { $params["editorConfig"]["customization"]["help"] = false; } //default is original - $reviewDisplay = $this->config->GetCustomizationReviewDisplay(); + $reviewDisplay = $this->config->getCustomizationReviewDisplay(); if ($reviewDisplay !== "original") { $params["editorConfig"]["customization"]["reviewDisplay"] = $reviewDisplay; } - $theme = $this->config->GetCustomizationTheme(); + $theme = $this->config->getCustomizationTheme(); if (isset($theme)) { $params["editorConfig"]["customization"]["uiTheme"] = $theme; } //default is false - if ($this->config->GetCustomizationToolbarNoTabs() === true) { + if ($this->config->getCustomizationToolbarNoTabs() === true) { $params["editorConfig"]["customization"]["toolbarNoTabs"] = true; } //default is true - if ($this->config->GetCustomizationMacros() === false) { + if ($this->config->getCustomizationMacros() === false) { $params["editorConfig"]["customization"]["macros"] = false; } //default is true - if ($this->config->GetCustomizationPlugins() === false) { + if ($this->config->getCustomizationPlugins() === false) { $params["editorConfig"]["customization"]["plugins"] = false; } /* from system config */ - $autosave = $this->config->GetSystemValue($this->config->_customization_autosave); + $autosave = $this->config->getSystemValue($this->config->_customization_autosave); if (isset($autosave)) { $params["editorConfig"]["customization"]["autosave"] = $autosave; } - $customer = $this->config->GetSystemValue($this->config->_customization_customer); + $customer = $this->config->getSystemValue($this->config->_customization_customer); if (isset($customer)) { $params["editorConfig"]["customization"]["customer"] = $customer; } - $loaderLogo = $this->config->GetSystemValue($this->config->_customization_loaderLogo); + $loaderLogo = $this->config->getSystemValue($this->config->_customization_loaderLogo); if (isset($loaderLogo)) { $params["editorConfig"]["customization"]["loaderLogo"] = $loaderLogo; } - $loaderName = $this->config->GetSystemValue($this->config->_customization_loaderName); + $loaderName = $this->config->getSystemValue($this->config->_customization_loaderName); if (isset($loaderName)) { $params["editorConfig"]["customization"]["loaderName"] = $loaderName; } - $logo = $this->config->GetSystemValue($this->config->_customization_logo); + $logo = $this->config->getSystemValue($this->config->_customization_logo); if (isset($logo)) { $params["editorConfig"]["customization"]["logo"] = $logo; } - $zoom = $this->config->GetSystemValue($this->config->_customization_zoom); + $zoom = $this->config->getSystemValue($this->config->_customization_zoom); if (isset($zoom)) { $params["editorConfig"]["customization"]["zoom"] = $zoom; } @@ -869,7 +869,7 @@ private function setWatermark($params, $isPublic, $userId, $file) { * @return bool|string */ private function getWatermarkText($isPublic, $userId, $file, $canEdit, $canDownload) { - $watermarkSettings = $this->config->GetWatermarkSettings(); + $watermarkSettings = $this->config->getWatermarkSettings(); if (!$watermarkSettings["enabled"]) { return false; } diff --git a/controller/editorcontroller.php b/controller/editorcontroller.php index 9219bd3c..69ce397b 100644 --- a/controller/editorcontroller.php +++ b/controller/editorcontroller.php @@ -256,7 +256,7 @@ public function create($name, $dir, $templateId = null, $targetId = 0, $shareTok } if (!empty($templateId)) { - $templateFile = TemplateManager::GetTemplate($templateId); + $templateFile = TemplateManager::getTemplate($templateId); if ($templateFile !== null) { $template = $templateFile->getContent(); } @@ -272,14 +272,14 @@ public function create($name, $dir, $templateId = null, $targetId = 0, $shareTok $region = str_replace("_", "-", \OC::$server->getL10NFactory()->get("")->getLocaleCode()); $documentService = new DocumentService($this->trans, $this->config); try { - $newFileUri = $documentService->GetConvertedUri($fileUrl, $targetExt, $ext, $targetKey, $region); + $newFileUri = $documentService->getConvertedUri($fileUrl, $targetExt, $ext, $targetKey, $region); } catch (\Exception $e) { - $this->logger->logException($e, ["message" => "GetConvertedUri: " . $targetFile->getId(), "app" => $this->appName]); + $this->logger->logException($e, ["message" => "getConvertedUri: " . $targetFile->getId(), "app" => $this->appName]); return ["error" => $e->getMessage()]; } - $template = $documentService->Request($newFileUri); + $template = $documentService->request($newFileUri); } else { - $template = TemplateManager::GetEmptyTemplate($name); + $template = TemplateManager::getEmptyTemplate($name); } if (!$template) { @@ -582,7 +582,7 @@ public function reference($referenceData, $path = null) { $file = null; $fileId = (integer)($referenceData["fileKey"] ?? 0); if (!empty($fileId) - && $referenceData["instanceId"] === $this->config->GetSystemValue("instanceid", true)) { + && $referenceData["instanceId"] === $this->config->getSystemValue("instanceid", true)) { list($file, $error, $share) = $this->getFile($userId, $fileId); } @@ -610,13 +610,13 @@ public function reference($referenceData, $path = null) { "path" => $userFolder->getRelativePath($file->getPath()), "referenceData" => [ "fileKey" => $file->getId(), - "instanceId" => $this->config->GetSystemValue("instanceid", true), + "instanceId" => $this->config->getSystemValue("instanceid", true), ], "url" => $this->getUrl($file, $user), ]; - if (!empty($this->config->GetDocumentServerSecret())) { - $token = \Firebase\JWT\JWT::encode($response, $this->config->GetDocumentServerSecret(), "HS256"); + if (!empty($this->config->getDocumentServerSecret())) { + $token = \Firebase\JWT\JWT::encode($response, $this->config->getDocumentServerSecret(), "HS256"); $response["token"] = $token; } @@ -661,7 +661,7 @@ public function convert($fileId, $shareToken = null) { $fileName = $file->getName(); $ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION)); - $format = $this->config->FormatsSetting()[$ext]; + $format = $this->config->formatsSetting()[$ext]; if (!isset($format)) { $this->logger->info("Format for convertion not supported: $fileName", ["app" => $this->appName]); return ["error" => $this->trans->t("Format is not supported")]; @@ -688,9 +688,9 @@ public function convert($fileId, $shareToken = null) { $fileUrl = $this->getUrl($file, $user, $shareToken); $region = str_replace("_", "-", \OC::$server->getL10NFactory()->get("")->getLocaleCode()); try { - $newFileUri = $documentService->GetConvertedUri($fileUrl, $ext, $internalExtension, $key, $region); + $newFileUri = $documentService->getConvertedUri($fileUrl, $ext, $internalExtension, $key, $region); } catch (\Exception $e) { - $this->logger->logException($e, ["message" => "GetConvertedUri: " . $file->getId(), "app" => $this->appName]); + $this->logger->logException($e, ["message" => "getConvertedUri: " . $file->getId(), "app" => $this->appName]); return ["error" => $e->getMessage()]; } @@ -700,7 +700,7 @@ public function convert($fileId, $shareToken = null) { } try { - $newData = $documentService->Request($newFileUri); + $newData = $documentService->request($newFileUri); } catch (\Exception $e) { $this->logger->logException($e, ["message" => "Failed to download converted file", "app" => $this->appName]); return ["error" => $this->trans->t("Failed to download converted file")]; @@ -756,11 +756,11 @@ public function save($name, $dir, $url) { return ["error" => $this->trans->t("You don't have enough permission to create")]; } - $url = $this->config->ReplaceDocumentServerUrlToInternal($url); + $url = $this->config->replaceDocumentServerUrlToInternal($url); try { $documentService = new DocumentService($this->trans, $this->config); - $newData = $documentService->Request($url); + $newData = $documentService->request($url); } catch (\Exception $e) { $this->logger->logException($e, ["message" => "Failed to download file for saving: $url", "app" => $this->appName]); return ["error" => $this->trans->t("Download failed")]; @@ -836,7 +836,7 @@ public function history($fileId) { $versionNum = $versionNum + 1; $key = $this->fileUtility->getVersionKey($version); - $key = DocumentService::GenerateRevisionId($key); + $key = DocumentService::generateRevisionId($key); $historyItem = [ "created" => $version->getTimestamp(), @@ -867,7 +867,7 @@ public function history($fileId) { } $key = $this->fileUtility->getKey($file, true); - $key = DocumentService::GenerateRevisionId($key); + $key = DocumentService::generateRevisionId($key); $historyItem = [ "created" => $file->getMTime(), @@ -963,7 +963,7 @@ public function version($fileId, $version) { $fileUrl = $this->getUrl($file, $user, null, $version); } - $key = DocumentService::GenerateRevisionId($key); + $key = DocumentService::generateRevisionId($key); $fileName = $file->getName(); $ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION)); @@ -982,7 +982,7 @@ public function version($fileId, $version) { $prevVersion = array_values($versions)[$version - 2]; $prevVersionKey = $this->fileUtility->getVersionKey($prevVersion); - $prevVersionKey = DocumentService::GenerateRevisionId($prevVersionKey); + $prevVersionKey = DocumentService::generateRevisionId($prevVersionKey); $prevVersionUrl = $this->getUrl($file, $user, null, $version - 1); @@ -993,8 +993,8 @@ public function version($fileId, $version) { ]; } - if (!empty($this->config->GetDocumentServerSecret())) { - $token = \Firebase\JWT\JWT::encode($result, $this->config->GetDocumentServerSecret(), "HS256"); + if (!empty($this->config->getDocumentServerSecret())) { + $token = \Firebase\JWT\JWT::encode($result, $this->config->getDocumentServerSecret(), "HS256"); $result["token"] = $token; } @@ -1094,8 +1094,8 @@ public function url($filePath) { "url" => $fileUrl ]; - if (!empty($this->config->GetDocumentServerSecret())) { - $token = \Firebase\JWT\JWT::encode($result, $this->config->GetDocumentServerSecret(), "HS256"); + if (!empty($this->config->getDocumentServerSecret())) { + $token = \Firebase\JWT\JWT::encode($result, $this->config->getDocumentServerSecret(), "HS256"); $result["token"] = $token; } @@ -1122,7 +1122,7 @@ public function download($fileId, $toExtension = null, $template = false) { } if ($template) { - $templateFile = TemplateManager::GetTemplate($fileId); + $templateFile = TemplateManager::getTemplate($fileId); if (empty($templateFile)) { $this->logger->info("Download: template not found: $fileId", ["app" => $this->appName]); return $this->renderError($this->trans->t("File not found")); @@ -1171,14 +1171,14 @@ public function download($fileId, $toExtension = null, $template = false) { $key = $this->fileUtility->getKey($file); $fileUrl = $this->getUrl($file, $user); try { - $newFileUri = $documentService->GetConvertedUri($fileUrl, $ext, $toExtension, $key); + $newFileUri = $documentService->getConvertedUri($fileUrl, $ext, $toExtension, $key); } catch (\Exception $e) { - $this->logger->logException($e, ["message" => "GetConvertedUri: " . $file->getId(), "app" => $this->appName]); + $this->logger->logException($e, ["message" => "getConvertedUri: " . $file->getId(), "app" => $this->appName]); return $this->renderError($e->getMessage()); } try { - $newData = $documentService->Request($newFileUri); + $newData = $documentService->request($newFileUri); } catch (\Exception $e) { $this->logger->logException($e, ["message" => "Failed to download converted file", "app" => $this->appName]); return $this->renderError($this->trans->t("Failed to download converted file")); @@ -1187,7 +1187,7 @@ public function download($fileId, $toExtension = null, $template = false) { $fileNameWithoutExt = substr($fileName, 0, strlen($fileName) - strlen($ext) - 1); $newFileName = $fileNameWithoutExt . "." . $toExtension; - $formats = $this->config->FormatsSetting(); + $formats = $this->config->formatsSetting(); return new DataDownloadResponse($newData, $newFileName, $formats[$toExtension]["mime"]); } @@ -1232,7 +1232,7 @@ public function index($fileId, $filePath = null, $shareToken = null, $version = return $this->renderError($this->trans->t("Not permitted")); } - $documentServerUrl = $this->config->GetDocumentServerUrl(); + $documentServerUrl = $this->config->getDocumentServerUrl(); if (empty($documentServerUrl)) { $this->logger->error("documentServerUrl is empty", ["app" => $this->appName]); @@ -1299,7 +1299,7 @@ public function index($fileId, $filePath = null, $shareToken = null, $version = * @NoCSRFRequired * @PublicPage */ - public function PublicPage($fileId, $shareToken, $version = 0, $inframe = false) { + public function publicPage($fileId, $shareToken, $version = 0, $inframe = false) { return $this->index($fileId, null, $shareToken, $version, $inframe); } @@ -1319,7 +1319,7 @@ private function getFile($userId, $fileId, $filePath = null, $template = false) } try { - $folder = !$template ? $this->root->getUserFolder($userId) : TemplateManager::GetGlobalTemplateDir(); + $folder = !$template ? $this->root->getUserFolder($userId) : TemplateManager::getGlobalTemplateDir(); $files = $folder->getById($fileId); } catch (\Exception $e) { $this->logger->logException($e, ["message" => "getFile: $fileId", "app" => $this->appName]); @@ -1387,12 +1387,12 @@ private function getUrl($file, $user = null, $shareToken = null, $version = 0, $ $data["template"] = true; } - $hashUrl = $this->crypt->GetHash($data); + $hashUrl = $this->crypt->getHash($data); $fileUrl = $this->urlGenerator->linkToRouteAbsolute($this->appName . ".callback.download", ["doc" => $hashUrl]); - if (!$this->config->UseDemo() && !empty($this->config->GetStorageUrl())) { - $fileUrl = str_replace($this->urlGenerator->getAbsoluteURL("/"), $this->config->GetStorageUrl(), $fileUrl); + if (!$this->config->useDemo() && !empty($this->config->getStorageUrl())) { + $fileUrl = str_replace($this->urlGenerator->getAbsoluteURL("/"), $this->config->getStorageUrl(), $fileUrl); } return $fileUrl; @@ -1421,7 +1421,7 @@ private function getShareExcludedGroups() { * @return string */ private function buildUserId($userId) { - $instanceId = $this->config->GetSystemValue("instanceid", true); + $instanceId = $this->config->getSystemValue("instanceid", true); $userId = $instanceId . "_" . $userId; return $userId; } diff --git a/controller/federationcontroller.php b/controller/federationcontroller.php index c06af242..55e32b8c 100644 --- a/controller/federationcontroller.php +++ b/controller/federationcontroller.php @@ -105,7 +105,7 @@ public function key($shareToken, $path) { $key = $this->fileUtility->getKey($file, true); - $key = DocumentService::GenerateRevisionId($key); + $key = DocumentService::generateRevisionId($key); $this->logger->debug("Federated request get for " . $file->getId() . " key $key", ["app" => $this->appName]); diff --git a/controller/joblistcontroller.php b/controller/joblistcontroller.php index ee5f4752..8d536034 100644 --- a/controller/joblistcontroller.php +++ b/controller/joblistcontroller.php @@ -91,7 +91,7 @@ private function removeJob($job) { * */ private function checkEditorsCheckJob() { - if ($this->config->GetEditorsCheckInterval() > 0) { + if ($this->config->getEditorsCheckInterval() > 0) { $this->addJob(EditorsCheck::class); } else { $this->removeJob(EditorsCheck::class); diff --git a/controller/settingscontroller.php b/controller/settingscontroller.php index 0e181196..5895d0e8 100644 --- a/controller/settingscontroller.php +++ b/controller/settingscontroller.php @@ -106,36 +106,36 @@ public function __construct( */ public function index() { $data = [ - "documentserver" => $this->config->GetDocumentServerUrl(true), - "documentserverInternal" => $this->config->GetDocumentServerInternalUrl(true), - "storageUrl" => $this->config->GetStorageUrl(), - "verifyPeerOff" => $this->config->GetVerifyPeerOff(), - "secret" => $this->config->GetDocumentServerSecret(true), - "jwtHeader" => $this->config->JwtHeader(true), - "demo" => $this->config->GetDemoData(), + "documentserver" => $this->config->getDocumentServerUrl(true), + "documentserverInternal" => $this->config->getDocumentServerInternalUrl(true), + "storageUrl" => $this->config->getStorageUrl(), + "verifyPeerOff" => $this->config->getVerifyPeerOff(), + "secret" => $this->config->getDocumentServerSecret(true), + "jwtHeader" => $this->config->jwtHeader(true), + "demo" => $this->config->getDemoData(), "currentServer" => $this->urlGenerator->getAbsoluteURL("/"), - "formats" => $this->config->FormatsSetting(), - "sameTab" => $this->config->GetSameTab(), - "preview" => $this->config->GetPreview(), - "advanced" => $this->config->GetAdvanced(), - "versionHistory" => $this->config->GetVersionHistory(), - "protection" => $this->config->GetProtection(), - "limitGroups" => $this->config->GetLimitGroups(), - "chat" => $this->config->GetCustomizationChat(), - "compactHeader" => $this->config->GetCustomizationCompactHeader(), - "feedback" => $this->config->GetCustomizationFeedback(), - "forcesave" => $this->config->GetCustomizationForcesave(), - "help" => $this->config->GetCustomizationHelp(), - "toolbarNoTabs" => $this->config->GetCustomizationToolbarNoTabs(), - "successful" => $this->config->SettingsAreSuccessful(), - "watermark" => $this->config->GetWatermarkSettings(), - "plugins" => $this->config->GetCustomizationPlugins(), - "macros" => $this->config->GetCustomizationMacros(), + "formats" => $this->config->formatsSetting(), + "sameTab" => $this->config->getSameTab(), + "preview" => $this->config->getPreview(), + "advanced" => $this->config->getAdvanced(), + "versionHistory" => $this->config->getVersionHistory(), + "protection" => $this->config->getProtection(), + "limitGroups" => $this->config->getLimitGroups(), + "chat" => $this->config->getCustomizationChat(), + "compactHeader" => $this->config->getCustomizationCompactHeader(), + "feedback" => $this->config->getCustomizationFeedback(), + "forcesave" => $this->config->getCustomizationForcesave(), + "help" => $this->config->getCustomizationHelp(), + "toolbarNoTabs" => $this->config->getCustomizationToolbarNoTabs(), + "successful" => $this->config->settingsAreSuccessful(), + "watermark" => $this->config->getWatermarkSettings(), + "plugins" => $this->config->getCustomizationPlugins(), + "macros" => $this->config->getCustomizationMacros(), "tagsEnabled" => \OC::$server->getAppManager()->isEnabledForUser("systemtags"), - "reviewDisplay" => $this->config->GetCustomizationReviewDisplay(), - "theme" => $this->config->GetCustomizationTheme(), - "templates" => $this->GetGlobalTemplates(), - "linkToDocs" => $this->config->GetLinkToDocs() + "reviewDisplay" => $this->config->getCustomizationReviewDisplay(), + "theme" => $this->config->getCustomizationTheme(), + "templates" => $this->getGlobalTemplates(), + "linkToDocs" => $this->config->getLinkToDocs() ]; return new TemplateResponse($this->appName, "settings", $data, "blank"); } @@ -153,7 +153,7 @@ public function index() { * * @return array */ - public function SaveAddress( + public function saveAddress( $documentserver, $documentserverInternal, $storageUrl, @@ -163,35 +163,35 @@ public function SaveAddress( $demo ) { $error = null; - if (!$this->config->SelectDemo($demo === true)) { + if (!$this->config->selectDemo($demo === true)) { $error = $this->trans->t("The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Docs server."); } if ($demo !== true) { - $this->config->SetDocumentServerUrl($documentserver); - $this->config->SetVerifyPeerOff($verifyPeerOff); - $this->config->SetDocumentServerInternalUrl($documentserverInternal); - $this->config->SetDocumentServerSecret($secret); - $this->config->SetJwtHeader($jwtHeader); + $this->config->setDocumentServerUrl($documentserver); + $this->config->setVerifyPeerOff($verifyPeerOff); + $this->config->setDocumentServerInternalUrl($documentserverInternal); + $this->config->setDocumentServerSecret($secret); + $this->config->setJwtHeader($jwtHeader); } - $this->config->SetStorageUrl($storageUrl); + $this->config->setStorageUrl($storageUrl); $version = null; if (empty($error)) { - $documentserver = $this->config->GetDocumentServerUrl(); + $documentserver = $this->config->getDocumentServerUrl(); if (!empty($documentserver)) { $documentService = new DocumentService($this->trans, $this->config); list($error, $version) = $documentService->checkDocServiceUrl($this->urlGenerator, $this->crypt); - $this->config->SetSettingsError($error); + $this->config->setSettingsError($error); } } return [ - "documentserver" => $this->config->GetDocumentServerUrl(true), - "verifyPeerOff" => $this->config->GetVerifyPeerOff(), - "documentserverInternal" => $this->config->GetDocumentServerInternalUrl(true), - "storageUrl" => $this->config->GetStorageUrl(), - "secret" => $this->config->GetDocumentServerSecret(true), - "jwtHeader" => $this->config->JwtHeader(true), + "documentserver" => $this->config->getDocumentServerUrl(true), + "verifyPeerOff" => $this->config->getVerifyPeerOff(), + "documentserverInternal" => $this->config->getDocumentServerInternalUrl(true), + "storageUrl" => $this->config->getStorageUrl(), + "secret" => $this->config->getDocumentServerSecret(true), + "jwtHeader" => $this->config->jwtHeader(true), "error" => $error, "version" => $version, ]; @@ -217,7 +217,7 @@ public function SaveAddress( * * @return array */ - public function SaveCommon( + public function saveCommon( $defFormats, $editFormats, $sameTab, @@ -235,21 +235,21 @@ public function SaveCommon( $theme ) { - $this->config->SetDefaultFormats($defFormats); - $this->config->SetEditableFormats($editFormats); - $this->config->SetSameTab($sameTab); - $this->config->SetPreview($preview); - $this->config->SetAdvanced($advanced); - $this->config->SetVersionHistory($versionHistory); - $this->config->SetLimitGroups($limitGroups); - $this->config->SetCustomizationChat($chat); - $this->config->SetCustomizationCompactHeader($compactHeader); - $this->config->SetCustomizationFeedback($feedback); - $this->config->SetCustomizationForcesave($forcesave); - $this->config->SetCustomizationHelp($help); - $this->config->SetCustomizationToolbarNoTabs($toolbarNoTabs); - $this->config->SetCustomizationReviewDisplay($reviewDisplay); - $this->config->SetCustomizationTheme($theme); + $this->config->setDefaultFormats($defFormats); + $this->config->setEditableFormats($editFormats); + $this->config->setSameTab($sameTab); + $this->config->setPreview($preview); + $this->config->setAdvanced($advanced); + $this->config->setVersionHistory($versionHistory); + $this->config->setLimitGroups($limitGroups); + $this->config->setCustomizationChat($chat); + $this->config->setCustomizationCompactHeader($compactHeader); + $this->config->setCustomizationFeedback($feedback); + $this->config->setCustomizationForcesave($forcesave); + $this->config->setCustomizationHelp($help); + $this->config->setCustomizationToolbarNoTabs($toolbarNoTabs); + $this->config->setCustomizationReviewDisplay($reviewDisplay); + $this->config->setCustomizationTheme($theme); return [ ]; @@ -265,7 +265,7 @@ public function SaveCommon( * * @return array */ - public function SaveSecurity( + public function saveSecurity( $watermarks, $plugins, $macros, @@ -279,10 +279,10 @@ public function SaveSecurity( } } - $this->config->SetWatermarkSettings($watermarks); - $this->config->SetCustomizationPlugins($plugins); - $this->config->SetCustomizationMacros($macros); - $this->config->SetProtection($protection); + $this->config->setWatermarkSettings($watermarks); + $this->config->setCustomizationPlugins($plugins); + $this->config->setCustomizationMacros($macros); + $this->config->setProtection($protection); return [ ]; @@ -293,7 +293,7 @@ public function SaveSecurity( * * @return array */ - public function ClearHistory() { + public function clearHistory() { FileVersions::clearHistory(); @@ -306,15 +306,15 @@ public function ClearHistory() { * * @return array */ - private function GetGlobalTemplates() { + private function getGlobalTemplates() { $templates = []; - $templatesList = TemplateManager::GetGlobalTemplates(); + $templatesList = TemplateManager::getGlobalTemplates(); foreach ($templatesList as $templatesItem) { $template = [ "id" => $templatesItem->getId(), "name" => $templatesItem->getName(), - "type" => TemplateManager::GetTypeTemplate($templatesItem->getMimeType()) + "type" => TemplateManager::getTypeTemplate($templatesItem->getMimeType()) ]; array_push($templates, $template); } diff --git a/controller/sharingapicontroller.php b/controller/sharingapicontroller.php index e4693a46..65b9f6e1 100644 --- a/controller/sharingapicontroller.php +++ b/controller/sharingapicontroller.php @@ -118,7 +118,7 @@ public function __construct( $this->shareManager = $shareManager; $this->appConfig = $appConfig; - if ($this->appConfig->GetAdvanced() + if ($this->appConfig->getAdvanced() && \OC::$server->getAppManager()->isInstalled("files_sharing")) { $this->extraPermissions = new ExtraPermissions($AppName, $logger, $shareManager, $appConfig); } diff --git a/controller/templatecontroller.php b/controller/templatecontroller.php index d4e94f73..215074f9 100644 --- a/controller/templatecontroller.php +++ b/controller/templatecontroller.php @@ -83,15 +83,15 @@ public function __construct( * * @NoAdminRequired */ - public function GetTemplates() { - $templatesList = TemplateManager::GetGlobalTemplates(); + public function getTemplates() { + $templatesList = TemplateManager::getGlobalTemplates(); $templates = []; foreach ($templatesList as $templatesItem) { $template = [ "id" => $templatesItem->getId(), "name" => $templatesItem->getName(), - "type" => TemplateManager::GetTypeTemplate($templatesItem->getMimeType()) + "type" => TemplateManager::getTypeTemplate($templatesItem->getMimeType()) ]; array_push($templates, $template); } @@ -104,19 +104,19 @@ public function GetTemplates() { * * @return array */ - public function AddTemplate() { + public function addTemplate() { $file = $this->request->getUploadedFile("file"); if (!is_null($file)) { if (is_uploaded_file($file["tmp_name"]) && $file["error"] === 0) { - if (!TemplateManager::IsTemplateType($file["name"])) { + if (!TemplateManager::isTemplateType($file["name"])) { return [ "error" => $this->trans->t("Template must be in OOXML format") ]; } - $templateDir = TemplateManager::GetGlobalTemplateDir(); + $templateDir = TemplateManager::getGlobalTemplateDir(); if ($templateDir->nodeExists($file["name"])) { return [ "error" => $this->trans->t("Template already exists") @@ -132,7 +132,7 @@ public function AddTemplate() { $result = [ "id" => $fileInfo->getId(), "name" => $fileInfo->getName(), - "type" => TemplateManager::GetTypeTemplate($fileInfo->getMimeType()) + "type" => TemplateManager::getTypeTemplate($fileInfo->getMimeType()) ]; return $result; @@ -151,13 +151,13 @@ public function AddTemplate() { * * @return array */ - public function DeleteTemplate($templateId) { - $templateDir = TemplateManager::GetGlobalTemplateDir(); + public function deleteTemplate($templateId) { + $templateDir = TemplateManager::getGlobalTemplateDir(); try { $templates = $templateDir->getById($templateId); } catch (\Exception $e) { - $this->logger->logException($e, ["message" => "DeleteTemplate: $templateId", "app" => $this->AppName]); + $this->logger->logException($e, ["message" => "deleteTemplate: $templateId", "app" => $this->AppName]); return [ "error" => $this->trans->t("Failed to delete template") ]; @@ -195,7 +195,7 @@ public function preview($fileId, $x = 256, $y = 256, $crop = false, $mode = IPre return new DataResponse([], Http::STATUS_BAD_REQUEST); } - $template = TemplateManager::GetTemplate($fileId); + $template = TemplateManager::getTemplate($fileId); if (empty($template)) { $this->logger->error("Template not found: $fileId", ["app" => $this->appName]); return new DataResponse([], Http::STATUS_NOT_FOUND); diff --git a/lib/appconfig.php b/lib/appconfig.php index 01707fcb..3d568d3d 100644 --- a/lib/appconfig.php +++ b/lib/appconfig.php @@ -345,7 +345,7 @@ public function __construct($AppName) { * * @return string */ - public function GetSystemValue($key, $system = false) { + public function getSystemValue($key, $system = false) { if ($system) { return $this->config->getSystemValue($key); } @@ -363,10 +363,10 @@ public function GetSystemValue($key, $system = false) { * * @return bool */ - public function SelectDemo($value) { + public function selectDemo($value) { $this->logger->info("Select demo: " . json_encode($value), ["app" => $this->appName]); - $data = $this->GetDemoData(); + $data = $this->getDemoData(); if ($value === true && !$data["available"]) { $this->logger->info("Trial demo is overdue: " . json_encode($data), ["app" => $this->appName]); @@ -387,7 +387,7 @@ public function SelectDemo($value) { * * @return array */ - public function GetDemoData() { + public function getDemoData() { $data = $this->config->getAppValue($this->appName, $this->_demo, ""); if (empty($data)) { @@ -416,8 +416,8 @@ public function GetDemoData() { * * @return bool */ - public function UseDemo() { - return $this->GetDemoData()["enabled"] === true; + public function useDemo() { + return $this->getDemoData()["enabled"] === true; } /** @@ -425,7 +425,7 @@ public function UseDemo() { * * @param string $documentServer - document service address */ - public function SetDocumentServerUrl($documentServer) { + public function setDocumentServerUrl($documentServer) { $documentServer = trim($documentServer); if (strlen($documentServer) > 0) { $documentServer = rtrim($documentServer, "/") . "/"; @@ -434,7 +434,7 @@ public function SetDocumentServerUrl($documentServer) { } } - $this->logger->info("SetDocumentServerUrl: $documentServer", ["app" => $this->appName]); + $this->logger->info("setDocumentServerUrl: $documentServer", ["app" => $this->appName]); $this->config->setAppValue($this->appName, $this->_documentserver, $documentServer); } @@ -446,14 +446,14 @@ public function SetDocumentServerUrl($documentServer) { * * @return string */ - public function GetDocumentServerUrl($origin = false) { - if (!$origin && $this->UseDemo()) { + public function getDocumentServerUrl($origin = false) { + if (!$origin && $this->useDemo()) { return $this->DEMO_PARAM["ADDR"]; } $url = $this->config->getAppValue($this->appName, $this->_documentserver, ""); if (empty($url)) { - $url = $this->GetSystemValue($this->_documentserver); + $url = $this->getSystemValue($this->_documentserver); } if ($url !== null && $url !== "/") { $url = rtrim($url, "/"); @@ -469,7 +469,7 @@ public function GetDocumentServerUrl($origin = false) { * * @param string $documentServerInternal - document service address */ - public function SetDocumentServerInternalUrl($documentServerInternal) { + public function setDocumentServerInternalUrl($documentServerInternal) { $documentServerInternal = rtrim(trim($documentServerInternal), "/"); if (strlen($documentServerInternal) > 0) { $documentServerInternal = $documentServerInternal . "/"; @@ -478,7 +478,7 @@ public function SetDocumentServerInternalUrl($documentServerInternal) { } } - $this->logger->info("SetDocumentServerInternalUrl: $documentServerInternal", ["app" => $this->appName]); + $this->logger->info("setDocumentServerInternalUrl: $documentServerInternal", ["app" => $this->appName]); $this->config->setAppValue($this->appName, $this->_documentserverInternal, $documentServerInternal); } @@ -490,17 +490,17 @@ public function SetDocumentServerInternalUrl($documentServerInternal) { * * @return string */ - public function GetDocumentServerInternalUrl($origin = false) { - if (!$origin && $this->UseDemo()) { - return $this->GetDocumentServerUrl(); + public function getDocumentServerInternalUrl($origin = false) { + if (!$origin && $this->useDemo()) { + return $this->getDocumentServerUrl(); } $url = $this->config->getAppValue($this->appName, $this->_documentserverInternal, ""); if (empty($url)) { - $url = $this->GetSystemValue($this->_documentserverInternal); + $url = $this->getSystemValue($this->_documentserverInternal); } if (!$origin && empty($url)) { - $url = $this->GetDocumentServerUrl(); + $url = $this->getDocumentServerUrl(); } return $url; } @@ -512,10 +512,10 @@ public function GetDocumentServerInternalUrl($origin = false) { * * @return string */ - public function ReplaceDocumentServerUrlToInternal($url) { - $documentServerUrl = $this->GetDocumentServerInternalUrl(); + public function replaceDocumentServerUrlToInternal($url) { + $documentServerUrl = $this->getDocumentServerInternalUrl(); if (!empty($documentServerUrl)) { - $from = $this->GetDocumentServerUrl(); + $from = $this->getDocumentServerUrl(); if (!preg_match("/^https?:\/\//i", $from)) { $parsedUrl = parse_url($url); @@ -536,7 +536,7 @@ public function ReplaceDocumentServerUrlToInternal($url) { * * @param string $documentServer - document service address */ - public function SetStorageUrl($storageUrl) { + public function setStorageUrl($storageUrl) { $storageUrl = rtrim(trim($storageUrl), "/"); if (strlen($storageUrl) > 0) { $storageUrl = $storageUrl . "/"; @@ -545,7 +545,7 @@ public function SetStorageUrl($storageUrl) { } } - $this->logger->info("SetStorageUrl: $storageUrl", ["app" => $this->appName]); + $this->logger->info("setStorageUrl: $storageUrl", ["app" => $this->appName]); $this->config->setAppValue($this->appName, $this->_storageUrl, $storageUrl); } @@ -555,10 +555,10 @@ public function SetStorageUrl($storageUrl) { * * @return string */ - public function GetStorageUrl() { + public function getStorageUrl() { $url = $this->config->getAppValue($this->appName, $this->_storageUrl, ""); if (empty($url)) { - $url = $this->GetSystemValue($this->_storageUrl); + $url = $this->getSystemValue($this->_storageUrl); } return $url; } @@ -568,7 +568,7 @@ public function GetStorageUrl() { * * @param string $secret - secret key */ - public function SetDocumentServerSecret($secret) { + public function setDocumentServerSecret($secret) { $secret = trim($secret); if (empty($secret)) { $this->logger->info("Clear secret key", ["app" => $this->appName]); @@ -586,14 +586,14 @@ public function SetDocumentServerSecret($secret) { * * @return string */ - public function GetDocumentServerSecret($origin = false) { - if (!$origin && $this->UseDemo()) { + public function getDocumentServerSecret($origin = false) { + if (!$origin && $this->useDemo()) { return $this->DEMO_PARAM["SECRET"]; } $secret = $this->config->getAppValue($this->appName, $this->_jwtSecret, ""); if (empty($secret)) { - $secret = $this->GetSystemValue($this->_jwtSecret); + $secret = $this->getSystemValue($this->_jwtSecret); } return $secret; } @@ -603,10 +603,10 @@ public function GetDocumentServerSecret($origin = false) { * * @return string */ - public function GetSKey() { - $secret = $this->GetDocumentServerSecret(); + public function getSKey() { + $secret = $this->getDocumentServerSecret(); if (empty($secret)) { - $secret = $this->GetSystemValue($this->_cryptSecret, true); + $secret = $this->getSystemValue($this->_cryptSecret, true); } return $secret; } @@ -616,7 +616,7 @@ public function GetSKey() { * * @param array $formats - formats with status */ - public function SetDefaultFormats($formats) { + public function setDefaultFormats($formats) { $value = json_encode($formats); $this->logger->info("Set default formats: $value", ["app" => $this->appName]); @@ -628,7 +628,7 @@ public function SetDefaultFormats($formats) { * * @return array */ - private function GetDefaultFormats() { + private function getDefaultFormats() { $value = $this->config->getAppValue($this->appName, $this->_defFormats, ""); if (empty($value)) { return array(); @@ -641,7 +641,7 @@ private function GetDefaultFormats() { * * @param array $formats - formats with status */ - public function SetEditableFormats($formats) { + public function setEditableFormats($formats) { $value = json_encode($formats); $this->logger->info("Set editing formats: $value", ["app" => $this->appName]); @@ -653,7 +653,7 @@ public function SetEditableFormats($formats) { * * @return array */ - private function GetEditableFormats() { + private function getEditableFormats() { $value = $this->config->getAppValue($this->appName, $this->_editFormats, ""); if (empty($value)) { return array(); @@ -666,7 +666,7 @@ private function GetEditableFormats() { * * @param bool $value - same tab */ - public function SetSameTab($value) { + public function setSameTab($value) { $this->logger->info("Set opening in a same tab: " . json_encode($value), ["app" => $this->appName]); $this->config->setAppValue($this->appName, $this->_sameTab, json_encode($value)); @@ -677,7 +677,7 @@ public function SetSameTab($value) { * * @return bool */ - public function GetSameTab() { + public function getSameTab() { return $this->config->getAppValue($this->appName, $this->_sameTab, "true") === "true"; } @@ -686,7 +686,7 @@ public function GetSameTab() { * * @param bool $value - preview */ - public function SetPreview($value) { + public function setPreview($value) { $this->logger->info("Set generate preview: " . json_encode($value), ["app" => $this->appName]); $this->config->setAppValue($this->appName, $this->_preview, json_encode($value)); @@ -697,7 +697,7 @@ public function SetPreview($value) { * * @return bool */ - public function GetAdvanced() { + public function getAdvanced() { return $this->config->getAppValue($this->appName, $this->_advanced, "false") === "true"; } @@ -706,7 +706,7 @@ public function GetAdvanced() { * * @param bool $value - advanced */ - public function SetAdvanced($value) { + public function setAdvanced($value) { $this->logger->info("Set advanced: " . json_encode($value), ["app" => $this->appName]); $this->config->setAppValue($this->appName, $this->_advanced, json_encode($value)); @@ -717,7 +717,7 @@ public function SetAdvanced($value) { * * @return bool */ - public function GetPreview() { + public function getPreview() { return $this->config->getAppValue($this->appName, $this->_preview, "true") === "true"; } @@ -726,7 +726,7 @@ public function GetPreview() { * * @param bool $value - version history */ - public function SetVersionHistory($value) { + public function setVersionHistory($value) { $this->logger->info("Set keep versions history: " . json_encode($value), ["app" => $this->appName]); $this->config->setAppValue($this->appName, $this->_versionHistory, json_encode($value)); @@ -737,7 +737,7 @@ public function SetVersionHistory($value) { * * @return bool */ - public function GetVersionHistory() { + public function getVersionHistory() { return $this->config->getAppValue($this->appName, $this->_versionHistory, "true") === "true"; } @@ -746,7 +746,7 @@ public function GetVersionHistory() { * * @param bool $value - version history */ - public function SetProtection($value) { + public function setProtection($value) { $this->logger->info("Set protection: " . $value, ["app" => $this->appName]); $this->config->setAppValue($this->appName, $this->_protection, $value); @@ -757,7 +757,7 @@ public function SetProtection($value) { * * @return bool */ - public function GetProtection() { + public function getProtection() { $value = $this->config->getAppValue($this->appName, $this->_protection, "owner"); if ($value === "all") { return "all"; @@ -770,7 +770,7 @@ public function GetProtection() { * * @param bool $value - display chat */ - public function SetCustomizationChat($value) { + public function setCustomizationChat($value) { $this->logger->info("Set chat display: " . json_encode($value), ["app" => $this->appName]); $this->config->setAppValue($this->appName, $this->_customizationChat, json_encode($value)); @@ -781,7 +781,7 @@ public function SetCustomizationChat($value) { * * @return bool */ - public function GetCustomizationChat() { + public function getCustomizationChat() { return $this->config->getAppValue($this->appName, $this->_customizationChat, "true") === "true"; } @@ -790,7 +790,7 @@ public function GetCustomizationChat() { * * @param bool $value - display compact header */ - public function SetCustomizationCompactHeader($value) { + public function setCustomizationCompactHeader($value) { $this->logger->info("Set compact header display: " . json_encode($value), ["app" => $this->appName]); $this->config->setAppValue($this->appName, $this->_customizationCompactHeader, json_encode($value)); @@ -801,7 +801,7 @@ public function SetCustomizationCompactHeader($value) { * * @return bool */ - public function GetCustomizationCompactHeader() { + public function getCustomizationCompactHeader() { return $this->config->getAppValue($this->appName, $this->_customizationCompactHeader, "true") === "true"; } @@ -810,7 +810,7 @@ public function GetCustomizationCompactHeader() { * * @param bool $value - display feedback */ - public function SetCustomizationFeedback($value) { + public function setCustomizationFeedback($value) { $this->logger->info("Set feedback display: " . json_encode($value), ["app" => $this->appName]); $this->config->setAppValue($this->appName, $this->_customizationFeedback, json_encode($value)); @@ -821,7 +821,7 @@ public function SetCustomizationFeedback($value) { * * @return bool */ - public function GetCustomizationFeedback() { + public function getCustomizationFeedback() { return $this->config->getAppValue($this->appName, $this->_customizationFeedback, "true") === "true"; } @@ -830,7 +830,7 @@ public function GetCustomizationFeedback() { * * @param bool $value - forcesave */ - public function SetCustomizationForcesave($value) { + public function setCustomizationForcesave($value) { $this->logger->info("Set forcesave: " . json_encode($value), ["app" => $this->appName]); $this->config->setAppValue($this->appName, $this->_customizationForcesave, json_encode($value)); @@ -841,7 +841,7 @@ public function SetCustomizationForcesave($value) { * * @return bool */ - public function GetCustomizationForcesave() { + public function getCustomizationForcesave() { return $this->config->getAppValue($this->appName, $this->_customizationForcesave, "false") === "true"; } @@ -850,7 +850,7 @@ public function GetCustomizationForcesave() { * * @param bool $value - display help */ - public function SetCustomizationHelp($value) { + public function setCustomizationHelp($value) { $this->logger->info("Set help display: " . json_encode($value), ["app" => $this->appName]); $this->config->setAppValue($this->appName, $this->_customizationHelp, json_encode($value)); @@ -861,7 +861,7 @@ public function SetCustomizationHelp($value) { * * @return bool */ - public function GetCustomizationHelp() { + public function getCustomizationHelp() { return $this->config->getAppValue($this->appName, $this->_customizationHelp, "true") === "true"; } @@ -870,7 +870,7 @@ public function GetCustomizationHelp() { * * @param bool $value - without tabs */ - public function SetCustomizationToolbarNoTabs($value) { + public function setCustomizationToolbarNoTabs($value) { $this->logger->info("Set without tabs: " . json_encode($value), ["app" => $this->appName]); $this->config->setAppValue($this->appName, $this->_customizationToolbarNoTabs, json_encode($value)); @@ -881,7 +881,7 @@ public function SetCustomizationToolbarNoTabs($value) { * * @return bool */ - public function GetCustomizationToolbarNoTabs() { + public function getCustomizationToolbarNoTabs() { return $this->config->getAppValue($this->appName, $this->_customizationToolbarNoTabs, "true") === "true"; } @@ -890,7 +890,7 @@ public function GetCustomizationToolbarNoTabs() { * * @param string $value - review mode */ - public function SetCustomizationReviewDisplay($value) { + public function setCustomizationReviewDisplay($value) { $this->logger->info("Set review mode: " . $value, array("app" => $this->appName)); $this->config->setAppValue($this->appName, $this->_customizationReviewDisplay, $value); @@ -901,7 +901,7 @@ public function SetCustomizationReviewDisplay($value) { * * @return string */ - public function GetCustomizationReviewDisplay() { + public function getCustomizationReviewDisplay() { $value = $this->config->getAppValue($this->appName, $this->_customizationReviewDisplay, "original"); if ($value === "markup") { return "markup"; @@ -917,7 +917,7 @@ public function GetCustomizationReviewDisplay() { * * @param string $value - theme */ - public function SetCustomizationTheme($value) { + public function setCustomizationTheme($value) { $this->logger->info("Set theme: " . $value, array("app" => $this->appName)); $this->config->setAppValue($this->appName, $this->_customizationTheme, $value); @@ -928,7 +928,7 @@ public function SetCustomizationTheme($value) { * * @return string */ - public function GetCustomizationTheme() { + public function getCustomizationTheme() { $value = $this->config->getAppValue($this->appName, $this->_customizationTheme, "theme-classic-light"); if ($value === "theme-light") { return "theme-light"; @@ -944,7 +944,7 @@ public function GetCustomizationTheme() { * * @param array $settings - watermark settings */ - public function SetWatermarkSettings($settings) { + public function setWatermarkSettings($settings) { $this->logger->info("Set watermark enabled: " . $settings["enabled"], ["app" => $this->appName]); if ($settings["enabled"] !== "true") { @@ -992,7 +992,7 @@ public function SetWatermarkSettings($settings) { * * @return bool|array */ - public function GetWatermarkSettings() { + public function getWatermarkSettings() { $result = [ "text" => $this->config->getAppValue(AppConfig::WATERMARK_APP_NAMESPACE, "watermark_text", "{userId}, {date}"), ]; @@ -1034,7 +1034,7 @@ public function GetWatermarkSettings() { * * @param array $groups - the list of groups */ - public function SetLimitGroups($groups) { + public function setLimitGroups($groups) { if (!is_array($groups)) { $groups = array(); } @@ -1049,7 +1049,7 @@ public function SetLimitGroups($groups) { * * @return array */ - public function GetLimitGroups() { + public function getLimitGroups() { $value = $this->config->getAppValue($this->appName, $this->_groups, ""); if (empty($value)) { return array(); @@ -1075,7 +1075,7 @@ public function isUserAllowedToUse($userId = null) { return false; } - $groups = $this->GetLimitGroups(); + $groups = $this->getLimitGroups(); // no group set -> all users are allowed if (count($groups) === 0) { return true; @@ -1095,7 +1095,7 @@ public function isUserAllowedToUse($userId = null) { $group = \OC::$server->getGroupManager()->get($groupName); if ($group === null) { \OC::$server->getLogger()->error("Group is unknown $groupName", ["app" => $this->appName]); - $this->SetLimitGroups(array_diff($groups, [$groupName])); + $this->setLimitGroups(array_diff($groups, [$groupName])); } else { if ($group->inGroup($user)) { return true; @@ -1111,8 +1111,8 @@ public function isUserAllowedToUse($userId = null) { * * @param bool $verifyPeerOff - parameter verification setting */ - public function SetVerifyPeerOff($verifyPeerOff) { - $this->logger->info("SetVerifyPeerOff " . json_encode($verifyPeerOff), ["app" => $this->appName]); + public function setVerifyPeerOff($verifyPeerOff) { + $this->logger->info("setVerifyPeerOff " . json_encode($verifyPeerOff), ["app" => $this->appName]); $this->config->setAppValue($this->appName, $this->_verification, json_encode($verifyPeerOff)); } @@ -1122,14 +1122,14 @@ public function SetVerifyPeerOff($verifyPeerOff) { * * @return bool */ - public function GetVerifyPeerOff() { + public function getVerifyPeerOff() { $turnOff = $this->config->getAppValue($this->appName, $this->_verification, ""); if (!empty($turnOff)) { return $turnOff === "true"; } - return $this->GetSystemValue($this->_verification); + return $this->getSystemValue($this->_verification); } /** @@ -1137,8 +1137,8 @@ public function GetVerifyPeerOff() { * * @return int */ - public function GetLimitThumbSize() { - $limitSize = (integer)$this->GetSystemValue($this->_limitThumbSize); + public function getLimitThumbSize() { + $limitSize = (integer)$this->getSystemValue($this->_limitThumbSize); if (!empty($limitSize)) { return $limitSize; @@ -1154,14 +1154,14 @@ public function GetLimitThumbSize() { * * @return string */ - public function JwtHeader($origin = false) { - if (!$origin && $this->UseDemo()) { + public function jwtHeader($origin = false) { + if (!$origin && $this->useDemo()) { return $this->DEMO_PARAM["HEADER"]; } $header = $this->config->getAppValue($this->appName, $this->_jwtHeader, ""); if (empty($header)) { - $header = $this->GetSystemValue($this->_jwtHeader); + $header = $this->getSystemValue($this->_jwtHeader); } if (!$origin && empty($header)) { $header = "Authorization"; @@ -1174,7 +1174,7 @@ public function JwtHeader($origin = false) { * * @param string $value - jwtHeader */ - public function SetJwtHeader($value) { + public function setJwtHeader($value) { $value = trim($value); if (empty($value)) { $this->logger->info("Clear header key", ["app" => $this->appName]); @@ -1190,8 +1190,8 @@ public function SetJwtHeader($value) { * * @return int */ - public function GetJwtLeeway() { - $jwtLeeway = (integer)$this->GetSystemValue($this->_jwtLeeway); + public function getJwtLeeway() { + $jwtLeeway = (integer)$this->getSystemValue($this->_jwtLeeway); return $jwtLeeway; } @@ -1201,7 +1201,7 @@ public function GetJwtLeeway() { * * @param string $value - error */ - public function SetSettingsError($value) { + public function setSettingsError($value) { $this->config->setAppValue($this->appName, $this->_settingsError, $value); } @@ -1210,7 +1210,7 @@ public function SetSettingsError($value) { * * @return bool */ - public function SettingsAreSuccessful() { + public function settingsAreSuccessful() { return empty($this->config->getAppValue($this->appName, $this->_settingsError, "")); } @@ -1221,17 +1221,17 @@ public function SettingsAreSuccessful() { * * @NoAdminRequired */ - public function FormatsSetting() { + public function formatsSetting() { $result = $this->formats; - $defFormats = $this->GetDefaultFormats(); + $defFormats = $this->getDefaultFormats(); foreach ($defFormats as $format => $setting) { if (array_key_exists($format, $result)) { $result[$format]["def"] = ($setting === true || $setting === "true"); } } - $editFormats = $this->GetEditableFormats(); + $editFormats = $this->getEditableFormats(); foreach ($editFormats as $format => $setting) { if (array_key_exists($format, $result)) { $result[$format]["edit"] = ($setting === true || $setting === "true"); @@ -1246,7 +1246,7 @@ public function FormatsSetting() { * * @param bool $value - enable macros */ - public function SetCustomizationMacros($value) { + public function setCustomizationMacros($value) { $this->logger->info("Set macros enabled: " . json_encode($value), ["app" => $this->appName]); $this->config->setAppValue($this->appName, $this->_customizationMacros, json_encode($value)); @@ -1257,7 +1257,7 @@ public function SetCustomizationMacros($value) { * * @return bool */ - public function GetCustomizationMacros() { + public function getCustomizationMacros() { return $this->config->getAppValue($this->appName, $this->_customizationMacros, "true") === "true"; } @@ -1266,7 +1266,7 @@ public function GetCustomizationMacros() { * * @param bool $value - enable macros */ - public function SetCustomizationPlugins($value) { + public function setCustomizationPlugins($value) { $this->logger->info("Set plugins enabled: " . json_encode($value), ["app" => $this->appName]); $this->config->setAppValue($this->appName, $this->_customizationPlugins, json_encode($value)); @@ -1277,7 +1277,7 @@ public function SetCustomizationPlugins($value) { * * @return bool */ - public function GetCustomizationPlugins() { + public function getCustomizationPlugins() { return $this->config->getAppValue($this->appName, $this->_customizationPlugins, "true") === "true"; } @@ -1286,8 +1286,8 @@ public function GetCustomizationPlugins() { * * @return int */ - public function GetEditorsCheckInterval() { - $interval = $this->GetSystemValue($this->_editors_check_interval); + public function getEditorsCheckInterval() { + $interval = $this->getSystemValue($this->_editors_check_interval); if (empty($interval) && $interval !== 0) { $interval = 60 * 60 * 24; @@ -1355,7 +1355,7 @@ public function GetEditorsCheckInterval() { * * @return string */ - public function GetLinkToDocs() { + public function getLinkToDocs() { return $this->linkToDocs; } } diff --git a/lib/command/documentserver.php b/lib/command/documentserver.php index 9ba0ae80..080155a6 100644 --- a/lib/command/documentserver.php +++ b/lib/command/documentserver.php @@ -106,7 +106,7 @@ protected function configure() { protected function execute(InputInterface $input, OutputInterface $output) { $check = $input->getOption("check"); - $documentserver = $this->config->GetDocumentServerUrl(true); + $documentserver = $this->config->getDocumentServerUrl(true); if (empty($documentserver)) { $output->writeln("Document server is not configured"); return 1; @@ -116,7 +116,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { $documentService = new DocumentService($this->trans, $this->config); list($error, $version) = $documentService->checkDocServiceUrl($this->urlGenerator, $this->crypt); - $this->config->SetSettingsError($error); + $this->config->setSettingsError($error); if (!empty($error)) { $output->writeln("Error connection: $error"); diff --git a/lib/cron/editorscheck.php b/lib/cron/editorscheck.php index a82a6273..81edd3d1 100644 --- a/lib/cron/editorscheck.php +++ b/lib/cron/editorscheck.php @@ -112,7 +112,7 @@ public function __construct( $this->trans = $trans; $this->crypt = $crypt; $this->groupManager = $groupManager; - $this->setInterval($this->config->GetEditorsCheckInterval()); + $this->setInterval($this->config->getEditorsCheckInterval()); $this->setTimeSensitivity(IJob::TIME_SENSITIVE); } @@ -122,17 +122,17 @@ public function __construct( * @param array $argument unused argument */ protected function run($argument) { - if (empty($this->config->GetDocumentServerUrl())) { + if (empty($this->config->getDocumentServerUrl())) { $this->logger->debug("Settings are empty", ["app" => $this->appName]); return; } - if (!$this->config->SettingsAreSuccessful()) { + if (!$this->config->settingsAreSuccessful()) { $this->logger->debug("Settings are not correct", ["app" => $this->appName]); return; } $fileUrl = $this->urlGenerator->linkToRouteAbsolute($this->appName . ".callback.emptyfile"); - if (!$this->config->UseDemo() && !empty($this->config->GetStorageUrl())) { - $fileUrl = str_replace($this->urlGenerator->getAbsoluteURL("/"), $this->config->GetStorageUrl(), $fileUrl); + if (!$this->config->useDemo() && !empty($this->config->getStorageUrl())) { + $fileUrl = str_replace($this->urlGenerator->getAbsoluteURL("/"), $this->config->getStorageUrl(), $fileUrl); } $host = parse_url($fileUrl)["host"]; if ($host === "localhost" || $host === "127.0.0.1") { @@ -147,7 +147,7 @@ protected function run($argument) { if (!empty($error)) { $this->logger->info("ONLYOFFICE server is not available", ["app" => $this->appName]); - $this->config->SetSettingsError($error); + $this->config->setSettingsError($error); $this->notifyAdmins(); } else { $this->logger->debug("ONLYOFFICE server availability check is finished successfully", ["app" => $this->appName]); diff --git a/lib/crypt.php b/lib/crypt.php index f55259bd..7b9cd45a 100644 --- a/lib/crypt.php +++ b/lib/crypt.php @@ -47,8 +47,8 @@ public function __construct(AppConfig $appConfig) { * * @return string */ - public function GetHash($object) { - return \Firebase\JWT\JWT::encode($object, $this->config->GetSKey(), "HS256"); + public function getHash($object) { + return \Firebase\JWT\JWT::encode($object, $this->config->getSKey(), "HS256"); } /** @@ -58,14 +58,14 @@ public function GetHash($object) { * * @return array */ - public function ReadHash($token) { + public function readHash($token) { $result = null; $error = null; if ($token === null) { return [$result, "token is empty"]; } try { - $result = \Firebase\JWT\JWT::decode($token, new \Firebase\JWT\Key($this->config->GetSKey(), "HS256")); + $result = \Firebase\JWT\JWT::decode($token, new \Firebase\JWT\Key($this->config->getSKey(), "HS256")); } catch (\UnexpectedValueException $e) { $error = $e->getMessage(); } diff --git a/lib/directeditor.php b/lib/directeditor.php index 90389d0f..67c9c574 100644 --- a/lib/directeditor.php +++ b/lib/directeditor.php @@ -130,7 +130,7 @@ public function getMimetypes(): array { return $mimes; } - $formats = $this->config->FormatsSetting(); + $formats = $this->config->formatsSetting(); foreach ($formats as $format => $setting) { if (array_key_exists("edit", $setting) && $setting["edit"] && array_key_exists("def", $setting) && $setting["def"]) { @@ -152,7 +152,7 @@ public function getMimetypesOptional(): array { return $mimes; } - $formats = $this->config->FormatsSetting(); + $formats = $this->config->formatsSetting(); foreach ($formats as $format => $setting) { if (array_key_exists("edit", $setting) && $setting["edit"] && (!array_key_exists("def", $setting) || !$setting["def"])) { @@ -213,14 +213,14 @@ public function open(IToken $token): Response { return $this->renderError($this->trans->t("Not permitted")); } - $documentServerUrl = $this->config->GetDocumentServerUrl(); + $documentServerUrl = $this->config->getDocumentServerUrl(); if (empty($documentServerUrl)) { $this->logger->error("documentServerUrl is empty", ["app" => $this->appName]); return $this->renderError($this->trans->t("ONLYOFFICE app is not configured. Please contact admin")); } - $directToken = $this->crypt->GetHash([ + $directToken = $this->crypt->getHash([ "userId" => $userId, "fileId" => $fileId, "action" => "direct", diff --git a/lib/documentservice.php b/lib/documentservice.php index 7d5b9312..bbb96ca9 100644 --- a/lib/documentservice.php +++ b/lib/documentservice.php @@ -65,7 +65,7 @@ public function __construct(IL10N $trans, AppConfig $appConfig) { * * @return string */ - public static function GenerateRevisionId($expected_key) { + public static function generateRevisionId($expected_key) { if (strlen($expected_key) > 20) { $expected_key = crc32($expected_key); } @@ -85,12 +85,12 @@ public static function GenerateRevisionId($expected_key) { * * @return string */ - public function GetConvertedUri($document_uri, $from_extension, $to_extension, $document_revision_id, $region = null) { - $responceFromConvertService = $this->SendRequestToConvertService($document_uri, $from_extension, $to_extension, $document_revision_id, false, $region); + public function getConvertedUri($document_uri, $from_extension, $to_extension, $document_revision_id, $region = null) { + $responceFromConvertService = $this->sendRequestToConvertService($document_uri, $from_extension, $to_extension, $document_revision_id, false, $region); $errorElement = $responceFromConvertService->Error; if ($errorElement->count() > 0) { - $this->ProcessConvServResponceError($errorElement . ""); + $this->processConvServResponceError($errorElement . ""); } $isEndConvert = $responceFromConvertService->EndConvert; @@ -114,8 +114,8 @@ public function GetConvertedUri($document_uri, $from_extension, $to_extension, $ * * @return array */ - public function SendRequestToConvertService($document_uri, $from_extension, $to_extension, $document_revision_id, $is_async, $region = null) { - $documentServerUrl = $this->config->GetDocumentServerInternalUrl(); + public function sendRequestToConvertService($document_uri, $from_extension, $to_extension, $document_revision_id, $is_async, $region = null) { + $documentServerUrl = $this->config->getDocumentServerInternalUrl(); if (empty($documentServerUrl)) { throw new \Exception($this->trans->t("ONLYOFFICE app is not configured. Please contact admin")); @@ -127,7 +127,7 @@ public function SendRequestToConvertService($document_uri, $from_extension, $to_ $document_revision_id = $document_uri; } - $document_revision_id = self::GenerateRevisionId($document_revision_id); + $document_revision_id = self::generateRevisionId($document_revision_id); if (empty($from_extension)) { $from_extension = pathinfo($document_uri)["extension"]; @@ -148,8 +148,8 @@ public function SendRequestToConvertService($document_uri, $from_extension, $to_ $data["region"] = $region; } - if ($this->config->UseDemo()) { - $data["tenant"] = $this->config->GetSystemValue("instanceid", true); + if ($this->config->useDemo()) { + $data["tenant"] = $this->config->getSystemValue("instanceid", true); } $opts = [ @@ -160,19 +160,19 @@ public function SendRequestToConvertService($document_uri, $from_extension, $to_ "body" => json_encode($data) ]; - if (!empty($this->config->GetDocumentServerSecret())) { + if (!empty($this->config->getDocumentServerSecret())) { $params = [ "payload" => $data ]; - $token = \Firebase\JWT\JWT::encode($params, $this->config->GetDocumentServerSecret(), "HS256"); - $opts["headers"][$this->config->JwtHeader()] = "Bearer " . $token; + $token = \Firebase\JWT\JWT::encode($params, $this->config->getDocumentServerSecret(), "HS256"); + $opts["headers"][$this->config->jwtHeader()] = "Bearer " . $token; - $token = \Firebase\JWT\JWT::encode($data, $this->config->GetDocumentServerSecret(), "HS256"); + $token = \Firebase\JWT\JWT::encode($data, $this->config->getDocumentServerSecret(), "HS256"); $data["token"] = $token; $opts["body"] = json_encode($data); } - $response_xml_data = $this->Request($urlToConverter, "post", $opts); + $response_xml_data = $this->request($urlToConverter, "post", $opts); libxml_use_internal_errors(true); if (!function_exists("simplexml_load_file")) { @@ -197,7 +197,7 @@ public function SendRequestToConvertService($document_uri, $from_extension, $to_ * * @return null */ - public function ProcessConvServResponceError($errorCode) { + public function processConvServResponceError($errorCode) { $errorMessageTemplate = $this->trans->t("Error occurred in the document service"); $errorMessage = ""; @@ -244,9 +244,9 @@ public function ProcessConvServResponceError($errorCode) { * * @return bool */ - public function HealthcheckRequest() { + public function healthcheckRequest() { - $documentServerUrl = $this->config->GetDocumentServerInternalUrl(); + $documentServerUrl = $this->config->getDocumentServerInternalUrl(); if (empty($documentServerUrl)) { throw new \Exception($this->trans->t("ONLYOFFICE app is not configured. Please contact admin")); @@ -254,7 +254,7 @@ public function HealthcheckRequest() { $urlHealthcheck = $documentServerUrl . "healthcheck"; - $response = $this->Request($urlHealthcheck); + $response = $this->request($urlHealthcheck); return $response === "true"; } @@ -266,9 +266,9 @@ public function HealthcheckRequest() { * * @return array */ - public function CommandRequest($method) { + public function commandRequest($method) { - $documentServerUrl = $this->config->GetDocumentServerInternalUrl(); + $documentServerUrl = $this->config->getDocumentServerInternalUrl(); if (empty($documentServerUrl)) { throw new \Exception($this->trans->t("ONLYOFFICE app is not configured. Please contact admin")); @@ -287,23 +287,23 @@ public function CommandRequest($method) { "body" => json_encode($data) ]; - if (!empty($this->config->GetDocumentServerSecret())) { + if (!empty($this->config->getDocumentServerSecret())) { $params = [ "payload" => $data ]; - $token = \Firebase\JWT\JWT::encode($params, $this->config->GetDocumentServerSecret(), "HS256"); - $opts["headers"][$this->config->JwtHeader()] = "Bearer " . $token; + $token = \Firebase\JWT\JWT::encode($params, $this->config->getDocumentServerSecret(), "HS256"); + $opts["headers"][$this->config->jwtHeader()] = "Bearer " . $token; - $token = \Firebase\JWT\JWT::encode($data, $this->config->GetDocumentServerSecret(), "HS256"); + $token = \Firebase\JWT\JWT::encode($data, $this->config->getDocumentServerSecret(), "HS256"); $data["token"] = $token; $opts["body"] = json_encode($data); } - $response = $this->Request($urlCommand, "post", $opts); + $response = $this->request($urlCommand, "post", $opts); $data = json_decode($response); - $this->ProcessCommandServResponceError($data->error); + $this->processCommandServResponceError($data->error); return $data; } @@ -315,7 +315,7 @@ public function CommandRequest($method) { * * @return null */ - public function ProcessCommandServResponceError($errorCode) { + public function processCommandServResponceError($errorCode) { $errorMessageTemplate = $this->trans->t("Error occurred in the document service"); $errorMessage = ""; @@ -348,14 +348,14 @@ public function ProcessCommandServResponceError($errorCode) { * * @return string */ - public function Request($url, $method = "get", $opts = null) { + public function request($url, $method = "get", $opts = null) { $httpClientService = \OC::$server->getHTTPClientService(); $client = $httpClientService->newClient(); if (null === $opts) { $opts = array(); } - if (substr($url, 0, strlen("https")) === "https" && $this->config->GetVerifyPeerOff()) { + if (substr($url, 0, strlen("https")) === "https" && $this->config->getVerifyPeerOff()) { $opts["verify"] = false; } if (!array_key_exists("timeout", $opts)) { @@ -389,7 +389,7 @@ public function checkDocServiceUrl($urlGenerator, $crypt) { try { if (preg_match("/^https:\/\//i", $urlGenerator->getAbsoluteURL("/")) - && preg_match("/^http:\/\//i", $this->config->GetDocumentServerUrl())) { + && preg_match("/^http:\/\//i", $this->config->getDocumentServerUrl())) { throw new \Exception($this->trans->t("Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required.")); } } catch (\Exception $e) { @@ -398,18 +398,18 @@ public function checkDocServiceUrl($urlGenerator, $crypt) { } try { - $healthcheckResponse = $this->HealthcheckRequest(); + $healthcheckResponse = $this->healthcheckRequest(); if (!$healthcheckResponse) { throw new \Exception($this->trans->t("Bad healthcheck status")); } } catch (\Exception $e) { - $logger->logException($e, ["message" => "HealthcheckRequest on check error", "app" => self::$appName]); + $logger->logException($e, ["message" => "healthcheckRequest on check error", "app" => self::$appName]); return [$e->getMessage(), $version]; } try { - $commandResponse = $this->CommandRequest("version"); - $logger->debug("CommandRequest on check: " . json_encode($commandResponse), ["app" => self::$appName]); + $commandResponse = $this->commandRequest("version"); + $logger->debug("commandRequest on check: " . json_encode($commandResponse), ["app" => self::$appName]); if (empty($commandResponse)) { throw new \Exception($this->trans->t("Error occurred in the document service")); } @@ -419,30 +419,30 @@ public function checkDocServiceUrl($urlGenerator, $crypt) { throw new \Exception($this->trans->t("Not supported version")); } } catch (\Exception $e) { - $logger->logException($e, ["message" => "CommandRequest on check error", "app" => self::$appName]); + $logger->logException($e, ["message" => "commandRequest on check error", "app" => self::$appName]); return [$e->getMessage(), $version]; } $convertedFileUri = null; try { - $hashUrl = $crypt->GetHash(["action" => "empty"]); + $hashUrl = $crypt->getHash(["action" => "empty"]); $fileUrl = $urlGenerator->linkToRouteAbsolute(self::$appName . ".callback.emptyfile", ["doc" => $hashUrl]); - if (!$this->config->UseDemo() && !empty($this->config->GetStorageUrl())) { - $fileUrl = str_replace($urlGenerator->getAbsoluteURL("/"), $this->config->GetStorageUrl(), $fileUrl); + if (!$this->config->useDemo() && !empty($this->config->getStorageUrl())) { + $fileUrl = str_replace($urlGenerator->getAbsoluteURL("/"), $this->config->getStorageUrl(), $fileUrl); } - $convertedFileUri = $this->GetConvertedUri($fileUrl, "docx", "docx", "check_" . rand()); + $convertedFileUri = $this->getConvertedUri($fileUrl, "docx", "docx", "check_" . rand()); if (strcmp($convertedFileUri, $fileUrl) === 0) { - $logger->debug("GetConvertedUri skipped", ["app" => self::$appName]); + $logger->debug("getConvertedUri skipped", ["app" => self::$appName]); } } catch (\Exception $e) { - $logger->logException($e, ["message" => "GetConvertedUri on check error", "app" => self::$appName]); + $logger->logException($e, ["message" => "getConvertedUri on check error", "app" => self::$appName]); return [$e->getMessage(), $version]; } try { - $this->Request($convertedFileUri); + $this->request($convertedFileUri); } catch (\Exception $e) { $logger->logException($e, ["message" => "Request converted file on check error", "app" => self::$appName]); return [$e->getMessage(), $version]; diff --git a/lib/extrapermissions.php b/lib/extrapermissions.php index 3f6d9792..2e8c89be 100644 --- a/lib/extrapermissions.php +++ b/lib/extrapermissions.php @@ -401,7 +401,7 @@ private function validation($share, $checkExtra) { $node = $share->getNode(); $ext = strtolower(pathinfo($node->getName(), PATHINFO_EXTENSION)); - $format = !empty($ext) && array_key_exists($ext, $this->config->FormatsSetting()) ? $this->config->FormatsSetting()[$ext] : null; + $format = !empty($ext) && array_key_exists($ext, $this->config->formatsSetting()) ? $this->config->formatsSetting()[$ext] : null; if (!isset($format)) { return [$availableExtra, $defaultExtra]; } diff --git a/lib/filecreator.php b/lib/filecreator.php index 732ef332..6d4c4752 100644 --- a/lib/filecreator.php +++ b/lib/filecreator.php @@ -136,7 +136,7 @@ public function create(File $file, string $creatorId = null, string $templateId $this->logger->debug("FileCreator: " . $file->getId() . " " . $file->getName() . " $creatorId $templateId", ["app" => $this->appName]); $fileName = $file->getName(); - $template = TemplateManager::GetEmptyTemplate($fileName); + $template = TemplateManager::getEmptyTemplate($fileName); if (!$template) { $this->logger->error("FileCreator: Template for file creation not found: $templateId", ["app" => $this->appName]); diff --git a/lib/fileutility.php b/lib/fileutility.php index e4d4b35a..1cf35259 100644 --- a/lib/fileutility.php +++ b/lib/fileutility.php @@ -228,7 +228,7 @@ public function getKey($file, $origin = false) { $key = KeyManager::get($fileId); if (empty($key)) { - $instanceId = $this->config->GetSystemValue("instanceid", true); + $instanceId = $this->config->getSystemValue("instanceid", true); $key = $instanceId . "_" . $this->GUID(); @@ -259,7 +259,7 @@ private function GUID() { * @return string */ public function getVersionKey($version) { - $instanceId = $this->config->GetSystemValue("instanceid", true); + $instanceId = $this->config->getSystemValue("instanceid", true); $key = $instanceId . "_" . $version->getSourceFile()->getEtag() . "_" . $version->getRevisionId(); diff --git a/lib/listeners/directeditorlistener.php b/lib/listeners/directeditorlistener.php index 4c1de5a1..afc9bb89 100644 --- a/lib/listeners/directeditorlistener.php +++ b/lib/listeners/directeditorlistener.php @@ -62,8 +62,8 @@ public function handle(Event $event): void { return; } - if (!empty($this->appConfig->GetDocumentServerUrl()) - && $this->appConfig->SettingsAreSuccessful()) { + if (!empty($this->appConfig->getDocumentServerUrl()) + && $this->appConfig->settingsAreSuccessful()) { $event->register($this->editor); } } diff --git a/lib/listeners/filesharinglistener.php b/lib/listeners/filesharinglistener.php index a2273788..146cee41 100644 --- a/lib/listeners/filesharinglistener.php +++ b/lib/listeners/filesharinglistener.php @@ -76,11 +76,11 @@ public function handle(Event $event): void { return; } - if (!empty($this->appConfig->GetDocumentServerUrl()) - && $this->appConfig->SettingsAreSuccessful()) { + if (!empty($this->appConfig->getDocumentServerUrl()) + && $this->appConfig->settingsAreSuccessful()) { Util::addScript("onlyoffice", "main"); - if ($this->appConfig->GetSameTab()) { + if ($this->appConfig->getSameTab()) { Util::addScript("onlyoffice", "listener"); } diff --git a/lib/listeners/fileslistener.php b/lib/listeners/fileslistener.php index 2d2c15cf..bb9d8928 100644 --- a/lib/listeners/fileslistener.php +++ b/lib/listeners/fileslistener.php @@ -76,18 +76,18 @@ public function handle(Event $event): void { return; } - if (!empty($this->appConfig->GetDocumentServerUrl()) - && $this->appConfig->SettingsAreSuccessful() + if (!empty($this->appConfig->getDocumentServerUrl()) + && $this->appConfig->settingsAreSuccessful() && $this->appConfig->isUserAllowedToUse()) { Util::addScript("onlyoffice", "desktop"); Util::addScript("onlyoffice", "main"); Util::addScript("onlyoffice", "template"); - if ($this->appConfig->GetSameTab()) { + if ($this->appConfig->getSameTab()) { Util::addScript("onlyoffice", "listener"); } - if ($this->appConfig->GetAdvanced() + if ($this->appConfig->getAdvanced() && \OC::$server->getAppManager()->isInstalled("files_sharing")) { Util::addScript("onlyoffice", "share"); Util::addStyle("onlyoffice", "share"); diff --git a/lib/listeners/viewerlistener.php b/lib/listeners/viewerlistener.php index c04b4b69..d4624795 100644 --- a/lib/listeners/viewerlistener.php +++ b/lib/listeners/viewerlistener.php @@ -77,8 +77,8 @@ public function handle(Event $event): void { return; } - if (!empty($this->appConfig->GetDocumentServerUrl()) - && $this->appConfig->SettingsAreSuccessful() + if (!empty($this->appConfig->getDocumentServerUrl()) + && $this->appConfig->settingsAreSuccessful() && $this->appConfig->isUserAllowedToUse()) { Util::addScript("onlyoffice", "viewer", "viewer"); Util::addScript("onlyoffice", "listener", "viewer"); diff --git a/lib/listeners/widgetlistener.php b/lib/listeners/widgetlistener.php index ccd80ebe..4ccc7258 100644 --- a/lib/listeners/widgetlistener.php +++ b/lib/listeners/widgetlistener.php @@ -50,8 +50,8 @@ public function handle(Event $event): void { return; } - if (!empty($this->appConfig->GetDocumentServerUrl()) - && $this->appConfig->SettingsAreSuccessful() + if (!empty($this->appConfig->getDocumentServerUrl()) + && $this->appConfig->settingsAreSuccessful() && $this->appConfig->isUserAllowedToUse()) { Util::addScript("onlyoffice", "desktop"); } diff --git a/lib/preview.php b/lib/preview.php index 0b877bc6..5b280035 100644 --- a/lib/preview.php +++ b/lib/preview.php @@ -221,12 +221,12 @@ public function getMimeType() { * @return bool */ public function isAvailable(FileInfo $fileInfo) { - if ($this->config->GetPreview() !== true) { + if ($this->config->getPreview() !== true) { return false; } if (!$fileInfo || $fileInfo->getSize() === 0 - || $fileInfo->getSize() > $this->config->GetLimitThumbSize()) { + || $fileInfo->getSize() > $this->config->getLimitThumbSize()) { return false; } if (!in_array($fileInfo->getMimetype(), self::$capabilities, true)) { @@ -260,14 +260,14 @@ public function getThumbnail($path, $maxX, $maxY, $scalingup, $view) { $imageUrl = null; $documentService = new DocumentService($this->trans, $this->config); try { - $imageUrl = $documentService->GetConvertedUri($fileUrl, $extension, self::THUMBEXTENSION, $key); + $imageUrl = $documentService->getConvertedUri($fileUrl, $extension, self::THUMBEXTENSION, $key); } catch (\Exception $e) { - $this->logger->logException($e, ["message" => "GetConvertedUri: from $extension to " . self::THUMBEXTENSION, "app" => $this->appName]); + $this->logger->logException($e, ["message" => "getConvertedUri: from $extension to " . self::THUMBEXTENSION, "app" => $this->appName]); return false; } try { - $thumbnail = $documentService->Request($imageUrl); + $thumbnail = $documentService->request($imageUrl); } catch (\Exception $e) { $this->logger->logException($e, ["message" => "Failed to download thumbnail", "app" => $this->appName]); return false; @@ -313,12 +313,12 @@ private function getUrl($file, $user = null, $version = 0, $template = false) { $data["template"] = true; } - $hashUrl = $this->crypt->GetHash($data); + $hashUrl = $this->crypt->getHash($data); $fileUrl = $this->urlGenerator->linkToRouteAbsolute($this->appName . ".callback.download", ["doc" => $hashUrl]); - if (!$this->config->UseDemo() && !empty($this->config->GetStorageUrl())) { - $fileUrl = str_replace($this->urlGenerator->getAbsoluteURL("/"), $this->config->GetStorageUrl(), $fileUrl); + if (!$this->config->useDemo() && !empty($this->config->getStorageUrl())) { + $fileUrl = str_replace($this->urlGenerator->getAbsoluteURL("/"), $this->config->getStorageUrl(), $fileUrl); } return $fileUrl; @@ -369,17 +369,17 @@ private function getFileParam($path, $view) { $versionId = $version->getRevisionId(); if (strcmp($versionId, $fileVersion) === 0) { $key = $this->fileUtility->getVersionKey($version); - $key = DocumentService::GenerateRevisionId($key); + $key = DocumentService::generateRevisionId($key); break; } } } else { $key = $this->fileUtility->getKey($fileInfo); - $key = DocumentService::GenerateRevisionId($key); + $key = DocumentService::generateRevisionId($key); } - if (TemplateManager::IsTemplate($fileInfo->getId())) { + if (TemplateManager::isTemplate($fileInfo->getId())) { $template = true; } diff --git a/lib/settingsdata.php b/lib/settingsdata.php index 506627c7..484496c9 100644 --- a/lib/settingsdata.php +++ b/lib/settingsdata.php @@ -34,8 +34,8 @@ public function __construct(AppConfig $appConfig) { public function jsonSerialize(): array { $data = [ - "formats" => $this->appConfig->FormatsSetting(), - "sameTab" => $this->appConfig->GetSameTab() + "formats" => $this->appConfig->formatsSetting(), + "sameTab" => $this->appConfig->getSameTab() ]; return $data; diff --git a/lib/templatemanager.php b/lib/templatemanager.php index 000b9a2e..d8605ef5 100644 --- a/lib/templatemanager.php +++ b/lib/templatemanager.php @@ -49,8 +49,8 @@ class TemplateManager { * * @return Folder */ - public static function GetGlobalTemplateDir() { - $dirPath = "appdata_" . \OC::$server->getConfig()->GetSystemValue("instanceid", null) + public static function getGlobalTemplateDir() { + $dirPath = "appdata_" . \OC::$server->getConfig()->getSystemValue("instanceid", null) . "/" . self::$appName . "/" . self::$templateFolderName; @@ -72,8 +72,8 @@ public static function GetGlobalTemplateDir() { * * @return array */ - public static function GetGlobalTemplates($mimetype = null) { - $templateDir = self::GetGlobalTemplateDir(); + public static function getGlobalTemplates($mimetype = null) { + $templateDir = self::getGlobalTemplateDir(); $templatesList = $templateDir->getDirectoryListing(); if (!empty($mimetype) @@ -91,7 +91,7 @@ public static function GetGlobalTemplates($mimetype = null) { * * @return File */ - public static function GetTemplate($templateId) { + public static function getTemplate($templateId) { $logger = \OC::$server->getLogger(); if (empty($templateId)) { @@ -99,11 +99,11 @@ public static function GetTemplate($templateId) { return null; } - $templateDir = self::GetGlobalTemplateDir(); + $templateDir = self::getGlobalTemplateDir(); try { $templates = $templateDir->getById($templateId); } catch (\Exception $e) { - $logger->logException($e, ["message" => "GetTemplate: $templateId", "app" => self::$appName]); + $logger->logException($e, ["message" => "getTemplate: $templateId", "app" => self::$appName]); return null; } @@ -121,7 +121,7 @@ public static function GetTemplate($templateId) { * * @return string */ - public static function GetTypeTemplate($mime) { + public static function getTypeTemplate($mime) { switch ($mime) { case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return "document"; @@ -141,7 +141,7 @@ public static function GetTypeTemplate($mime) { * * @return string */ - public static function GetMimeTemplate($type) { + public static function getMimeTemplate($type) { switch ($type) { case "document": return "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; @@ -161,7 +161,7 @@ public static function GetMimeTemplate($type) { * * @return bool */ - public static function IsTemplateType($name) { + public static function isTemplateType($name) { $ext = strtolower(pathinfo($name, PATHINFO_EXTENSION)); switch ($ext) { case "docx": @@ -180,8 +180,8 @@ public static function IsTemplateType($name) { * * @return bool */ - public static function IsTemplate($fileId) { - $template = self::GetTemplate($fileId); + public static function isTemplate($fileId) { + $template = self::getTemplate($fileId); if (empty($template)) { return false; @@ -197,12 +197,12 @@ public static function IsTemplate($fileId) { * * @return string */ - public static function GetEmptyTemplate($name) { + public static function getEmptyTemplate($name) { $ext = strtolower("." . pathinfo($name, PATHINFO_EXTENSION)); $lang = \OC::$server->getL10NFactory("")->get("")->getLanguageCode(); - $templatePath = self::GetEmptyTemplatePath($lang, $ext); + $templatePath = self::getEmptyTemplatePath($lang, $ext); if (!file_exists($templatePath)) { return false; } @@ -219,7 +219,7 @@ public static function GetEmptyTemplate($name) { * * @return string */ - public static function GetEmptyTemplatePath($lang, $ext) { + public static function getEmptyTemplatePath($lang, $ext) { if (!array_key_exists($lang, self::$localPath)) { $lang = "en"; } diff --git a/lib/templateprovider.php b/lib/templateprovider.php index fd80ec8a..b33735c3 100644 --- a/lib/templateprovider.php +++ b/lib/templateprovider.php @@ -59,7 +59,7 @@ public function __construct($AppName, IURLGenerator $urlGenerator) { public function getCustomTemplates($mimetype) : array { $templates = []; - $templateFiles = TemplateManager::GetGlobalTemplates($mimetype); + $templateFiles = TemplateManager::getGlobalTemplates($mimetype); foreach ($templateFiles as $templateFile) { $template = new Template( @@ -84,6 +84,6 @@ public function getCustomTemplates($mimetype) : array { * @return File */ public function getCustomTemplate($templateId) : File { - return TemplateManager::GetTemplate($templateId); + return TemplateManager::getTemplate($templateId); } }