Skip to content

Commit

Permalink
correct camelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
rivexe committed Oct 10, 2023
1 parent f1ec41e commit 5d7661f
Show file tree
Hide file tree
Showing 27 changed files with 382 additions and 382 deletions.
8 changes: 4 additions & 4 deletions appinfo/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down Expand Up @@ -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);
}
Expand All @@ -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");
Expand Down
48 changes: 24 additions & 24 deletions controller/callbackcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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) {
Expand Down Expand Up @@ -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();
Expand All @@ -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);

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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]);
Expand Down Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit 5d7661f

Please sign in to comment.