OCA\Richdocuments\Controller\DocumentController::index PHP Метод

index() публичный Метод

public index ( )
    public function index()
    {
        $wopiRemote = $this->appConfig->getAppValue('wopi_url');
        if (($parts = parse_url($wopiRemote)) && isset($parts['scheme']) && isset($parts['host'])) {
            $webSocketProtocol = "ws://";
            if ($parts['scheme'] == "https") {
                $webSocketProtocol = "wss://";
            }
            $webSocket = sprintf("%s%s%s", $webSocketProtocol, $parts['host'], isset($parts['port']) ? ":" . $parts['port'] : "");
        } else {
            return $this->responseError($this->l10n->t('Collabora Online: Invalid URL "%s".', array($wopiRemote)), $this->l10n->t('Please ask your administrator to check the Collabora Online server setting.'));
        }
        \OC::$server->getNavigationManager()->setActiveEntry('richdocuments_index');
        $maxUploadFilesize = \OCP\Util::maxUploadFilesize("/");
        $response = new TemplateResponse('richdocuments', 'documents', ['enable_previews' => $this->settings->getSystemValue('enable_previews', true), 'uploadMaxFilesize' => $maxUploadFilesize, 'uploadMaxHumanFilesize' => \OCP\Util::humanFileSize($maxUploadFilesize), 'allowShareWithLink' => $this->settings->getAppValue('core', 'shareapi_allow_links', 'yes'), 'wopi_url' => $webSocket]);
        $policy = new ContentSecurityPolicy();
        $policy->addAllowedScriptDomain('\'self\' http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js http://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js \'unsafe-eval\' ' . $wopiRemote);
        /* frame-src is deprecated on Firefox, but Safari wants it! */
        $policy->addAllowedFrameDomain('\'self\' http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js http://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js \'unsafe-eval\' ' . $wopiRemote);
        $policy->addAllowedChildSrcDomain('\'self\' http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js http://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js \'unsafe-eval\' ' . $wopiRemote);
        $policy->addAllowedConnectDomain($webSocket);
        $policy->addAllowedImageDomain('*');
        $policy->allowInlineScript(true);
        $policy->addAllowedFontDomain('data:');
        $response->setContentSecurityPolicy($policy);
        return $response;
    }