public function httpGet(RequestInterface $request, ResponseInterface $response)
    {
        // We're not using straight-up $_GET, because we want everything to be
        // unit testable.
        $getVars = $request->getQueryParameters();

        // CSP headers
        $response->setHeader('Content-Security-Policy', "default-src 'none'; img-src 'self'; style-src 'self'; font-src 'self';");

        $sabreAction = isset($getVars['sabreAction']) ? $getVars['sabreAction'] : null;

        switch ($sabreAction) {
            case 'asset':
                // Asset handling, such as images
                $this->serveAsset(isset($getVars['assetName']) ? $getVars['assetName'] : null);

                return false;
            default:
            case 'info':
                try {
                    $this->server->tree->getNodeForPath($request->getPath());
                } catch (DAV\Exception\NotFound $e) {
                    // We're simply stopping when the file isn't found to not interfere
                    // with other plugins.
                    return;
                }

                $response->setStatus(200);
                $response->setHeader('Content-Type', 'text/html; charset=utf-8');

                $response->setBody(
                    $this->generateDirectoryIndex($request->getPath())
                );

                return false;

            case 'plugins':
                $response->setStatus(200);
                $response->setHeader('Content-Type', 'text/html; charset=utf-8');

                $response->setBody(
                    $this->generatePluginListing()
                );

                return false;
        }
    }
public function httpGet(RequestInterface $request, ResponseInterface $response)
    {
        // We're not using straight-up $_GET, because we want everything to be
        // unit testable.
        $getVars = $request->getQueryParameters();

        // CSP headers
        $response->setHeader('Content-Security-Policy', "default-src 'none'; img-src 'self'; style-src 'self'; font-src 'self';");

        $sabreAction = isset($getVars['sabreAction']) ? $getVars['sabreAction'] : null;

        switch ($sabreAction) {
            case 'asset':
                // Asset handling, such as images
                $this->serveAsset(isset($getVars['assetName']) ? $getVars['assetName'] : null);

                return false;
            default:
            case 'info':
                try {
                    $this->server->tree->getNodeForPath($request->getPath());
                } catch (DAV\Exception\NotFound $e) {
                    // We're simply stopping when the file isn't found to not interfere
                    // with other plugins.
                    return;
                }

                $response->setStatus(200);
                $response->setHeader('Content-Type', 'text/html; charset=utf-8');

                $response->setBody(
                    $this->generateDirectoryIndex($request->getPath())
                );

                return false;

            case 'plugins':
                $response->setStatus(200);
                $response->setHeader('Content-Type', 'text/html; charset=utf-8');

                $response->setBody(
                    $this->generatePluginListing()
                );

                return false;
        }
    }
public function httpGet ( RequestInterface $ request , ResponseInterface $ response ) { // We're not using straight-up $_GET, because we want everything to be // unit testable. $ getVars = $ request -> getQueryParameters ( ) ; // CSP headers $ response -> setHeader ( 'Content-Security-Policy' , "default-src 'none'; img-src 'self'; style-src 'self'; font-src 'self';" ) ; $ sabreAction = isset ( $ getVars [ 'sabreAction' ] ) ? $ getVars [ 'sabreAction' ] : null ; switch ( $ sabreAction ) { case 'asset' : // Asset handling, such as images $ this -> serveAsset ( isset ( $ getVars [ 'assetName' ] ) ? $ getVars [ 'assetName' ] : null ) ; return false ; default : case 'info' : try { $ this -> server -> tree -> getNodeForPath ( $ request -> getPath ( ) ) ; } catch ( DAV \ Exception \ NotFound $ e ) { // We're simply stopping when the file isn't found to not interfere // with other plugins. return ; } $ response -> setStatus ( 200 ) ; $ response -> setHeader ( 'Content-Type' , 'text/html; charset=utf-8' ) ; $ response -> setBody ( $ this -> generateDirectoryIndex ( $ request -> getPath ( ) ) ) ; return false ; case 'plugins' : $ response -> setStatus ( 200 ) ; $ response -> setHeader ( 'Content-Type' , 'text/html; charset=utf-8' ) ; $ response -> setBody ( $ this -> generatePluginListing ( ) ) ; return false ; } }
This method intercepts GET requests to collections and returns the html.

@param RequestInterface  $request
@param ResponseInterface $response

@return bool
This method intercepts GET requests to collections and returns the html .