Skip to content

Commit

Permalink
Merge pull request #16902 from owncloud/jsocclient
Browse files Browse the repository at this point in the history
Web UI uses Webdav instead of ajax/* calls
  • Loading branch information
DeepDiver1975 committed Nov 23, 2015
2 parents 2f89eef + 418fefc commit 79bbda9
Show file tree
Hide file tree
Showing 58 changed files with 4,134 additions and 1,620 deletions.
27 changes: 27 additions & 0 deletions apps/dav/lib/connector/sabre/filesplugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public function initialize(\Sabre\DAV\Server $server) {
$this->server->on('afterBind', array($this, 'sendFileIdHeader'));
$this->server->on('afterWriteContent', array($this, 'sendFileIdHeader'));
$this->server->on('afterMethod:GET', [$this,'httpGet']);
$this->server->on('afterMethod:GET', array($this, 'handleDownloadToken'));
$this->server->on('afterResponse', function($request, ResponseInterface $response) {
$body = $response->getBody();
if (is_resource($body)) {
Expand Down Expand Up @@ -148,6 +149,32 @@ function checkMove($source, $destination) {
}
}

/**
* This sets a cookie to be able to recognize the start of the download
* the content must not be longer than 32 characters and must only contain
* alphanumeric characters
*
* @param RequestInterface $request
* @param ResponseInterface $response
*/
function handleDownloadToken(RequestInterface $request, ResponseInterface $response) {
$queryParams = $request->getQueryParameters();

/**
* this sets a cookie to be able to recognize the start of the download
* the content must not be longer than 32 characters and must only contain
* alphanumeric characters
*/
if (isset($queryParams['downloadStartSecret'])) {
$token = $queryParams['downloadStartSecret'];
if (!isset($token[32])
&& preg_match('!^[a-zA-Z0-9]+$!', $token) === 1) {
// FIXME: use $response->setHeader() instead
setcookie('ocDownloadStarted', $token, time() + 20, '/');
}
}
}

/**
* Plugin that adds a 'Content-Disposition: attachment' header to all files
* delivered by SabreDAV.
Expand Down
81 changes: 0 additions & 81 deletions apps/files/ajax/delete.php

This file was deleted.

59 changes: 0 additions & 59 deletions apps/files/ajax/move.php

This file was deleted.

103 changes: 0 additions & 103 deletions apps/files/ajax/newfile.php

This file was deleted.

99 changes: 0 additions & 99 deletions apps/files/ajax/newfolder.php

This file was deleted.

Loading

0 comments on commit 79bbda9

Please sign in to comment.