summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorJan-Christoph Borchardt <hey@jancborchardt.net>2014-01-29 10:55:44 +0100
committerJan-Christoph Borchardt <hey@jancborchardt.net>2014-01-29 10:55:44 +0100
commit13ed59c1cf2598f28c415c0c2459b5a4495ff5ef (patch)
tree890efcfe462f19468e2aa05ca1a22049edc21ab6 /apps/files_sharing
parentc767ebcc03c604f3141af4c286ad099fdf64c561 (diff)
parentcf2c061f1f2577b3a995d9e2423c93589d7df2b3 (diff)
downloadnextcloud-server-13ed59c1cf2598f28c415c0c2459b5a4495ff5ef.tar.gz
nextcloud-server-13ed59c1cf2598f28c415c0c2459b5a4495ff5ef.zip
merge master into mobile-style
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/css/authenticate.css7
-rw-r--r--apps/files_sharing/css/public.css10
-rw-r--r--apps/files_sharing/js/public.js16
-rw-r--r--apps/files_sharing/lib/api.php10
-rw-r--r--apps/files_sharing/lib/cache.php23
-rw-r--r--apps/files_sharing/templates/authenticate.php2
-rw-r--r--apps/files_sharing/templates/public.php2
7 files changed, 38 insertions, 32 deletions
diff --git a/apps/files_sharing/css/authenticate.css b/apps/files_sharing/css/authenticate.css
index cebe906dd59..ef963ba7c65 100644
--- a/apps/files_sharing/css/authenticate.css
+++ b/apps/files_sharing/css/authenticate.css
@@ -11,16 +11,13 @@
margin: 6px;
}
-input[type="submit"]{
+input[type='submit'] {
width: 45px;
height: 45px;
margin: 6px;
- background-image: url('%webroot%/core/img/actions/confirm.svg');
- background-repeat: no-repeat;
- background-position: center;
}
-#body-login input[type="submit"] {
+#body-login input[type='submit'] {
position: absolute;
top: 0px;
}
diff --git a/apps/files_sharing/css/public.css b/apps/files_sharing/css/public.css
index a3bc36dcc76..c50624e20b1 100644
--- a/apps/files_sharing/css/public.css
+++ b/apps/files_sharing/css/public.css
@@ -3,7 +3,7 @@ body {
}
#header {
- background: #1d2d44 url('%webroot%/core/img/noise.png') repeat;
+ background-color: #1d2d44;
height:32px;
left:0;
line-height:32px;
@@ -39,7 +39,7 @@ body {
#noPreview {
display:none;
- padding-top:5em;
+ padding-top:80px;
}
footer {
@@ -49,7 +49,7 @@ footer {
p.info {
color: #777;
text-align: center;
- width: 22em;
+ width: 352px;
margin: 0 auto;
padding: 20px;
}
@@ -61,8 +61,8 @@ p.info a {
#imgframe {
height:75%;
- padding-bottom:2em;
- padding-top:2em;
+ padding-bottom:32px;
+ padding-top:32px;
width:80%;
margin:0 auto;
}
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js
index 730649c6378..c1b7eee3fb7 100644
--- a/apps/files_sharing/js/public.js
+++ b/apps/files_sharing/js/public.js
@@ -25,18 +25,16 @@ $(document).ready(function() {
window.location = $(tr).find('a.name').attr('href');
}
});
- FileActions.register('file', 'Download', OC.PERMISSION_READ, '', function(filename) {
- var tr = FileList.findFileEl(filename);
- if (tr.length > 0) {
- window.location = $(tr).find('a.name').attr('href');
- }
- });
- FileActions.register('dir', 'Download', OC.PERMISSION_READ, '', function(filename) {
+
+ // override since the format is different
+ FileList.getDownloadUrl = function(filename, dir) {
+ // we use this because we need the service and token attributes
var tr = FileList.findFileEl(filename);
if (tr.length > 0) {
- window.location = $(tr).find('a.name').attr('href')+'&download';
+ return $(tr).find('a.name').attr('href') + '&download';
}
- });
+ return null;
+ };
}
var file_upload_start = $('#file_upload_start');
diff --git a/apps/files_sharing/lib/api.php b/apps/files_sharing/lib/api.php
index 84e90c71681..cb3d3e42c34 100644
--- a/apps/files_sharing/lib/api.php
+++ b/apps/files_sharing/lib/api.php
@@ -162,7 +162,7 @@ class Api {
$view = new \OC\Files\View('/'.\OCP\User::getUser().'/files');
if(!$view->is_dir($path)) {
- return new \OC_OCS_Result(null, 404, "not a directory");
+ return new \OC_OCS_Result(null, 400, "not a directory");
}
$content = $view->getDirectoryContent($path);
@@ -223,7 +223,7 @@ class Api {
$encryptionEnabled = \OC_App::isEnabled('files_encryption');
if(isset($_POST['publicUpload']) &&
($encryptionEnabled || $publicUploadEnabled !== 'yes')) {
- return new \OC_OCS_Result(null, 404, "public upload disabled by the administrator");
+ return new \OC_OCS_Result(null, 403, "public upload disabled by the administrator");
}
$publicUpload = isset($_POST['publicUpload']) ? $_POST['publicUpload'] : 'false';
// read, create, update (7) if public upload is enabled or
@@ -231,7 +231,7 @@ class Api {
$permissions = $publicUpload === 'true' ? 7 : 1;
break;
default:
- return new \OC_OCS_Result(null, 404, "unknown share type");
+ return new \OC_OCS_Result(null, 400, "unknown share type");
}
try {
@@ -243,7 +243,7 @@ class Api {
$permissions
);
} catch (\Exception $e) {
- return new \OC_OCS_Result(null, 404, $e->getMessage());
+ return new \OC_OCS_Result(null, 403, $e->getMessage());
}
if ($token) {
@@ -365,7 +365,7 @@ class Api {
$publicUploadEnabled = \OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes');
$encryptionEnabled = \OC_App::isEnabled('files_encryption');
if($encryptionEnabled || $publicUploadEnabled !== 'yes') {
- return new \OC_OCS_Result(null, 404, "public upload disabled by the administrator");
+ return new \OC_OCS_Result(null, 403, "public upload disabled by the administrator");
}
if ($share['item_type'] !== 'folder' ||
diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php
index 90440d08f4e..425d51113b1 100644
--- a/apps/files_sharing/lib/cache.php
+++ b/apps/files_sharing/lib/cache.php
@@ -127,7 +127,18 @@ class Shared_Cache extends Cache {
return $files;
} else {
if ($cache = $this->getSourceCache($folder)) {
- return $cache->getFolderContents($this->files[$folder]);
+ $sourceFolderContent = $cache->getFolderContents($this->files[$folder]);
+ foreach ($sourceFolderContent as $key => $c) {
+ $ownerPathParts = explode('/', \OC_Filesystem::normalizePath($c['path']));
+ $userPathParts = explode('/', \OC_Filesystem::normalizePath($folder));
+ $usersPath = 'files/Shared/'.$userPathParts[1];
+ foreach (array_slice($ownerPathParts, 3) as $part) {
+ $usersPath .= '/'.$part;
+ }
+ $sourceFolderContent[$key]['usersPath'] = $usersPath;
+ }
+
+ return $sourceFolderContent;
}
}
return false;
@@ -260,7 +271,7 @@ class Shared_Cache extends Cache {
return $this->searchWithWhere($where, $value);
}
-
+
/**
* The maximum number of placeholders that can be used in an SQL query.
* Value MUST be <= 1000 for oracle:
@@ -268,7 +279,7 @@ class Shared_Cache extends Cache {
* FIXME we should get this from doctrine as other DBs allow a lot more placeholders
*/
const MAX_SQL_CHUNK_SIZE = 1000;
-
+
/**
* search for files with a custom where clause and value
* the $wherevalue will be array_merge()d with the file id chunks
@@ -282,16 +293,16 @@ class Shared_Cache extends Cache {
$ids = $this->getAll();
$files = array();
-
+
// divide into chunks
$chunks = array_chunk($ids, $chunksize);
-
+
foreach ($chunks as $chunk) {
$placeholders = join(',', array_fill(0, count($chunk), '?'));
$sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
`encrypted`, `unencrypted_size`, `etag`
FROM `*PREFIX*filecache` WHERE ' . $sqlwhere . ' `fileid` IN (' . $placeholders . ')';
-
+
$stmt = \OC_DB::prepare($sql);
$result = $stmt->execute(array_merge(array($wherevalue), $chunk));
diff --git a/apps/files_sharing/templates/authenticate.php b/apps/files_sharing/templates/authenticate.php
index 6b98e6c9f34..928be93fc96 100644
--- a/apps/files_sharing/templates/authenticate.php
+++ b/apps/files_sharing/templates/authenticate.php
@@ -9,7 +9,7 @@
<p class="infield">
<label for="password" class="infield"><?php p($l->t('Password')); ?></label>
<input type="password" name="password" id="password" placeholder="" value="" autofocus />
- <input type="submit" value="" class="svg" />
+ <input type="submit" value="" class="svg icon icon-confirm" />
</p>
</fieldset>
</form>
diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php
index 652cd74eaff..2f9c7246be5 100644
--- a/apps/files_sharing/templates/public.php
+++ b/apps/files_sharing/templates/public.php
@@ -9,7 +9,7 @@
<input type="hidden" name="sharingToken" value="<?php p($_['sharingToken']) ?>" id="sharingToken">
<input type="hidden" name="filename" value="<?php p($_['filename']) ?>" id="filename">
<input type="hidden" name="mimetype" value="<?php p($_['mimetype']) ?>" id="mimetype">
-<header><div id="header">
+<header><div id="header" class="icon icon-noise">
<a href="<?php print_unescaped(link_to('', 'index.php')); ?>" title="" id="owncloud"><img class="svg"
src="<?php print_unescaped(image_path('', 'logo-wide.svg')); ?>" alt="<?php p($theme->getName()); ?>" /></a>
<div id="logo-claim" style="display:none;"><?php p($theme->getLogoClaim()); ?></div>