get('enable_onlyoffice_plugin'); if (!$isEnable) { exit("Document server isn't enabled"); return; } $appSettings = new OnlyofficeAppsettings($plugin); $documentServerUrl = $appSettings->getDocumentServerUrl(); if (empty($documentServerUrl)) { exit("Document server isn't configured"); return; } $config = []; $docApiUrl = $appSettings->getDocumentServerApiUrl(); $docId = $_GET['docId']; $groupId = isset($_GET['groupId']) && !empty($_GET['groupId']) ? $_GET['groupId'] : null; $userId = api_get_user_id(); $userInfo = api_get_user_info($userId); $sessionId = api_get_session_id(); $courseId = api_get_course_int_id(); $courseInfo = api_get_course_info(); if (empty($courseInfo)) { api_not_allowed(true); } $courseCode = $courseInfo['code']; $docInfo = DocumentManager::get_document_data_by_id($docId, $courseCode, false, $sessionId); $langInfo = LangManager::getLangUser(); $jwtManager = new OnlyofficeJwtManager($appSettings); if (isset($_GET['forceEdit']) && (bool) $_GET['forceEdit'] === true) { $docInfo['forceEdit'] = $_GET['forceEdit']; } $documentManager = new OnlyofficeDocumentManager($appSettings, $docInfo); $extension = $documentManager->getExt($documentManager->getDocInfo('title')); $docType = $documentManager->getDocType($extension); $key = $documentManager->getDocumentKey($docId, $courseCode); $fileUrl = $documentManager->getFileUrl($docId); if (!empty($appSettings->getStorageUrl())) { $fileUrl = str_replace(api_get_path(WEB_PATH), $appSettings->getStorageUrl(), $fileUrl); } $configService = new OnlyofficeConfigService($appSettings, $jwtManager, $documentManager); $editorsMode = $configService->getEditorsMode(); $config = $configService->createConfig($docId, $editorsMode, $_SERVER['HTTP_USER_AGENT']); $config = json_decode(json_encode($config), true); $isMobileAgent = $configService->isMobileAgent($_SERVER['HTTP_USER_AGENT']); $showHeaders = true; $headerHeight = 'calc(100% - 140px)'; if (!empty($_GET['nh'])) { $showHeaders = false; $headerHeight = '100%'; } ?>