Merge remote-tracking branch 'remotes/origin/develop' into feature/userInfoGroups

# Conflicts:
#	web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/ExampleData.java
#	web/documentserver-example/java/src/main/java/helpers/Users.java
#	web/documentserver-example/php/users.php
#	web/documentserver-example/python/src/utils/users.py
#	web/documentserver-example/ruby/app/models/users.rb
This commit is contained in:
Oleg Sinizin
2022-02-11 10:13:49 +03:00
96 changed files with 849 additions and 373 deletions

View File

@ -52,7 +52,7 @@
}
$fileuri = FileUri($filename, true);
$fileuriUser = FileUri($filename);
$fileuriUser = realpath($GLOBALS['STORAGE_PATH']) === $GLOBALS['STORAGE_PATH'] ? getDownloadUrl($filename) . "&dmode=emb" : FileUri($filename);
$docKey = getDocEditorKey($filename);
$filetype = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
@ -218,6 +218,7 @@
// get document history
function getHistory($filename, $filetype, $docKey, $fileuri) {
$storagePath = $GLOBALS['STORAGE_PATH'];
$histDir = getHistoryDir(getStoragePath($filename)); // get the path to the file history
if (getFileVersion($histDir) > 0) { // check if the file was modified (the file version is greater than 0)
@ -246,31 +247,40 @@
];
}
$fileT = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
$prevFileName = $verDir . DIRECTORY_SEPARATOR . "prev." . $filetype;
$prevFileName = substr($prevFileName, strlen(getStoragePath("")));
$dataObj["fileType"] = $fileT;
$dataObj["key"] = $key;
$dataObj["url"] = $i == $curVer ? $fileuri : getVirtualPath(true) . str_replace("%5C", "/", rawurlencode($prevFileName)); // write file url to the data object
$prevFileUrl = $i == $curVer ? $fileuri : getVirtualPath(true) . str_replace("%5C", "/", rawurlencode($prevFileName));
if (realpath($storagePath) === $storagePath) {
$prevFileUrl = $i == $curVer ? getDownloadUrl($filename) : getDownloadUrl($prevFileName);
}
$dataObj["url"] = $prevFileUrl; // write file url to the data object
$dataObj["version"] = $i;
if ($i > 1) { // check if the version number is greater than 1 (the document was modified)
$changes = json_decode(file_get_contents(getVersionDir($histDir, $i - 1) . DIRECTORY_SEPARATOR . "changes.json"), true); // get the path to the changes.json file
$change = $changes["changes"][0];
$obj["changes"] = $change ? $changes["changes"][0] : null; // write information about changes to the object
$obj["changes"] = $changes ? $changes["changes"] : null; // write information about changes to the object
$obj["serverVersion"] = $changes["serverVersion"];
$obj["created"] = $change ? $change["created"] : null;
$obj["user"] = $change ? $change["user"] : null;
$prev = $histData[$i - 2]; // get the history data from the previous file version
$dataObj["previous"] = [ // write information about previous file version to the data object
"fileType" => $prev["fileType"],
"key" => $prev["key"],
"url" => $prev["url"]
];
$changesUrl = getVersionDir($histDir, $i - 1) . DIRECTORY_SEPARATOR . "diff.zip";
$changesUrl = substr($changesUrl, strlen(getStoragePath("")));
$changesPath = getVersionDir($histDir, $i - 1) . DIRECTORY_SEPARATOR . "diff.zip";
$changesPath = substr($changesPath, strlen(getStoragePath("")));
// write the path to the diff.zip archive with differences in this file version
$dataObj["changesUrl"] = getVirtualPath(true) . str_replace("%5C", "/", rawurlencode($changesUrl));
$changesUrl = realpath($storagePath) === $storagePath ? getDownloadUrl($changesPath) : getVirtualPath(true) . str_replace("%5C", "/", rawurlencode($changesPath)) ;
$dataObj["changesUrl"] = $changesUrl;
}
if (isJwtEnabled()) {