Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-07-08 13:55:22 +0400
committerThomas Müller <thomas.mueller@tmit.eu>2013-07-08 13:55:22 +0400
commitc14206e3f887bc629bfd5fbd45c9e5b852cbcbd4 (patch)
tree52b4af1c1823e6667624327202eaa4d7dc5a3327 /apps
parent54a1239680c353d908475ca912ea2005329a83fb (diff)
Squashed commit of the following:
commit 70e6ad56ed5d00aeea8fe82b45047998dac92f80 Author: Thomas Müller <thomas.mueller@tmit.eu> Date: Sat Jul 6 00:11:42 2013 +0200 fixing check if public share is a folder or not commit 8e74ecec3f43a52a9a55871954171ef4073eab9d Author: Thomas Müller <thomas.mueller@tmit.eu> Date: Sat Jul 6 00:04:01 2013 +0200 removing unused getSharedItem() commit 60ac0f274bbaa926dcec1800e952f2e0b1f05a50 Author: Thomas Müller <thomas.mueller@tmit.eu> Date: Fri Jul 5 17:39:41 2013 +0200 on reshares we now recursively move to the root of all reshares - therefore some code has been refactured and added as a new public function Conflicts: apps/files/ajax/upload.php commit f071f7439568ffd8b785cd96035cc2e616f61b01 Author: Thomas Müller <thomas.mueller@tmit.eu> Date: Fri Jul 5 11:30:53 2013 +0200 fixing Notice: Undefined index: isPublic commit d2f2c7e9b896fd0ac57fb8047501205fc37b2abc Author: Thomas Müller <thomas.mueller@tmit.eu> Date: Fri Jul 5 09:58:41 2013 +0200 handle anonymous upload to reshared folder
Diffstat (limited to 'apps')
-rw-r--r--apps/files/ajax/upload.php30
-rw-r--r--apps/files/index.php1
-rw-r--r--apps/files_sharing/public.php20
3 files changed, 17 insertions, 34 deletions
diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php
index 8d6381cba35..3ba3665bf3b 100644
--- a/apps/files/ajax/upload.php
+++ b/apps/files/ajax/upload.php
@@ -26,21 +26,17 @@ if (empty($_POST['dirToken'])) {
if (!($linkItem['permissions'] & OCP\PERMISSION_CREATE)) {
OCP\JSON::checkLoggedIn();
} else {
- // Setup FS with owner
- OC_Util::tearDownFS();
- OC_Util::setupFS($linkItem['uid_owner']);
+ // resolve reshares
+ $rootLinkItem = OCP\Share::resolveReShare($linkItem);
- // translate linkItem to the real folder name on the file system
- $sharedItem = OCP\Share::getSharedItem($linkItem['item_type'], $linkItem['item_source'], $linkItem['uid_owner']);
- if (!$sharedItem || empty($sharedItem) || $sharedItem === false) {
- OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Unable to set upload directory.')))));
- die();
- }
+ // Setup FS with owner
+ OC_Util::setupFS($rootLinkItem['uid_owner']);
// The token defines the target directory (security reasons)
+ $path = \OC\Files\Filesystem::getPath($linkItem['file_source']);
$dir = sprintf(
"/%s/%s",
- $sharedItem['path'],
+ $path,
isset($_POST['subdir']) ? $_POST['subdir'] : ''
);
@@ -83,17 +79,17 @@ $files = $_FILES['files'];
$error = '';
-$maxUploadFilesize = OCP\Util::maxUploadFilesize($dir);
-$maxHumanFilesize = OCP\Util::humanFileSize($maxUploadFilesize);
+$maxUploadFileSize = $storageStats['uploadMaxFilesize'];
+$maxHumanFileSize = OCP\Util::humanFileSize($maxUploadFileSize);
$totalSize = 0;
foreach ($files['size'] as $size) {
$totalSize += $size;
}
-if ($totalSize > $maxUploadFilesize) {
+if ($maxUploadFileSize >= 0 and $totalSize > $maxUploadFileSize) {
OCP\JSON::error(array('data' => array('message' => $l->t('Not enough storage available'),
- 'uploadMaxFilesize' => $maxUploadFilesize,
- 'maxHumanFilesize' => $maxHumanFilesize)));
+ 'uploadMaxFilesize' => $maxUploadFileSize,
+ 'maxHumanFilesize' => $maxHumanFileSize)));
exit();
}
@@ -115,8 +111,8 @@ if (strpos($dir, '..') === false) {
'id' => $meta['fileid'],
'name' => basename($target),
'originalname' => $files['name'][$i],
- 'uploadMaxFilesize' => $maxUploadFilesize,
- 'maxHumanFilesize' => $maxHumanFilesize
+ 'uploadMaxFilesize' => $maxUploadFileSize,
+ 'maxHumanFilesize' => $maxHumanFileSize
);
}
}
diff --git a/apps/files/index.php b/apps/files/index.php
index 640c28c0075..2338cf439e4 100644
--- a/apps/files/index.php
+++ b/apps/files/index.php
@@ -137,5 +137,6 @@ if ($needUpgrade) {
$tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
$tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
$tmpl->assign('usedSpacePercent', (int)$storageInfo['relative']);
+ $tmpl->assign('isPublic', false);
$tmpl->printPage();
}
diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index 8d42cad455d..1a07ca9a8c7 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -20,23 +20,9 @@ if (isset($_GET['t'])) {
$type = $linkItem['item_type'];
$fileSource = $linkItem['file_source'];
$shareOwner = $linkItem['uid_owner'];
- $fileOwner = null;
$path = null;
- if (isset($linkItem['parent'])) {
- $parent = $linkItem['parent'];
- while (isset($parent)) {
- $query = \OC_DB::prepare('SELECT `parent`, `uid_owner` FROM `*PREFIX*share` WHERE `id` = ?', 1);
- $item = $query->execute(array($parent))->fetchRow();
- if (isset($item['parent'])) {
- $parent = $item['parent'];
- } else {
- $fileOwner = $item['uid_owner'];
- break;
- }
- }
- } else {
- $fileOwner = $shareOwner;
- }
+ $rootLinkItem = OCP\Share::resolveReShare($linkItem);
+ $fileOwner = $rootLinkItem['uid_owner'];
if (isset($fileOwner)) {
OC_Util::tearDownFS();
OC_Util::setupFS($fileOwner);
@@ -144,7 +130,7 @@ if (isset($path)) {
if (\OCP\App::isEnabled('files_encryption')) {
$allowPublicUploadEnabled = false;
}
- if (isset($file)) {
+ if ($linkItem['item_type'] !== 'folder') {
$allowPublicUploadEnabled = false;
}