1
0
mirror of https://github.com/ONLYOFFICE/onlyoffice-owncloud.git synced 2025-08-08 05:42:07 +03:00

oc native function invocation

This commit is contained in:
rivexe
2023-12-18 14:52:00 +03:00
parent 696b4aca2b
commit 79555b55cc
13 changed files with 62 additions and 62 deletions

View File

@@ -202,7 +202,7 @@ class CallbackController extends Controller {
return new JSONResponse(["message" => $this->trans->t("Access denied")], Http::STATUS_FORBIDDEN); return new JSONResponse(["message" => $this->trans->t("Access denied")], Http::STATUS_FORBIDDEN);
} }
$header = substr($header, strlen("Bearer ")); $header = substr($header, \strlen("Bearer "));
try { 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"));
@@ -275,7 +275,7 @@ class CallbackController extends Controller {
$versions = array_reverse($this->versionManager->getVersionsForFile($owner, $file->getFileInfo())); $versions = array_reverse($this->versionManager->getVersionsForFile($owner, $file->getFileInfo()));
$versionId = null; $versionId = null;
if ($version > count($versions)) { if ($version > \count($versions)) {
$versionId = $file->getFileInfo()->getMtime(); $versionId = $file->getFileInfo()->getMtime();
} else { } else {
$fileVersion = array_values($versions)[$version - 1]; $fileVersion = array_values($versions)[$version - 1];
@@ -339,7 +339,7 @@ class CallbackController extends Controller {
return new JSONResponse(["message" => $this->trans->t("Access denied")], Http::STATUS_FORBIDDEN); return new JSONResponse(["message" => $this->trans->t("Access denied")], Http::STATUS_FORBIDDEN);
} }
$header = substr($header, strlen("Bearer ")); $header = substr($header, \strlen("Bearer "));
try { 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"));
@@ -417,7 +417,7 @@ class CallbackController extends Controller {
return new JSONResponse(["message" => $this->trans->t("Access denied")], Http::STATUS_FORBIDDEN); return new JSONResponse(["message" => $this->trans->t("Access denied")], Http::STATUS_FORBIDDEN);
} }
$header = substr($header, strlen("Bearer ")); $header = substr($header, \strlen("Bearer "));
try { 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"));
@@ -625,7 +625,7 @@ class CallbackController extends Controller {
$file = $files[0]; $file = $files[0];
if (count($files) > 1 && !empty($filePath)) { if (\count($files) > 1 && !empty($filePath)) {
$filePath = "/" . $userId . "/files" . $filePath; $filePath = "/" . $userId . "/files" . $filePath;
foreach ($files as $curFile) { foreach ($files as $curFile) {
if ($curFile->getPath() === $filePath) { if ($curFile->getPath() === $filePath) {
@@ -654,7 +654,7 @@ class CallbackController extends Controller {
$versions = array_reverse($this->versionManager->getVersionsForFile($owner, $file->getFileInfo())); $versions = array_reverse($this->versionManager->getVersionsForFile($owner, $file->getFileInfo()));
if ($version <= count($versions)) { if ($version <= \count($versions)) {
$fileVersion = array_values($versions)[$version - 1]; $fileVersion = array_values($versions)[$version - 1];
$file = $this->versionManager->getVersionFile($owner, $file->getFileInfo(), $fileVersion->getRevisionId()); $file = $this->versionManager->getVersionFile($owner, $file->getFileInfo(), $fileVersion->getRevisionId());
} }
@@ -709,7 +709,7 @@ class CallbackController extends Controller {
if ($owner !== null) { if ($owner !== null) {
$versions = array_reverse($this->versionManager->getVersionsForFile($owner, $file->getFileInfo())); $versions = array_reverse($this->versionManager->getVersionsForFile($owner, $file->getFileInfo()));
if ($version <= count($versions)) { if ($version <= \count($versions)) {
$fileVersion = array_values($versions)[$version - 1]; $fileVersion = array_values($versions)[$version - 1];
$file = $this->versionManager->getVersionFile($owner, $file->getFileInfo(), $fileVersion->getRevisionId()); $file = $this->versionManager->getVersionFile($owner, $file->getFileInfo(), $fileVersion->getRevisionId());
} }
@@ -757,8 +757,8 @@ class CallbackController extends Controller {
$instanceId = $this->config->GetSystemValue("instanceid", true); $instanceId = $this->config->GetSystemValue("instanceid", true);
$instanceId = $instanceId . "_"; $instanceId = $instanceId . "_";
if (substr($userId, 0, strlen($instanceId)) === $instanceId) { if (substr($userId, 0, \strlen($instanceId)) === $instanceId) {
return substr($userId, strlen($instanceId)); return substr($userId, \strlen($instanceId));
} }
return $userId; return $userId;

View File

@@ -266,7 +266,7 @@ class EditorApiController extends OCSController {
$fileName = $file->getName(); $fileName = $file->getName();
$ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION)); $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)) { if (!isset($format)) {
$this->logger->info("Format is not supported for editing: $fileName", ["app" => $this->appName]); $this->logger->info("Format is not supported for editing: $fileName", ["app" => $this->appName]);
return new JSONResponse(["error" => $this->trans->t("Format is not supported")]); return new JSONResponse(["error" => $this->trans->t("Format is not supported")]);
@@ -281,7 +281,7 @@ class EditorApiController extends OCSController {
if ($owner !== null) { if ($owner !== null) {
$versions = array_reverse($this->versionManager->getVersionsForFile($owner, $file->getFileInfo())); $versions = array_reverse($this->versionManager->getVersionsForFile($owner, $file->getFileInfo()));
if ($version <= count($versions)) { if ($version <= \count($versions)) {
$fileVersion = array_values($versions)[$version - 1]; $fileVersion = array_values($versions)[$version - 1];
$key = $this->fileUtility->getVersionKey($fileVersion); $key = $this->fileUtility->getVersionKey($fileVersion);
@@ -361,7 +361,7 @@ class EditorApiController extends OCSController {
&& (\OC::$server->getConfig()->getAppValue("files", "enable_lock_file_action", "no") === "yes") && (\OC::$server->getConfig()->getAppValue("files", "enable_lock_file_action", "no") === "yes")
&& $fileStorage->instanceOfStorage(IPersistentLockingStorage::class)) { && $fileStorage->instanceOfStorage(IPersistentLockingStorage::class)) {
$locks = $fileStorage->getLocks($file->getFileInfo()->getInternalPath(), false); $locks = $fileStorage->getLocks($file->getFileInfo()->getInternalPath(), false);
if (count($locks) > 0) { if (\count($locks) > 0) {
$activeLock = $locks[0]; $activeLock = $locks[0];
if ($accountId !== $activeLock->getOwnerAccountId()) { if ($accountId !== $activeLock->getOwnerAccountId()) {
@@ -582,7 +582,7 @@ class EditorApiController extends OCSController {
$file = $files[0]; $file = $files[0];
if (count($files) > 1 && !empty($filePath)) { if (\count($files) > 1 && !empty($filePath)) {
$filePath = "/" . $userId . "/files" . $filePath; $filePath = "/" . $userId . "/files" . $filePath;
foreach ($files as $curFile) { foreach ($files as $curFile) {
if ($curFile->getPath() === $filePath) { if ($curFile->getPath() === $filePath) {
@@ -763,7 +763,7 @@ class EditorApiController extends OCSController {
private function isFavorite($fileId) { private function isFavorite($fileId) {
$currentTags = $this->tagManager->load("files")->getTagsForObjects([$fileId]); $currentTags = $this->tagManager->load("files")->getTagsForObjects([$fileId]);
if ($currentTags) { if ($currentTags) {
return in_array(Tags::TAG_FAVORITE, $currentTags[$fileId]); return \in_array(Tags::TAG_FAVORITE, $currentTags[$fileId]);
} }
return false; return false;

View File

@@ -377,7 +377,7 @@ class EditorController extends Controller {
foreach ($currentUserGroups as $currentUserGroup) { foreach ($currentUserGroups as $currentUserGroup) {
$group = $this->groupManager->get($currentUserGroup); $group = $this->groupManager->get($currentUserGroup);
foreach ($group->getUsers() as $user) { foreach ($group->getUsers() as $user) {
if (!in_array($user, $users)) { if (!\in_array($user, $users)) {
array_push($users, $user); array_push($users, $user);
} }
} }
@@ -391,7 +391,7 @@ class EditorController extends Controller {
if (!$all) { if (!$all) {
$accessList = $this->getAccessList($file); $accessList = $this->getAccessList($file);
foreach ($accessList as $accessUser) { foreach ($accessList as $accessUser) {
if (!in_array($accessUser, $users)) { if (!\in_array($accessUser, $users)) {
array_push($users, $accessUser); array_push($users, $accessUser);
} }
} }
@@ -439,7 +439,7 @@ class EditorController extends Controller {
$recipients = $this->userManager->getByEmail($email); $recipients = $this->userManager->getByEmail($email);
foreach ($recipients as $recipient) { foreach ($recipients as $recipient) {
$recipientId = $recipient->getUID(); $recipientId = $recipient->getUID();
if (!in_array($recipientId, $recipientIds)) { if (!\in_array($recipientId, $recipientIds)) {
array_push($recipientIds, $recipientId); array_push($recipientIds, $recipientId);
} }
} }
@@ -465,9 +465,9 @@ class EditorController extends Controller {
//Length from ownCloud: //Length from ownCloud:
//https://github.com/owncloud/core/blob/master/lib/private/Notification/Notification.php#L181 //https://github.com/owncloud/core/blob/master/lib/private/Notification/Notification.php#L181
$maxLen = 64; $maxLen = 64;
if (strlen($comment) > $maxLen) { if (\strlen($comment) > $maxLen) {
$ending = "..."; $ending = "...";
$comment = substr($comment, 0, ($maxLen - strlen($ending))) . $ending; $comment = substr($comment, 0, ($maxLen - \strlen($ending))) . $ending;
} }
$notificationManager = \OC::$server->getNotificationManager(); $notificationManager = \OC::$server->getNotificationManager();
@@ -494,7 +494,7 @@ class EditorController extends Controller {
foreach ($recipientIds as $recipientId) { foreach ($recipientIds as $recipientId) {
$recipient = $this->userManager->get($recipientId); $recipient = $this->userManager->get($recipientId);
$isAvailable = in_array($recipient, $accessList); $isAvailable = \in_array($recipient, $accessList);
if (!$isAvailable if (!$isAvailable
&& $file->getFileInfo()->getMountPoint() instanceof \OCA\Files_External\Config\ExternalMountPoint) { && $file->getFileInfo()->getMountPoint() instanceof \OCA\Files_External\Config\ExternalMountPoint) {
@@ -692,7 +692,7 @@ class EditorController extends Controller {
return ["error" => $this->trans->t("Failed to download converted file")]; return ["error" => $this->trans->t("Failed to download converted file")];
} }
$fileNameWithoutExt = substr($fileName, 0, strlen($fileName) - strlen($ext) - 1); $fileNameWithoutExt = substr($fileName, 0, \strlen($fileName) - \strlen($ext) - 1);
$newFileName = $folder->getNonExistingName($fileNameWithoutExt . "." . $internalExtension); $newFileName = $folder->getNonExistingName($fileNameWithoutExt . "." . $internalExtension);
try { try {
@@ -944,7 +944,7 @@ class EditorController extends Controller {
$key = null; $key = null;
$fileUrl = null; $fileUrl = null;
$versionId = null; $versionId = null;
if ($version > count($versions)) { if ($version > \count($versions)) {
$key = $this->fileUtility->getKey($file, true); $key = $this->fileUtility->getKey($file, true);
$versionId = $file->getFileInfo()->getMtime(); $versionId = $file->getFileInfo()->getMtime();
@@ -969,7 +969,7 @@ class EditorController extends Controller {
]; ];
if ($version > 1 if ($version > 1
&& count($versions) >= $version - 1 && \count($versions) >= $version - 1
&& FileVersions::hasChanges($ownerId, $fileId, $versionId)) { && FileVersions::hasChanges($ownerId, $fileId, $versionId)) {
$changesUrl = $this->getUrl($file, $user, null, $version, true); $changesUrl = $this->getUrl($file, $user, null, $version, true);
$result["changesUrl"] = $changesUrl; $result["changesUrl"] = $changesUrl;
@@ -1040,7 +1040,7 @@ class EditorController extends Controller {
$versions = array_reverse($this->versionManager->getVersionsForFile($owner, $file->getFileInfo())); $versions = array_reverse($this->versionManager->getVersionsForFile($owner, $file->getFileInfo()));
} }
if (count($versions) >= $version) { if (\count($versions) >= $version) {
$fileVersion = array_values($versions)[$version - 1]; $fileVersion = array_values($versions)[$version - 1];
$this->versionManager->rollback($fileVersion); $this->versionManager->rollback($fileVersion);
} }
@@ -1173,7 +1173,7 @@ class EditorController extends Controller {
return $this->renderError($this->trans->t("Failed to download converted file")); return $this->renderError($this->trans->t("Failed to download converted file"));
} }
$fileNameWithoutExt = substr($fileName, 0, strlen($fileName) - strlen($ext) - 1); $fileNameWithoutExt = substr($fileName, 0, \strlen($fileName) - \strlen($ext) - 1);
$newFileName = $fileNameWithoutExt . "." . $toExtension; $newFileName = $fileNameWithoutExt . "." . $toExtension;
$formats = $this->config->FormatsSetting(); $formats = $this->config->FormatsSetting();
@@ -1306,7 +1306,7 @@ class EditorController extends Controller {
$file = $files[0]; $file = $files[0];
if (count($files) > 1 && !empty($filePath)) { if (\count($files) > 1 && !empty($filePath)) {
$filePath = "/" . $userId . "/files" . $filePath; $filePath = "/" . $userId . "/files" . $filePath;
foreach ($files as $curFile) { foreach ($files as $curFile) {
if ($curFile->getPath() === $filePath) { if ($curFile->getPath() === $filePath) {
@@ -1404,13 +1404,13 @@ class EditorController extends Controller {
} }
foreach ($accessList as $accessUser) { foreach ($accessList as $accessUser) {
if (!in_array($accessUser, $result)) { if (!\in_array($accessUser, $result)) {
array_push($result, $accessUser); array_push($result, $accessUser);
} }
} }
} }
if (!in_array($file->getOwner(), $result)) { if (!\in_array($file->getOwner(), $result)) {
array_push($result, $file->getOwner()); array_push($result, $file->getOwner());
} }

View File

@@ -92,7 +92,7 @@ class TemplateController extends Controller {
public function AddTemplate() { public function AddTemplate() {
$file = $this->request->getUploadedFile("file"); $file = $this->request->getUploadedFile("file");
if (!is_null($file)) { if (!\is_null($file)) {
if (is_uploaded_file($file["tmp_name"]) && $file["error"] === 0) { if (is_uploaded_file($file["tmp_name"]) && $file["error"] === 0) {
if (!TemplateManager::IsTemplateType($file["name"])) { if (!TemplateManager::IsTemplateType($file["name"])) {
return [ return [

View File

@@ -327,7 +327,7 @@ class AppConfig {
return $this->config->getSystemValue($key); return $this->config->getSystemValue($key);
} }
if (!empty($this->config->getSystemValue($this->appName)) if (!empty($this->config->getSystemValue($this->appName))
&& array_key_exists($key, $this->config->getSystemValue($this->appName))) { && \array_key_exists($key, $this->config->getSystemValue($this->appName))) {
return $this->config->getSystemValue($this->appName)[$key]; return $this->config->getSystemValue($this->appName)[$key];
} }
return null; return null;
@@ -404,7 +404,7 @@ class AppConfig {
*/ */
public function SetDocumentServerUrl($documentServer) { public function SetDocumentServerUrl($documentServer) {
$documentServer = trim($documentServer); $documentServer = trim($documentServer);
if (strlen($documentServer) > 0) { if (\strlen($documentServer) > 0) {
$documentServer = rtrim($documentServer, "/") . "/"; $documentServer = rtrim($documentServer, "/") . "/";
if (!preg_match("/(^https?:\/\/)|^\//i", $documentServer)) { if (!preg_match("/(^https?:\/\/)|^\//i", $documentServer)) {
$documentServer = "http://" . $documentServer; $documentServer = "http://" . $documentServer;
@@ -434,7 +434,7 @@ class AppConfig {
} }
if ($url !== "/") { if ($url !== "/") {
$url = rtrim($url, "/"); $url = rtrim($url, "/");
if (strlen($url) > 0) { if (\strlen($url) > 0) {
$url = $url . "/"; $url = $url . "/";
} }
} }
@@ -448,7 +448,7 @@ class AppConfig {
*/ */
public function SetDocumentServerInternalUrl($documentServerInternal) { public function SetDocumentServerInternalUrl($documentServerInternal) {
$documentServerInternal = rtrim(trim($documentServerInternal), "/"); $documentServerInternal = rtrim(trim($documentServerInternal), "/");
if (strlen($documentServerInternal) > 0) { if (\strlen($documentServerInternal) > 0) {
$documentServerInternal = $documentServerInternal . "/"; $documentServerInternal = $documentServerInternal . "/";
if (!preg_match("/^https?:\/\//i", $documentServerInternal)) { if (!preg_match("/^https?:\/\//i", $documentServerInternal)) {
$documentServerInternal = "http://" . $documentServerInternal; $documentServerInternal = "http://" . $documentServerInternal;
@@ -496,7 +496,7 @@ class AppConfig {
if (!preg_match("/^https?:\/\//i", $from)) { if (!preg_match("/^https?:\/\//i", $from)) {
$parsedUrl = parse_url($url); $parsedUrl = parse_url($url);
$from = $parsedUrl["scheme"] . "://" . $parsedUrl["host"] . (array_key_exists("port", $parsedUrl) ? (":" . $parsedUrl["port"]) : "") . $from; $from = $parsedUrl["scheme"] . "://" . $parsedUrl["host"] . (\array_key_exists("port", $parsedUrl) ? (":" . $parsedUrl["port"]) : "") . $from;
} }
if ($from !== $documentServerUrl) { if ($from !== $documentServerUrl) {
@@ -515,7 +515,7 @@ class AppConfig {
*/ */
public function SetStorageUrl($storageUrl) { public function SetStorageUrl($storageUrl) {
$storageUrl = rtrim(trim($storageUrl), "/"); $storageUrl = rtrim(trim($storageUrl), "/");
if (strlen($storageUrl) > 0) { if (\strlen($storageUrl) > 0) {
$storageUrl = $storageUrl . "/"; $storageUrl = $storageUrl . "/";
if (!preg_match("/^https?:\/\//i", $storageUrl)) { if (!preg_match("/^https?:\/\//i", $storageUrl)) {
$storageUrl = "http://" . $storageUrl; $storageUrl = "http://" . $storageUrl;
@@ -944,7 +944,7 @@ class AppConfig {
* @param array $groups - the list of groups * @param array $groups - the list of groups
*/ */
public function SetLimitGroups($groups) { public function SetLimitGroups($groups) {
if (!is_array($groups)) { if (!\is_array($groups)) {
$groups = array(); $groups = array();
} }
$value = json_encode($groups); $value = json_encode($groups);
@@ -964,7 +964,7 @@ class AppConfig {
return array(); return array();
} }
$groups = json_decode($value, true); $groups = json_decode($value, true);
if (!is_array($groups)) { if (!\is_array($groups)) {
$groups = array(); $groups = array();
} }
return $groups; return $groups;
@@ -980,17 +980,17 @@ class AppConfig {
public function isUserAllowedToUse($userId = null) { public function isUserAllowedToUse($userId = null) {
// no user -> no // no user -> no
$userSession = \OC::$server->getUserSession(); $userSession = \OC::$server->getUserSession();
if (is_null($userId) && ($userSession === null || !$userSession->isLoggedIn())) { if (\is_null($userId) && ($userSession === null || !$userSession->isLoggedIn())) {
return false; return false;
} }
$groups = $this->GetLimitGroups(); $groups = $this->GetLimitGroups();
// no group set -> all users are allowed // no group set -> all users are allowed
if (count($groups) === 0) { if (\count($groups) === 0) {
return true; return true;
} }
if (is_null($userId)) { if (\is_null($userId)) {
$user = $userSession->getUser(); $user = $userSession->getUser();
} else { } else {
$user = \OC::$server->getUserManager()->get($userId); $user = \OC::$server->getUserManager()->get($userId);
@@ -1157,14 +1157,14 @@ class AppConfig {
$defFormats = $this->GetDefaultFormats(); $defFormats = $this->GetDefaultFormats();
foreach ($defFormats as $format => $setting) { foreach ($defFormats as $format => $setting) {
if (array_key_exists($format, $result)) { if (\array_key_exists($format, $result)) {
$result[$format]["def"] = ($setting === true || $setting === "true"); $result[$format]["def"] = ($setting === true || $setting === "true");
} }
} }
$editFormats = $this->GetEditableFormats(); $editFormats = $this->GetEditableFormats();
foreach ($editFormats as $format => $setting) { foreach ($editFormats as $format => $setting) {
if (array_key_exists($format, $result)) { if (\array_key_exists($format, $result)) {
$result[$format]["edit"] = ($setting === true || $setting === "true"); $result[$format]["edit"] = ($setting === true || $setting === "true");
} }
} }

View File

@@ -67,11 +67,11 @@ class DocumentService {
* @return string * @return string
*/ */
public static function GenerateRevisionId($expected_key) { public static function GenerateRevisionId($expected_key) {
if (strlen($expected_key) > 20) { if (\strlen($expected_key) > 20) {
$expected_key = crc32($expected_key); $expected_key = crc32($expected_key);
} }
$key = preg_replace("[^0-9-.a-zA-Z_=]", "_", $expected_key); $key = preg_replace("[^0-9-.a-zA-Z_=]", "_", $expected_key);
$key = substr($key, 0, min(array(strlen($key), 20))); $key = substr($key, 0, min(array(\strlen($key), 20)));
return $key; return $key;
} }
@@ -171,7 +171,7 @@ class DocumentService {
$response_xml_data = $this->Request($urlToConverter, "post", $opts); $response_xml_data = $this->Request($urlToConverter, "post", $opts);
libxml_use_internal_errors(true); libxml_use_internal_errors(true);
if (!function_exists("simplexml_load_file")) { if (!\function_exists("simplexml_load_file")) {
throw new \Exception($this->trans->t("Server can't read xml")); throw new \Exception($this->trans->t("Server can't read xml"));
} }
$response_data = simplexml_load_string($response_xml_data); $response_data = simplexml_load_string($response_xml_data);
@@ -349,10 +349,10 @@ class DocumentService {
if (null === $opts) { if (null === $opts) {
$opts = array(); $opts = array();
} }
if (substr($url, 0, strlen("https")) === "https" && $this->config->GetVerifyPeerOff()) { if (substr($url, 0, \strlen("https")) === "https" && $this->config->GetVerifyPeerOff()) {
$opts["verify"] = false; $opts["verify"] = false;
} }
if (!array_key_exists("timeout", $opts)) { if (!\array_key_exists("timeout", $opts)) {
$opts["timeout"] = 60; $opts["timeout"] = 60;
} }
@@ -407,7 +407,7 @@ class DocumentService {
} }
$version = $commandResponse->version; $version = $commandResponse->version;
$versionF = floatval($version); $versionF = \floatval($version);
if ($versionF > 0.0 && $versionF <= 6.0) { if ($versionF > 0.0 && $versionF <= 6.0) {
throw new \Exception($this->trans->t("Not supported version")); throw new \Exception($this->trans->t("Not supported version"));
} }

View File

@@ -273,7 +273,7 @@ class FileUtility {
* @return string * @return string
*/ */
private function GUID() { private function GUID() {
if (function_exists("com_create_guid") === true) { if (\function_exists("com_create_guid") === true) {
return trim(com_create_guid(), "{}"); return trim(com_create_guid(), "{}");
} }

View File

@@ -75,7 +75,7 @@ class FileVersions {
return false; return false;
} }
$filePath = substr($pathVersion, 0, $pos); $filePath = substr($pathVersion, 0, $pos);
$versionId = substr($pathVersion, 2 + $pos - strlen($pathVersion)); $versionId = substr($pathVersion, 2 + $pos - \strlen($pathVersion));
return [$filePath, $versionId]; return [$filePath, $versionId];
} }

View File

@@ -47,7 +47,7 @@ class KeyManager {
$result = $select->execute([$fileId]); $result = $select->execute([$fileId]);
$keys = $result ? $select->fetch() : []; $keys = $result ? $select->fetch() : [];
$key = is_array($keys) && isset($keys["key"]) ? $keys["key"] : ""; $key = \is_array($keys) && isset($keys["key"]) ? $keys["key"] : "";
return $key; return $key;
} }
@@ -142,7 +142,7 @@ class KeyManager {
$result = $select->execute([$fileId]); $result = $select->execute([$fileId]);
$rows = $result ? $select->fetch() : []; $rows = $result ? $select->fetch() : [];
$fs = is_array($rows) && isset($rows["fs"]) ? $rows["fs"] : ""; $fs = \is_array($rows) && isset($rows["fs"]) ? $rows["fs"] : "";
return $fs === "1"; return $fs === "1";
} }

View File

@@ -236,7 +236,7 @@ class Preview implements IProvider2 {
|| $fileInfo->getSize() > $this->config->GetLimitThumbSize()) { || $fileInfo->getSize() > $this->config->GetLimitThumbSize()) {
return false; return false;
} }
if (!in_array($fileInfo->getMimetype(), self::$capabilities, true)) { if (!\in_array($fileInfo->getMimetype(), self::$capabilities, true)) {
return false; return false;
} }
return true; return true;

View File

@@ -117,7 +117,7 @@ class RemoteInstance {
$logger = \OC::$server->getLogger(); $logger = \OC::$server->getLogger();
$remote = rtrim($remote, "/") . "/"; $remote = rtrim($remote, "/") . "/";
if (in_array($remote, self::$healthRemote)) { if (\in_array($remote, self::$healthRemote)) {
$logger->debug("Remote instance " . $remote . " from local cache status " . $dbremote["status"], ["app" => self::App_Name]); $logger->debug("Remote instance " . $remote . " from local cache status " . $dbremote["status"], ["app" => self::App_Name]);
return true; return true;
} }

View File

@@ -73,7 +73,7 @@ class TemplateManager {
$templatesList = $templateDir->getDirectoryListing(); $templatesList = $templateDir->getDirectoryListing();
if (!empty($mimetype) if (!empty($mimetype)
&& is_array($templatesList) && count($templatesList) > 0) { && \is_array($templatesList) && \count($templatesList) > 0) {
$templatesList = $templateDir->searchByMime($mimetype); $templatesList = $templateDir->searchByMime($mimetype);
} }
@@ -171,11 +171,11 @@ class TemplateManager {
* @return string * @return string
*/ */
public static function GetEmptyTemplatePath($lang, $ext) { public static function GetEmptyTemplatePath($lang, $ext) {
if (!array_key_exists($lang, self::$localPath)) { if (!\array_key_exists($lang, self::$localPath)) {
$lang = "en"; $lang = "en";
} }
return dirname(__DIR__) . DIRECTORY_SEPARATOR . "assets" . DIRECTORY_SEPARATOR . self::$localPath[$lang] . DIRECTORY_SEPARATOR . "new" . $ext; return \dirname(__DIR__) . DIRECTORY_SEPARATOR . "assets" . DIRECTORY_SEPARATOR . self::$localPath[$lang] . DIRECTORY_SEPARATOR . "new" . $ext;
} }
/** /**

View File

@@ -119,7 +119,7 @@ script("onlyoffice", "template");
<p> <p>
<input type="checkbox" class="checkbox" id="onlyofficeGroups" <input type="checkbox" class="checkbox" id="onlyofficeGroups"
<?php if (count($_["limitGroups"]) > 0) { ?>checked="checked"<?php } ?> /> <?php if (\count($_["limitGroups"]) > 0) { ?>checked="checked"<?php } ?> />
<label for="onlyofficeGroups"><?php p($l->t("Restrict access to editors to following groups")) ?></label> <label for="onlyofficeGroups"><?php p($l->t("Restrict access to editors to following groups")) ?></label>
<br /> <br />
<input type="hidden" id="onlyofficeLimitGroups" value="<?php p(implode("|", $_["limitGroups"])) ?>" <input type="hidden" id="onlyofficeLimitGroups" value="<?php p(implode("|", $_["limitGroups"])) ?>"
@@ -148,12 +148,12 @@ script("onlyoffice", "template");
<p class="onlyoffice-header"><?php p($l->t("The default application for opening the format")) ?></p> <p class="onlyoffice-header"><?php p($l->t("The default application for opening the format")) ?></p>
<div class="onlyoffice-exts"> <div class="onlyoffice-exts">
<?php foreach ($_["formats"] as $format => $setting) { ?> <?php foreach ($_["formats"] as $format => $setting) { ?>
<?php if (array_key_exists("mime", $setting)) { ?> <?php if (\array_key_exists("mime", $setting)) { ?>
<div> <div>
<input type="checkbox" class="checkbox" <input type="checkbox" class="checkbox"
id="onlyofficeDefFormat<?php p($format) ?>" id="onlyofficeDefFormat<?php p($format) ?>"
name="<?php p($format) ?>" name="<?php p($format) ?>"
<?php if (array_key_exists("def", $setting) && $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> <label for="onlyofficeDefFormat<?php p($format) ?>"><?php p($format) ?></label>
</div> </div>
<?php } ?> <?php } ?>
@@ -166,12 +166,12 @@ script("onlyoffice", "template");
</p> </p>
<div class="onlyoffice-exts"> <div class="onlyoffice-exts">
<?php foreach ($_["formats"] as $format => $setting) { ?> <?php foreach ($_["formats"] as $format => $setting) { ?>
<?php if (array_key_exists("editable", $setting)) { ?> <?php if (\array_key_exists("editable", $setting)) { ?>
<div> <div>
<input type="checkbox" class="checkbox" <input type="checkbox" class="checkbox"
id="onlyofficeEditFormat<?php p($format) ?>" id="onlyofficeEditFormat<?php p($format) ?>"
name="<?php p($format) ?>" name="<?php p($format) ?>"
<?php if (array_key_exists("edit", $setting) && $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> <label for="onlyofficeEditFormat<?php p($format) ?>"><?php p($format) ?></label>
</div> </div>
<?php } ?> <?php } ?>