Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ONLYOFFICE/onlyoffice-nextcloud.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Linnik <sergey.linnik@onlyoffice.com>2019-03-27 16:08:52 +0300
committerGitHub <noreply@github.com>2019-03-27 16:08:52 +0300
commitbf1eab435759ea7bd2a602a3c3cafec2083396ef (patch)
tree52b1f42d7629246a049787331cfde085f54f9a8b
parenta72c491387a8e2e471b6be647bdae6feaccad9ae (diff)
parentb3ccf1a07021a47648a034fa0deae0b440408b01 (diff)
Merge pull request #71 from ONLYOFFICE/developv2.1.6
Release/2.1.6
-rw-r--r--CHANGELOG.md11
-rw-r--r--README.md19
-rw-r--r--appinfo/app.php2
-rw-r--r--appinfo/application.php2
-rw-r--r--appinfo/info.xml5
-rw-r--r--appinfo/routes.php2
-rw-r--r--assets/bg/new.docxbin0 -> 6701 bytes
-rw-r--r--assets/bg/new.pptxbin0 -> 28341 bytes
-rw-r--r--assets/bg/new.xlsxbin0 -> 5655 bytes
-rw-r--r--assets/nl/new.docxbin0 -> 7042 bytes
-rw-r--r--assets/nl/new.pptxbin0 -> 35675 bytes
-rw-r--r--assets/nl/new.xlsxbin0 -> 14809 bytes
-rw-r--r--controller/callbackcontroller.php19
-rw-r--r--controller/editorcontroller.php207
-rw-r--r--controller/settingscontroller.php15
-rw-r--r--css/editor.css7
-rw-r--r--css/main.css15
-rw-r--r--css/settings.css2
-rw-r--r--js/desktop.js2
-rw-r--r--js/editor.js15
-rw-r--r--js/main.js54
-rw-r--r--js/settings.js4
-rw-r--r--l10n/bg.js50
-rw-r--r--l10n/bg.json48
-rw-r--r--l10n/de.js1
-rw-r--r--l10n/de.json1
-rw-r--r--l10n/de_DE.js1
-rw-r--r--l10n/de_DE.json1
-rw-r--r--l10n/es.js1
-rw-r--r--l10n/es.json1
-rw-r--r--l10n/fr.js1
-rw-r--r--l10n/fr.json1
-rw-r--r--l10n/pt_BR.js1
-rw-r--r--l10n/pt_BR.json1
-rw-r--r--l10n/ru.js1
-rw-r--r--l10n/ru.json1
-rw-r--r--l10n/sv.js1
-rw-r--r--l10n/sv.json1
-rw-r--r--lib/adminsection.php2
-rw-r--r--lib/adminsettings.php2
-rw-r--r--lib/appconfig.php86
-rw-r--r--lib/crypt.php2
-rw-r--r--lib/documentservice.php90
-rw-r--r--settings.php2
-rw-r--r--templates/editor.php4
-rw-r--r--templates/settings.php8
46 files changed, 439 insertions, 250 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8764650..634769e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,16 @@
# Change Log
+## 2.1.6
+## Added
+- file creation in public folder
+- file convertion in public folder
+- Bulgarian translation
+- file templates in Dutch
+
+## Changed
+- fix editor size on mobile
+- fix php warning
+
## 2.1.2
## Added
- restricting access for groups
diff --git a/README.md b/README.md
index b7c42d4..bf7bc63 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,6 @@ This allows multiple users to collaborate in real time and to save back those ch
You can also use our **[Docker installation](https://github.com/ONLYOFFICE/docker-onlyoffice-nextcloud)** to get installed and configured Document Server and Nextcloud installation with a couple of commands.
-
## Installing ONLYOFFICE Document Server
You will need an instance of ONLYOFFICE Document Server that is resolvable and connectable both from Nextcloud and any end clients (version 4.2.7 and later are supported for use with the app).
@@ -25,7 +24,6 @@ Or you can use Document Server behind a proxy, please refer to [this article](ht
The easiest way to start an instance of ONLYOFFICE Document Server is to use [Docker](https://github.com/ONLYOFFICE/Docker-DocumentServer).
-
## Installing Nextcloud ONLYOFFICE integration app
The Nextcloud administrator can install the integration app from the in-built application market.
@@ -35,7 +33,7 @@ After that find **ONLYOFFICE** in the list of available applications and install
If the server with the Nextcloud installed does not have an Internet access, or if you need it for some other reason, the administrator can install the application manually.
To start using ONLYOFFICE Document Server with Nextcloud, the following steps must be performed:
-1. Go to the Nextcloud server _apps/_ directory (or some other directory [used](https://docs.nextcloud.com/server/13/admin_manual/installation/apps_management_installation.html#using-custom-app-directories)):
+1. Go to the Nextcloud server _apps/_ directory (or some other directory [used](https://docs.nextcloud.com/server/latest/admin_manual/apps_management.html#using-custom-app-directories)):
```
cd apps/
```
@@ -60,7 +58,6 @@ There are several ways to do that:
3. In Nextcloud open the `~/index.php/settings/apps?category=disabled` page with _Not enabled_ apps by administrator and click _Enable_ for the **ONLYOFFICE** application.
-
## Configuring Nextcloud ONLYOFFICE integration app
In Nextcloud open the `~/index.php/settings/admin/onlyoffice` page with administrative settings for **ONLYOFFICE** section.
@@ -88,7 +85,6 @@ The **Open in ONLYOFFICE** action will be added to the file context menu.
You can specify this action as default and it will be used when the file name is clicked for the selected file types.
-
## How it works
The ONLYOFFICE integration follows the API documented here https://api.onlyoffice.com/editors/basic:
@@ -122,12 +118,11 @@ This method adds the copy of the file from the assets folder to the folder the u
* When all users and client browsers are done with editing, they close the editing window.
-* After [10 seconds](https://api.onlyoffice.com/editors/save#savedelay) of inactivity, ONLYOFFICE Document Server sends a POST to the _callback_ URL letting Nextcloud know that the clients have finished editing the document and closed it.
+* After [10 seconds](https://api.onlyoffice.com/editors/save#savedelay) of inactivity, ONLYOFFICE Document Server sends a POST to the _callback_ URL letting Nextcloud know that the clients have finished editing the document and closed it.
* Nextcloud downloads the new version of the document, replacing the old one.
-
## Known issues
* If the document is shared using the **Federated Cloud Sharing** app, the co-editing among the servers will not be avaialble.
@@ -142,4 +137,12 @@ When the _Log-in credentials, save in session_ authentication type is used, the
But if the encryption with the _per-user encryption keys_ (used by default in Nextcloud **Default encryption module** app) is enabled, ONLYOFFICE Document Server cannot open the encrypted files for editing and save them after the editing.
The ONLYOFFICE section of the administrative settings page will display a notification about it.
However if you set the encryption with the _master key_, ONLYOFFICE application will work as intended.
-The instruction on enabling _master key_ based encryption is available in the official documentation on [Nextcloud](https://docs.nextcloud.com/server/13/admin_manual/configuration_files/encryption_configuration.html#occ-encryption-commands) websites.
+The instruction on enabling _master key_ based encryption is available in the official documentation on [Nextcloud](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/encryption_configuration.html#occ-encryption-commands) websites.
+
+* If you are using a self-signed certificate for your **Document Server**, Nextcloud will not validate such a certificate and will not allow connection to/from **Document Server**. This issue can be solved the following way: locate the Nextcloud config file (_/nextcloud/config/config.php_) and open it. Insert the following section to it:
+ ```
+ 'onlyoffice' => array (
+ 'verify_peer_off' => true
+ )
+ ```
+ This will disable the certificate verification and allow Nextcloud to establish connection with **Document Server**, but you must remember that this is a temporary insecure solution and we strongly recommend that you replace the certificate with the one issued by some CA. Once you do that, do not forget to remove the above section from Nextcloud config file.
diff --git a/appinfo/app.php b/appinfo/app.php
index e39c69a..e7d2480 100644
--- a/appinfo/app.php
+++ b/appinfo/app.php
@@ -1,7 +1,7 @@
<?php
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
diff --git a/appinfo/application.php b/appinfo/application.php
index e858b5e..d0a92fd 100644
--- a/appinfo/application.php
+++ b/appinfo/application.php
@@ -1,7 +1,7 @@
<?php
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
diff --git a/appinfo/info.xml b/appinfo/info.xml
index c7e8a27..45821dc 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -7,7 +7,7 @@
<description>ONLYOFFICE connector enables you to edit Office documents within ONLYOFFICE from the familiar web interface. This will create a new Open in ONLYOFFICE action within the document library for Office documents. This allows multiple users to collaborate in real time and to save back those changes to your file storage.</description>
<licence>agpl</licence>
<author mail="dev@onlyoffice.com" homepage="https://www.onlyoffice.com/">Ascensio System SIA</author>
- <version>2.1.2</version>
+ <version>2.1.6</version>
<namespace>Onlyoffice</namespace>
<types>
<filesystem/>
@@ -20,7 +20,6 @@
<category>files</category>
<category>integration</category>
<category>office</category>
- <category>organization</category>
<category>tools</category>
<website>https://www.onlyoffice.com</website>
<bugs>https://github.com/ONLYOFFICE/onlyoffice-nextcloud/issues</bugs>
@@ -36,4 +35,4 @@
<admin>OCA\Onlyoffice\AdminSettings</admin>
<admin-section>OCA\Onlyoffice\AdminSection</admin-section>
</settings>
-</info> \ No newline at end of file
+</info>
diff --git a/appinfo/routes.php b/appinfo/routes.php
index 53a8c0d..4accc96 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -1,7 +1,7 @@
<?php
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
diff --git a/assets/bg/new.docx b/assets/bg/new.docx
new file mode 100644
index 0000000..b26d321
--- /dev/null
+++ b/assets/bg/new.docx
Binary files differ
diff --git a/assets/bg/new.pptx b/assets/bg/new.pptx
new file mode 100644
index 0000000..5bf9f50
--- /dev/null
+++ b/assets/bg/new.pptx
Binary files differ
diff --git a/assets/bg/new.xlsx b/assets/bg/new.xlsx
new file mode 100644
index 0000000..79d0e09
--- /dev/null
+++ b/assets/bg/new.xlsx
Binary files differ
diff --git a/assets/nl/new.docx b/assets/nl/new.docx
new file mode 100644
index 0000000..c0e4917
--- /dev/null
+++ b/assets/nl/new.docx
Binary files differ
diff --git a/assets/nl/new.pptx b/assets/nl/new.pptx
new file mode 100644
index 0000000..b28324c
--- /dev/null
+++ b/assets/nl/new.pptx
Binary files differ
diff --git a/assets/nl/new.xlsx b/assets/nl/new.xlsx
new file mode 100644
index 0000000..3472c3b
--- /dev/null
+++ b/assets/nl/new.xlsx
Binary files differ
diff --git a/controller/callbackcontroller.php b/controller/callbackcontroller.php
index 05f8e30..dccb139 100644
--- a/controller/callbackcontroller.php
+++ b/controller/callbackcontroller.php
@@ -1,7 +1,7 @@
<?php
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
@@ -429,10 +429,9 @@ class CallbackController extends Controller {
}
}
- if (($newData = $documentService->Request($url))) {
- $file->putContent($newData);
- $error = 0;
- }
+ $newData = $documentService->Request($url);
+ $file->putContent($newData);
+ $error = 0;
} catch (\Exception $e) {
$this->logger->error("Track " . $trackerStatus . " error: " . $e->getMessage(), array("app" => $this->appName));
}
@@ -444,6 +443,8 @@ class CallbackController extends Controller {
break;
}
+ $this->logger->debug("Track: " . $fileId . " status " . $status . " result " . $error, array("app" => $this->appName));
+
return new JSONResponse(["error" => $error], Http::STATUS_OK);
}
@@ -462,6 +463,7 @@ class CallbackController extends Controller {
}
$files = $this->root->getUserFolder($userId)->getById($fileId);
+
if (empty($files)) {
$this->logger->error("Files not found: " . $fileId, array("app" => $this->appName));
return [NULL, new JSONResponse(["message" => $this->trans->t("Files not found")], Http::STATUS_NOT_FOUND)];
@@ -499,7 +501,12 @@ class CallbackController extends Controller {
}
if ($node instanceof Folder) {
- $file = $node->getById($fileId)[0];
+ $files = $node->getById($fileId);
+
+ if (empty($files)) {
+ return [NULL, new JSONResponse(["message" => $this->trans->t("File not found")], Http::STATUS_NOT_FOUND)];
+ }
+ $file = $files[0];
} else {
$file = $node;
}
diff --git a/controller/editorcontroller.php b/controller/editorcontroller.php
index dcc85dd..9f28223 100644
--- a/controller/editorcontroller.php
+++ b/controller/editorcontroller.php
@@ -1,7 +1,7 @@
<?php
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
@@ -36,6 +36,7 @@ use OCP\AppFramework\Http\TemplateResponse;
use OCP\AutoloadNotAllowedException;
use OCP\Constants;
use OCP\Files\FileInfo;
+use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
@@ -172,20 +173,41 @@ class EditorController extends Controller {
*
* @param string $name - file name
* @param string $dir - folder path
+ * @param string $token - access token
*
* @return array
*
* @NoAdminRequired
+ * @PublicPage
*/
- public function create($name, $dir) {
+ public function create($name, $dir, $token = NULL) {
$this->logger->debug("Create: " . $name, array("app" => $this->appName));
- if (!$this->config->isUserAllowedToUse()) {
+ if (empty($token) && !$this->config->isUserAllowedToUse()) {
return ["error" => $this->trans->t("Not permitted")];
}
- $userId = $this->userSession->getUser()->getUID();
- $userFolder = $this->root->getUserFolder($userId);
+ if (empty($token)) {
+ $userId = $this->userSession->getUser()->getUID();
+ $userFolder = $this->root->getUserFolder($userId);
+ } else {
+ list ($userFolder, $error, $share) = $this->getNodeByToken($token);
+
+ if (isset($error)) {
+ $this->logger->error("Create: " . $error, array("app" => $this->appName));
+ return ["error" => $error];
+ }
+
+ if ($userFolder instanceof File) {
+ return ["error" => $this->trans->t("You don't have enough permission to create")];
+ }
+
+ if (!empty($token) && ($share->getPermissions() & Constants::PERMISSION_CREATE) === 0) {
+ $this->logger->error("Create in public folder without access: " . $fileId, array("app" => $this->appName));
+ return ["error" => $this->trans->t("You do not have enough permissions to view the file")];
+ }
+ }
+
$folder = $userFolder->get($dir);
if ($folder === NULL) {
@@ -197,9 +219,7 @@ class EditorController extends Controller {
return ["error" => $this->trans->t("You don't have enough permission to create")];
}
- $name = $folder->getNonExistingName($name);
- $filePath = $dir . DIRECTORY_SEPARATOR . $name;
- $ext = strtolower("." . pathinfo($filePath, PATHINFO_EXTENSION));
+ $ext = strtolower("." . pathinfo($name, PATHINFO_EXTENSION));
$lang = \OC::$server->getL10NFactory("")->get("")->getLanguageCode();
@@ -215,19 +235,19 @@ class EditorController extends Controller {
return ["error" => $this->trans->t("Template not found")];
}
- $view = Filesystem::getView();
- if (!$view->file_put_contents($filePath, $template)) {
- $this->logger->error("Can't create file: " . $filePath, array("app" => $this->appName));
- return ["error" => $this->trans->t("Can't create file")];
- }
+ $name = $folder->getNonExistingName($name);
- $fileInfo = $view->getFileInfo($filePath);
+ try {
+ $file = $folder->newFile($name);
- if ($fileInfo === false) {
- $this->logger->error("File not found: " . $filePath, array("app" => $this->appName));
- return ["error" => $this->trans->t("File not found")];
+ $file->putContent($template);
+ } catch (NotPermittedException $e) {
+ $this->logger->error("Can't create file: " . $name, array("app" => $this->appName));
+ return ["error" => $this->trans->t("Can't create file")];
}
+ $fileInfo = $file->getFileInfo();
+
$result = Helper::formatFileInfo($fileInfo);
return $result;
}
@@ -248,26 +268,38 @@ class EditorController extends Controller {
* Conversion file to Office Open XML format
*
* @param integer $fileId - file identifier
+ * @param string $token - access token
*
* @return array
*
* @NoAdminRequired
+ * @PublicPage
*/
- public function convert($fileId) {
+ public function convert($fileId, $token = NULL) {
$this->logger->debug("Convert: " . $fileId, array("app" => $this->appName));
- if (!$this->config->isUserAllowedToUse()) {
+ if (empty($token) && !$this->config->isUserAllowedToUse()) {
return ["error" => $this->trans->t("Not permitted")];
}
- $userId = $this->userSession->getUser()->getUID();
- list ($file, $error) = $this->getFile($userId, $fileId);
+ $user = $this->userSession->getUser();
+ $userId = NULL;
+ if (!empty($user)) {
+ $userId = $user->getUID();
+ }
+
+ list ($file, $error, $share) = empty($token) ? $this->getFile($userId, $fileId) : $this->getFileByToken($fileId, $token);
if (isset($error)) {
$this->logger->error("Convertion: " . $fileId . " " . $error, array("app" => $this->appName));
return ["error" => $error];
}
+ if (!empty($token) && ($share->getPermissions() & Constants::PERMISSION_CREATE) === 0) {
+ $this->logger->error("Convertion in public folder without access: " . $fileId, array("app" => $this->appName));
+ return ["error" => $this->trans->t("You do not have enough permissions to view the file")];
+ }
+
$fileName = $file->getName();
$ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
$format = $this->config->FormatsSetting()[$ext];
@@ -295,7 +327,7 @@ class EditorController extends Controller {
$documentService = new DocumentService($this->trans, $this->config);
$key = $this->getKey($file);
$fileId = $file->getId();
- $fileUrl = $this->getUrl($fileId);
+ $fileUrl = $this->getUrl($fileId, $token);
try {
$newFileUri = $documentService->GetConvertedUri($fileUrl, $ext, $internalExtension, $key);
} catch (\Exception $e) {
@@ -307,31 +339,27 @@ class EditorController extends Controller {
if (!$folder->isCreatable()) {
$folder = $this->root->getUserFolder($userId);
}
- $pattern = "/^\\" . DIRECTORY_SEPARATOR . $userId . "\\" . DIRECTORY_SEPARATOR . "files/";
- $newFolderPath = preg_replace($pattern, "", $folder->getPath());
+
+ try {
+ $newData = $documentService->Request($newFileUri);
+ } catch (\Exception $e) {
+ $this->logger->error("Failed to download converted file: " . $newFileUri . " " . $e->getMessage(), array("app" => $this->appName));
+ return ["error" => $this->trans->t("Failed to download converted file")];
+ }
$fileNameWithoutExt = substr($fileName, 0, strlen($fileName) - strlen($ext) - 1);
$newFileName = $folder->getNonExistingName($fileNameWithoutExt . "." . $internalExtension);
- $newFilePath = $newFolderPath . DIRECTORY_SEPARATOR . $newFileName;
-
- if (($newData = $documentService->Request($newFileUri)) === false) {
- $this->logger->error("Failed to download converted file: " . $newFileUri, array("app" => $this->appName));
- return ["error" => $this->trans->t("Failed to download converted file")];
- }
+ try {
+ $file = $folder->newFile($newFileName);
- $view = Filesystem::getView();
- if (!$view->file_put_contents($newFilePath, $newData)) {
- $this->logger->error("Can't create file after convertion: " . $newFilePath, array("app" => $this->appName));
+ $file->putContent($newData);
+ } catch (NotPermittedException $e) {
+ $this->logger->error("Can't create file: " . $newFileName, array("app" => $this->appName));
return ["error" => $this->trans->t("Can't create file")];
}
- $fileInfo = $view->getFileInfo($newFilePath);
-
- if ($fileInfo === false) {
- $this->logger->info("File not found: " . $newFilePath, array("app" => $this->appName));
- return ["error" => $this->trans->t("File not found")];
- }
+ $fileInfo = $file->getFileInfo();
$result = Helper::formatFileInfo($fileInfo);
return $result;
@@ -342,14 +370,15 @@ class EditorController extends Controller {
*
* @param integer $fileId - file identifier
* @param string $token - access token
+ * @param string $filePath - file path
*
* @return TemplateResponse|RedirectResponse
*
* @NoAdminRequired
* @NoCSRFRequired
*/
- public function index($fileId, $token = NULL) {
- $this->logger->debug("Open: " . $fileId, array("app" => $this->appName));
+ public function index($fileId, $token = NULL, $filePath = NULL) {
+ $this->logger->debug("Open: " . $fileId . " " . $filePath, array("app" => $this->appName));
if (empty($token) && !$this->userSession->isLoggedIn()) {
$redirectUrl = $this->urlGenerator->linkToRoute("core.login.showLoginForm", [
@@ -372,6 +401,7 @@ class EditorController extends Controller {
$params = [
"documentServerUrl" => $documentServerUrl,
"fileId" => $fileId,
+ "filePath" => $filePath,
"token" => $token
];
@@ -411,6 +441,7 @@ class EditorController extends Controller {
* Collecting the file parameters for the document service
*
* @param integer $fileId - file identifier
+ * @param string $filePath - file path
* @param string $token - access token
* @param bool $desktop - desktop label
*
@@ -419,7 +450,7 @@ class EditorController extends Controller {
* @NoAdminRequired
* @PublicPage
*/
- public function config($fileId, $token = NULL, $desktop = false) {
+ public function config($fileId, $filePath = NULL, $token = NULL, $desktop = false) {
if (empty($token) && !$this->config->isUserAllowedToUse()) {
return ["error" => $this->trans->t("Not permitted")];
@@ -431,7 +462,7 @@ class EditorController extends Controller {
$userId = $user->getUID();
}
- list ($file, $error, $share) = empty($token) ? $this->getFile($userId, $fileId) : $this->getFileByToken($fileId, $token);
+ list ($file, $error, $share) = empty($token) ? $this->getFile($userId, $fileId, $filePath) : $this->getFileByToken($fileId, $token);
if (isset($error)) {
$this->logger->error("Config: " . $fileId . " " . $error, array("app" => $this->appName));
@@ -499,6 +530,13 @@ class EditorController extends Controller {
$folderLink = NULL;
if (!empty($token)) {
+ if (method_exists($share, getHideDownload) && $share->getHideDownload()) {
+ $params["document"]["permissions"] = [
+ "download" => false,
+ "print" => false
+ ];
+ }
+
$node = $share->getNode();
if ($node instanceof Folder) {
$sharedFolder = $node;
@@ -538,6 +576,14 @@ class EditorController extends Controller {
$params = $this->setCustomization($params);
+ $permissions_modifyFilter = $this->config->getSystemValue($this->config->_permissions_modifyFilter);
+ if (isset($permissions_modifyFilter)) {
+ if (!array_key_exists("permissions", $params["document"])) {
+ $params["document"]["permissions"] = [];
+ }
+ $params["document"]["permissions"]["modifyFilter"] = $permissions_modifyFilter;
+ }
+
if (!empty($this->config->GetDocumentServerSecret())) {
$token = \Firebase\JWT\JWT::encode($params, $this->config->GetDocumentServerSecret());
$params["token"] = $token;
@@ -553,30 +599,38 @@ class EditorController extends Controller {
*
* @param string $userId - user identifier
* @param integer $fileId - file identifier
+ * @param string $filePath - file path
*
* @return array
*/
- private function getFile($userId, $fileId) {
+ private function getFile($userId, $fileId, $filePath = NULL) {
if (empty($fileId)) {
- return [NULL, $this->trans->t("FileId is empty")];
+ return [NULL, $this->trans->t("FileId is empty"), NULL];
}
- if ($userId !== NULL) {
- $files = $this->root->getUserFolder($userId)->getById($fileId);
- } else {
- $this->logger->debug("getFile by unknown user: " . $fileId, array("app" => $this->appName));
- $files = $this->root->getById($fileId);
- }
+ $files = $this->root->getUserFolder($userId)->getById($fileId);
if (empty($files)) {
- return [NULL, $this->trans->t("File not found")];
+ $this->logger->info("Files not found: " . $fileId, array("app" => $this->appName));
+ return [NULL, $this->trans->t("File not found"), NULL];
}
+
$file = $files[0];
+ if (count($files) > 1 && !empty($filePath)) {
+ $filePath = "/" . $userId . "/files" . $filePath;
+ foreach ($files as $curFile) {
+ if ($curFile->getPath() === $filePath) {
+ $file = $curFile;
+ }
+ }
+ }
+
if (!$file->isReadable()) {
- return [NULL, $this->trans->t("You do not have enough permissions to view the file")];
+ return [NULL, $this->trans->t("You do not have enough permissions to view the file"), NULL];
}
- return [$file, NULL];
+
+ return [$file, NULL, NULL];
}
/**
@@ -588,30 +642,53 @@ class EditorController extends Controller {
* @return array
*/
private function getFileByToken($fileId, $token) {
+ list ($node, $error, $share) = $this->getNodeByToken($token);
+
+ if (isset($error)) {
+ return [NULL, $error, NULL];
+ }
+
+ if ($node instanceof Folder) {
+ $files = $node->getById($fileId);
+
+ if (empty($files)) {
+ $this->logger->info("Files not found: " . $fileId, array("app" => $this->appName));
+ return [NULL, $this->trans->t("File not found"), NULL];
+ }
+ $file = $files[0];
+ } else {
+ $file = $node;
+ }
+
+ return [$file, NULL, $share];
+ }
+
+ /**
+ * Getting file by token
+ *
+ * @param string $token - access token
+ *
+ * @return array
+ */
+ private function getNodeByToken($token) {
list ($share, $error) = $this->getShare($token);
if (isset($error)) {
- return [NULL, $error];
+ return [NULL, $error, NULL];
}
if (($share->getPermissions() & Constants::PERMISSION_READ) === 0) {
- return [NULL, $this->trans->t("You do not have enough permissions to view the file")];
+ return [NULL, $this->trans->t("You do not have enough permissions to view the file"), NULL];
}
try {
$node = $share->getNode();
} catch (NotFoundException $e) {
$this->logger->error("getFileByToken error: " . $e->getMessage(), array("app" => $this->appName));
- return [NULL, $this->trans->t("File not found")];
+ return [NULL, $this->trans->t("File not found"), NULL];
}
- if ($node instanceof Folder) {
- $file = $node->getById($fileId)[0];
- } else {
- $file = $node;
- }
-
- return [$file, NULL, $share];
+ return [$node, NULL, $share];
}
/**
@@ -638,7 +715,7 @@ class EditorController extends Controller {
return [NULL, $this->trans->t("You do not have enough permissions to view the file")];
}
- if ($share->getPassword()
+ if ($share->getPassword()
&& (!$this->session->exists("public_link_authenticated")
|| $this->session->get("public_link_authenticated") !== (string) $share->getId())) {
return [NULL, $this->trans->t("You do not have enough permissions to view the file")];
diff --git a/controller/settingscontroller.php b/controller/settingscontroller.php
index 917d456..1acd11a 100644
--- a/controller/settingscontroller.php
+++ b/controller/settingscontroller.php
@@ -1,7 +1,7 @@
<?php
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
@@ -156,13 +156,12 @@ class SettingsController extends Controller {
$this->config->SetDocumentServerSecret($secret);
$documentserver = $this->config->GetDocumentServerUrl();
+ $error = NULL;
if (!empty($documentserver)) {
$error = $this->checkDocServiceUrl();
$this->config->SetSettingsError($error);
}
- $this->config->DropSKey();
-
$this->config->SetDefaultFormats($defFormats);
$this->config->SetEditableFormats($editFormats);
$this->config->SetSameTab($sameTab);
@@ -206,10 +205,8 @@ class SettingsController extends Controller {
private function checkDocServiceUrl() {
try {
- $documentServerUrl = $this->config->GetDocumentServerUrl();
- if (substr($this->urlGenerator->getAbsoluteURL("/"), 0, strlen("https")) === "https"
- && preg_match("/^https?:\/\//i", $documentServerUrl)
- && substr($documentServerUrl, 0, strlen("https")) !== "https") {
+ if (preg_match("/^https:\/\//i", $this->urlGenerator->getAbsoluteURL("/"))
+ && preg_match("/^http:\/\//i", $this->config->GetDocumentServerUrl())) {
throw new \Exception($this->trans->t("Mixed Active Content is not allowed. HTTPS address for Document Server is required."));
}
@@ -271,9 +268,7 @@ class SettingsController extends Controller {
}
try {
- if ($documentService->Request($convertedFileUri) === false) {
- throw new \Exception($this->trans->t("Error occurred in the document service"));
- }
+ $documentService->Request($convertedFileUri);
} catch (\Exception $e) {
$this->logger->error("Request converted file on check error: " . $convertedFileUri . " " . $e->getMessage(), array("app" => $this->appName));
return $e->getMessage();
diff --git a/css/editor.css b/css/editor.css
index 399c854..69f82c7 100644
--- a/css/editor.css
+++ b/css/editor.css
@@ -1,6 +1,6 @@
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
@@ -37,10 +37,7 @@
.AscDesktopEditor #body-user #header {
display: none;
}
-.AscDesktopEditor #body-user #content-wrapper /*13*/{
- padding-top: 0;
-}
-.AscDesktopEditor #body-user #content /*14*/{
+.AscDesktopEditor #body-user #content {
min-height: 100%;
padding-top: 0;
}
diff --git a/css/main.css b/css/main.css
index c3ee427..b8adbeb 100644
--- a/css/main.css
+++ b/css/main.css
@@ -1,6 +1,6 @@
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
@@ -43,19 +43,18 @@
.AscDesktopEditor #body-user #header {
display: none;
}
-.AscDesktopEditor #body-user #content-wrapper, /*13*/
-.AscDesktopEditor #body-user #content /*14*/{
+.AscDesktopEditor #body-user #content {
padding-top: 0;
}
-.AscDesktopEditor #body-user #app-navigation, /*14*/
-.AscDesktopEditor #body-user #controls, /*14*/
+.AscDesktopEditor #body-user #app-navigation,
+.AscDesktopEditor #body-user #controls,
.AscDesktopEditor #body-user #app-sidebar {
top: 0;
}
-.AscDesktopEditor #body-user #app-navigation /*14*/{
- height: 100%; /*14*/
+.AscDesktopEditor #body-user #app-navigation {
+ height: 100%;
}
-.AscDesktopEditor #body-user #app-sidebar /*14*/{
+.AscDesktopEditor #body-user #app-sidebar {
height: 100vh;
}
.AscDesktopEditor #body-user table.multiselect thead {
diff --git a/css/settings.css b/css/settings.css
index bda57ac..ca22413 100644
--- a/css/settings.css
+++ b/css/settings.css
@@ -1,6 +1,6 @@
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
diff --git a/js/desktop.js b/js/desktop.js
index 282faad..34433b7 100644
--- a/js/desktop.js
+++ b/js/desktop.js
@@ -1,6 +1,6 @@
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
diff --git a/js/editor.js b/js/editor.js
index 51bd5f8..bc10d1e 100644
--- a/js/editor.js
+++ b/js/editor.js
@@ -1,6 +1,6 @@
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
@@ -40,6 +40,7 @@
};
var fileId = $("#iframeEditor").data("id");
+ var filePath = $("#iframeEditor").data("path");
var fileToken = $("#iframeEditor").data("token");
if (!fileId && !fileToken) {
displayError(t(OCA.Onlyoffice.AppName, "FileId is empty"));
@@ -51,9 +52,15 @@
return;
}
- var configUrl = OC.generateUrl("apps/onlyoffice/ajax/config/" + (fileId || 0));
+ var configUrl = OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/config/{fileId}",
+ {
+ fileId: fileId || 0
+ });
var params = [];
+ if (filePath) {
+ params.push("filePath=" + encodeURIComponent(filePath));
+ }
if (fileToken) {
params.push("token=" + encodeURIComponent(fileToken));
}
@@ -99,6 +106,10 @@
};
var docEditor = new DocsAPI.DocEditor("iframeEditor", config);
+
+ if (config.type === "mobile" && $("#app > iframe").css("position") === "fixed") {
+ $("#app > iframe").css("height", "calc(100% - 50px)")
+ }
}
}
});
diff --git a/js/main.js b/js/main.js
index 5c75b82..7b3825c 100644
--- a/js/main.js
+++ b/js/main.js
@@ -1,6 +1,6 @@
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
@@ -45,11 +45,17 @@
}
}
+ var createData = {
+ name: name,
+ dir: dir
+ };
+
+ if ($("#isPublic").val()) {
+ createData.token = encodeURIComponent($("#sharingToken").val());
+ }
+
$.post(OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/new"),
- {
- name: name,
- dir: dir
- },
+ createData,
function onSuccess(response) {
if (response.error) {
if (winEditor) {
@@ -63,7 +69,7 @@
}
fileList.add(response, { animate: true });
- OCA.Onlyoffice.OpenEditor(response.id, winEditor);
+ OCA.Onlyoffice.OpenEditor(response.id, dir, response.name, winEditor);
OC.Notification.show(t(OCA.Onlyoffice.AppName, "File created"), {
timeout: 3
@@ -72,14 +78,20 @@
);
};
- OCA.Onlyoffice.OpenEditor = function (fileId, winEditor) {
- var url = OC.generateUrl("/apps/" + OCA.Onlyoffice.AppName + "/{fileId}",
+ OCA.Onlyoffice.OpenEditor = function (fileId, fileDir, fileName, winEditor) {
+ var filePath = fileDir.replace(new RegExp("\/$"), "") + "/" + fileName;
+ var url = OC.generateUrl("/apps/" + OCA.Onlyoffice.AppName + "/{fileId}?filePath={filePath}",
{
- fileId: fileId
+ fileId: fileId,
+ filePath: filePath
});
if ($("#isPublic").val()) {
- url = OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/s/" + encodeURIComponent($("#sharingToken").val())) + "?fileId=" + fileId;
+ url = OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/s/{token}?fileId={fileId}",
+ {
+ token: encodeURIComponent($("#sharingToken").val()),
+ fileId: fileId
+ });
}
if (winEditor && winEditor.location) {
@@ -93,17 +105,23 @@
OCA.Onlyoffice.FileClick = function (fileName, context) {
var fileInfoModel = context.fileInfoModel || context.fileList.getModelForFile(fileName);
- OCA.Onlyoffice.OpenEditor(fileInfoModel.id);
+ OCA.Onlyoffice.OpenEditor(fileInfoModel.id, context.dir, fileName);
};
OCA.Onlyoffice.FileConvertClick = function (fileName, context) {
var fileInfoModel = context.fileInfoModel || context.fileList.getModelForFile(fileName);
var fileList = context.fileList;
+ var convertData = {
+ fileId: fileInfoModel.id
+ };
+
+ if ($("#isPublic").val()) {
+ convertData.token = encodeURIComponent($("#sharingToken").val());
+ }
+
$.post(OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/convert"),
- {
- fileId: fileInfoModel.id
- },
+ convertData,
function onSuccess(response) {
if (response.error) {
OC.Notification.show(response.error, {
@@ -167,12 +185,12 @@
fileList.fileActions.setDefault(attr.mime, "onlyofficeOpen");
}
- if (!$("#isPublic").val() && attr.conv) {
+ if (attr.conv) {
fileList.fileActions.registerAction({
name: "onlyofficeConvert",
displayName: t(OCA.Onlyoffice.AppName, "Convert with ONLYOFFICE"),
mime: attr.mime,
- permissions: OC.PERMISSION_READ,
+ permissions: ($("#isPublic").val() ? OC.PERMISSION_UPDATE : OC.PERMISSION_READ),
iconClass: "icon-onlyoffice-convert",
actionHandler: OCA.Onlyoffice.FileConvertClick
});
@@ -188,7 +206,7 @@
attach: function (menu) {
var fileList = menu.fileList;
- if (fileList.id !== "files") {
+ if (fileList.id !== "files" && fileList.id !== "files.public") {
return;
}
@@ -228,7 +246,7 @@
};
var initPage = function(){
- if ($("#isPublic").val() && !$("#dir").val().length) {
+ if ($("#isPublic").val() === "1" && !$("#filestable").length) {
var fileName = $("#filename").val();
var extension = fileName.substr(fileName.lastIndexOf(".") + 1).toLowerCase();
diff --git a/js/settings.js b/js/settings.js
index 33561dd..a8b48cb 100644
--- a/js/settings.js
+++ b/js/settings.js
@@ -1,6 +1,6 @@
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
@@ -93,7 +93,7 @@
$.ajax({
method: "PUT",
- url: OC.generateUrl("apps/onlyoffice/ajax/settings"),
+ url: OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/settings"),
data: {
documentserver: onlyofficeUrl,
documentserverInternal: onlyofficeInternalUrl,
diff --git a/l10n/bg.js b/l10n/bg.js
new file mode 100644
index 0000000..ce01ee0
--- /dev/null
+++ b/l10n/bg.js
@@ -0,0 +1,50 @@
+OC.L10N.register(
+ "onlyoffice",
+ {
+ "Access denied" : "Отказан достъп",
+ "Invalid request" : "Неправилна заявка",
+ "Files not found" : "Файловете не са намерени",
+ "File not found" : "Файлът не открит",
+ "Not permitted" : "Операцията не е разрешена",
+ "Download failed" : "Грешка при изтегляне",
+ "The required folder was not found" : "Папката не е намерена",
+ "You don't have enough permission to create" : "Нямате права за създаване",
+ "Template not found" : "Шаблона не е намерен",
+ "Can't create file" : "Файла не може да бъде създаден",
+ "Format is not supported" : "Форматът не се поддържа",
+ "Conversion is not required" : "Не е необходимо конвертиране",
+ "Failed to download converted file" : "Грешка при изтегляне на конверирания файл",
+ "ONLYOFFICE app is not configured. Please contact admin" : "Приложението ONLYOFFICE не конфигурирано. Моля, свържете се с администратора",
+ "FileId is empty" : "Полето е празно",
+ "You do not have enough permissions to view the file" : "Нямате достатъчно права за преглед на файла",
+ "Error occurred in the document service" : "Възникна грешка в услугата за документи",
+ "Not supported version" : "Неподдържана версия",
+ "ONLYOFFICE cannot be reached. Please contact admin" : "Приложението ONLYOFFICE не е достъпно. Моля, свържете се с администратора",
+ "Loading, please wait." : "Зареждане. Моля, изчакайте.",
+ "File created" : "Файлът е създаден",
+ "Open in ONLYOFFICE" : "Отвори в ONLYOFFICE",
+ "Convert with ONLYOFFICE" : "Конвертирай с ONLYOFFICE",
+ "Document" : "Документ",
+ "Spreadsheet" : "Електронна таблица",
+ "Presentation" : "Презентация",
+ "Error when trying to connect" : "Грешка при опит за свързване",
+ "Settings have been successfully updated" : "Настройките са успешно обновени",
+ "Server can't read xml" : "Невъзможно прочитане на xml файла на сървъра",
+ "Bad Response. Errors: " : "Неправилен отговор. Грешки:",
+ "Documentation" : "Документация",
+ "ONLYOFFICE Document Service Location specifies the address of the server with the document services installed. Please change the '<documentserver>' for the server address in the below line." : "Адреса на ONLYOFFICE Document услугата определя адреса на сървъра с инсталирани услуги за документи. Моля, променете '<documentserver>' адреса на сървъра в долния ред.",
+ "Encryption App is enabled, the application cannot work. You can continue working with the application if you enable master key." : "Активирано е криптиране, приложението не може да продължи работа. Ще може да продължите работа с приложението, ако използвате Основен ключ.",
+ "Document Editing Service address" : "Адрес на услугата за редактиране на документи",
+ "Advanced server settings" : "Допълнителни настройки на сървъра",
+ "Document Editing Service address for internal requests from the server" : "Адрес на услугата за редактиране на документи за вътрешни заявки към сървъра",
+ "Server address for internal requests from the Document Editing Service" : "Адрес на сървъра за вътрешни заявки на услугата за редактиране на документи",
+ "Secret key (leave blank to disable)" : "Секретен ключ (оставете празно за забрана)",
+ "Open file in the same tab" : "Отваряне на файла в същия прозорец",
+ "The default application for opening the format" : "Приложение по подразбиране за отваряне на следните формати",
+ "Open the file for editing (due to format restrictions, the data might be lost when saving to the formats from the list below)" : "Отваряне на файла за редактиране (според ограниченята на формата данните могат да бъдат загубени при запис във формати от списъка по-долу)",
+ "View details" : "Виж детайли",
+ "Save" : "Запази",
+ "Mixed Active Content is not allowed. HTTPS address for Document Server is required." : "Смесеното активно съдържание е недопустимо. За услугата за редактиране на документи е необходимо използването на HTTPS-адрес.",
+ "Restrict access to editors to following groups" : "Разреши достъп до редакторите само за тези групи"
+},
+"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);");
diff --git a/l10n/bg.json b/l10n/bg.json
new file mode 100644
index 0000000..6da128f
--- /dev/null
+++ b/l10n/bg.json
@@ -0,0 +1,48 @@
+{ "translations": {
+ "Access denied" : "Отказан достъп",
+ "Invalid request" : "Неправилна заявка",
+ "Files not found" : "Файловете не са намерени",
+ "File not found" : "Файлът не открит",
+ "Not permitted" : "Операцията не е разрешена",
+ "Download failed" : "Грешка при изтегляне",
+ "The required folder was not found" : "Папката не е намерена",
+ "You don't have enough permission to create" : "Нямате права за създаване",
+ "Template not found" : "Шаблона не е намерен",
+ "Can't create file" : "Файла не може да бъде създаден",
+ "Format is not supported" : "Форматът не се поддържа",
+ "Conversion is not required" : "Не е необходимо конвертиране",
+ "Failed to download converted file" : "Грешка при изтегляне на конверирания файл",
+ "ONLYOFFICE app is not configured. Please contact admin" : "Приложението ONLYOFFICE не конфигурирано. Моля, свържете се с администратора",
+ "FileId is empty" : "Полето е празно",
+ "You do not have enough permissions to view the file" : "Нямате достатъчно права за преглед на файла",
+ "Error occurred in the document service" : "Възникна грешка в услугата за документи",
+ "Not supported version" : "Неподдържана версия",
+ "ONLYOFFICE cannot be reached. Please contact admin" : "Приложението ONLYOFFICE не е достъпно. Моля, свържете се с администратора",
+ "Loading, please wait." : "Зареждане. Моля, изчакайте.",
+ "File created" : "Файлът е създаден",
+ "Open in ONLYOFFICE" : "Отвори в ONLYOFFICE",
+ "Convert with ONLYOFFICE" : "Конвертирай с ONLYOFFICE",
+ "Document" : "Документ",
+ "Spreadsheet" : "Електронна таблица",
+ "Presentation" : "Презентация",
+ "Error when trying to connect" : "Грешка при опит за свързване",
+ "Settings have been successfully updated" : "Настройките са успешно обновени",
+ "Server can't read xml" : "Невъзможно прочитане на xml файла на сървъра",
+ "Bad Response. Errors: " : "Неправилен отговор. Грешки:",
+ "Documentation" : "Документация",
+ "ONLYOFFICE Document Service Location specifies the address of the server with the document services installed. Please change the '<documentserver>' for the server address in the below line." : "Адреса на ONLYOFFICE Document услугата определя адреса на сървъра с инсталирани услуги за документи. Моля, променете '<documentserver>' адреса на сървъра в долния ред.",
+ "Encryption App is enabled, the application cannot work. You can continue working with the application if you enable master key." : "Активирано е криптиране, приложението не може да продължи работа. Ще може да продължите работа с приложението, ако използвате Основен ключ.",
+ "Document Editing Service address" : "Адрес на услугата за редактиране на документи",
+ "Advanced server settings" : "Допълнителни настройки на сървъра",
+ "Document Editing Service address for internal requests from the server" : "Адрес на услугата за редактиране на документи за вътрешни заявки към сървъра",
+ "Server address for internal requests from the Document Editing Service" : "Адрес на сървъра за вътрешни заявки на услугата за редактиране на документи",
+ "Secret key (leave blank to disable)" : "Секретен ключ (оставете празно за забрана)",
+ "Open file in the same tab" : "Отваряне на файла в същия прозорец",
+ "The default application for opening the format" : "Приложение по подразбиране за отваряне на следните формати",
+ "Open the file for editing (due to format restrictions, the data might be lost when saving to the formats from the list below)" : "Отваряне на файла за редактиране (според ограниченята на формата данните могат да бъдат загубени при запис във формати от списъка по-долу)",
+ "View details" : "Виж детайли",
+ "Save" : "Запази",
+ "Mixed Active Content is not allowed. HTTPS address for Document Server is required." : "Смесеното активно съдържание е недопустимо. За услугата за редактиране на документи е необходимо използването на HTTPS-адрес.",
+ "Restrict access to editors to following groups" : "Разреши достъп до редакторите само за тези групи"
+},"pluralForm" :"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"
+} \ No newline at end of file
diff --git a/l10n/de.js b/l10n/de.js
index 2a8b3aa..b578c2c 100644
--- a/l10n/de.js
+++ b/l10n/de.js
@@ -29,7 +29,6 @@ OC.L10N.register(
"Presentation" : "Präsentation",
"Error when trying to connect" : "Fehler beim Anschließen",
"Settings have been successfully updated" : "Einstellungen wurden erfolgreich aktualisiert",
- "Bad Request or timeout error" : "Bad Request oder Timeout Fehlermeldung",
"Server can't read xml" : "Server kann eine xml-Datei nicht einlesen",
"Bad Response. Errors: " : "Bad Response. Fehler:",
"Documentation" : "Dokumentation",
diff --git a/l10n/de.json b/l10n/de.json
index eab6510..e29b9ce 100644
--- a/l10n/de.json
+++ b/l10n/de.json
@@ -27,7 +27,6 @@
"Presentation" : "Präsentation",
"Error when trying to connect" : "Fehler beim Anschließen",
"Settings have been successfully updated" : "Einstellungen wurden erfolgreich aktualisiert",
- "Bad Request or timeout error" : "Bad Request oder Timeout Fehlermeldung",
"Server can't read xml" : "Server kann eine xml-Datei nicht einlesen",
"Bad Response. Errors: " : "Bad Response. Fehler:",
"Documentation" : "Dokumentation",
diff --git a/l10n/de_DE.js b/l10n/de_DE.js
index b4a1c22..05c90da 100644
--- a/l10n/de_DE.js
+++ b/l10n/de_DE.js
@@ -29,7 +29,6 @@ OC.L10N.register(
"Presentation" : "Präsentation",
"Error when trying to connect" : "Fehler beim Anschließen",
"Settings have been successfully updated" : "Einstellungen wurden erfolgreich aktualisiert",
- "Bad Request or timeout error" : "Bad Request oder Timeout Fehlermeldung",
"Server can't read xml" : "Server kann eine xml-Datei nicht einlesen",
"Bad Response. Errors: " : "Bad Response. Fehler:",
"Documentation" : "Dokumentation",
diff --git a/l10n/de_DE.json b/l10n/de_DE.json
index 144529c..6cf04f7 100644
--- a/l10n/de_DE.json
+++ b/l10n/de_DE.json
@@ -27,7 +27,6 @@
"Presentation" : "Präsentation",
"Error when trying to connect" : "Fehler beim Anschließen",
"Settings have been successfully updated" : "Einstellungen wurden erfolgreich aktualisiert",
- "Bad Request or timeout error" : "Bad Request oder Timeout Fehlermeldung",
"Server can't read xml" : "Server kann eine xml-Datei nicht einlesen",
"Bad Response. Errors: " : "Bad Response. Fehler:",
"Documentation" : "Dokumentation",
diff --git a/l10n/es.js b/l10n/es.js
index 6440bd9..e22b794 100644
--- a/l10n/es.js
+++ b/l10n/es.js
@@ -29,7 +29,6 @@ OC.L10N.register(
"Presentation" : "Presentación",
"Error when trying to connect" : "Error al intentar establecer la conexión",
"Settings have been successfully updated" : "Ajustes han sido actualizados con éxito",
- "Bad Request or timeout error" : "Solicitud Mala o error de límite de tiempo",
"Server can't read xml" : "Servidor no puede leer xml",
"Bad Response. Errors: " : "Respuesta Mala. Errores:",
"Documentation" : "Documentación",
diff --git a/l10n/es.json b/l10n/es.json
index 920d4c5..9c0922a 100644
--- a/l10n/es.json
+++ b/l10n/es.json
@@ -27,7 +27,6 @@
"Presentation" : "Presentación",
"Error when trying to connect" : "Error al intentar establecer la conexión",
"Settings have been successfully updated" : "Ajustes han sido actualizados con éxito",
- "Bad Request or timeout error" : "Solicitud Mala o error de límite de tiempo",
"Server can't read xml" : "Servidor no puede leer xml",
"Bad Response. Errors: " : "Respuesta Mala. Errores:",
"Documentation" : "Documentación",
diff --git a/l10n/fr.js b/l10n/fr.js
index e4d0b90..6adddb8 100644
--- a/l10n/fr.js
+++ b/l10n/fr.js
@@ -29,7 +29,6 @@ OC.L10N.register(
"Presentation" : "Présentation",
"Error when trying to connect" : "Erreur durant la tentative de connexion",
"Settings have been successfully updated" : "Les paramètres ont été mis à jour avec succès",
- "Bad Request or timeout error" : "Demande incorrecte ou délai d'attente dépassé",
"Server can't read xml" : "Le serveur ne peut pas lire le XML",
"Bad Response. Errors: " : "Mauvaise réponse. Erreurs:",
"Documentation" : "Documentation",
diff --git a/l10n/fr.json b/l10n/fr.json
index 26e2587..b129788 100644
--- a/l10n/fr.json
+++ b/l10n/fr.json
@@ -27,7 +27,6 @@
"Presentation" : "Présentation",
"Error when trying to connect" : "Erreur durant la tentative de connexion",
"Settings have been successfully updated" : "Les paramètres ont été mis à jour avec succès",
- "Bad Request or timeout error" : "Demande incorrecte ou délai d'attente dépassé",
"Server can't read xml" : "Le serveur ne peut pas lire le XML",
"Bad Response. Errors: " : "Mauvaise réponse. Erreurs:",
"Documentation" : "Documentation",
diff --git a/l10n/pt_BR.js b/l10n/pt_BR.js
index da6f02a..40f74b9 100644
--- a/l10n/pt_BR.js
+++ b/l10n/pt_BR.js
@@ -29,7 +29,6 @@ OC.L10N.register(
"Presentation" : "Apresentação",
"Error when trying to connect" : "Erro ao tentar conectar",
"Settings have been successfully updated" : "Configurações salvas com sucesso",
- "Bad Request or timeout error" : "Pedido ruim ou erro de limite de tempo",
"Server can't read xml" : "Servidor não pode ler xml",
"Bad Response. Errors: " : "Resposta ruim. Erros:",
"Documentation" : "Documentação",
diff --git a/l10n/pt_BR.json b/l10n/pt_BR.json
index d49db3d..d8164b0 100644
--- a/l10n/pt_BR.json
+++ b/l10n/pt_BR.json
@@ -27,7 +27,6 @@
"Presentation" : "Apresentação",
"Error when trying to connect" : "Erro ao tentar conectar",
"Settings have been successfully updated" : "Configurações salvas com sucesso",
- "Bad Request or timeout error" : "Pedido ruim ou erro de limite de tempo",
"Server can't read xml" : "Servidor não pode ler xml",
"Bad Response. Errors: " : "Resposta ruim. Erros:",
"Documentation" : "Documentação",
diff --git a/l10n/ru.js b/l10n/ru.js
index 1a2702b..b6ddd3e 100644
--- a/l10n/ru.js
+++ b/l10n/ru.js
@@ -29,7 +29,6 @@ OC.L10N.register(
"Presentation" : "Презентация",
"Error when trying to connect" : "При попытке соединения возникла ошибка",
"Settings have been successfully updated" : "Настройки были успешно обновлены",
- "Bad Request or timeout error" : "Ошибка запроса или таймаут",
"Server can't read xml" : "Невозможно прочитать xml файл на сервере",
"Bad Response. Errors: " : "Неправильный ответ. Ошибки:",
"Documentation" : "Документация",
diff --git a/l10n/ru.json b/l10n/ru.json
index 92fc5ed..58a53d2 100644
--- a/l10n/ru.json
+++ b/l10n/ru.json
@@ -27,7 +27,6 @@
"Presentation" : "Презентация",
"Error when trying to connect" : "При попытке соединения возникла ошибка",
"Settings have been successfully updated" : "Настройки были успешно обновлены",
- "Bad Request or timeout error" : "Ошибка запроса или таймаут",
"Server can't read xml" : "Невозможно прочитать xml файл на сервере",
"Bad Response. Errors: " : "Неправильный ответ. Ошибки:",
"Documentation" : "Документация",
diff --git a/l10n/sv.js b/l10n/sv.js
index 0bc18e4..a0fbe38 100644
--- a/l10n/sv.js
+++ b/l10n/sv.js
@@ -29,7 +29,6 @@ OC.L10N.register(
"Presentation" : "Presentation",
"Error when trying to connect" : "Fel vid försök att ansluta",
"Settings have been successfully updated" : "Inställningarna har uppdaterats",
- "Bad Request or timeout error" : "Fel vid förfrågan eller timeout-fel",
"Server can't read xml" : "Servern kan inte läsa XML",
"Bad Response. Errors: " : "Felaktigt svar. Fel:",
"Documentation" : "Dokumentation",
diff --git a/l10n/sv.json b/l10n/sv.json
index afe8f4f..378eaea 100644
--- a/l10n/sv.json
+++ b/l10n/sv.json
@@ -27,7 +27,6 @@
"Presentation" : "Presentation",
"Error when trying to connect" : "Fel vid försök att ansluta",
"Settings have been successfully updated" : "Inställningarna har uppdaterats",
- "Bad Request or timeout error" : "Fel vid förfrågan eller timeout-fel",
"Server can't read xml" : "Servern kan inte läsa XML",
"Bad Response. Errors: " : "Felaktigt svar. Fel:",
"Documentation" : "Dokumentation",
diff --git a/lib/adminsection.php b/lib/adminsection.php
index d182c71..6a6ff2d 100644
--- a/lib/adminsection.php
+++ b/lib/adminsection.php
@@ -1,7 +1,7 @@
<?php
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
diff --git a/lib/adminsettings.php b/lib/adminsettings.php
index e0376d4..32b112b 100644
--- a/lib/adminsettings.php
+++ b/lib/adminsettings.php
@@ -1,7 +1,7 @@
<?php
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
diff --git a/lib/appconfig.php b/lib/appconfig.php
index 67d8de7..52a6812 100644
--- a/lib/appconfig.php
+++ b/lib/appconfig.php
@@ -1,7 +1,7 @@
<?php
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
@@ -86,7 +86,7 @@ class AppConfig {
*
* @var string
*/
- private $_cryptSecret = "skey";
+ private $_cryptSecret = "secret";
/**
* The config key for the default formats
@@ -145,6 +145,13 @@ class AppConfig {
private $_settingsError = "settings_error";
/**
+ * The config key for the modifyFilter
+ *
+ * @var string
+ */
+ public $_permissions_modifyFilter = "permissions_modifyFilter";
+
+ /**
* The config key for the customer
*
* @var string
@@ -350,19 +357,7 @@ class AppConfig {
* @return string
*/
public function GetSKey() {
- $skey = $this->config->getAppValue($this->appName, $this->_cryptSecret, "");
- if (empty($skey)) {
- $skey = number_format(round(microtime(true) * 1000), 0, ".", "");
- $this->config->setAppValue($this->appName, $this->_cryptSecret, $skey);
- }
- return $skey;
- }
-
- /**
- * Regenerate the secret key
- */
- public function DropSKey() {
- $this->config->setAppValue($this->appName, $this->_cryptSecret, "");
+ return $this->config->getSystemValue($this->_cryptSecret, true);
}
/**
@@ -438,9 +433,12 @@ class AppConfig {
/**
* Save the list of groups
*
- * @param array $value - same tab
+ * @param array $groups - the list of groups
*/
public function SetLimitGroups($groups) {
+ if (!is_array($groups)) {
+ $groups = array();
+ }
$value = json_encode($groups);
$this->logger->info("Set groups: " . $value, array("app" => $this->appName));
@@ -457,7 +455,11 @@ class AppConfig {
if (empty($value)) {
return array();
}
- return json_decode($value, true);
+ $groups = json_decode($value, true);
+ if (!is_array($groups)) {
+ $groups = array();
+ }
+ return $groups;
}
/**
@@ -571,34 +573,34 @@ class AppConfig {
*/
private $formats = [
"csv" => [ "mime" => "text/csv", "type" => "spreadsheet", "edit" => true, "editable" => true ],
- "doc" => [ "mime" => "application/msword", "type" => "text", "conv" => true ],
- "docm" => [ "mime" => "application/vnd.ms-word.document.macroEnabled.12", "type" => "text", "conv" => true ],
- "docx" => [ "mime" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "type" => "text", "edit" => true, "def" => true ],
- "dot" => [ "type" => "text", "conv" => true ],
- "dotx" => [ "mime" => "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "type" => "text", "conv" => true ],
- "epub" => [ "mime" => "application/epub+zip", "type" => "text", "conv" => true ],
- "htm" => [ "type" => "text", "conv" => true ],
- "html" => [ "mime" => "text/html", "type" => "text", "conv" => true ],
+ "doc" => [ "mime" => "application/msword", "type" => "text", "conv" => true ],
+ "docm" => [ "mime" => "application/vnd.ms-word.document.macroEnabled.12", "type" => "text", "conv" => true ],
+ "docx" => [ "mime" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "type" => "text", "edit" => true, "def" => true ],
+ "dot" => [ "type" => "text", "conv" => true ],
+ "dotx" => [ "mime" => "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "type" => "text", "conv" => true ],
+ "epub" => [ "mime" => "application/epub+zip", "type" => "text", "conv" => true ],
+ "htm" => [ "type" => "text", "conv" => true ],
+ "html" => [ "mime" => "text/html", "type" => "text", "conv" => true ],
"odp" => [ "mime" => "application/vnd.oasis.opendocument.presentation", "type" => "presentation", "conv" => true, "editable" => true ],
"ods" => [ "mime" => "application/vnd.oasis.opendocument.spreadsheet", "type" => "spreadsheet", "conv" => true, "editable" => true ],
"odt" => [ "mime" => "application/vnd.oasis.opendocument.text", "type" => "text", "conv" => true, "editable" => true ],
- "pdf" => [ "mime" => "application/pdf", "type" => "text" ],
- "pot" => [ "type" => "presentation", "conv" => true ],
- "potm" => [ "mime" => "application/vnd.ms-powerpoint.template.macroEnabled.12", "type" => "presentation", "conv" => true ],
- "potx" => [ "mime" => "application/vnd.openxmlformats-officedocument.presentationml.template", "type" => "presentation", "conv" => true ],
- "pps" => [ "type" => "presentation", "conv" => true ],
- "ppsm" => [ "mime" => "application/vnd.ms-powerpoint.slideshow.macroEnabled.12", "type" => "presentation", "conv" => true ],
- "ppsx" => [ "mime" => "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "type" => "presentation", "conv" => true ],
- "ppt" => [ "mime" => "application/vnd.ms-powerpoint", "type" => "presentation", "conv" => true ],
- "pptm" => [ "mime" => "application/vnd.ms-powerpoint.presentation.macroEnabled.12", "type" => "presentation", "conv" => true ],
- "pptx" => [ "mime" => "application/vnd.openxmlformats-officedocument.presentationml.presentation", "type" => "presentation", "edit" => true, "def" => true ],
+ "pdf" => [ "mime" => "application/pdf", "type" => "text" ],
+ "pot" => [ "type" => "presentation", "conv" => true ],
+ "potm" => [ "mime" => "application/vnd.ms-powerpoint.template.macroEnabled.12", "type" => "presentation", "conv" => true ],
+ "potx" => [ "mime" => "application/vnd.openxmlformats-officedocument.presentationml.template", "type" => "presentation", "conv" => true ],
+ "pps" => [ "type" => "presentation", "conv" => true ],
+ "ppsm" => [ "mime" => "application/vnd.ms-powerpoint.slideshow.macroEnabled.12", "type" => "presentation", "conv" => true ],
+ "ppsx" => [ "mime" => "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "type" => "presentation", "conv" => true ],
+ "ppt" => [ "mime" => "application/vnd.ms-powerpoint", "type" => "presentation", "conv" => true ],
+ "pptm" => [ "mime" => "application/vnd.ms-powerpoint.presentation.macroEnabled.12", "type" => "presentation", "conv" => true ],
+ "pptx" => [ "mime" => "application/vnd.openxmlformats-officedocument.presentationml.presentation", "type" => "presentation", "edit" => true, "def" => true ],
"rtf" => [ "mime" => "text/rtf", "type" => "text", "conv" => true, "editable" => true ],
"txt" => [ "mime" => "text/plain", "type" => "text", "edit" => true, "editable" => true ],
- "xls" => [ "mime" => "application/vnd.ms-excel", "type" => "spreadsheet", "conv" => true ],
- "xlsm" => [ "mime" => "application/vnd.ms-excel.sheet.macroEnabled.12", "type" => "spreadsheet", "conv" => true ],
- "xlsx" => [ "mime" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "type" => "spreadsheet", "edit" => true, "def" => true ],
- "xlt" => [ "type" => "spreadsheet", "conv" => true ],
- "xltm" => [ "mime" => "application/vnd.ms-excel.template.macroEnabled.12", "type" => "spreadsheet", "conv" => true ],
- "xltx" => [ "mime" => "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "type" => "spreadsheet", "conv" => true ]
- ];
+ "xls" => [ "mime" => "application/vnd.ms-excel", "type" => "spreadsheet", "conv" => true ],
+ "xlsm" => [ "mime" => "application/vnd.ms-excel.sheet.macroEnabled.12", "type" => "spreadsheet", "conv" => true ],
+ "xlsx" => [ "mime" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "type" => "spreadsheet", "edit" => true, "def" => true ],
+ "xlt" => [ "type" => "spreadsheet", "conv" => true ],
+ "xltm" => [ "mime" => "application/vnd.ms-excel.template.macroEnabled.12", "type" => "spreadsheet", "conv" => true ],
+ "xltx" => [ "mime" => "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "type" => "spreadsheet", "conv" => true ]
+ ];
}
diff --git a/lib/crypt.php b/lib/crypt.php
index 4605df0..ec37a12 100644
--- a/lib/crypt.php
+++ b/lib/crypt.php
@@ -1,7 +1,7 @@
<?php
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
diff --git a/lib/documentservice.php b/lib/documentservice.php
index 8818d19..ea14002 100644
--- a/lib/documentservice.php
+++ b/lib/documentservice.php
@@ -1,7 +1,7 @@
<?php
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
@@ -151,39 +151,27 @@ class DocumentService {
"key" => $document_revision_id
];
- $response_xml_data;
- $countTry = 0;
-
- $opts = array("http" => array(
- "method" => "POST",
- "timeout" => "120",
- "header"=> "Content-type: application/json\r\n",
- "content" => json_encode($data)
- )
- );
+ $opts = array(
+ "timeout" => "120",
+ "headers" => [
+ "Content-type" => "application/json"
+ ],
+ "body" => json_encode($data)
+ );
if (!empty($this->config->GetDocumentServerSecret())) {
$params = [
"payload" => $data
];
$token = \Firebase\JWT\JWT::encode($params, $this->config->GetDocumentServerSecret());
- $opts["http"]["header"] = $opts["http"]["header"] . $this->config->JwtHeader() . ": Bearer " . $token . "\r\n";
+ $opts["headers"][$this->config->JwtHeader()] = "Bearer " . $token;
$token = \Firebase\JWT\JWT::encode($data, $this->config->GetDocumentServerSecret());
$data["token"] = $token;
- $opts["http"]["content"] = json_encode($data);
- }
-
- $ServiceConverterMaxTry = 3;
- while ($countTry < $ServiceConverterMaxTry) {
- $countTry = $countTry + 1;
- $response_xml_data = $this->Request($urlToConverter, $opts);
- if ($response_xml_data !== false) { break; }
+ $opts["body"] = json_encode($data);
}
- if ($countTry === $ServiceConverterMaxTry) {
- throw new \Exception ($this->trans->t("Bad Request or timeout error"));
- }
+ $response_xml_data = $this->Request($urlToConverter, "post", $opts);
libxml_use_internal_errors(true);
if (!function_exists("simplexml_load_file")) {
@@ -265,14 +253,7 @@ class DocumentService {
$urlHealthcheck = $documentServerUrl . "healthcheck";
- $opts = array("http" => array(
- "timeout" => "60"
- )
- );
-
- if (($response = $this->Request($urlHealthcheck, $opts)) === false) {
- throw new \Exception ($this->trans->t("Bad Request or timeout error"));
- }
+ $response = $this->Request($urlHealthcheck);
return $response === "true";
}
@@ -298,29 +279,26 @@ class DocumentService {
"c" => $method
];
- $opts = array("http" => array(
- "method" => "POST",
- "timeout" => "60",
- "header"=> "Content-type: application/json\r\n",
- "content" => json_encode($data)
- )
- );
+ $opts = array(
+ "headers" => [
+ "Content-type" => "application/json"
+ ],
+ "body" => json_encode($data)
+ );
if (!empty($this->config->GetDocumentServerSecret())) {
$params = [
"payload" => $data
];
$token = \Firebase\JWT\JWT::encode($params, $this->config->GetDocumentServerSecret());
- $opts["http"]["header"] = $opts["http"]["header"] . $this->config->JwtHeader() . ": Bearer " . $token . "\r\n";
+ $opts["headers"][$this->config->JwtHeader()] = "Bearer " . $token;
$token = \Firebase\JWT\JWT::encode($data, $this->config->GetDocumentServerSecret());
$data["token"] = $token;
- $opts["http"]["content"] = json_encode($data);
+ $opts["body"] = json_encode($data);
}
- if (($response = $this->Request($urlCommand, $opts)) === false) {
- throw new \Exception ($this->trans->t("Bad Request or timeout error"));
- }
+ $response = $this->Request($urlCommand, "post", $opts);
$data = json_decode($response);
@@ -364,24 +342,32 @@ class DocumentService {
* Request to Document Server with turn off verification
*
* @param string $url - request address
- * @param array $opts - stream context options
+ * @param array $method - request method
+ * @param array $opts - request options
*
* @return string
*/
- public function Request($url, $opts = NULL) {
+
+ public function Request($url, $method = "get", $opts = NULL) {
+ $httpClientService = \OC::$server->getHTTPClientService();
+ $client = $httpClientService->newClient();
+
if (NULL === $opts) {
$opts = array();
}
-
if (substr($url, 0, strlen("https")) === "https" && $this->config->TurnOffVerification()) {
- $opts["ssl"] = array(
- "verify_peer" => false,
- "verify_peer_name" => false
- );
+ $opts["verify"] = false;
+ }
+ if (!array_key_exists("timeout", $opts)) {
+ $opts["timeout"] = 60;
}
- $context = stream_context_create($opts);
+ if ($method === "post") {
+ $response = $client->post($url, $opts);
+ } else {
+ $response = $client->get($url, $opts);
+ }
- return file_get_contents($url, false, $context);
+ return $response->getBody();
}
}
diff --git a/settings.php b/settings.php
index ceeb6be..802d01f 100644
--- a/settings.php
+++ b/settings.php
@@ -1,7 +1,7 @@
<?php
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
diff --git a/templates/editor.php b/templates/editor.php
index 2410445..38deacc 100644
--- a/templates/editor.php
+++ b/templates/editor.php
@@ -1,7 +1,7 @@
<?php
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
@@ -34,7 +34,7 @@
<div id="app">
- <div id="iframeEditor" data-id="<?php p($_["fileId"]) ?>" data-token="<?php p($_["token"]) ?>"></div>
+ <div id="iframeEditor" data-id="<?php p($_["fileId"]) ?>" data-path="<?php p($_["filePath"]) ?>" data-token="<?php p($_["token"]) ?>"></div>
<?php if (!empty($_["documentServerUrl"])) { ?>
<script nonce="<?php p(base64_encode($_["requesttoken"])) ?>"
diff --git a/templates/settings.php b/templates/settings.php
index 1d9b210..b7b567a 100644
--- a/templates/settings.php
+++ b/templates/settings.php
@@ -1,7 +1,7 @@
<?php
/**
*
- * (c) Copyright Ascensio System Limited 2010-2018
+ * (c) Copyright Ascensio System SIA 2019
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
@@ -82,7 +82,7 @@
<input type="checkbox" class="checkbox"
id="onlyofficeDefFormat<?php p($format) ?>"
name="<?php p($format) ?>"
- <?php if ($setting["def"]) { ?>checked="checked"<?php } ?> />
+ <?php if (array_key_exists("def", $setting) && $setting["def"]) { ?>checked="checked"<?php } ?> />
<label for="onlyofficeDefFormat<?php p($format) ?>"><?php p($format) ?></label>
</div>
<?php } ?>
@@ -90,7 +90,7 @@
</div>
<h3 class="onlyoffice-header"><?php p($l->t("Open the file for editing (due to format restrictions, the data might be lost when saving to the formats from the list below)")) ?></h3>
- <a target="_blank" class="icon-info svg" title="" href="https://api.onlyoffice.com/editors/owncloud#editable" data-original-title="<?php p($l->t("View details")) ?>"></a>
+ <a target="_blank" class="icon-info svg" title="" href="https://api.onlyoffice.com/editors/nextcloud#editable" data-original-title="<?php p($l->t("View details")) ?>"></a>
<div class="onlyoffice-exts">
<?php foreach ($_["formats"] as $format => $setting) { ?>
<?php if (array_key_exists("editable", $setting)) { ?>
@@ -98,7 +98,7 @@
<input type="checkbox" class="checkbox"
id="onlyofficeEditFormat<?php p($format) ?>"
name="<?php p($format) ?>"
- <?php if ($setting["edit"]) { ?>checked="checked"<?php } ?> />
+ <?php if (array_key_exists("edit", $setting) && $setting["edit"]) { ?>checked="checked"<?php } ?> />
<label for="onlyofficeEditFormat<?php p($format) ?>"><?php p($format) ?></label>
</div>
<?php } ?>