1
0
mirror of https://github.com/ONLYOFFICE/onlyoffice-owncloud.git synced 2025-07-31 21:44:24 +03:00

camelCase format for methods names, no prefixes with an underscore for variables

This commit is contained in:
rivexe
2023-12-20 13:14:38 +03:00
parent c568f47c16
commit 198e86aa1e
18 changed files with 375 additions and 375 deletions

View File

@ -80,8 +80,8 @@ class Application extends App {
$eventDispatcher->addListener(
"OCA\Files::loadAdditionalScripts",
function () {
if (!empty($this->appConfig->GetDocumentServerUrl())
&& $this->appConfig->SettingsAreSuccessful()
if (!empty($this->appConfig->getDocumentServerUrl())
&& $this->appConfig->settingsAreSuccessful()
&& $this->appConfig->isUserAllowedToUse()
) {
Util::addScript("onlyoffice", "desktop");
@ -89,7 +89,7 @@ class Application extends App {
Util::addScript("onlyoffice", "share");
Util::addScript("onlyoffice", "template");
if ($this->appConfig->GetSameTab()) {
if ($this->appConfig->getSameTab()) {
Util::addScript("onlyoffice", "listener");
}
@ -110,7 +110,7 @@ class Application extends App {
include_once __DIR__ . "/../3rdparty/jwt/Key.php";
// 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();
$container = $this->getContainer();
@ -123,7 +123,7 @@ class Application extends App {
$detector->registerType("oform", "application/vnd.openxmlformats-officedocument.wordprocessingml.document.oform");
$previewManager = $container->query(IPreview::class);
if ($this->appConfig->GetPreview()) {
if ($this->appConfig->getPreview()) {
$previewManager->registerProvider(
Preview::getMimeTypeRegex(), function () use ($container) {
return $container->query(Preview::class);

View File

@ -177,7 +177,7 @@ class CallbackController extends Controller {
* @CORS
*/
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);
@ -196,8 +196,8 @@ class CallbackController extends Controller {
if (!$this->userSession->isLoggedIn()
&& !$changes
) {
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);
@ -206,7 +206,7 @@ class CallbackController extends Controller {
$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);
@ -324,7 +324,7 @@ class CallbackController extends Controller {
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);
@ -334,8 +334,8 @@ class CallbackController extends Controller {
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);
@ -344,14 +344,14 @@ class CallbackController extends Controller {
$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) {
@ -391,7 +391,7 @@ class CallbackController extends Controller {
* @CORS
*/
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);
@ -404,16 +404,16 @@ class CallbackController extends Controller {
$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);
@ -422,7 +422,7 @@ class CallbackController extends Controller {
$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) {
@ -511,7 +511,7 @@ class CallbackController extends Controller {
return $error;
}
$url = $this->config->ReplaceDocumentServerUrlToInternal($url);
$url = $this->config->replaceDocumentServerUrlToInternal($url);
$prevVersion = $file->getFileInfo()->getMtime();
$fileName = $file->getName();
@ -520,18 +520,18 @@ class CallbackController extends Controller {
$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);
@ -563,17 +563,17 @@ class CallbackController extends Controller {
if (!$isForcesave
&& !$prevIsForcesave
&& $this->versionManager->available
&& $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);
}
@ -617,7 +617,7 @@ class CallbackController extends Controller {
}
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]);
@ -760,7 +760,7 @@ class CallbackController extends Controller {
* @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) {

View File

@ -206,7 +206,7 @@ class EditorApiController extends OCSController {
}
$name = $file->getName();
$template = TemplateManager::GetEmptyTemplate($name);
$template = TemplateManager::getEmptyTemplate($name);
if (!$template) {
$this->logger->error("Template for file filling not found: $name ($fileId)", ["app" => $this->appName]);
@ -267,7 +267,7 @@ class EditorApiController extends OCSController {
$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")]);
@ -293,7 +293,7 @@ class EditorApiController extends OCSController {
if ($key === null) {
$key = $this->fileUtility->getKey($file, true);
}
$key = DocumentService::GenerateRevisionId($key);
$key = DocumentService::generateRevisionId($key);
$params = [
"document" => [
@ -304,7 +304,7 @@ class EditorApiController extends OCSController {
"url" => $fileUrl,
"referenceData" => [
"fileKey" => $file->getId(),
"instanceId" => $this->config->GetSystemValue("instanceid", true),
"instanceId" => $this->config->getSystemValue("instanceid", true),
],
],
"documentType" => $format["type"],
@ -391,7 +391,7 @@ class EditorApiController extends OCSController {
}
$canProtect = true;
if ($this->config->GetProtection() === "owner") {
if ($this->config->getProtection() === "owner") {
$canProtect = $ownerId === $userId;
}
$params["document"]["permissions"]["protect"] = $canProtect;
@ -401,11 +401,11 @@ class EditorApiController extends OCSController {
$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;
@ -487,7 +487,7 @@ class EditorApiController extends OCSController {
$params["editorConfig"]["createUrl"] = urldecode($createUrl);
$templatesList = TemplateManager::GetGlobalTemplates($file->getMimeType());
$templatesList = TemplateManager::getGlobalTemplates($file->getMimeType());
if (!empty($templatesList)) {
$templates = [];
foreach ($templatesList as $templateItem) {
@ -513,14 +513,14 @@ class EditorApiController extends OCSController {
}
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) {
if ($this->config->GetSameTab()) {
if ($this->config->getSameTab()) {
$params["editorConfig"]["customization"]["goback"]["blank"] = false;
if ($inframe === true) {
$params["editorConfig"]["customization"]["goback"]["requestClose"] = true;
@ -535,8 +535,8 @@ class EditorApiController extends OCSController {
$params = $this->setCustomization($params);
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) {
@ -549,8 +549,8 @@ class EditorApiController extends OCSController {
}
}
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;
}
@ -575,7 +575,7 @@ class EditorApiController extends OCSController {
}
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]);
@ -642,12 +642,12 @@ class EditorApiController extends OCSController {
$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;
@ -661,7 +661,7 @@ class EditorApiController extends OCSController {
* @return string
*/
private function buildUserId($userId) {
$instanceId = $this->config->GetSystemValue("instanceid", true);
$instanceId = $this->config->getSystemValue("instanceid", true);
$userId = $instanceId . "_" . $userId;
return $userId;
}
@ -675,84 +675,84 @@ class EditorApiController extends OCSController {
*/
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;
}

View File

@ -249,7 +249,7 @@ class EditorController extends Controller {
}
if (!empty($templateId)) {
$templateFile = TemplateManager::GetTemplate($templateId);
$templateFile = TemplateManager::getTemplate($templateId);
if ($templateFile) {
$template = $templateFile->getContent();
}
@ -271,14 +271,14 @@ class EditorController extends Controller {
$ext = strtolower(pathinfo($name, PATHINFO_EXTENSION));
$documentService = new DocumentService($this->trans, $this->config);
try {
$newFileUri = $documentService->GetConvertedUri($fileUrl, $targetExt, $ext, $targetKey);
$newFileUri = $documentService->getConvertedUri($fileUrl, $targetExt, $ext, $targetKey);
} 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) {
@ -570,7 +570,7 @@ class EditorController extends Controller {
$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);
}
@ -601,13 +601,13 @@ class EditorController extends Controller {
"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;
}
@ -657,7 +657,7 @@ class EditorController extends Controller {
$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")];
@ -683,9 +683,9 @@ class EditorController extends Controller {
$key = $this->fileUtility->getKey($file);
$fileUrl = $this->getUrl($file, $user, $shareToken);
try {
$newFileUri = $documentService->GetConvertedUri($fileUrl, $ext, $internalExtension, $key);
$newFileUri = $documentService->getConvertedUri($fileUrl, $ext, $internalExtension, $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 ["error" => $e->getMessage()];
}
@ -695,7 +695,7 @@ class EditorController extends Controller {
}
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")];
@ -755,11 +755,11 @@ class EditorController extends Controller {
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", "app" => $this->appName]);
return ["error" => $this->trans->t("Download failed")];
@ -795,7 +795,7 @@ class EditorController extends Controller {
* @NoAdminRequired
*/
public function history($fileId) {
$this->logger->debug("Request history for: $fileId", ["app" => $this->appName]);
$this->logger->debug("request history for: $fileId", ["app" => $this->appName]);
if (!$this->config->isUserAllowedToUse()) {
return ["error" => $this->trans->t("Not permitted")];
@ -839,7 +839,7 @@ class EditorController extends Controller {
$versionNum = $versionNum + 1;
$key = $this->fileUtility->getVersionKey($version);
$key = DocumentService::GenerateRevisionId($key);
$key = DocumentService::generateRevisionId($key);
$historyItem = [
"created" => $version->getTimestamp(),
@ -870,7 +870,7 @@ class EditorController extends Controller {
}
$key = $this->fileUtility->getKey($file, true);
$key = DocumentService::GenerateRevisionId($key);
$key = DocumentService::generateRevisionId($key);
$historyItem = [
"created" => $file->getMTime(),
@ -915,7 +915,7 @@ class EditorController extends Controller {
* @NoAdminRequired
*/
public function version($fileId, $version) {
$this->logger->debug("Request version for: $fileId ($version)", ["app" => $this->appName]);
$this->logger->debug("request version for: $fileId ($version)", ["app" => $this->appName]);
if (!$this->config->isUserAllowedToUse()) {
return ["error" => $this->trans->t("Not permitted")];
@ -967,7 +967,7 @@ class EditorController extends Controller {
$fileUrl = $this->getUrl($file, $user, null, $version);
}
$key = DocumentService::GenerateRevisionId($key);
$key = DocumentService::generateRevisionId($key);
$fileName = $file->getName();
$ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
@ -987,7 +987,7 @@ class EditorController extends Controller {
$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);
@ -998,8 +998,8 @@ class EditorController extends Controller {
];
}
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;
}
@ -1018,7 +1018,7 @@ class EditorController extends Controller {
* @PublicPage
*/
public function restore($fileId, $version) {
$this->logger->debug("Request restore version for: $fileId ($version)", ["app" => $this->appName]);
$this->logger->debug("request restore version for: $fileId ($version)", ["app" => $this->appName]);
if (!$this->config->isUserAllowedToUse()) {
return ["error" => $this->trans->t("Not permitted")];
@ -1070,7 +1070,7 @@ class EditorController extends Controller {
* @NoAdminRequired
*/
public function url($filePath) {
$this->logger->debug("Request url for: $filePath", ["app" => $this->appName]);
$this->logger->debug("request url for: $filePath", ["app" => $this->appName]);
if (!$this->config->isUserAllowedToUse()) {
return ["error" => $this->trans->t("Not permitted")];
@ -1100,8 +1100,8 @@ class EditorController extends Controller {
"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;
}
@ -1128,7 +1128,7 @@ class EditorController extends Controller {
}
if ($template) {
$templateFile = TemplateManager::GetTemplate($fileId);
$templateFile = TemplateManager::getTemplate($fileId);
if (empty($templateFile)) {
$this->logger->info("Download: template not found: $fileId", ["app" => $this->appName]);
@ -1172,14 +1172,14 @@ class EditorController extends Controller {
$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"));
@ -1188,7 +1188,7 @@ class EditorController extends Controller {
$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"]);
}
@ -1233,7 +1233,7 @@ class EditorController extends Controller {
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]);
@ -1286,7 +1286,7 @@ class EditorController extends Controller {
* @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);
}
@ -1306,7 +1306,7 @@ class EditorController extends Controller {
}
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]);
@ -1373,12 +1373,12 @@ class EditorController extends Controller {
$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;
@ -1392,7 +1392,7 @@ class EditorController extends Controller {
* @return string
*/
private function buildUserId($userId) {
$instanceId = $this->config->GetSystemValue("instanceid", true);
$instanceId = $this->config->getSystemValue("instanceid", true);
$userId = $instanceId . "_" . $userId;
return $userId;
}

View File

@ -106,7 +106,7 @@ class FederationController extends OCSController {
$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]);

View File

@ -111,7 +111,7 @@ class JobListController extends Controller {
* @return void
*/
private function checkEditorsCheckJob() {
if ($this->config->GetEditorsCheckInterval() > 0) {
if ($this->config->getEditorsCheckInterval() > 0) {
$this->addJob(EditorsCheck::class);
} else {
$this->removeJob(EditorsCheck::class);

View File

@ -71,9 +71,9 @@ class SettingsApiController extends OCSController {
* @NoAdminRequired
* @CORS
*/
public function GetDocServerUrl() {
$url = $this->config->GetDocumentServerUrl();
if (!$this->config->SettingsAreSuccessful()) {
public function getDocServerUrl() {
$url = $this->config->getDocumentServerUrl();
if (!$this->config->settingsAreSuccessful()) {
$url = "";
} elseif (!preg_match("/^https?:\/\//i", $url)) {
$url = $this->urlGenerator->getAbsoluteURL($url);

View File

@ -106,34 +106,34 @@ class SettingsController extends Controller {
*/
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(),
"versionHistory" => $this->config->GetVersionHistory(),
"protection" => $this->config->GetProtection(),
"formats" => $this->config->formatsSetting(),
"sameTab" => $this->config->getSameTab(),
"preview" => $this->config->getPreview(),
"versionHistory" => $this->config->getVersionHistory(),
"protection" => $this->config->getProtection(),
"encryption" => $this->config->checkEncryptionModule(),
"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(),
"plugins" => $this->config->GetCustomizationPlugins(),
"macros" => $this->config->GetCustomizationMacros(),
"reviewDisplay" => $this->config->GetCustomizationReviewDisplay(),
"theme" => $this->config->GetCustomizationTheme(),
"templates" => $this->GetGlobalTemplates(),
"linkToDocs" => $this->config->GetLinkToDocs()
"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(),
"plugins" => $this->config->getCustomizationPlugins(),
"macros" => $this->config->getCustomizationMacros(),
"reviewDisplay" => $this->config->getCustomizationReviewDisplay(),
"theme" => $this->config->getCustomizationTheme(),
"templates" => $this->getGlobalTemplates(),
"linkToDocs" => $this->config->getLinkToDocs()
];
return new TemplateResponse($this->appName, "settings", $data, "blank");
}
@ -151,7 +151,7 @@ class SettingsController extends Controller {
*
* @return array
*/
public function SaveAddress(
public function saveAddress(
$documentserver,
$documentserverInternal,
$storageUrl,
@ -161,25 +161,25 @@ class SettingsController extends Controller {
$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);
}
if ($this->config->checkEncryptionModule() === true) {
@ -188,12 +188,12 @@ class SettingsController extends Controller {
}
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,
];
@ -219,7 +219,7 @@ class SettingsController extends Controller {
*
* @return array
*/
public function SaveCommon(
public function saveCommon(
$defFormats,
$editFormats,
$sameTab,
@ -235,20 +235,20 @@ class SettingsController extends Controller {
$reviewDisplay,
$theme
) {
$this->config->SetDefaultFormats($defFormats);
$this->config->SetEditableFormats($editFormats);
$this->config->SetSameTab($sameTab);
$this->config->SetPreview($preview);
$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->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 [
];
@ -263,14 +263,14 @@ class SettingsController extends Controller {
*
* @return array
*/
public function SaveSecurity(
public function saveSecurity(
$plugins,
$macros,
$protection
) {
$this->config->SetCustomizationPlugins($plugins);
$this->config->SetCustomizationMacros($macros);
$this->config->SetProtection($protection);
$this->config->setCustomizationPlugins($plugins);
$this->config->setCustomizationMacros($macros);
$this->config->setProtection($protection);
return [
];
@ -281,7 +281,7 @@ class SettingsController extends Controller {
*
* @return array
*/
public function ClearHistory() {
public function clearHistory() {
FileVersions::clearHistory();
return [
@ -296,11 +296,11 @@ class SettingsController extends Controller {
* @NoAdminRequired
* @PublicPage
*/
public function GetSettings() {
public function getSettings() {
$result = [
"formats" => $this->config->FormatsSetting(),
"sameTab" => $this->config->GetSameTab(),
"shareAttributesVersion" => $this->config->ShareAttributesVersion()
"formats" => $this->config->formatsSetting(),
"sameTab" => $this->config->getSameTab(),
"shareAttributesVersion" => $this->config->shareAttributesVersion()
];
return $result;
}
@ -310,15 +310,15 @@ class SettingsController extends Controller {
*
* @return array
*/
private function GetGlobalTemplates() {
private function getGlobalTemplates() {
$templates = [];
$templatesList = TemplateManager::GetGlobalTemplates();
$templatesList = TemplateManager::getGlobalTemplates();
foreach ($templatesList as $templateItem) {
$template = [
"id" => $templateItem->getId(),
"name" => $templateItem->getName(),
"type" => TemplateManager::GetTypeTemplate($templateItem->getMimeType())
"type" => TemplateManager::getTypeTemplate($templateItem->getMimeType())
];
array_push($templates, $template);
}

View File

@ -70,15 +70,15 @@ class TemplateController extends Controller {
*
* @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);
}
@ -91,18 +91,18 @@ class TemplateController extends Controller {
*
* @return array
*/
public function AddTemplate() {
public function addTemplate() {
$file = $this->request->getUploadedFile("file");
if ($file !== null) {
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")
@ -117,7 +117,7 @@ class TemplateController extends Controller {
$result = [
"id" => $fileInfo->getId(),
"name" => $fileInfo->getName(),
"type" => TemplateManager::GetTypeTemplate($fileInfo->getMimeType())
"type" => TemplateManager::getTypeTemplate($fileInfo->getMimeType())
];
$this->logger->debug("Template: added " . $fileInfo->getName(), ["app" => $this->appName]);
@ -138,13 +138,13 @@ class TemplateController extends Controller {
*
* @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")
];

View File

@ -233,70 +233,70 @@ class AppConfig {
*
* @var string
*/
public $_limitThumbSize = "limit_thumb_size";
public $limitThumbSize = "limit_thumb_size";
/**
* The config key for the customer
*
* @var string
*/
public $_customization_customer = "customization_customer";
public $customization_customer = "customization_customer";
/**
* The config key for the loaderLogo
*
* @var string
*/
public $_customization_loaderLogo = "customization_loaderLogo";
public $customization_loaderLogo = "customization_loaderLogo";
/**
* The config key for the loaderName
*
* @var string
*/
public $_customization_loaderName = "customization_loaderName";
public $customization_loaderName = "customization_loaderName";
/**
* The config key for the logo
*
* @var string
*/
public $_customization_logo = "customization_logo";
public $customization_logo = "customization_logo";
/**
* The config key for the zoom
*
* @var string
*/
public $_customization_zoom = "customization_zoom";
public $customization_zoom = "customization_zoom";
/**
* The config key for the autosave
*
* @var string
*/
public $_customization_autosave = "customization_autosave";
public $customization_autosave = "customization_autosave";
/**
* The config key for the goback
*
* @var string
*/
public $_customization_goback = "customization_goback";
public $customization_goback = "customization_goback";
/**
* The config key for the macros
*
* @var string
*/
public $_customization_macros = "customization_macros";
public $customization_macros = "customization_macros";
/**
* The config key for the plugins
*
* @var string
*/
public $_customizationPlugins = "customization_plugins";
public $customizationPlugins = "customization_plugins";
/**
* The config key for the interval of editors availability check by cron
@ -323,7 +323,7 @@ class AppConfig {
*
* @return string
*/
public function GetSystemValue($key, $system = false) {
public function getSystemValue($key, $system = false) {
if ($system) {
return $this->config->getSystemValue($key);
}
@ -342,10 +342,10 @@ class AppConfig {
*
* @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]);
@ -366,7 +366,7 @@ class AppConfig {
*
* @return array
*/
public function GetDemoData() {
public function getDemoData() {
$data = $this->config->getAppValue($this->appName, $this->_demo, "");
if (empty($data)) {
@ -395,8 +395,8 @@ class AppConfig {
*
* @return bool
*/
public function UseDemo() {
return $this->GetDemoData()["enabled"] === true;
public function useDemo() {
return $this->getDemoData()["enabled"] === true;
}
/**
@ -406,7 +406,7 @@ class AppConfig {
*
* @return void
*/
public function SetDocumentServerUrl($documentServer) {
public function setDocumentServerUrl($documentServer) {
$documentServer = trim($documentServer);
if (\strlen($documentServer) > 0) {
$documentServer = rtrim($documentServer, "/") . "/";
@ -415,7 +415,7 @@ class AppConfig {
}
}
$this->logger->info("SetDocumentServerUrl: $documentServer", ["app" => $this->appName]);
$this->logger->info("setDocumentServerUrl: $documentServer", ["app" => $this->appName]);
$this->config->setAppValue($this->appName, $this->_documentserver, $documentServer);
}
@ -427,14 +427,14 @@ class AppConfig {
*
* @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 !== "/") {
$url = rtrim($url, "/");
@ -452,7 +452,7 @@ class AppConfig {
*
* @return void
*/
public function SetDocumentServerInternalUrl($documentServerInternal) {
public function setDocumentServerInternalUrl($documentServerInternal) {
$documentServerInternal = rtrim(trim($documentServerInternal), "/");
if (\strlen($documentServerInternal) > 0) {
$documentServerInternal = $documentServerInternal . "/";
@ -461,7 +461,7 @@ class AppConfig {
}
}
$this->logger->info("SetDocumentServerInternalUrl: $documentServerInternal", ["app" => $this->appName]);
$this->logger->info("setDocumentServerInternalUrl: $documentServerInternal", ["app" => $this->appName]);
$this->config->setAppValue($this->appName, $this->_documentserverInternal, $documentServerInternal);
}
@ -473,17 +473,17 @@ class AppConfig {
*
* @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;
}
@ -495,10 +495,10 @@ class AppConfig {
*
* @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);
@ -517,11 +517,11 @@ class AppConfig {
/**
* Save the ownCloud address available from document server to the application configuration
*
* @param string $documentServer - document service address
* @param string $storageUrl - storage url
*
* @return void
*/
public function SetStorageUrl($storageUrl) {
public function setStorageUrl($storageUrl) {
$storageUrl = rtrim(trim($storageUrl), "/");
if (\strlen($storageUrl) > 0) {
$storageUrl = $storageUrl . "/";
@ -530,7 +530,7 @@ class AppConfig {
}
}
$this->logger->info("SetStorageUrl: $storageUrl", ["app" => $this->appName]);
$this->logger->info("setStorageUrl: $storageUrl", ["app" => $this->appName]);
$this->config->setAppValue($this->appName, $this->_storageUrl, $storageUrl);
}
@ -540,10 +540,10 @@ class AppConfig {
*
* @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;
}
@ -555,7 +555,7 @@ class AppConfig {
*
* @return void
*/
public function SetDocumentServerSecret($secret) {
public function setDocumentServerSecret($secret) {
$secret = trim($secret);
if (empty($secret)) {
$this->logger->info("Clear secret key", ["app" => $this->appName]);
@ -573,14 +573,14 @@ class AppConfig {
*
* @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;
}
@ -590,10 +590,10 @@ class AppConfig {
*
* @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;
}
@ -605,7 +605,7 @@ class AppConfig {
*
* @return void
*/
public function SetDefaultFormats($formats) {
public function setDefaultFormats($formats) {
$value = json_encode($formats);
$this->logger->info("Set default formats: $value", ["app" => $this->appName]);
@ -617,7 +617,7 @@ class AppConfig {
*
* @return array
*/
private function GetDefaultFormats() {
private function getDefaultFormats() {
$value = $this->config->getAppValue($this->appName, $this->_defFormats, "");
if (empty($value)) {
return [];
@ -632,7 +632,7 @@ class AppConfig {
*
* @return void
*/
public function SetEditableFormats($formats) {
public function setEditableFormats($formats) {
$value = json_encode($formats);
$this->logger->info("Set editing formats: $value", ["app" => $this->appName]);
@ -644,7 +644,7 @@ class AppConfig {
*
* @return array
*/
private function GetEditableFormats() {
private function getEditableFormats() {
$value = $this->config->getAppValue($this->appName, $this->_editFormats, "");
if (empty($value)) {
return [];
@ -659,7 +659,7 @@ class AppConfig {
*
* @return void
*/
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));
@ -670,7 +670,7 @@ class AppConfig {
*
* @return bool
*/
public function GetSameTab() {
public function getSameTab() {
return $this->config->getAppValue($this->appName, $this->_sameTab, "false") === "true";
}
@ -681,7 +681,7 @@ class AppConfig {
*
* @return bool
*/
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));
@ -692,7 +692,7 @@ class AppConfig {
*
* @return bool
*/
public function GetPreview() {
public function getPreview() {
return $this->config->getAppValue($this->appName, $this->_preview, "true") === "true";
}
@ -703,7 +703,7 @@ class AppConfig {
*
* @return void
*/
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));
@ -714,7 +714,7 @@ class AppConfig {
*
* @return bool
*/
public function GetVersionHistory() {
public function getVersionHistory() {
return $this->config->getAppValue($this->appName, $this->_versionHistory, "true") === "true";
}
@ -725,7 +725,7 @@ class AppConfig {
*
* @return void
*/
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);
@ -736,7 +736,7 @@ class AppConfig {
*
* @return string
*/
public function GetProtection() {
public function getProtection() {
$value = $this->config->getAppValue($this->appName, $this->_protection, "owner");
if ($value === "all") {
return "all";
@ -751,7 +751,7 @@ class AppConfig {
*
* @return void
*/
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));
@ -762,7 +762,7 @@ class AppConfig {
*
* @return bool
*/
public function GetCustomizationChat() {
public function getCustomizationChat() {
return $this->config->getAppValue($this->appName, $this->_customizationChat, "true") === "true";
}
@ -773,7 +773,7 @@ class AppConfig {
*
* @return void
*/
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));
@ -784,7 +784,7 @@ class AppConfig {
*
* @return bool
*/
public function GetCustomizationCompactHeader() {
public function getCustomizationCompactHeader() {
return $this->config->getAppValue($this->appName, $this->_customizationCompactHeader, "true") === "true";
}
@ -795,7 +795,7 @@ class AppConfig {
*
* @return void
*/
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));
@ -806,7 +806,7 @@ class AppConfig {
*
* @return bool
*/
public function GetCustomizationFeedback() {
public function getCustomizationFeedback() {
return $this->config->getAppValue($this->appName, $this->_customizationFeedback, "true") === "true";
}
@ -817,7 +817,7 @@ class AppConfig {
*
* @return void
*/
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));
@ -828,7 +828,7 @@ class AppConfig {
*
* @return bool
*/
public function GetCustomizationForcesave() {
public function getCustomizationForcesave() {
$value = $this->config->getAppValue($this->appName, $this->_customizationForcesave, "false") === "true";
return $value && ($this->checkEncryptionModule() === false);
@ -841,7 +841,7 @@ class AppConfig {
*
* @return void
*/
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));
@ -852,7 +852,7 @@ class AppConfig {
*
* @return bool
*/
public function GetCustomizationHelp() {
public function getCustomizationHelp() {
return $this->config->getAppValue($this->appName, $this->_customizationHelp, "true") === "true";
}
@ -863,7 +863,7 @@ class AppConfig {
*
* @return void
*/
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));
@ -874,7 +874,7 @@ class AppConfig {
*
* @return bool
*/
public function GetCustomizationToolbarNoTabs() {
public function getCustomizationToolbarNoTabs() {
return $this->config->getAppValue($this->appName, $this->_customizationToolbarNoTabs, "true") === "true";
}
@ -885,7 +885,7 @@ class AppConfig {
*
* @return void
*/
public function SetCustomizationReviewDisplay($value) {
public function setCustomizationReviewDisplay($value) {
$this->logger->info("Set review mode: " . $value, ["app" => $this->appName]);
$this->config->setAppValue($this->appName, $this->_customizationReviewDisplay, $value);
@ -896,7 +896,7 @@ class AppConfig {
*
* @return string
*/
public function GetCustomizationReviewDisplay() {
public function getCustomizationReviewDisplay() {
$value = $this->config->getAppValue($this->appName, $this->_customizationReviewDisplay, "original");
if ($value === "markup") {
return "markup";
@ -914,7 +914,7 @@ class AppConfig {
*
* @return void
*/
public function SetCustomizationTheme($value) {
public function setCustomizationTheme($value) {
$this->logger->info("Set theme: " . $value, ["app" => $this->appName]);
$this->config->setAppValue($this->appName, $this->_customizationTheme, $value);
@ -925,7 +925,7 @@ class AppConfig {
*
* @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";
@ -943,10 +943,10 @@ class AppConfig {
*
* @return void
*/
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->_customization_macros, json_encode($value));
$this->config->setAppValue($this->appName, $this->customization_macros, json_encode($value));
}
/**
@ -954,8 +954,8 @@ class AppConfig {
*
* @return bool
*/
public function GetCustomizationMacros() {
return $this->config->getAppValue($this->appName, $this->_customization_macros, "true") === "true";
public function getCustomizationMacros() {
return $this->config->getAppValue($this->appName, $this->customization_macros, "true") === "true";
}
/**
@ -965,10 +965,10 @@ class AppConfig {
*
* @return void
*/
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));
$this->config->setAppValue($this->appName, $this->customizationPlugins, json_encode($value));
}
/**
@ -976,8 +976,8 @@ class AppConfig {
*
* @return bool
*/
public function GetCustomizationPlugins() {
return $this->config->getAppValue($this->appName, $this->_customizationPlugins, "true") === "true";
public function getCustomizationPlugins() {
return $this->config->getAppValue($this->appName, $this->customizationPlugins, "true") === "true";
}
/**
@ -987,7 +987,7 @@ class AppConfig {
*
* @return void
*/
public function SetLimitGroups($groups) {
public function setLimitGroups($groups) {
if (!\is_array($groups)) {
$groups = [];
}
@ -1002,7 +1002,7 @@ class AppConfig {
*
* @return array
*/
public function GetLimitGroups() {
public function getLimitGroups() {
$value = $this->config->getAppValue($this->appName, $this->_groups, "");
if (empty($value)) {
return [];
@ -1028,7 +1028,7 @@ class AppConfig {
return false;
}
$groups = $this->GetLimitGroups();
$groups = $this->getLimitGroups();
// no group set -> all users are allowed
if (\count($groups) === 0) {
return true;
@ -1048,7 +1048,7 @@ class AppConfig {
$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;
@ -1066,8 +1066,8 @@ class AppConfig {
*
* @return void
*/
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));
}
@ -1077,14 +1077,14 @@ class AppConfig {
*
* @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);
}
/**
@ -1092,8 +1092,8 @@ class AppConfig {
*
* @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;
@ -1109,14 +1109,14 @@ class AppConfig {
*
* @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";
@ -1131,7 +1131,7 @@ class AppConfig {
*
* @return void
*/
public function SetJwtHeader($value) {
public function setJwtHeader($value) {
$value = trim($value);
if (empty($value)) {
$this->logger->info("Clear header key", ["app" => $this->appName]);
@ -1147,8 +1147,8 @@ class AppConfig {
*
* @return int
*/
public function GetJwtLeeway() {
$jwtLeeway = (integer)$this->GetSystemValue($this->_jwtLeeway);
public function getJwtLeeway() {
$jwtLeeway = (integer)$this->getSystemValue($this->_jwtLeeway);
return $jwtLeeway;
}
@ -1160,7 +1160,7 @@ class AppConfig {
*
* @return void
*/
public function SetSettingsError($value) {
public function setSettingsError($value) {
$this->config->setAppValue($this->appName, $this->_settingsError, $value);
}
@ -1169,7 +1169,7 @@ class AppConfig {
*
* @return bool
*/
public function SettingsAreSuccessful() {
public function settingsAreSuccessful() {
return empty($this->config->getAppValue($this->appName, $this->_settingsError, ""));
}
@ -1202,17 +1202,17 @@ class AppConfig {
*
* @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");
@ -1227,7 +1227,7 @@ class AppConfig {
*
* @return string
*/
public function ShareAttributesVersion() {
public function shareAttributesVersion() {
if (\version_compare(\implode(".", \OCP\Util::getVersion()), "10.3.0", ">=")) {
return "v2";
} elseif (\version_compare(\implode(".", \OCP\Util::getVersion()), "10.2.0", ">=")) {
@ -1241,8 +1241,8 @@ class AppConfig {
*
* @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;
@ -1310,7 +1310,7 @@ class AppConfig {
*
* @return string
*/
public function GetLinkToDocs() {
public function getLinkToDocs() {
return $this->linkToDocs;
}
}

View File

@ -113,7 +113,7 @@ class DocumentServer extends Command {
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("<info>Document server is not configured</info>");
return 1;
@ -123,7 +123,7 @@ class DocumentServer extends Command {
$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>Error connection: $error</error>");

View File

@ -113,7 +113,7 @@ class EditorsCheck extends TimedJob {
$this->trans = $trans;
$this->crypt = $crypt;
$this->groupManager = $groupManager;
$this->setInterval($this->config->GetEditorsCheckInterval());
$this->setInterval($this->config->getEditorsCheckInterval());
}
/**
@ -124,17 +124,17 @@ class EditorsCheck extends TimedJob {
* @return void
*/
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") {
@ -148,7 +148,7 @@ class EditorsCheck extends TimedJob {
list($error, $version) = $documentService->checkDocServiceUrl($this->urlGenerator, $this->crypt);
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]);

View File

@ -49,8 +49,8 @@ class Crypt {
*
* @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");
}
/**
@ -60,14 +60,14 @@ class Crypt {
*
* @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();
}

View File

@ -67,7 +67,7 @@ class DocumentService {
*
* @return string
*/
public static function GenerateRevisionId($expected_key) {
public static function generateRevisionId($expected_key) {
if (\strlen($expected_key) > 20) {
$expected_key = crc32($expected_key);
}
@ -86,12 +86,12 @@ class DocumentService {
*
* @return string
*/
public function GetConvertedUri($document_uri, $from_extension, $to_extension, $document_revision_id) {
$responceFromConvertService = $this->SendRequestToConvertService($document_uri, $from_extension, $to_extension, $document_revision_id, false);
public function getConvertedUri($document_uri, $from_extension, $to_extension, $document_revision_id) {
$responceFromConvertService = $this->sendRequestToConvertService($document_uri, $from_extension, $to_extension, $document_revision_id, false);
$errorElement = $responceFromConvertService->Error;
if ($errorElement->count() > 0) {
$this->ProcessConvServResponceError($errorElement . "");
$this->processConvServResponceError($errorElement . "");
}
$isEndConvert = $responceFromConvertService->EndConvert;
@ -104,7 +104,7 @@ class DocumentService {
}
/**
* Request for conversion to a service
* request for conversion to a service
*
* @param string $document_uri - Uri for the document to convert
* @param string $from_extension - Document extension
@ -114,8 +114,8 @@ class DocumentService {
*
* @return array
*/
public function SendRequestToConvertService($document_uri, $from_extension, $to_extension, $document_revision_id, $is_async) {
$documentServerUrl = $this->config->GetDocumentServerInternalUrl();
public function sendRequestToConvertService($document_uri, $from_extension, $to_extension, $document_revision_id, $is_async) {
$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 @@ class DocumentService {
$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"];
@ -145,8 +145,8 @@ class DocumentService {
"region" => str_replace("_", "-", \OC::$server->getL10NFactory("")->get("")->getLanguageCode())
];
if ($this->config->UseDemo()) {
$data["tenant"] = $this->config->GetSystemValue("instanceid", true);
if ($this->config->useDemo()) {
$data["tenant"] = $this->config->getSystemValue("instanceid", true);
}
$opts = [
@ -157,19 +157,19 @@ class DocumentService {
"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")) {
@ -194,7 +194,7 @@ class DocumentService {
*
* @return null
*/
public function ProcessConvServResponceError($errorCode) {
public function processConvServResponceError($errorCode) {
$errorMessageTemplate = $this->trans->t("Error occurred in the document service");
$errorMessage = "";
@ -237,12 +237,12 @@ class DocumentService {
}
/**
* Request health status
* request health status
*
* @return bool
*/
public function HealthcheckRequest() {
$documentServerUrl = $this->config->GetDocumentServerInternalUrl();
public function healthcheckRequest() {
$documentServerUrl = $this->config->getDocumentServerInternalUrl();
if (empty($documentServerUrl)) {
throw new \Exception($this->trans->t("ONLYOFFICE app is not configured. Please contact admin"));
@ -250,7 +250,7 @@ class DocumentService {
$urlHealthcheck = $documentServerUrl . "healthcheck";
$response = $this->Request($urlHealthcheck);
$response = $this->request($urlHealthcheck);
return $response === "true";
}
@ -262,8 +262,8 @@ class DocumentService {
*
* @return array
*/
public function CommandRequest($method) {
$documentServerUrl = $this->config->GetDocumentServerInternalUrl();
public function commandRequest($method) {
$documentServerUrl = $this->config->getDocumentServerInternalUrl();
if (empty($documentServerUrl)) {
throw new \Exception($this->trans->t("ONLYOFFICE app is not configured. Please contact admin"));
@ -282,23 +282,23 @@ class DocumentService {
"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;
}
@ -310,7 +310,7 @@ class DocumentService {
*
* @return null
*/
public function ProcessCommandServResponceError($errorCode) {
public function processCommandServResponceError($errorCode) {
$errorMessageTemplate = $this->trans->t("Error occurred in the document service");
$errorMessage = "";
@ -335,7 +335,7 @@ class DocumentService {
}
/**
* Request to Document Server with turn off verification
* request to Document Server with turn off verification
*
* @param string $url - request address
* @param array $method - request method
@ -343,14 +343,14 @@ class DocumentService {
*
* @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 ($opts === null) {
$opts = [];
}
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)) {
@ -380,7 +380,7 @@ class DocumentService {
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."));
}
@ -390,19 +390,19 @@ class DocumentService {
}
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");
$commandResponse = $this->commandRequest("version");
$logger->debug("CommandRequest on check: " . json_encode($commandResponse), ["app" => self::$appName]);
$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"));
@ -414,28 +414,28 @@ class DocumentService {
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());
} 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]);
$logger->logException($e, ["message" => "request converted file on check error", "app" => self::$appName]);
return [$e->getMessage(), $version];
}

View File

@ -235,7 +235,7 @@ class FileUtility {
$key = KeyManager::get($fileId);
if (empty($key)) {
$instanceId = $this->config->GetSystemValue("instanceid", true);
$instanceId = $this->config->getSystemValue("instanceid", true);
$key = $instanceId . "_" . $this->GUID();
@ -291,7 +291,7 @@ class FileUtility {
* @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();

View File

@ -36,16 +36,16 @@ class HookHandler {
*
* @return void
*/
public static function PublicPage() {
public static function publicPage() {
$appName = "onlyoffice";
$appConfig = new AppConfig($appName);
if (!empty($appConfig->GetDocumentServerUrl()) && $appConfig->SettingsAreSuccessful()) {
if (!empty($appConfig->getDocumentServerUrl()) && $appConfig->settingsAreSuccessful()) {
Util::addScript("onlyoffice", "main");
Util::addScript("onlyoffice", "share");
if ($appConfig->GetSameTab()) {
if ($appConfig->getSameTab()) {
Util::addScript("onlyoffice", "listener");
}

View File

@ -233,12 +233,12 @@ class Preview implements IProvider2 {
* @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;
}
@ -274,14 +274,14 @@ class Preview implements IProvider2 {
$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;
@ -322,12 +322,12 @@ class Preview implements IProvider2 {
$data["version"] = $version;
}
$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;
@ -378,7 +378,7 @@ class Preview implements IProvider2 {
$versionId = $version->getRevisionId();
if (strcmp($versionId, $fileVersion) === 0) {
$key = $this->fileUtility->getVersionKey($version);
$key = DocumentService::GenerateRevisionId($key);
$key = DocumentService::generateRevisionId($key);
break;
}
@ -387,7 +387,7 @@ class Preview implements IProvider2 {
$owner = $file->getOwner();
$key = $this->fileUtility->getKey($file);
$key = DocumentService::GenerateRevisionId($key);
$key = DocumentService::generateRevisionId($key);
}
$fileUrl = $this->getUrl($file, $owner, $versionNum);

View File

@ -48,7 +48,7 @@ class TemplateManager {
*
* @return Folder
*/
public static function GetGlobalTemplateDir() {
public static function getGlobalTemplateDir() {
$dirPath = self::$appName . "/" . self::$templateFolderName;
$rootFolder = \OC::$server->getRootFolder();
@ -69,8 +69,8 @@ class TemplateManager {
*
* @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)
@ -89,14 +89,14 @@ class TemplateManager {
*
* @return File
*/
public static function GetTemplate($templateId) {
public static function getTemplate($templateId) {
$logger = \OC::$server->getLogger();
$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;
}
@ -115,7 +115,7 @@ class TemplateManager {
*
* @return string
*/
public static function GetTypeTemplate($mime) {
public static function getTypeTemplate($mime) {
switch($mime) {
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document":
return "document";
@ -135,7 +135,7 @@ class TemplateManager {
*
* @return bool
*/
public static function IsTemplateType($name) {
public static function isTemplateType($name) {
$ext = strtolower(pathinfo($name, PATHINFO_EXTENSION));
switch($ext) {
case "docx":
@ -154,11 +154,11 @@ class TemplateManager {
*
* @return string
*/
public static function GetEmptyTemplate($fileName) {
public static function getEmptyTemplate($fileName) {
$ext = strtolower("." . pathinfo($fileName, PATHINFO_EXTENSION));
$lang = \OC::$server->getL10NFactory("")->get("")->getLanguageCode();
$templatePath = self::GetEmptyTemplatePath($lang, $ext);
$templatePath = self::getEmptyTemplatePath($lang, $ext);
$template = file_get_contents($templatePath);
return $template;
@ -172,7 +172,7 @@ class TemplateManager {
*
* @return string
*/
public static function GetEmptyTemplatePath($lang, $ext) {
public static function getEmptyTemplatePath($lang, $ext) {
if (!\array_key_exists($lang, self::$localPath)) {
$lang = "en";
}