summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorraghunayyar <me@iraghu.com>2014-01-16 14:42:37 +0530
committerraghunayyar <me@iraghu.com>2014-01-16 14:42:37 +0530
commit775e08e0ee4125cc7b2a594771437686f6a21b56 (patch)
tree362f84449171898335dd3e8511b65c97c150e9e1 /apps/files_sharing
parent4687d2dd0bde3f689eb57c90d0c4341cd00991bd (diff)
parentbd643c47f32ba6d7b3ba6a18ed1591aab0b81be8 (diff)
downloadnextcloud-server-775e08e0ee4125cc7b2a594771437686f6a21b56.tar.gz
nextcloud-server-775e08e0ee4125cc7b2a594771437686f6a21b56.zip
Merge branch 'master' into core-em-to-px
Conflicts: apps/files_sharing/css/public.css apps/user_ldap/css/settings.css core/css/multiselect.css core/css/share.css
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/ajax/publicpreview.php14
-rw-r--r--apps/files_sharing/appinfo/app.php3
-rw-r--r--apps/files_sharing/appinfo/update.php22
-rw-r--r--apps/files_sharing/appinfo/version2
-rw-r--r--apps/files_sharing/css/authenticate.css26
-rw-r--r--apps/files_sharing/css/public.css68
-rw-r--r--apps/files_sharing/js/public.js8
-rw-r--r--apps/files_sharing/js/share.js20
-rw-r--r--apps/files_sharing/l10n/ar.php1
-rw-r--r--apps/files_sharing/l10n/bg_BG.php1
-rw-r--r--apps/files_sharing/l10n/bn_BD.php1
-rw-r--r--apps/files_sharing/l10n/ca.php5
-rw-r--r--apps/files_sharing/l10n/cs_CZ.php5
-rw-r--r--apps/files_sharing/l10n/cy_GB.php1
-rw-r--r--apps/files_sharing/l10n/da.php5
-rw-r--r--apps/files_sharing/l10n/de.php13
-rw-r--r--apps/files_sharing/l10n/de_CH.php1
-rw-r--r--apps/files_sharing/l10n/de_DE.php5
-rw-r--r--apps/files_sharing/l10n/el.php15
-rw-r--r--apps/files_sharing/l10n/en@pirate.php1
-rw-r--r--apps/files_sharing/l10n/en_GB.php5
-rw-r--r--apps/files_sharing/l10n/eo.php11
-rw-r--r--apps/files_sharing/l10n/es.php5
-rw-r--r--apps/files_sharing/l10n/es_AR.php1
-rw-r--r--apps/files_sharing/l10n/es_CL.php6
-rw-r--r--apps/files_sharing/l10n/es_MX.php20
-rw-r--r--apps/files_sharing/l10n/et_EE.php5
-rw-r--r--apps/files_sharing/l10n/eu.php5
-rw-r--r--apps/files_sharing/l10n/fa.php1
-rw-r--r--apps/files_sharing/l10n/fi_FI.php5
-rw-r--r--apps/files_sharing/l10n/fr.php5
-rw-r--r--apps/files_sharing/l10n/gl.php5
-rw-r--r--apps/files_sharing/l10n/he.php1
-rw-r--r--apps/files_sharing/l10n/hr.php1
-rw-r--r--apps/files_sharing/l10n/hu_HU.php5
-rw-r--r--apps/files_sharing/l10n/hy.php1
-rw-r--r--apps/files_sharing/l10n/ia.php1
-rw-r--r--apps/files_sharing/l10n/id.php16
-rw-r--r--apps/files_sharing/l10n/is.php1
-rw-r--r--apps/files_sharing/l10n/it.php5
-rw-r--r--apps/files_sharing/l10n/ja_JP.php5
-rw-r--r--apps/files_sharing/l10n/ka_GE.php1
-rw-r--r--apps/files_sharing/l10n/ko.php17
-rw-r--r--apps/files_sharing/l10n/ku_IQ.php1
-rw-r--r--apps/files_sharing/l10n/lb.php1
-rw-r--r--apps/files_sharing/l10n/lt_LT.php5
-rw-r--r--apps/files_sharing/l10n/lv.php1
-rw-r--r--apps/files_sharing/l10n/mk.php1
-rw-r--r--apps/files_sharing/l10n/ms_MY.php1
-rw-r--r--apps/files_sharing/l10n/my_MM.php1
-rw-r--r--apps/files_sharing/l10n/nb_NO.php1
-rw-r--r--apps/files_sharing/l10n/nl.php5
-rw-r--r--apps/files_sharing/l10n/nn_NO.php1
-rw-r--r--apps/files_sharing/l10n/oc.php1
-rw-r--r--apps/files_sharing/l10n/pl.php5
-rw-r--r--apps/files_sharing/l10n/pt_BR.php5
-rw-r--r--apps/files_sharing/l10n/pt_PT.php7
-rw-r--r--apps/files_sharing/l10n/ro.php1
-rw-r--r--apps/files_sharing/l10n/ru.php5
-rw-r--r--apps/files_sharing/l10n/si_LK.php1
-rw-r--r--apps/files_sharing/l10n/sk.php5
-rw-r--r--apps/files_sharing/l10n/sk_SK.php9
-rw-r--r--apps/files_sharing/l10n/sl.php12
-rw-r--r--apps/files_sharing/l10n/sq.php1
-rw-r--r--apps/files_sharing/l10n/sr.php1
-rw-r--r--apps/files_sharing/l10n/sr@latin.php1
-rw-r--r--apps/files_sharing/l10n/sv.php5
-rw-r--r--apps/files_sharing/l10n/ta_LK.php1
-rw-r--r--apps/files_sharing/l10n/th_TH.php1
-rw-r--r--apps/files_sharing/l10n/tr.php16
-rw-r--r--apps/files_sharing/l10n/ug.php1
-rw-r--r--apps/files_sharing/l10n/uk.php12
-rw-r--r--apps/files_sharing/l10n/vi.php1
-rw-r--r--apps/files_sharing/l10n/zh_CN.php1
-rw-r--r--apps/files_sharing/l10n/zh_TW.php2
-rw-r--r--apps/files_sharing/lib/api.php104
-rw-r--r--apps/files_sharing/lib/cache.php84
-rw-r--r--apps/files_sharing/lib/maintainer.php44
-rw-r--r--apps/files_sharing/lib/permissions.php15
-rw-r--r--apps/files_sharing/lib/share/file.php2
-rw-r--r--apps/files_sharing/lib/sharedstorage.php131
-rw-r--r--apps/files_sharing/lib/updater.php50
-rw-r--r--apps/files_sharing/lib/watcher.php27
-rw-r--r--apps/files_sharing/public.php20
-rw-r--r--apps/files_sharing/templates/authenticate.php7
-rw-r--r--apps/files_sharing/templates/public.php10
-rw-r--r--apps/files_sharing/tests/api.php171
-rw-r--r--apps/files_sharing/tests/base.php143
-rw-r--r--apps/files_sharing/tests/permissions.php110
-rw-r--r--apps/files_sharing/tests/watcher.php161
90 files changed, 1106 insertions, 430 deletions
diff --git a/apps/files_sharing/ajax/publicpreview.php b/apps/files_sharing/ajax/publicpreview.php
index 41a1c178a48..54a9806e8bf 100644
--- a/apps/files_sharing/ajax/publicpreview.php
+++ b/apps/files_sharing/ajax/publicpreview.php
@@ -9,6 +9,8 @@ if(!\OC_App::isEnabled('files_sharing')){
exit;
}
+\OC_User::setIncognitoMode(true);
+
$file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : '';
$maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '36';
$maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '36';
@@ -34,12 +36,16 @@ if(!isset($linkedItem['uid_owner']) || !isset($linkedItem['file_source'])) {
exit;
}
-$userId = $linkedItem['uid_owner'];
+$rootLinkItem = OCP\Share::resolveReShare($linkedItem);
+$userId = $rootLinkItem['uid_owner'];
+
\OC_Util::setupFS($userId);
+\OC\Files\Filesystem::initMountPoints($userId);
+$view = new \OC\Files\View('/' . $userId . '/files');
$pathId = $linkedItem['file_source'];
-$path = \OC\Files\Filesystem::getPath($pathId);
-$pathInfo = \OC\Files\Filesystem::getFileInfo($path);
+$path = $view->getPath($pathId);
+$pathInfo = $view->getFileInfo($path);
$sharedFile = null;
if($linkedItem['item_type'] === 'folder') {
@@ -54,7 +60,7 @@ if($linkedItem['item_type'] === 'folder') {
if($linkedItem['item_type'] === 'file') {
$parent = $pathInfo['parent'];
- $path = \OC\Files\Filesystem::getPath($parent);
+ $path = $view->getPath($parent);
$sharedFile = $pathInfo['name'];
}
diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php
index ffdcbf05109..217bc005faf 100644
--- a/apps/files_sharing/appinfo/app.php
+++ b/apps/files_sharing/appinfo/app.php
@@ -8,12 +8,15 @@ OC::$CLASSPATH['OC\Files\Cache\Shared_Permissions'] = 'files_sharing/lib/permiss
OC::$CLASSPATH['OC\Files\Cache\Shared_Updater'] = 'files_sharing/lib/updater.php';
OC::$CLASSPATH['OC\Files\Cache\Shared_Watcher'] = 'files_sharing/lib/watcher.php';
OC::$CLASSPATH['OCA\Files\Share\Api'] = 'files_sharing/lib/api.php';
+OC::$CLASSPATH['OCA\Files\Share\Maintainer'] = 'files_sharing/lib/maintainer.php';
OCP\Util::connectHook('OC_Filesystem', 'setup', '\OC\Files\Storage\Shared', 'setup');
OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
OCP\Util::addScript('files_sharing', 'share');
\OC_Hook::connect('OC_Filesystem', 'post_write', '\OC\Files\Cache\Shared_Updater', 'writeHook');
+\OC_Hook::connect('OC_Filesystem', 'post_delete', '\OC\Files\Cache\Shared_Updater', 'postDeleteHook');
\OC_Hook::connect('OC_Filesystem', 'delete', '\OC\Files\Cache\Shared_Updater', 'deleteHook');
\OC_Hook::connect('OC_Filesystem', 'post_rename', '\OC\Files\Cache\Shared_Updater', 'renameHook');
\OC_Hook::connect('OCP\Share', 'post_shared', '\OC\Files\Cache\Shared_Updater', 'shareHook');
\OC_Hook::connect('OCP\Share', 'pre_unshare', '\OC\Files\Cache\Shared_Updater', 'shareHook');
+\OC_Hook::connect('OC_Appconfig', 'post_set_value', '\OCA\Files\Share\Maintainer', 'configChangeHook');
diff --git a/apps/files_sharing/appinfo/update.php b/apps/files_sharing/appinfo/update.php
index 48e41e93048..0d827da28ea 100644
--- a/apps/files_sharing/appinfo/update.php
+++ b/apps/files_sharing/appinfo/update.php
@@ -68,11 +68,21 @@ if (version_compare($installedVersion, '0.3', '<')) {
// $query = OCP\DB::prepare('DROP TABLE `*PREFIX*sharing`');
// $query->execute();
}
-if (version_compare($installedVersion, '0.3.3', '<')) {
- OC_User::useBackend(new OC_User_Database());
- OC_App::loadApps(array('authentication'));
- $users = OC_User::getUsers();
- foreach ($users as $user) {
-// OC_FileCache::delete('Shared', '/'.$user.'/files/');
+
+// clean up oc_share table from files which are no longer exists
+if (version_compare($installedVersion, '0.3.5', '<')) {
+
+ // get all shares where the original file no longer exists
+ $findShares = \OC_DB::prepare('SELECT `file_source` FROM `*PREFIX*share` LEFT JOIN `*PREFIX*filecache` ON `file_source` = `*PREFIX*filecache`.`fileid` WHERE `*PREFIX*filecache`.`fileid` IS NULL AND `*PREFIX*share`.`item_type` IN (\'file\', \'folder\')');
+ $sharesFound = $findShares->execute(array())->fetchAll();
+
+ // delete those shares from the oc_share table
+ if (is_array($sharesFound) && !empty($sharesFound)) {
+ $delArray = array();
+ foreach ($sharesFound as $share) {
+ $delArray[] = $share['file_source'];
+ }
+ $removeShares = \OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `file_source` IN (?)');
+ $result = $removeShares->execute(array(implode(',', $delArray)));
}
}
diff --git a/apps/files_sharing/appinfo/version b/apps/files_sharing/appinfo/version
index 87a0871112f..09e9157034c 100644
--- a/apps/files_sharing/appinfo/version
+++ b/apps/files_sharing/appinfo/version
@@ -1 +1 @@
-0.3.3 \ No newline at end of file
+0.3.5 \ No newline at end of file
diff --git a/apps/files_sharing/css/authenticate.css b/apps/files_sharing/css/authenticate.css
new file mode 100644
index 00000000000..cebe906dd59
--- /dev/null
+++ b/apps/files_sharing/css/authenticate.css
@@ -0,0 +1,26 @@
+#body-login form label.infield {
+ width: 190px;
+ padding: 10px;
+ left: 8px;
+ top: 8px;
+}
+
+#password {
+ width: 190px !important;
+ padding: 10px;
+ margin: 6px;
+}
+
+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"] {
+ position: absolute;
+ top: 0px;
+}
diff --git a/apps/files_sharing/css/public.css b/apps/files_sharing/css/public.css
index 70345c3577d..e948811c032 100644
--- a/apps/files_sharing/css/public.css
+++ b/apps/files_sharing/css/public.css
@@ -1,17 +1,17 @@
body {
- background:#ddd;
+ height: auto;
}
#header {
background: #1d2d44 url('%webroot%/core/img/noise.png') repeat;
- height:40px;
+ height:32px;
left:0;
- line-height:40px;
+ line-height:32px;
position:fixed;
right:0;
top:0;
z-index:100;
- padding:8px;
+ padding:7px;
}
#details {
@@ -22,15 +22,20 @@ body {
#public_upload,
#download {
font-weight:700;
- margin: 0 6px 0 0;
+ margin: 0 0 0 6px;
padding: 0 5px;
- height: 27px;
+ height: 32px;
float: left;
}
.header-right #details {
- margin-right: 32px;
+ margin-right: 28px;
+}
+
+.header-right {
+ padding: 0;
+ height: 32px;
}
#public_upload {
@@ -44,12 +49,14 @@ body {
vertical-align:text-bottom;
}
+#controls {
+ left: 0;
+}
+
#preview {
- background:#eee;
- border-bottom:1px solid #f8f8f8;
- min-height:480px;
- text-align:center;
- margin:45px auto;
+ background: #fff;
+ text-align: center;
+ margin: 45px auto 0;
}
#noPreview {
@@ -57,11 +64,16 @@ body {
padding-top:90px;
}
+footer {
+ margin-top: 65px;
+}
+
p.info {
- color:#777;
- text-align:center;
- width:352px;
- margin:32px auto;
+ color: #777;
+ text-align: center;
+ width: 352px;
+ margin: 0 auto;
+ padding: 20px;
}
p.info a {
@@ -90,7 +102,7 @@ thead{
#data-upload-form {
position: relative;
right: 0;
- height: 27px;
+ height: 32px;
overflow: hidden;
padding: 0;
float: right;
@@ -109,26 +121,30 @@ thead{
width: 100% !important;
}
-#download span {
- position: relative;
- bottom: 3px;
-}
-
#publicUploadButtonMock {
position:relative;
display:block;
width:100%;
- height:27px;
+ height:32px;
cursor:pointer;
z-index:10;
background-image:url('%webroot%/core/img/actions/upload.svg');
background-repeat:no-repeat;
- background-position:7px 6px;
+ background-position:7px 8px;
}
#publicUploadButtonMock span {
margin: 0 5px 0 28px;
- position: relative;
- top: -2px;
color: #555;
}
+
+.directLink {
+ margin-bottom: 20px;
+}
+ .directLink label {
+ font-weight: normal;
+ }
+ .directLink input {
+ margin-left: 10px;
+ width: 300px;
+ }
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js
index 67320b1cdb6..2e34e6f9bc5 100644
--- a/apps/files_sharing/js/public.js
+++ b/apps/files_sharing/js/public.js
@@ -29,19 +29,19 @@ $(document).ready(function() {
}
}
FileActions.register('dir', 'Open', OC.PERMISSION_READ, '', function(filename) {
- var tr = $('tr').filterAttr('data-file', filename);
+ var tr = FileList.findFileEl(filename);
if (tr.length > 0) {
window.location = $(tr).find('a.name').attr('href');
}
});
FileActions.register('file', 'Download', OC.PERMISSION_READ, '', function(filename) {
- var tr = $('tr').filterAttr('data-file', 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) {
- var tr = $('tr').filterAttr('data-file', filename);
+ var tr = FileList.findFileEl(filename);
if (tr.length > 0) {
window.location = $(tr).find('a.name').attr('href')+'&download';
}
@@ -67,4 +67,6 @@ $(document).ready(function() {
procesSelection();
});
+ $('#directLink').focus();
+
});
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index 03ed02f41ef..36de452a55e 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -1,11 +1,19 @@
$(document).ready(function() {
- var disableSharing = $('#disableSharing').data('status');
+ var disableSharing = $('#disableSharing').data('status'),
+ sharesLoaded = false;
if (typeof OC.Share !== 'undefined' && typeof FileActions !== 'undefined' && !disableSharing) {
-
$('#fileList').on('fileActionsReady',function(){
- OC.Share.loadIcons('file');
+ if (!sharesLoaded){
+ OC.Share.loadIcons('file');
+ // assume that we got all shares, so switching directories
+ // will not invalidate that list
+ sharesLoaded = true;
+ }
+ else{
+ OC.Share.updateIcons('file');
+ }
});
FileActions.register('all', 'Share', OC.PERMISSION_READ, OC.imagePath('core', 'actions/share'), function(filename) {
@@ -14,7 +22,7 @@ $(document).ready(function() {
} else {
var item = $('#dir').val() + '/' + filename;
}
- var tr = $('tr').filterAttr('data-file', filename);
+ var tr = FileList.findFileEl(filename);
if ($(tr).data('type') == 'dir') {
var itemType = 'folder';
} else {
@@ -27,14 +35,14 @@ $(document).ready(function() {
if ($(tr).data('id') != $('#dropdown').attr('data-item-source')) {
OC.Share.hideDropDown(function () {
$(tr).addClass('mouseOver');
- OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions);
+ OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions, filename);
});
} else {
OC.Share.hideDropDown();
}
} else {
$(tr).addClass('mouseOver');
- OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions);
+ OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions, filename);
}
});
}
diff --git a/apps/files_sharing/l10n/ar.php b/apps/files_sharing/l10n/ar.php
index ff7b40d16bc..2625af1cc00 100644
--- a/apps/files_sharing/l10n/ar.php
+++ b/apps/files_sharing/l10n/ar.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "كلمة المرور",
-"Submit" => "تطبيق",
"%s shared the folder %s with you" => "%s شارك المجلد %s معك",
"%s shared the file %s with you" => "%s شارك الملف %s معك",
"Download" => "تحميل",
diff --git a/apps/files_sharing/l10n/bg_BG.php b/apps/files_sharing/l10n/bg_BG.php
index 1094870fd0f..f4b9e2dd5fc 100644
--- a/apps/files_sharing/l10n/bg_BG.php
+++ b/apps/files_sharing/l10n/bg_BG.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "Парола",
-"Submit" => "Потвърждение",
"%s shared the folder %s with you" => "%s сподели папката %s с Вас",
"%s shared the file %s with you" => "%s сподели файла %s с Вас",
"Download" => "Изтегляне",
diff --git a/apps/files_sharing/l10n/bn_BD.php b/apps/files_sharing/l10n/bn_BD.php
index 71b948e347b..aaed904d9d7 100644
--- a/apps/files_sharing/l10n/bn_BD.php
+++ b/apps/files_sharing/l10n/bn_BD.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "কূটশব্দ",
-"Submit" => "জমা দিন",
"%s shared the folder %s with you" => "%s আপনার সাথে %s ফোল্ডারটি ভাগাভাগি করেছেন",
"%s shared the file %s with you" => "%s আপনার সাথে %s ফাইলটি ভাগাভাগি করেছেন",
"Download" => "ডাউনলোড",
diff --git a/apps/files_sharing/l10n/ca.php b/apps/files_sharing/l10n/ca.php
index cbe8f86e253..96e59992967 100644
--- a/apps/files_sharing/l10n/ca.php
+++ b/apps/files_sharing/l10n/ca.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Aquest compartit està protegit amb contrasenya",
"The password is wrong. Try again." => "la contrasenya és incorrecta. Intenteu-ho de nou.",
"Password" => "Contrasenya",
-"Submit" => "Envia",
"Sorry, this link doesn’t seem to work anymore." => "Aquest enllaç sembla que no funciona.",
"Reasons might be:" => "Les raons podrien ser:",
"the item was removed" => "l'element ha estat eliminat",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Baixa",
"Upload" => "Puja",
"Cancel upload" => "Cancel·la la pujada",
-"No preview available for" => "No hi ha vista prèvia disponible per a"
+"No preview available for" => "No hi ha vista prèvia disponible per a",
+"Direct link" => "Enllaç directe"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/cs_CZ.php b/apps/files_sharing/l10n/cs_CZ.php
index 7258dedcf6d..adf099a6d94 100644
--- a/apps/files_sharing/l10n/cs_CZ.php
+++ b/apps/files_sharing/l10n/cs_CZ.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Toto sdílení je chráněno heslem",
"The password is wrong. Try again." => "Heslo není správné. Zkuste to znovu.",
"Password" => "Heslo",
-"Submit" => "Odeslat",
"Sorry, this link doesn’t seem to work anymore." => "Je nám líto, ale tento odkaz již není funkční.",
"Reasons might be:" => "Možné důvody:",
"the item was removed" => "položka byla odebrána",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Stáhnout",
"Upload" => "Odeslat",
"Cancel upload" => "Zrušit odesílání",
-"No preview available for" => "Náhled není dostupný pro"
+"No preview available for" => "Náhled není dostupný pro",
+"Direct link" => "Přímý odkaz"
);
$PLURAL_FORMS = "nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;";
diff --git a/apps/files_sharing/l10n/cy_GB.php b/apps/files_sharing/l10n/cy_GB.php
index 66fbc4e1d1c..d2ae28141d4 100644
--- a/apps/files_sharing/l10n/cy_GB.php
+++ b/apps/files_sharing/l10n/cy_GB.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "Cyfrinair",
-"Submit" => "Cyflwyno",
"%s shared the folder %s with you" => "Rhannodd %s blygell %s â chi",
"%s shared the file %s with you" => "Rhannodd %s ffeil %s â chi",
"Download" => "Llwytho i lawr",
diff --git a/apps/files_sharing/l10n/da.php b/apps/files_sharing/l10n/da.php
index 0ca0f38161a..849b0e28d30 100644
--- a/apps/files_sharing/l10n/da.php
+++ b/apps/files_sharing/l10n/da.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Delingen er beskyttet af kodeord",
"The password is wrong. Try again." => "Kodeordet er forkert. Prøv igen.",
"Password" => "Kodeord",
-"Submit" => "Send",
"Sorry, this link doesn’t seem to work anymore." => "Desværre, dette link ser ikke ud til at fungerer længere.",
"Reasons might be:" => "Årsagen kan være:",
"the item was removed" => "Filen blev fjernet",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Download",
"Upload" => "Upload",
"Cancel upload" => "Fortryd upload",
-"No preview available for" => "Forhåndsvisning ikke tilgængelig for"
+"No preview available for" => "Forhåndsvisning ikke tilgængelig for",
+"Direct link" => "Direkte link"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/de.php b/apps/files_sharing/l10n/de.php
index afed17d8839..d7879833ca9 100644
--- a/apps/files_sharing/l10n/de.php
+++ b/apps/files_sharing/l10n/de.php
@@ -1,19 +1,20 @@
<?php
$TRANSLATIONS = array(
-"The password is wrong. Try again." => "Bitte überprüfen sie Ihr Passwort und versuchen Sie es erneut.",
+"This share is password-protected" => "Diese Freigabe ist durch ein Passwort geschützt",
+"The password is wrong. Try again." => "Bitte überprüfe Dein Passwort und versuche es erneut.",
"Password" => "Passwort",
-"Submit" => "Absenden",
"Sorry, this link doesn’t seem to work anymore." => "Entschuldigung, dieser Link scheint nicht mehr zu funktionieren.",
"Reasons might be:" => "Gründe könnten sein:",
-"the item was removed" => "Die Elemente wurden entfernt",
+"the item was removed" => "Das Element wurde entfernt",
"the link expired" => "Der Link ist abgelaufen",
"sharing is disabled" => "Teilen ist deaktiviert",
-"For more info, please ask the person who sent this link." => "Für mehr Informationen, frage bitte die Person, die dir diesen Link geschickt hat.",
+"For more info, please ask the person who sent this link." => "Für mehr Informationen, frage bitte die Person, die Dir diesen Link geschickt hat.",
"%s shared the folder %s with you" => "%s hat den Ordner %s mit Dir geteilt",
"%s shared the file %s with you" => "%s hat die Datei %s mit Dir geteilt",
"Download" => "Download",
-"Upload" => "Hochladen",
+"Upload" => "Upload",
"Cancel upload" => "Upload abbrechen",
-"No preview available for" => "Es ist keine Vorschau verfügbar für"
+"No preview available for" => "Es ist keine Vorschau verfügbar für",
+"Direct link" => "Direkter Link"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/de_CH.php b/apps/files_sharing/l10n/de_CH.php
index 1bd24f9d9c4..f63714b902f 100644
--- a/apps/files_sharing/l10n/de_CH.php
+++ b/apps/files_sharing/l10n/de_CH.php
@@ -2,7 +2,6 @@
$TRANSLATIONS = array(
"The password is wrong. Try again." => "Das Passwort ist falsch. Bitte versuchen Sie es erneut.",
"Password" => "Passwort",
-"Submit" => "Bestätigen",
"Sorry, this link doesn’t seem to work anymore." => "Entschuldigung, dieser Link scheint nicht mehr zu funktionieren.",
"Reasons might be:" => "Gründe könnten sein:",
"the item was removed" => "Das Element wurde entfernt",
diff --git a/apps/files_sharing/l10n/de_DE.php b/apps/files_sharing/l10n/de_DE.php
index 1bd24f9d9c4..3ab95b6690d 100644
--- a/apps/files_sharing/l10n/de_DE.php
+++ b/apps/files_sharing/l10n/de_DE.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Diese Freigabe ist durch ein Passwort geschützt",
"The password is wrong. Try again." => "Das Passwort ist falsch. Bitte versuchen Sie es erneut.",
"Password" => "Passwort",
-"Submit" => "Bestätigen",
"Sorry, this link doesn’t seem to work anymore." => "Entschuldigung, dieser Link scheint nicht mehr zu funktionieren.",
"Reasons might be:" => "Gründe könnten sein:",
"the item was removed" => "Das Element wurde entfernt",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Herunterladen",
"Upload" => "Hochladen",
"Cancel upload" => "Upload abbrechen",
-"No preview available for" => "Es ist keine Vorschau verfügbar für"
+"No preview available for" => "Es ist keine Vorschau verfügbar für",
+"Direct link" => "Direkte Verlinkung"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/el.php b/apps/files_sharing/l10n/el.php
index 93486a831b1..3ea666504b1 100644
--- a/apps/files_sharing/l10n/el.php
+++ b/apps/files_sharing/l10n/el.php
@@ -1,19 +1,20 @@
<?php
$TRANSLATIONS = array(
-"The password is wrong. Try again." => "Εσφαλμένο συνθηματικό. Προσπαθήστε ξανά.",
-"Password" => "Συνθηματικό",
-"Submit" => "Καταχώρηση",
+"This share is password-protected" => "Αυτός ο κοινόχρηστος φάκελος προστατεύεται με κωδικό",
+"The password is wrong. Try again." => "Εσφαλμένος κωδικός πρόσβασης. Προσπαθήστε ξανά.",
+"Password" => "Κωδικός πρόσβασης",
"Sorry, this link doesn’t seem to work anymore." => "Συγγνώμη, αυτός ο σύνδεσμος μοιάζει να μην ισχύει πια.",
"Reasons might be:" => "Οι λόγοι μπορεί να είναι:",
"the item was removed" => "το αντικείμενο απομακρύνθηκε",
"the link expired" => "ο σύνδεσμος έληξε",
"sharing is disabled" => "ο διαμοιρασμός απενεργοποιήθηκε",
"For more info, please ask the person who sent this link." => "Για περισσότερες πληροφορίες, παρακαλώ ρωτήστε το άτομο που σας έστειλε αυτόν τον σύνδεσμο.",
-"%s shared the folder %s with you" => "%s μοιράστηκε τον φάκελο %s μαζί σας",
-"%s shared the file %s with you" => "%s μοιράστηκε το αρχείο %s μαζί σας",
+"%s shared the folder %s with you" => "Ο %s μοιράστηκε τον φάκελο %s μαζί σας",
+"%s shared the file %s with you" => "Ο %s μοιράστηκε το αρχείο %s μαζί σας",
"Download" => "Λήψη",
"Upload" => "Μεταφόρτωση",
-"Cancel upload" => "Ακύρωση αποστολής",
-"No preview available for" => "Δεν υπάρχει διαθέσιμη προεπισκόπηση για"
+"Cancel upload" => "Ακύρωση μεταφόρτωσης",
+"No preview available for" => "Δεν υπάρχει διαθέσιμη προεπισκόπηση για",
+"Direct link" => "Άμεσος σύνδεσμος"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/en@pirate.php b/apps/files_sharing/l10n/en@pirate.php
index a60f1fe72f2..cd3c00d29d2 100644
--- a/apps/files_sharing/l10n/en@pirate.php
+++ b/apps/files_sharing/l10n/en@pirate.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "Secret Code",
-"Submit" => "Submit",
"%s shared the folder %s with you" => "%s shared the folder %s with you",
"%s shared the file %s with you" => "%s shared the file %s with you",
"Download" => "Download",
diff --git a/apps/files_sharing/l10n/en_GB.php b/apps/files_sharing/l10n/en_GB.php
index 337c108651e..3e04d120beb 100644
--- a/apps/files_sharing/l10n/en_GB.php
+++ b/apps/files_sharing/l10n/en_GB.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "This share is password-protected",
"The password is wrong. Try again." => "The password is wrong. Try again.",
"Password" => "Password",
-"Submit" => "Submit",
"Sorry, this link doesn’t seem to work anymore." => "Sorry, this link doesn’t seem to work anymore.",
"Reasons might be:" => "Reasons might be:",
"the item was removed" => "the item was removed",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Download",
"Upload" => "Upload",
"Cancel upload" => "Cancel upload",
-"No preview available for" => "No preview available for"
+"No preview available for" => "No preview available for",
+"Direct link" => "Direct link"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/eo.php b/apps/files_sharing/l10n/eo.php
index 70e703bda91..891b3db9aa8 100644
--- a/apps/files_sharing/l10n/eo.php
+++ b/apps/files_sharing/l10n/eo.php
@@ -1,12 +1,19 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Ĉi tiu kunhavigo estas protektata per pasvorto",
"Password" => "Pasvorto",
-"Submit" => "Sendi",
+"Sorry, this link doesn’t seem to work anymore." => "Pardonu, ĉi tiu ligilo ŝajne ne plu funkcias.",
+"Reasons might be:" => "Kialoj povas esti:",
+"the item was removed" => "la ero foriĝis",
+"the link expired" => "la ligilo eksvalidiĝis",
+"sharing is disabled" => "kunhavigo malkapablas",
+"For more info, please ask the person who sent this link." => "Por plia informo, bonvolu peti al la persono, kiu sendis ĉi tiun ligilon.",
"%s shared the folder %s with you" => "%s kunhavigis la dosierujon %s kun vi",
"%s shared the file %s with you" => "%s kunhavigis la dosieron %s kun vi",
"Download" => "Elŝuti",
"Upload" => "Alŝuti",
"Cancel upload" => "Nuligi alŝuton",
-"No preview available for" => "Ne haveblas antaŭvido por"
+"No preview available for" => "Ne haveblas antaŭvido por",
+"Direct link" => "Direkta ligilo"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/es.php b/apps/files_sharing/l10n/es.php
index e163da766f3..f986c29b4f7 100644
--- a/apps/files_sharing/l10n/es.php
+++ b/apps/files_sharing/l10n/es.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Este elemento compartido esta protegido por contraseña",
"The password is wrong. Try again." => "La contraseña introducida es errónea. Inténtelo de nuevo.",
"Password" => "Contraseña",
-"Submit" => "Enviar",
"Sorry, this link doesn’t seem to work anymore." => "Vaya, este enlace parece que no volverá a funcionar.",
"Reasons might be:" => "Las causas podrían ser:",
"the item was removed" => "el elemento fue eliminado",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Descargar",
"Upload" => "Subir",
"Cancel upload" => "Cancelar subida",
-"No preview available for" => "No hay vista previa disponible para"
+"No preview available for" => "No hay vista previa disponible para",
+"Direct link" => "Enlace directo"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/es_AR.php b/apps/files_sharing/l10n/es_AR.php
index 7c9dcb94ac1..989a91a450f 100644
--- a/apps/files_sharing/l10n/es_AR.php
+++ b/apps/files_sharing/l10n/es_AR.php
@@ -2,7 +2,6 @@
$TRANSLATIONS = array(
"The password is wrong. Try again." => "La contraseña no es correcta. Probá de nuevo.",
"Password" => "Contraseña",
-"Submit" => "Enviar",
"Sorry, this link doesn’t seem to work anymore." => "Perdón, este enlace parece no funcionar más.",
"Reasons might be:" => "Las causas podrían ser:",
"the item was removed" => "el elemento fue borrado",
diff --git a/apps/files_sharing/l10n/es_CL.php b/apps/files_sharing/l10n/es_CL.php
new file mode 100644
index 00000000000..31dc045870c
--- /dev/null
+++ b/apps/files_sharing/l10n/es_CL.php
@@ -0,0 +1,6 @@
+<?php
+$TRANSLATIONS = array(
+"Password" => "Clave",
+"Upload" => "Subir"
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/es_MX.php b/apps/files_sharing/l10n/es_MX.php
new file mode 100644
index 00000000000..9100ef8b35f
--- /dev/null
+++ b/apps/files_sharing/l10n/es_MX.php
@@ -0,0 +1,20 @@
+<?php
+$TRANSLATIONS = array(
+"This share is password-protected" => "Este elemento compartido esta protegido por contraseña",
+"The password is wrong. Try again." => "La contraseña introducida es errónea. Inténtelo de nuevo.",
+"Password" => "Contraseña",
+"Sorry, this link doesn’t seem to work anymore." => "Lo siento, este enlace al parecer ya no funciona.",
+"Reasons might be:" => "Las causas podrían ser:",
+"the item was removed" => "el elemento fue eliminado",
+"the link expired" => "el enlace expiró",
+"sharing is disabled" => "compartir está desactivado",
+"For more info, please ask the person who sent this link." => "Para mayor información, contacte a la persona que le envió el enlace.",
+"%s shared the folder %s with you" => "%s compartió la carpeta %s contigo",
+"%s shared the file %s with you" => "%s compartió el archivo %s contigo",
+"Download" => "Descargar",
+"Upload" => "Subir",
+"Cancel upload" => "Cancelar subida",
+"No preview available for" => "No hay vista previa disponible para",
+"Direct link" => "Enlace directo"
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/et_EE.php b/apps/files_sharing/l10n/et_EE.php
index fe230902ff1..4b7f975e83d 100644
--- a/apps/files_sharing/l10n/et_EE.php
+++ b/apps/files_sharing/l10n/et_EE.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "See jagamine on parooliga kaitstud",
"The password is wrong. Try again." => "Parool on vale. Proovi uuesti.",
"Password" => "Parool",
-"Submit" => "Saada",
"Sorry, this link doesn’t seem to work anymore." => "Vabandust, see link ei tundu enam toimivat.",
"Reasons might be:" => "Põhjused võivad olla:",
"the item was removed" => "üksus on eemaldatud",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Lae alla",
"Upload" => "Lae üles",
"Cancel upload" => "Tühista üleslaadimine",
-"No preview available for" => "Eelvaadet pole saadaval"
+"No preview available for" => "Eelvaadet pole saadaval",
+"Direct link" => "Otsene link"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/eu.php b/apps/files_sharing/l10n/eu.php
index 7b6a4b08b3c..20de5a085ab 100644
--- a/apps/files_sharing/l10n/eu.php
+++ b/apps/files_sharing/l10n/eu.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Elkarbanatutako hau pasahitzarekin babestuta dago",
"The password is wrong. Try again." => "Pasahitza ez da egokia. Saiatu berriro.",
"Password" => "Pasahitza",
-"Submit" => "Bidali",
"Sorry, this link doesn’t seem to work anymore." => "Barkatu, lotura ez dirudi eskuragarria dagoenik.",
"Reasons might be:" => "Arrazoiak hurrengoak litezke:",
"the item was removed" => "fitxategia ezbatua izan da",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Deskargatu",
"Upload" => "Igo",
"Cancel upload" => "Ezeztatu igoera",
-"No preview available for" => "Ez dago aurrebista eskuragarririk hauentzat "
+"No preview available for" => "Ez dago aurrebista eskuragarririk hauentzat ",
+"Direct link" => "Lotura zuzena"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/fa.php b/apps/files_sharing/l10n/fa.php
index 48888f798a0..664338723c4 100644
--- a/apps/files_sharing/l10n/fa.php
+++ b/apps/files_sharing/l10n/fa.php
@@ -2,7 +2,6 @@
$TRANSLATIONS = array(
"The password is wrong. Try again." => "رمزعبور اشتباه می باشد. دوباره امتحان کنید.",
"Password" => "گذرواژه",
-"Submit" => "ثبت",
"%s shared the folder %s with you" => "%sپوشه %s را با شما به اشتراک گذاشت",
"%s shared the file %s with you" => "%sفایل %s را با شما به اشتراک گذاشت",
"Download" => "دانلود",
diff --git a/apps/files_sharing/l10n/fi_FI.php b/apps/files_sharing/l10n/fi_FI.php
index 42905be57a6..c54c822b1c4 100644
--- a/apps/files_sharing/l10n/fi_FI.php
+++ b/apps/files_sharing/l10n/fi_FI.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Tämä jako on suojattu salasanalla",
"The password is wrong. Try again." => "Väärä salasana. Yritä uudelleen.",
"Password" => "Salasana",
-"Submit" => "Lähetä",
"Sorry, this link doesn’t seem to work anymore." => "Valitettavasti linkki ei vaikuta enää toimivan.",
"Reasons might be:" => "Mahdollisia syitä:",
"the item was removed" => "kohde poistettiin",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Lataa",
"Upload" => "Lähetä",
"Cancel upload" => "Peru lähetys",
-"No preview available for" => "Ei esikatselua kohteelle"
+"No preview available for" => "Ei esikatselua kohteelle",
+"Direct link" => "Suora linkki"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/fr.php b/apps/files_sharing/l10n/fr.php
index c97a1db97e4..b51f421fa52 100644
--- a/apps/files_sharing/l10n/fr.php
+++ b/apps/files_sharing/l10n/fr.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Ce partage est protégé par un mot de passe",
"The password is wrong. Try again." => "Le mot de passe est incorrect. Veuillez réessayer.",
"Password" => "Mot de passe",
-"Submit" => "Envoyer",
"Sorry, this link doesn’t seem to work anymore." => "Désolé, mais le lien semble ne plus fonctionner.",
"Reasons might be:" => "Les raisons peuvent être :",
"the item was removed" => "l'item a été supprimé",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Télécharger",
"Upload" => "Envoyer",
"Cancel upload" => "Annuler l'envoi",
-"No preview available for" => "Pas d'aperçu disponible pour"
+"No preview available for" => "Pas d'aperçu disponible pour",
+"Direct link" => "Lien direct"
);
$PLURAL_FORMS = "nplurals=2; plural=(n > 1);";
diff --git a/apps/files_sharing/l10n/gl.php b/apps/files_sharing/l10n/gl.php
index 66b1f0e5ffc..3ea3fe5f1c5 100644
--- a/apps/files_sharing/l10n/gl.php
+++ b/apps/files_sharing/l10n/gl.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Esta compartición está protexida con contrasinal",
"The password is wrong. Try again." => "O contrasinal é incorrecto. Ténteo de novo.",
"Password" => "Contrasinal",
-"Submit" => "Enviar",
"Sorry, this link doesn’t seem to work anymore." => "Semella que esta ligazón non funciona.",
"Reasons might be:" => "As razóns poderían ser:",
"the item was removed" => "o elemento foi retirado",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Descargar",
"Upload" => "Enviar",
"Cancel upload" => "Cancelar o envío",
-"No preview available for" => "Sen vista previa dispoñíbel para"
+"No preview available for" => "Sen vista previa dispoñíbel para",
+"Direct link" => "Ligazón directa"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/he.php b/apps/files_sharing/l10n/he.php
index f8b304898ce..217298feddf 100644
--- a/apps/files_sharing/l10n/he.php
+++ b/apps/files_sharing/l10n/he.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "סיסמא",
-"Submit" => "שליחה",
"%s shared the folder %s with you" => "%s שיתף עמך את התיקייה %s",
"%s shared the file %s with you" => "%s שיתף עמך את הקובץ %s",
"Download" => "הורדה",
diff --git a/apps/files_sharing/l10n/hr.php b/apps/files_sharing/l10n/hr.php
index 87eb9567067..4a82dd7f71f 100644
--- a/apps/files_sharing/l10n/hr.php
+++ b/apps/files_sharing/l10n/hr.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "Lozinka",
-"Submit" => "Pošalji",
"Download" => "Preuzimanje",
"Upload" => "Učitaj",
"Cancel upload" => "Prekini upload"
diff --git a/apps/files_sharing/l10n/hu_HU.php b/apps/files_sharing/l10n/hu_HU.php
index 7ef69b1e0b6..a06c51b3775 100644
--- a/apps/files_sharing/l10n/hu_HU.php
+++ b/apps/files_sharing/l10n/hu_HU.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Ez egy jelszóval védett megosztás",
"The password is wrong. Try again." => "A megadott jelszó nem megfelelő. Próbálja újra!",
"Password" => "Jelszó",
-"Submit" => "Elküld",
"Sorry, this link doesn’t seem to work anymore." => "Sajnos úgy tűnik, ez a link már nem működik.",
"Reasons might be:" => "Ennek az oka a következő lehet:",
"the item was removed" => "az állományt időközben eltávolították",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Letöltés",
"Upload" => "Feltöltés",
"Cancel upload" => "A feltöltés megszakítása",
-"No preview available for" => "Nem áll rendelkezésre előnézet ehhez: "
+"No preview available for" => "Nem áll rendelkezésre előnézet ehhez: ",
+"Direct link" => "Közvetlen link"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/hy.php b/apps/files_sharing/l10n/hy.php
index d4cb416f45a..da200623e03 100644
--- a/apps/files_sharing/l10n/hy.php
+++ b/apps/files_sharing/l10n/hy.php
@@ -1,6 +1,5 @@
<?php
$TRANSLATIONS = array(
-"Submit" => "Հաստատել",
"Download" => "Բեռնել"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/ia.php b/apps/files_sharing/l10n/ia.php
index 5112501073d..f9d6c33a0b5 100644
--- a/apps/files_sharing/l10n/ia.php
+++ b/apps/files_sharing/l10n/ia.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "Contrasigno",
-"Submit" => "Submitter",
"Download" => "Discargar",
"Upload" => "Incargar"
);
diff --git a/apps/files_sharing/l10n/id.php b/apps/files_sharing/l10n/id.php
index a4d73bd2b75..865a951c2d2 100644
--- a/apps/files_sharing/l10n/id.php
+++ b/apps/files_sharing/l10n/id.php
@@ -1,12 +1,20 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Berbagi ini dilindungi sandi",
+"The password is wrong. Try again." => "Sandi salah. Coba lagi",
"Password" => "Sandi",
-"Submit" => "Kirim",
+"Sorry, this link doesn’t seem to work anymore." => "Maaf, tautan ini tampaknya tidak berfungsi lagi.",
+"Reasons might be:" => "Alasan mungkin:",
+"the item was removed" => "item telah dihapus",
+"the link expired" => "tautan telah kadaluarsa",
+"sharing is disabled" => "berbagi dinonaktifkan",
+"For more info, please ask the person who sent this link." => "Untuk info lebih lanjut, silakan tanyakan orang yang mengirim tautan ini.",
"%s shared the folder %s with you" => "%s membagikan folder %s dengan Anda",
-"%s shared the file %s with you" => "%s membagikan file %s dengan Anda",
+"%s shared the file %s with you" => "%s membagikan berkas %s dengan Anda",
"Download" => "Unduh",
"Upload" => "Unggah",
-"Cancel upload" => "Batal pengunggahan",
-"No preview available for" => "Tidak ada pratinjau tersedia untuk"
+"Cancel upload" => "Batal unggah",
+"No preview available for" => "Tidak ada pratinjau yang tersedia untuk",
+"Direct link" => "Tautan langsung"
);
$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/apps/files_sharing/l10n/is.php b/apps/files_sharing/l10n/is.php
index 05241d3f9e6..8ae8e48eff6 100644
--- a/apps/files_sharing/l10n/is.php
+++ b/apps/files_sharing/l10n/is.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "Lykilorð",
-"Submit" => "Senda",
"%s shared the folder %s with you" => "%s deildi möppunni %s með þér",
"%s shared the file %s with you" => "%s deildi skránni %s með þér",
"Download" => "Niðurhal",
diff --git a/apps/files_sharing/l10n/it.php b/apps/files_sharing/l10n/it.php
index a611e0641c8..7967b50d346 100644
--- a/apps/files_sharing/l10n/it.php
+++ b/apps/files_sharing/l10n/it.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Questa condivione è protetta da password",
"The password is wrong. Try again." => "La password è errata. Prova ancora.",
"Password" => "Password",
-"Submit" => "Invia",
"Sorry, this link doesn’t seem to work anymore." => "Spiacenti, questo collegamento sembra non essere più attivo.",
"Reasons might be:" => "I motivi potrebbero essere:",
"the item was removed" => "l'elemento è stato rimosso",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Scarica",
"Upload" => "Carica",
"Cancel upload" => "Annulla il caricamento",
-"No preview available for" => "Nessuna anteprima disponibile per"
+"No preview available for" => "Nessuna anteprima disponibile per",
+"Direct link" => "Collegamento diretto"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/ja_JP.php b/apps/files_sharing/l10n/ja_JP.php
index 4f7d5b31c2f..fe25cb5b6eb 100644
--- a/apps/files_sharing/l10n/ja_JP.php
+++ b/apps/files_sharing/l10n/ja_JP.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "この共有はパスワードで保護されています",
"The password is wrong. Try again." => "パスワードが間違っています。再試行してください。",
"Password" => "パスワード",
-"Submit" => "送信",
"Sorry, this link doesn’t seem to work anymore." => "申し訳ございません。このリンクはもう利用できません。",
"Reasons might be:" => "理由は以下の通りと考えられます:",
"the item was removed" => "アイテムが削除されました",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "ダウンロード",
"Upload" => "アップロード",
"Cancel upload" => "アップロードをキャンセル",
-"No preview available for" => "プレビューはありません"
+"No preview available for" => "プレビューはありません",
+"Direct link" => "リンク"
);
$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/apps/files_sharing/l10n/ka_GE.php b/apps/files_sharing/l10n/ka_GE.php
index a5a80b3c5a1..89a6800b3e4 100644
--- a/apps/files_sharing/l10n/ka_GE.php
+++ b/apps/files_sharing/l10n/ka_GE.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "პაროლი",
-"Submit" => "გაგზავნა",
"%s shared the folder %s with you" => "%s–მა გაგიზიარათ ფოლდერი %s",
"%s shared the file %s with you" => "%s–მა გაგიზიარათ ფაილი %s",
"Download" => "ჩამოტვირთვა",
diff --git a/apps/files_sharing/l10n/ko.php b/apps/files_sharing/l10n/ko.php
index f7eab1ac550..03c4c1aea94 100644
--- a/apps/files_sharing/l10n/ko.php
+++ b/apps/files_sharing/l10n/ko.php
@@ -1,19 +1,20 @@
<?php
$TRANSLATIONS = array(
-"The password is wrong. Try again." => "비밀번호가 틀립니다. 다시 입력해주세요.",
+"This share is password-protected" => "이 공유는 암호로 보호되어 있습니다",
+"The password is wrong. Try again." => "암호가 잘못되었습니다. 다시 입력해 주십시오.",
"Password" => "암호",
-"Submit" => "제출",
-"Sorry, this link doesn’t seem to work anymore." => "죄송합니다만 이 링크는 더이상 작동되지 않습니다.",
+"Sorry, this link doesn’t seem to work anymore." => "죄송합니다. 이 링크는 더 이상 작동하지 않습니다.",
"Reasons might be:" => "이유는 다음과 같을 수 있습니다:",
-"the item was removed" => "이 항목은 삭제되었습니다",
-"the link expired" => "링크가 만료되었습니다",
-"sharing is disabled" => "공유가 비활성되었습니다",
-"For more info, please ask the person who sent this link." => "더 자세한 설명은 링크를 보내신 분에게 여쭤보십시오",
+"the item was removed" => "항목이 삭제됨",
+"the link expired" => "링크가 만료됨",
+"sharing is disabled" => "공유가 비활성화됨",
+"For more info, please ask the person who sent this link." => "자세한 정보는 링크를 보낸 사람에게 문의하십시오.",
"%s shared the folder %s with you" => "%s 님이 폴더 %s을(를) 공유하였습니다",
"%s shared the file %s with you" => "%s 님이 파일 %s을(를) 공유하였습니다",
"Download" => "다운로드",
"Upload" => "업로드",
"Cancel upload" => "업로드 취소",
-"No preview available for" => "다음 항목을 미리 볼 수 없음:"
+"No preview available for" => "다음 항목을 미리 볼 수 없음:",
+"Direct link" => "직접 링크"
);
$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/apps/files_sharing/l10n/ku_IQ.php b/apps/files_sharing/l10n/ku_IQ.php
index 55576a19c36..6b4b7e4ba9e 100644
--- a/apps/files_sharing/l10n/ku_IQ.php
+++ b/apps/files_sharing/l10n/ku_IQ.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "وشەی تێپەربو",
-"Submit" => "ناردن",
"%s shared the folder %s with you" => "%s دابه‌شی کردووه‌ بوخچه‌ی %s له‌گه‌ڵ تۆ",
"%s shared the file %s with you" => "%s دابه‌شی کردووه‌ په‌ڕگه‌یی %s له‌گه‌ڵ تۆ",
"Download" => "داگرتن",
diff --git a/apps/files_sharing/l10n/lb.php b/apps/files_sharing/l10n/lb.php
index d37a1d9d22a..eeb6a3e2dca 100644
--- a/apps/files_sharing/l10n/lb.php
+++ b/apps/files_sharing/l10n/lb.php
@@ -2,7 +2,6 @@
$TRANSLATIONS = array(
"The password is wrong. Try again." => "Den Passwuert ass incorrect. Probeier ed nach eng keier.",
"Password" => "Passwuert",
-"Submit" => "Fortschécken",
"%s shared the folder %s with you" => "%s huet den Dossier %s mad der gedeelt",
"%s shared the file %s with you" => "%s deelt den Fichier %s mad dir",
"Download" => "Download",
diff --git a/apps/files_sharing/l10n/lt_LT.php b/apps/files_sharing/l10n/lt_LT.php
index 90ae6a39a07..3786fd08b92 100644
--- a/apps/files_sharing/l10n/lt_LT.php
+++ b/apps/files_sharing/l10n/lt_LT.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Turinys apsaugotas slaptažodžiu",
"The password is wrong. Try again." => "Netinka slaptažodis: Bandykite dar kartą.",
"Password" => "Slaptažodis",
-"Submit" => "Išsaugoti",
"Sorry, this link doesn’t seem to work anymore." => "Atleiskite, panašu, kad nuoroda yra neveiksni.",
"Reasons might be:" => "Galimos priežastys:",
"the item was removed" => "elementas buvo pašalintas",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Atsisiųsti",
"Upload" => "Įkelti",
"Cancel upload" => "Atšaukti siuntimą",
-"No preview available for" => "Peržiūra nėra galima"
+"No preview available for" => "Peržiūra nėra galima",
+"Direct link" => "Tiesioginė nuoroda"
);
$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);";
diff --git a/apps/files_sharing/l10n/lv.php b/apps/files_sharing/l10n/lv.php
index 0eb04fb966f..a913ba11525 100644
--- a/apps/files_sharing/l10n/lv.php
+++ b/apps/files_sharing/l10n/lv.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "Parole",
-"Submit" => "Iesniegt",
"%s shared the folder %s with you" => "%s ar jums dalījās ar mapi %s",
"%s shared the file %s with you" => "%s ar jums dalījās ar datni %s",
"Download" => "Lejupielādēt",
diff --git a/apps/files_sharing/l10n/mk.php b/apps/files_sharing/l10n/mk.php
index c913b2beaf7..c132f7aa265 100644
--- a/apps/files_sharing/l10n/mk.php
+++ b/apps/files_sharing/l10n/mk.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "Лозинка",
-"Submit" => "Прати",
"%s shared the folder %s with you" => "%s ја сподели папката %s со Вас",
"%s shared the file %s with you" => "%s ја сподели датотеката %s со Вас",
"Download" => "Преземи",
diff --git a/apps/files_sharing/l10n/ms_MY.php b/apps/files_sharing/l10n/ms_MY.php
index 0a3d08bbc17..9725dd4d1bc 100644
--- a/apps/files_sharing/l10n/ms_MY.php
+++ b/apps/files_sharing/l10n/ms_MY.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "Kata laluan",
-"Submit" => "Hantar",
"Download" => "Muat turun",
"Upload" => "Muat naik",
"Cancel upload" => "Batal muat naik"
diff --git a/apps/files_sharing/l10n/my_MM.php b/apps/files_sharing/l10n/my_MM.php
index f44010004cd..ff92e898ed4 100644
--- a/apps/files_sharing/l10n/my_MM.php
+++ b/apps/files_sharing/l10n/my_MM.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "စကားဝှက်",
-"Submit" => "ထည့်သွင်းမည်",
"Download" => "ဒေါင်းလုတ်"
);
$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/apps/files_sharing/l10n/nb_NO.php b/apps/files_sharing/l10n/nb_NO.php
index dd8a8edf313..0452b5275c1 100644
--- a/apps/files_sharing/l10n/nb_NO.php
+++ b/apps/files_sharing/l10n/nb_NO.php
@@ -2,7 +2,6 @@
$TRANSLATIONS = array(
"The password is wrong. Try again." => "Passordet er feil. Prøv på nytt.",
"Password" => "Passord",
-"Submit" => "Send inn",
"%s shared the folder %s with you" => "%s delte mappen %s med deg",
"%s shared the file %s with you" => "%s delte filen %s med deg",
"Download" => "Last ned",
diff --git a/apps/files_sharing/l10n/nl.php b/apps/files_sharing/l10n/nl.php
index 9c46a1ab4b3..687c6e134f5 100644
--- a/apps/files_sharing/l10n/nl.php
+++ b/apps/files_sharing/l10n/nl.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Deze share is met een wachtwoord beveiligd",
"The password is wrong. Try again." => "Wachtwoord ongeldig. Probeer het nogmaals.",
"Password" => "Wachtwoord",
-"Submit" => "Verzenden",
"Sorry, this link doesn’t seem to work anymore." => "Sorry, deze link lijkt niet meer in gebruik te zijn.",
"Reasons might be:" => "Redenen kunnen zijn:",
"the item was removed" => "bestand was verwijderd",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Downloaden",
"Upload" => "Uploaden",
"Cancel upload" => "Upload afbreken",
-"No preview available for" => "Geen voorbeeldweergave beschikbaar voor"
+"No preview available for" => "Geen voorbeeldweergave beschikbaar voor",
+"Direct link" => "Directe link"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/nn_NO.php b/apps/files_sharing/l10n/nn_NO.php
index 94272943e40..1f1e8001e70 100644
--- a/apps/files_sharing/l10n/nn_NO.php
+++ b/apps/files_sharing/l10n/nn_NO.php
@@ -2,7 +2,6 @@
$TRANSLATIONS = array(
"The password is wrong. Try again." => "Passordet er gale. Prøv igjen.",
"Password" => "Passord",
-"Submit" => "Send",
"Sorry, this link doesn’t seem to work anymore." => "Orsak, denne lenkja fungerer visst ikkje lenger.",
"Reasons might be:" => "Moglege grunnar:",
"the item was removed" => "fila/mappa er fjerna",
diff --git a/apps/files_sharing/l10n/oc.php b/apps/files_sharing/l10n/oc.php
index 493ddb4dfd3..299d98e58b4 100644
--- a/apps/files_sharing/l10n/oc.php
+++ b/apps/files_sharing/l10n/oc.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "Senhal",
-"Submit" => "Sosmetre",
"Download" => "Avalcarga",
"Upload" => "Amontcarga",
"Cancel upload" => " Anulla l'amontcargar"
diff --git a/apps/files_sharing/l10n/pl.php b/apps/files_sharing/l10n/pl.php
index 43c7e2e3144..4c7498ee1b7 100644
--- a/apps/files_sharing/l10n/pl.php
+++ b/apps/files_sharing/l10n/pl.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Udział ten jest chroniony hasłem",
"The password is wrong. Try again." => "To hasło jest niewłaściwe. Spróbuj ponownie.",
"Password" => "Hasło",
-"Submit" => "Wyślij",
"Sorry, this link doesn’t seem to work anymore." => "Przepraszamy ale wygląda na to, że ten link już nie działa.",
"Reasons might be:" => "Możliwe powody:",
"the item was removed" => "element został usunięty",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Pobierz",
"Upload" => "Wyślij",
"Cancel upload" => "Anuluj wysyłanie",
-"No preview available for" => "Podgląd nie jest dostępny dla"
+"No preview available for" => "Podgląd nie jest dostępny dla",
+"Direct link" => "Bezpośredni link"
);
$PLURAL_FORMS = "nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
diff --git a/apps/files_sharing/l10n/pt_BR.php b/apps/files_sharing/l10n/pt_BR.php
index 9fc1cacf7cb..ee03749795b 100644
--- a/apps/files_sharing/l10n/pt_BR.php
+++ b/apps/files_sharing/l10n/pt_BR.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Este compartilhamento esta protegido por senha",
"The password is wrong. Try again." => "Senha incorreta. Tente novamente.",
"Password" => "Senha",
-"Submit" => "Submeter",
"Sorry, this link doesn’t seem to work anymore." => "Desculpe, este link parece não mais funcionar.",
"Reasons might be:" => "As razões podem ser:",
"the item was removed" => "o item foi removido",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Baixar",
"Upload" => "Upload",
"Cancel upload" => "Cancelar upload",
-"No preview available for" => "Nenhuma visualização disponível para"
+"No preview available for" => "Nenhuma visualização disponível para",
+"Direct link" => "Link direto"
);
$PLURAL_FORMS = "nplurals=2; plural=(n > 1);";
diff --git a/apps/files_sharing/l10n/pt_PT.php b/apps/files_sharing/l10n/pt_PT.php
index 73dc2a3e1f3..cd94211b5d3 100644
--- a/apps/files_sharing/l10n/pt_PT.php
+++ b/apps/files_sharing/l10n/pt_PT.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Esta partilha está protegida por palavra-chave",
"The password is wrong. Try again." => "Password errada, por favor tente de novo",
-"Password" => "Password",
-"Submit" => "Submeter",
+"Password" => "Palavra-passe",
"Sorry, this link doesn’t seem to work anymore." => "Desculpe, mas este link parece não estar a funcionar.",
"Reasons might be:" => "As razões poderão ser:",
"the item was removed" => "O item foi removido",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Transferir",
"Upload" => "Carregar",
"Cancel upload" => "Cancelar envio",
-"No preview available for" => "Não há pré-visualização para"
+"No preview available for" => "Não há pré-visualização para",
+"Direct link" => "Link direto"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/ro.php b/apps/files_sharing/l10n/ro.php
index d17152ff1b1..54e20ed6bb4 100644
--- a/apps/files_sharing/l10n/ro.php
+++ b/apps/files_sharing/l10n/ro.php
@@ -2,7 +2,6 @@
$TRANSLATIONS = array(
"The password is wrong. Try again." => "Parola este incorectă. Încercaţi din nou.",
"Password" => "Parolă",
-"Submit" => "Trimite",
"%s shared the folder %s with you" => "%s a partajat directorul %s cu tine",
"%s shared the file %s with you" => "%s a partajat fișierul %s cu tine",
"Download" => "Descarcă",
diff --git a/apps/files_sharing/l10n/ru.php b/apps/files_sharing/l10n/ru.php
index f42f1d9aeb6..8c48096f666 100644
--- a/apps/files_sharing/l10n/ru.php
+++ b/apps/files_sharing/l10n/ru.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Эта шара защищена паролем",
"The password is wrong. Try again." => "Неверный пароль. Попробуйте еще раз.",
"Password" => "Пароль",
-"Submit" => "Отправить",
"Sorry, this link doesn’t seem to work anymore." => "К сожалению, эта ссылка, похоже не будет работать больше.",
"Reasons might be:" => "Причиной может быть:",
"the item was removed" => "объект был удалён",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Скачать",
"Upload" => "Загрузка",
"Cancel upload" => "Отмена загрузки",
-"No preview available for" => "Предпросмотр недоступен для"
+"No preview available for" => "Предпросмотр недоступен для",
+"Direct link" => "Прямая ссылка"
);
$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
diff --git a/apps/files_sharing/l10n/si_LK.php b/apps/files_sharing/l10n/si_LK.php
index 6135f092139..e8401385647 100644
--- a/apps/files_sharing/l10n/si_LK.php
+++ b/apps/files_sharing/l10n/si_LK.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "මුර පදය",
-"Submit" => "යොමු කරන්න",
"%s shared the folder %s with you" => "%s ඔබව %s ෆෝල්ඩරයට හවුල් කරගත්තේය",
"%s shared the file %s with you" => "%s ඔබ සමඟ %s ගොනුව බෙදාහදාගත්තේය",
"Download" => "බාන්න",
diff --git a/apps/files_sharing/l10n/sk.php b/apps/files_sharing/l10n/sk.php
new file mode 100644
index 00000000000..72c9039571e
--- /dev/null
+++ b/apps/files_sharing/l10n/sk.php
@@ -0,0 +1,5 @@
+<?php
+$TRANSLATIONS = array(
+"Download" => "Stiahnuť"
+);
+$PLURAL_FORMS = "nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;";
diff --git a/apps/files_sharing/l10n/sk_SK.php b/apps/files_sharing/l10n/sk_SK.php
index 31ecb28b602..4ea8cbdd77d 100644
--- a/apps/files_sharing/l10n/sk_SK.php
+++ b/apps/files_sharing/l10n/sk_SK.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Toto zdieľanie je chránené heslom",
"The password is wrong. Try again." => "Heslo je chybné. Skúste to znova.",
"Password" => "Heslo",
-"Submit" => "Odoslať",
"Sorry, this link doesn’t seem to work anymore." => "To je nepríjemné, ale tento odkaz už nie je funkčný.",
"Reasons might be:" => "Možné dôvody:",
"the item was removed" => "položka bola presunutá",
@@ -12,8 +12,9 @@ $TRANSLATIONS = array(
"%s shared the folder %s with you" => "%s zdieľa s vami priečinok %s",
"%s shared the file %s with you" => "%s zdieľa s vami súbor %s",
"Download" => "Sťahovanie",
-"Upload" => "Odoslať",
-"Cancel upload" => "Zrušiť odosielanie",
-"No preview available for" => "Žiaden náhľad k dispozícii pre"
+"Upload" => "Nahrať",
+"Cancel upload" => "Zrušiť nahrávanie",
+"No preview available for" => "Žiaden náhľad k dispozícii pre",
+"Direct link" => "Priama linka"
);
$PLURAL_FORMS = "nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;";
diff --git a/apps/files_sharing/l10n/sl.php b/apps/files_sharing/l10n/sl.php
index cbd4f5fea22..d5ef46e180e 100644
--- a/apps/files_sharing/l10n/sl.php
+++ b/apps/files_sharing/l10n/sl.php
@@ -1,12 +1,20 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "To mesto je zaščiteno z geslom.",
+"The password is wrong. Try again." => "Geslo je napačno. Poskusite znova.",
"Password" => "Geslo",
-"Submit" => "Pošlji",
+"Sorry, this link doesn’t seem to work anymore." => "Povezava očitno ni več v uporabi.",
+"Reasons might be:" => "Vzrok je lahko:",
+"the item was removed" => "predmet je odstranjen,",
+"the link expired" => "povezava je pretekla,",
+"sharing is disabled" => "souporaba je onemogočena.",
+"For more info, please ask the person who sent this link." => "Za več podrobnosti stopite v stik s pošiljateljem te povezave.",
"%s shared the folder %s with you" => "Oseba %s je določila mapo %s za souporabo",
"%s shared the file %s with you" => "Oseba %s je določila datoteko %s za souporabo",
"Download" => "Prejmi",
"Upload" => "Pošlji",
"Cancel upload" => "Prekliči pošiljanje",
-"No preview available for" => "Predogled ni na voljo za"
+"No preview available for" => "Predogled ni na voljo za",
+"Direct link" => "Neposredna povezava"
);
$PLURAL_FORMS = "nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);";
diff --git a/apps/files_sharing/l10n/sq.php b/apps/files_sharing/l10n/sq.php
index d2077663e8d..473049f75ed 100644
--- a/apps/files_sharing/l10n/sq.php
+++ b/apps/files_sharing/l10n/sq.php
@@ -2,7 +2,6 @@
$TRANSLATIONS = array(
"The password is wrong. Try again." => "Kodi është i gabuar. Provojeni përsëri.",
"Password" => "Kodi",
-"Submit" => "Parashtro",
"Sorry, this link doesn’t seem to work anymore." => "Ju kërkojmë ndjesë, kjo lidhje duket sikur nuk punon më.",
"Reasons might be:" => "Arsyet mund të jenë:",
"the item was removed" => "elementi është eliminuar",
diff --git a/apps/files_sharing/l10n/sr.php b/apps/files_sharing/l10n/sr.php
index 3b97d15419a..e484ad25eb6 100644
--- a/apps/files_sharing/l10n/sr.php
+++ b/apps/files_sharing/l10n/sr.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "Лозинка",
-"Submit" => "Пошаљи",
"Download" => "Преузми",
"Upload" => "Отпреми",
"Cancel upload" => "Прекини отпремање"
diff --git a/apps/files_sharing/l10n/sr@latin.php b/apps/files_sharing/l10n/sr@latin.php
index 1a6be625761..08463e15103 100644
--- a/apps/files_sharing/l10n/sr@latin.php
+++ b/apps/files_sharing/l10n/sr@latin.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "Lozinka",
-"Submit" => "Pošalji",
"Download" => "Preuzmi",
"Upload" => "Pošalji"
);
diff --git a/apps/files_sharing/l10n/sv.php b/apps/files_sharing/l10n/sv.php
index b8a5f8629a6..055ef552d6b 100644
--- a/apps/files_sharing/l10n/sv.php
+++ b/apps/files_sharing/l10n/sv.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Den här delningen är lösenordsskyddad",
"The password is wrong. Try again." => "Lösenordet är fel. Försök igen.",
"Password" => "Lösenord",
-"Submit" => "Skicka",
"Sorry, this link doesn’t seem to work anymore." => "Tyvärr, denna länk verkar inte fungera längre.",
"Reasons might be:" => "Orsaker kan vara:",
"the item was removed" => "objektet togs bort",
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Ladda ner",
"Upload" => "Ladda upp",
"Cancel upload" => "Avbryt uppladdning",
-"No preview available for" => "Ingen förhandsgranskning tillgänglig för"
+"No preview available for" => "Ingen förhandsgranskning tillgänglig för",
+"Direct link" => "Direkt länk"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/ta_LK.php b/apps/files_sharing/l10n/ta_LK.php
index b4eb0fb7fb8..90a2fb417f4 100644
--- a/apps/files_sharing/l10n/ta_LK.php
+++ b/apps/files_sharing/l10n/ta_LK.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "கடவுச்சொல்",
-"Submit" => "சமர்ப்பிக்குக",
"%s shared the folder %s with you" => "%s கோப்புறையானது %s உடன் பகிரப்பட்டது",
"%s shared the file %s with you" => "%s கோப்பானது %s உடன் பகிரப்பட்டது",
"Download" => "பதிவிறக்குக",
diff --git a/apps/files_sharing/l10n/th_TH.php b/apps/files_sharing/l10n/th_TH.php
index 060bd8bed94..e192e0a97cd 100644
--- a/apps/files_sharing/l10n/th_TH.php
+++ b/apps/files_sharing/l10n/th_TH.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "รหัสผ่าน",
-"Submit" => "ส่ง",
"%s shared the folder %s with you" => "%s ได้แชร์โฟลเดอร์ %s ให้กับคุณ",
"%s shared the file %s with you" => "%s ได้แชร์ไฟล์ %s ให้กับคุณ",
"Download" => "ดาวน์โหลด",
diff --git a/apps/files_sharing/l10n/tr.php b/apps/files_sharing/l10n/tr.php
index a5bcff82cf3..22fe8ed0209 100644
--- a/apps/files_sharing/l10n/tr.php
+++ b/apps/files_sharing/l10n/tr.php
@@ -1,12 +1,20 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Bu paylaşım parola korumalı",
+"The password is wrong. Try again." => "Parola hatalı. Yeniden deneyin.",
"Password" => "Parola",
-"Submit" => "Gönder",
-"%s shared the folder %s with you" => "%s sizinle paylaşılan %s klasör",
-"%s shared the file %s with you" => "%s sizinle paylaşılan %s klasör",
+"Sorry, this link doesn’t seem to work anymore." => "Üzgünüz, bu bağlantı artık çalışıyor gibi görünmüyor",
+"Reasons might be:" => "Sebepleri şunlar olabilir:",
+"the item was removed" => "öge kaldırılmış",
+"the link expired" => "bağlantı süresi dolmuş",
+"sharing is disabled" => "paylaşım devre dışı",
+"For more info, please ask the person who sent this link." => "Daha fazla bilgi için bu bağlantıyı aldığınız kişi ile iletişime geçin.",
+"%s shared the folder %s with you" => "%s, %s klasörünü sizinle paylaştı",
+"%s shared the file %s with you" => "%s, %s dosyasını sizinle paylaştı",
"Download" => "İndir",
"Upload" => "Yükle",
"Cancel upload" => "Yüklemeyi iptal et",
-"No preview available for" => "Kullanılabilir önizleme yok"
+"No preview available for" => "Kullanılabilir önizleme yok",
+"Direct link" => "Doğrudan bağlantı"
);
$PLURAL_FORMS = "nplurals=2; plural=(n > 1);";
diff --git a/apps/files_sharing/l10n/ug.php b/apps/files_sharing/l10n/ug.php
index 43ee9f77bcd..6ffa02f7344 100644
--- a/apps/files_sharing/l10n/ug.php
+++ b/apps/files_sharing/l10n/ug.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "ئىم",
-"Submit" => "تاپشۇر",
"Download" => "چۈشۈر",
"Upload" => "يۈكلە",
"Cancel upload" => "يۈكلەشتىن ۋاز كەچ"
diff --git a/apps/files_sharing/l10n/uk.php b/apps/files_sharing/l10n/uk.php
index b6a7784c690..842b4b8d961 100644
--- a/apps/files_sharing/l10n/uk.php
+++ b/apps/files_sharing/l10n/uk.php
@@ -1,12 +1,20 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Цей ресурс обміну захищений паролем",
+"The password is wrong. Try again." => "Невірний пароль. Спробуйте ще раз.",
"Password" => "Пароль",
-"Submit" => "Передати",
+"Sorry, this link doesn’t seem to work anymore." => "На жаль, посилання більше не працює.",
+"Reasons might be:" => "Можливі причини:",
+"the item was removed" => "цей пункт був вилучений",
+"the link expired" => "посилання застаріло",
+"sharing is disabled" => "обмін заборонений",
+"For more info, please ask the person who sent this link." => "Для отримання додаткової інформації, будь ласка, зверніться до особи, яка надіслала це посилання.",
"%s shared the folder %s with you" => "%s опублікував каталог %s для Вас",
"%s shared the file %s with you" => "%s опублікував файл %s для Вас",
"Download" => "Завантажити",
"Upload" => "Вивантажити",
"Cancel upload" => "Перервати завантаження",
-"No preview available for" => "Попередній перегляд недоступний для"
+"No preview available for" => "Попередній перегляд недоступний для",
+"Direct link" => "Пряме посилання"
);
$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
diff --git a/apps/files_sharing/l10n/vi.php b/apps/files_sharing/l10n/vi.php
index 00e8e094c36..4566d3744de 100644
--- a/apps/files_sharing/l10n/vi.php
+++ b/apps/files_sharing/l10n/vi.php
@@ -1,7 +1,6 @@
<?php
$TRANSLATIONS = array(
"Password" => "Mật khẩu",
-"Submit" => "Xác nhận",
"%s shared the folder %s with you" => "%s đã chia sẻ thư mục %s với bạn",
"%s shared the file %s with you" => "%s đã chia sẻ tập tin %s với bạn",
"Download" => "Tải về",
diff --git a/apps/files_sharing/l10n/zh_CN.php b/apps/files_sharing/l10n/zh_CN.php
index f541d6c155a..956c161b48e 100644
--- a/apps/files_sharing/l10n/zh_CN.php
+++ b/apps/files_sharing/l10n/zh_CN.php
@@ -2,7 +2,6 @@
$TRANSLATIONS = array(
"The password is wrong. Try again." => "用户名或密码错误!请重试",
"Password" => "密码",
-"Submit" => "提交",
"Sorry, this link doesn’t seem to work anymore." => "抱歉,此链接已失效",
"Reasons might be:" => "可能原因是:",
"the item was removed" => "此项已移除",
diff --git a/apps/files_sharing/l10n/zh_TW.php b/apps/files_sharing/l10n/zh_TW.php
index 5cc33fd3830..3854b7ae582 100644
--- a/apps/files_sharing/l10n/zh_TW.php
+++ b/apps/files_sharing/l10n/zh_TW.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "這個分享有密碼保護",
"The password is wrong. Try again." => "請檢查您的密碼並再試一次",
"Password" => "密碼",
-"Submit" => "送出",
"Sorry, this link doesn’t seem to work anymore." => "抱歉,此連結已經失效",
"Reasons might be:" => "可能的原因:",
"the item was removed" => "項目已經移除",
diff --git a/apps/files_sharing/lib/api.php b/apps/files_sharing/lib/api.php
index e6624624898..84e90c71681 100644
--- a/apps/files_sharing/lib/api.php
+++ b/apps/files_sharing/lib/api.php
@@ -31,15 +31,22 @@ class Api {
* @return \OC_OCS_Result share information
*/
public static function getAllShares($params) {
-
// if a file is specified, get the share for this file
if (isset($_GET['path'])) {
$params['itemSource'] = self::getFileId($_GET['path']);
$params['path'] = $_GET['path'];
- if (isset($_GET['subfiles']) && $_GET['subfiles'] === 'true') {
+ $params['itemType'] = self::getItemType($_GET['path']);
+
+ if ( isset($_GET['reshares']) && $_GET['reshares'] !== 'false' ) {
+ $params['reshares'] = true;
+ } else {
+ $params['reshares'] = false;
+ }
+
+ if (isset($_GET['subfiles']) && $_GET['subfiles'] !== 'false') {
return self::getSharesFromFolder($params);
}
- return self::getShare($params);
+ return self::collectShares($params);
}
$share = \OCP\Share::getItemShared('file', null);
@@ -60,28 +67,49 @@ class Api {
*/
public static function getShare($params) {
- // either the $params already contains a itemSource if we come from
- // getAllShare() or we need to translate the shareID to a itemSource
- if(isset($params['itemSource'])) {
- $itemSource = $params['itemSource'];
- $getSpecificShare = true;
- } else {
- $s = self::getShareFromId($params['id']);
- $itemSource = $s['item_source'];
- $getSpecificShare = false;
- }
+ $s = self::getShareFromId($params['id']);
+ $params['itemSource'] = $s['item_source'];
+ $params['itemType'] = $s['item_type'];
+ $params['specificShare'] = true;
+
+ return self::collectShares($params);
+ }
+
+ /**
+ * @brief collect all share information, either of a specific share or all
+ * shares for a given path
+ * @param array $params
+ * @return \OC_OCS_Result
+ */
+ private static function collectShares($params) {
+
+ $itemSource = $params['itemSource'];
+ $itemType = $params['itemType'];
+ $getSpecificShare = isset($params['specificShare']) ? $params['specificShare'] : false;
if ($itemSource !== null) {
- $shares = \OCP\Share::getItemShared('file', $itemSource);
+ $shares = \OCP\Share::getItemShared($itemType, $itemSource);
+ $receivedFrom = \OCP\Share::getItemSharedWithBySource($itemType, $itemSource);
// if a specific share was specified only return this one
- if ($getSpecificShare === false) {
+ if ($getSpecificShare === true) {
foreach ($shares as $share) {
- if ($share['id'] === (int)$params['id']) {
+ if ($share['id'] === (int) $params['id']) {
$shares = array('element' => $share);
break;
}
}
}
+
+ // include also reshares in the lists. This means that the result
+ // will contain every user with access to the file.
+ if (isset($params['reshares']) && $params['reshares'] === true) {
+ $shares = self::addReshares($shares, $itemSource);
+ }
+
+ if ($receivedFrom) {
+ $shares['received_from'] = $receivedFrom['uid_owner'];
+ $shares['received_from_displayname'] = \OCP\User::getDisplayName($receivedFrom['uid_owner']);
+ }
} else {
$shares = null;
}
@@ -94,6 +122,37 @@ class Api {
}
/**
+ * @brief add reshares to a array of shares
+ * @param array $shares array of shares
+ * @param int $itemSource item source ID
+ * @return array new shares array which includes reshares
+ */
+ private static function addReshares($shares, $itemSource) {
+
+ // if there are no shares than there are also no reshares
+ $firstShare = reset($shares);
+ if ($firstShare) {
+ $path = $firstShare['path'];
+ } else {
+ return $shares;
+ }
+
+ $select = '`*PREFIX*share`.`id`, `item_type`, `*PREFIX*share`.`parent`, `share_type`, `share_with`, `file_source`, `path` , `permissions`, `stime`, `expiration`, `token`, `storage`, `mail_send`, `mail_send`';
+ $getReshares = \OC_DB::prepare('SELECT ' . $select . ' FROM `*PREFIX*share` INNER JOIN `*PREFIX*filecache` ON `file_source` = `*PREFIX*filecache`.`fileid` WHERE `*PREFIX*share`.`file_source` = ? AND `*PREFIX*share`.`item_type` IN (\'file\', \'folder\') AND `uid_owner` != ?');
+ $reshares = $getReshares->execute(array($itemSource, \OCP\User::getUser()))->fetchAll();
+
+ foreach ($reshares as $key => $reshare) {
+ if (isset($reshare['share_with']) && $reshare['share_with'] !== '') {
+ $reshares[$key]['share_with_displayname'] = \OCP\User::getDisplayName($reshare['share_with']);
+ }
+ // add correct path to the result
+ $reshares[$key]['path'] = $path;
+ }
+
+ return array_merge($shares, $reshares);
+ }
+
+ /**
* @brief get share from all files in a given folder (non-recursive)
* @param array $params contains 'path' to the folder
* @return \OC_OCS_Result
@@ -110,7 +169,14 @@ class Api {
$result = array();
foreach ($content as $file) {
- $share = \OCP\Share::getItemShared('file', $file['fileid']);
+ // workaround because folders are named 'dir' in this context
+ $itemType = $file['type'] === 'file' ? 'file' : 'folder';
+ $share = \OCP\Share::getItemShared($itemType, $file['fileid']);
+ $receivedFrom = \OCP\Share::getItemSharedWithBySource($itemType, $file['fileid']);
+ if ($receivedFrom) {
+ $share['received_from'] = $receivedFrom['uid_owner'];
+ $share['received_from_displayname'] = \OCP\User::getDisplayName($receivedFrom['uid_owner']);
+ }
if ($share) {
$share['filename'] = $file['name'];
$result[] = $share;
@@ -132,7 +198,6 @@ class Api {
if($path === null) {
return new \OC_OCS_Result(null, 400, "please specify a file or folder path");
}
-
$itemSource = self::getFileId($path);
$itemType = self::getItemType($path);
@@ -184,7 +249,7 @@ class Api {
if ($token) {
$data = array();
$data['id'] = 'unknown';
- $shares = \OCP\Share::getItemShared('file', $itemSource);
+ $shares = \OCP\Share::getItemShared($itemType, $itemSource);
if(is_string($token)) { //public link share
foreach ($shares as $share) {
if ($share['token'] === $token) {
@@ -414,7 +479,6 @@ class Api {
$view = new \OC\Files\View('/'.\OCP\User::getUser().'/files');
$fileId = null;
-
$fileInfo = $view->getFileInfo($path);
if ($fileInfo) {
$fileId = $fileInfo['fileid'];
diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php
index 123268e240a..90440d08f4e 100644
--- a/apps/files_sharing/lib/cache.php
+++ b/apps/files_sharing/lib/cache.php
@@ -99,9 +99,13 @@ class Shared_Cache extends Cache {
$data['fileid'] = (int)$data['fileid'];
$data['size'] = (int)$data['size'];
$data['mtime'] = (int)$data['mtime'];
+ $data['storage_mtime'] = (int)$data['storage_mtime'];
$data['encrypted'] = (bool)$data['encrypted'];
$data['mimetype'] = $this->getMimetype($data['mimetype']);
$data['mimepart'] = $this->getMimetype($data['mimepart']);
+ if ($data['storage_mtime'] === 0) {
+ $data['storage_mtime'] = $data['mtime'];
+ }
return $data;
}
return false;
@@ -228,69 +232,73 @@ class Shared_Cache extends Cache {
*/
public function search($pattern) {
- // normalize pattern
- $pattern = $this->normalize($pattern);
+ $where = '`name` LIKE ? AND ';
- $ids = $this->getAll();
+ // normalize pattern
+ $value = $this->normalize($pattern);
- $files = array();
-
- // divide into 1k chunks
- $chunks = array_chunk($ids, 1000);
-
- foreach ($chunks as $chunk) {
- $placeholders = join(',', array_fill(0, count($chunk), '?'));
+ return $this->searchWithWhere($where, $value);
- $sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
- `encrypted`, `unencrypted_size`, `etag`
- FROM `*PREFIX*filecache` WHERE `name` LIKE ? AND `fileid` IN (' . $placeholders . ')';
-
- $result = \OC_DB::executeAudited($sql, array_merge(array($pattern), $chunk));
-
- while ($row = $result->fetchRow()) {
- if (substr($row['path'], 0, 6)==='files/') {
- $row['path'] = substr($row['path'],6); // remove 'files/' from path as it's relative to '/Shared'
- }
- $row['mimetype'] = $this->getMimetype($row['mimetype']);
- $row['mimepart'] = $this->getMimetype($row['mimepart']);
- $files[] = $row;
- }
- }
- return $files;
}
/**
* search for files by mimetype
*
- * @param string $part1
- * @param string $part2
+ * @param string $mimetype
* @return array
*/
public function searchByMime($mimetype) {
+
if (strpos($mimetype, '/')) {
- $where = '`mimetype` = ?';
+ $where = '`mimetype` = ? AND ';
} else {
- $where = '`mimepart` = ?';
+ $where = '`mimepart` = ? AND ';
}
- $mimetype = $this->getMimetypeId($mimetype);
+
+ $value = $this->getMimetypeId($mimetype);
+
+ return $this->searchWithWhere($where, $value);
+
+ }
+
+ /**
+ * The maximum number of placeholders that can be used in an SQL query.
+ * Value MUST be <= 1000 for oracle:
+ * see ORA-01795 maximum number of expressions in a list is 1000
+ * 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
+ *
+ * @param string $sqlwhere
+ * @param string $wherevalue
+ * @return array
+ */
+ private function searchWithWhere($sqlwhere, $wherevalue, $chunksize = self::MAX_SQL_CHUNK_SIZE) {
+
$ids = $this->getAll();
$files = array();
- // divide into 1k chunks
- $chunks = array_chunk($ids, 1000);
+ // divide into chunks
+ $chunks = array_chunk($ids, $chunksize);
foreach ($chunks as $chunk) {
- $placeholders = join(',', array_fill(0, count($ids), '?'));
+ $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 ' . $where . ' AND `fileid` IN (' . $placeholders . ')';
+ FROM `*PREFIX*filecache` WHERE ' . $sqlwhere . ' `fileid` IN (' . $placeholders . ')';
- $result = \OC_DB::executeAudited($sql, array_merge(array($mimetype), $chunk));
+ $stmt = \OC_DB::prepare($sql);
+
+ $result = $stmt->execute(array_merge(array($wherevalue), $chunk));
while ($row = $result->fetchRow()) {
- if (substr($row['path'], 0, 6)==='files/') {
- $row['path'] = substr($row['path'],6); // remove 'files/' from path as it's relative to '/Shared'
+ if (substr($row['path'], 0, 6) === 'files/') {
+ $row['path'] = substr($row['path'], 6); // remove 'files/' from path as it's relative to '/Shared'
}
$row['mimetype'] = $this->getMimetype($row['mimetype']);
$row['mimepart'] = $this->getMimetype($row['mimepart']);
diff --git a/apps/files_sharing/lib/maintainer.php b/apps/files_sharing/lib/maintainer.php
new file mode 100644
index 00000000000..bbb3268410e
--- /dev/null
+++ b/apps/files_sharing/lib/maintainer.php
@@ -0,0 +1,44 @@
+<?php
+/**
+ * ownCloud
+ *
+ * @author Morris Jobke
+ * @copyright 2013 Morris Jobke morris.jobke@gmail.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace OCA\Files\Share;
+
+/**
+ * Maintains stuff around the sharing functionality
+ *
+ * for example: on disable of "allow links" it removes all link shares
+ */
+
+class Maintainer {
+
+ /**
+ * Keeps track of the "allow links" config setting
+ * and removes all link shares if the config option is set to "no"
+ *
+ * @param array with app, key, value as named values
+ */
+ static public function configChangeHook($params) {
+ if($params['app'] === 'core' && $params['key'] === 'shareapi_allow_links' && $params['value'] === 'no') {
+ \OCP\Share::removeAllLinkShares();
+ }
+ }
+
+}
diff --git a/apps/files_sharing/lib/permissions.php b/apps/files_sharing/lib/permissions.php
index e2978e12bfb..1dc53428a7f 100644
--- a/apps/files_sharing/lib/permissions.php
+++ b/apps/files_sharing/lib/permissions.php
@@ -42,6 +42,19 @@ class Shared_Permissions extends Permissions {
}
}
+ private function getFile($fileId, $user) {
+ if ($fileId == -1) {
+ return \OCP\PERMISSION_READ;
+ }
+ $source = \OCP\Share::getItemSharedWithBySource('file', $fileId, \OC_Share_Backend_File::FORMAT_SHARED_STORAGE,
+ null, false);
+ if ($source) {
+ return $source['permissions'];
+ } else {
+ return -1;
+ }
+ }
+
/**
* set the permissions of a file
*
@@ -82,7 +95,7 @@ class Shared_Permissions extends Permissions {
if ($parentId === -1) {
return \OCP\Share::getItemsSharedWith('file', \OC_Share_Backend_File::FORMAT_PERMISSIONS);
}
- $permissions = $this->get($parentId, $user);
+ $permissions = $this->getFile($parentId, $user);
$query = \OC_DB::prepare('SELECT `fileid` FROM `*PREFIX*filecache` WHERE `parent` = ?');
$result = $query->execute(array($parentId));
$filePermissions = array();
diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php
index 07e7a4ca0c5..c956c55a1df 100644
--- a/apps/files_sharing/lib/share/file.php
+++ b/apps/files_sharing/lib/share/file.php
@@ -172,7 +172,7 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
$source['fileOwner'] = $fileOwner;
return $source;
}
- \OCP\Util::writeLog('files_sharing', 'File source not found for: '.$target, \OCP\Util::ERROR);
+ \OCP\Util::writeLog('files_sharing', 'File source not found for: '.$target, \OCP\Util::DEBUG);
return false;
}
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index 257da89c84e..afe5dffdebd 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -34,16 +34,16 @@ class Shared extends \OC\Files\Storage\Common {
$this->sharedFolder = $arguments['sharedFolder'];
}
- public function getId(){
+ public function getId() {
return 'shared::' . $this->sharedFolder;
}
/**
- * @brief Get the source file path, permissions, and owner for a shared file
- * @param string Shared target file path
- * @return Returns array with the keys path, permissions, and owner or false if not found
- */
- private function getFile($target) {
+ * @brief Get the source file path, permissions, and owner for a shared file
+ * @param string Shared target file path
+ * @return Returns array with the keys path, permissions, and owner or false if not found
+ */
+ public function getFile($target) {
if (!isset($this->files[$target])) {
// Check for partial files
if (pathinfo($target, PATHINFO_EXTENSION) === 'part') {
@@ -62,18 +62,18 @@ class Shared extends \OC\Files\Storage\Common {
}
/**
- * @brief Get the source file path for a shared file
- * @param string Shared target file path
- * @return string source file path or false if not found
- */
- private function getSourcePath($target) {
+ * @brief Get the source file path for a shared file
+ * @param string Shared target file path
+ * @return string source file path or false if not found
+ */
+ public function getSourcePath($target) {
$source = $this->getFile($target);
if ($source) {
if (!isset($source['fullPath'])) {
\OC\Files\Filesystem::initMountPoints($source['fileOwner']);
$mount = \OC\Files\Filesystem::getMountByNumericId($source['storage']);
if (is_array($mount)) {
- $this->files[$target]['fullPath'] = $mount[key($mount)]->getMountPoint().$source['path'];
+ $this->files[$target]['fullPath'] = $mount[key($mount)]->getMountPoint() . $source['path'];
} else {
$this->files[$target]['fullPath'] = false;
}
@@ -84,10 +84,10 @@ class Shared extends \OC\Files\Storage\Common {
}
/**
- * @brief Get the permissions granted for a shared file
- * @param string Shared target file path
- * @return int CRUDS permissions granted or false if not found
- */
+ * @brief Get the permissions granted for a shared file
+ * @param string Shared target file path
+ * @return int CRUDS permissions granted or false if not found
+ */
public function getPermissions($target) {
$source = $this->getFile($target);
if ($source) {
@@ -222,7 +222,7 @@ class Shared extends \OC\Files\Storage\Common {
if ($path == '' || $path == '/') {
$mtime = 0;
$dh = $this->opendir($path);
- if(is_resource($dh)) {
+ if (is_resource($dh)) {
while (($filename = readdir($dh)) !== false) {
$tempmtime = $this->filemtime($filename);
if ($tempmtime > $mtime) {
@@ -244,7 +244,7 @@ class Shared extends \OC\Files\Storage\Common {
$source = $this->getSourcePath($path);
if ($source) {
$info = array(
- 'target' => $this->sharedFolder.$path,
+ 'target' => $this->sharedFolder . $path,
'source' => $source,
);
\OCP\Util::emitHook('\OC\Files\Storage\Shared', 'file_get_contents', $info);
@@ -257,13 +257,14 @@ class Shared extends \OC\Files\Storage\Common {
if ($source = $this->getSourcePath($path)) {
// Check if permission is granted
if (($this->file_exists($path) && !$this->isUpdatable($path))
- || ($this->is_dir($path) && !$this->isCreatable($path))) {
+ || ($this->is_dir($path) && !$this->isCreatable($path))
+ ) {
return false;
}
$info = array(
- 'target' => $this->sharedFolder.$path,
- 'source' => $source,
- );
+ 'target' => $this->sharedFolder . $path,
+ 'source' => $source,
+ );
\OCP\Util::emitHook('\OC\Files\Storage\Shared', 'file_put_contents', $info);
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
$result = $storage->file_put_contents($internalPath, $data);
@@ -278,58 +279,26 @@ class Shared extends \OC\Files\Storage\Common {
if ($this->isDeletable($path)) {
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
return $storage->unlink($internalPath);
- } else if (dirname($path) == '/' || dirname($path) == '.') {
- // Unshare the file from the user if in the root of the Shared folder
- if ($this->is_dir($path)) {
- $itemType = 'folder';
- } else {
- $itemType = 'file';
- }
- return \OCP\Share::unshareFromSelf($itemType, $path);
}
}
return false;
}
public function rename($path1, $path2) {
- // Check for partial files
- if (pathinfo($path1, PATHINFO_EXTENSION) === 'part') {
- if ($oldSource = $this->getSourcePath($path1)) {
+ // Renaming/moving is only allowed within shared folders
+ $pos1 = strpos($path1, '/', 1);
+ $pos2 = strpos($path2, '/', 1);
+ if ($pos1 !== false && $pos2 !== false && ($oldSource = $this->getSourcePath($path1))) {
+ $newSource = $this->getSourcePath(dirname($path2)) . '/' . basename($path2);
+ // Within the same folder, we only need UPDATE permissions
+ if (dirname($path1) == dirname($path2) and $this->isUpdatable($path1)) {
list($storage, $oldInternalPath) = \OC\Files\Filesystem::resolvePath($oldSource);
- $newInternalPath = substr($oldInternalPath, 0, -5);
+ list(, $newInternalPath) = \OC\Files\Filesystem::resolvePath($newSource);
return $storage->rename($oldInternalPath, $newInternalPath);
- }
- } else {
- // Renaming/moving is only allowed within shared folders
- $pos1 = strpos($path1, '/', 1);
- $pos2 = strpos($path2, '/', 1);
- if ($pos1 !== false && $pos2 !== false && ($oldSource = $this->getSourcePath($path1))) {
- $newSource = $this->getSourcePath(dirname($path2)).'/'.basename($path2);
- if (dirname($path1) == dirname($path2)) {
- // Rename the file if UPDATE permission is granted
- if ($this->isUpdatable($path1)) {
- list($storage, $oldInternalPath) = \OC\Files\Filesystem::resolvePath($oldSource);
- list( , $newInternalPath) = \OC\Files\Filesystem::resolvePath($newSource);
- return $storage->rename($oldInternalPath, $newInternalPath);
- }
- } else {
- // Move the file if DELETE and CREATE permissions are granted
- if ($this->isDeletable($path1) && $this->isCreatable(dirname($path2))) {
- // Get the root shared folder
- $folder1 = substr($path1, 0, $pos1);
- $folder2 = substr($path2, 0, $pos2);
- // Copy and unlink the file if it exists in a different shared folder
- if ($folder1 != $folder2) {
- if ($this->copy($path1, $path2)) {
- return $this->unlink($path1);
- }
- } else {
- list($storage, $oldInternalPath) = \OC\Files\Filesystem::resolvePath($oldSource);
- list( , $newInternalPath) = \OC\Files\Filesystem::resolvePath($newSource);
- return $storage->rename($oldInternalPath, $newInternalPath);
- }
- }
- }
+ // otherwise DELETE and CREATE permissions required
+ } elseif ($this->isDeletable($path1) && $this->isCreatable(dirname($path2))) {
+ $rootView = new \OC\Files\View('');
+ return $rootView->rename($oldSource, $newSource);
}
}
return false;
@@ -338,10 +307,10 @@ class Shared extends \OC\Files\Storage\Common {
public function copy($path1, $path2) {
// Copy the file if CREATE permission is granted
if ($this->isCreatable(dirname($path2))) {
- $source = $this->fopen($path1, 'r');
- $target = $this->fopen($path2, 'w');
- list ($count, $result) = \OC_Helper::streamCopy($source, $target);
- return $result;
+ $oldSource = $this->getSourcePath($path1);
+ $newSource = $this->getSourcePath(dirname($path2)) . '/' . basename($path2);
+ $rootView = new \OC\Files\View('');
+ return $rootView->copy($oldSource, $newSource);
}
return false;
}
@@ -363,16 +332,16 @@ class Shared extends \OC\Files\Storage\Common {
case 'xb':
case 'a':
case 'ab':
- $exists = $this->file_exists($path);
- if ($exists && !$this->isUpdatable($path)) {
- return false;
- }
- if (!$exists && !$this->isCreatable(dirname($path))) {
- return false;
- }
+ $exists = $this->file_exists($path);
+ if ($exists && !$this->isUpdatable($path)) {
+ return false;
+ }
+ if (!$exists && !$this->isCreatable(dirname($path))) {
+ return false;
+ }
}
$info = array(
- 'target' => $this->sharedFolder.$path,
+ 'target' => $this->sharedFolder . $path,
'source' => $source,
'mode' => $mode,
);
@@ -412,6 +381,7 @@ class Shared extends \OC\Files\Storage\Common {
}
return false;
}
+
public function touch($path, $mtime = null) {
if ($source = $this->getSourcePath($path)) {
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
@@ -422,11 +392,12 @@ class Shared extends \OC\Files\Storage\Common {
public static function setup($options) {
if (!\OCP\User::isLoggedIn() || \OCP\User::getUser() != $options['user']
- || \OCP\Share::getItemsSharedWith('file')) {
+ || \OCP\Share::getItemsSharedWith('file')
+ ) {
$user_dir = $options['user_dir'];
\OC\Files\Filesystem::mount('\OC\Files\Storage\Shared',
array('sharedFolder' => '/Shared'),
- $user_dir.'/Shared/');
+ $user_dir . '/Shared/');
}
}
diff --git a/apps/files_sharing/lib/updater.php b/apps/files_sharing/lib/updater.php
index a43ab2e2a0a..23ebc9fb811 100644
--- a/apps/files_sharing/lib/updater.php
+++ b/apps/files_sharing/lib/updater.php
@@ -23,6 +23,9 @@ namespace OC\Files\Cache;
class Shared_Updater {
+ // shares which can be removed from oc_share after the delete operation was successful
+ static private $toRemove = array();
+
/**
* Correct the parent folders' ETags for all users shared the file at $target
*
@@ -32,29 +35,43 @@ class Shared_Updater {
$uid = \OCP\User::getUser();
$uidOwner = \OC\Files\Filesystem::getOwner($target);
$info = \OC\Files\Filesystem::getFileInfo($target);
+ $checkedUser = array($uidOwner);
// Correct Shared folders of other users shared with
$users = \OCP\Share::getUsersItemShared('file', $info['fileid'], $uidOwner, true);
if (!empty($users)) {
while (!empty($users)) {
$reshareUsers = array();
foreach ($users as $user) {
- if ( $user !== $uidOwner ) {
+ if ( !in_array($user, $checkedUser) ) {
$etag = \OC\Files\Filesystem::getETag('');
\OCP\Config::setUserValue($user, 'files_sharing', 'etag', $etag);
// Look for reshares
$reshareUsers = array_merge($reshareUsers, \OCP\Share::getUsersItemShared('file', $info['fileid'], $user, true));
+ $checkedUser[] = $user;
}
}
$users = $reshareUsers;
}
- // Correct folders of shared file owner
- $target = substr($target, 8);
- if ($uidOwner !== $uid && $source = \OC_Share_Backend_File::getSource($target)) {
- \OC\Files\Filesystem::initMountPoints($uidOwner);
- $source = '/'.$uidOwner.'/'.$source['path'];
- \OC\Files\Cache\Updater::correctFolder($source, $info['mtime']);
+ }
+ }
+
+ /**
+ * @brief remove all shares for a given file if the file was deleted
+ *
+ * @param string $path
+ */
+ private static function removeShare($path) {
+ $fileSource = self::$toRemove[$path];
+
+ if (!\OC\Files\Filesystem::file_exists($path)) {
+ $query = \OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `file_source`=?');
+ try {
+ \OC_DB::executeAudited($query, array($fileSource));
+ } catch (\Exception $e) {
+ \OCP\Util::writeLog('files_sharing', "can't remove share: " . $e->getMessage(), \OCP\Util::WARN);
}
}
+ unset(self::$toRemove[$path]);
}
/**
@@ -77,6 +94,17 @@ class Shared_Updater {
*/
static public function deleteHook($params) {
self::correctFolders($params['path']);
+ $fileInfo = \OC\Files\Filesystem::getFileInfo($params['path']);
+ // mark file as deleted so that we can clean up the share table if
+ // the file was deleted successfully
+ self::$toRemove[$params['path']] = $fileInfo['fileid'];
+ }
+
+ /**
+ * @param array $params
+ */
+ static public function postDeleteHook($params) {
+ self::removeShare($params['path']);
}
/**
@@ -84,8 +112,12 @@ class Shared_Updater {
*/
static public function shareHook($params) {
if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') {
- $uidOwner = \OCP\User::getUser();
- $users = \OCP\Share::getUsersItemShared($params['itemType'], $params['fileSource'], $uidOwner, true);
+ if (isset($params['uidOwner'])) {
+ $uidOwner = $params['uidOwner'];
+ } else {
+ $uidOwner = \OCP\User::getUser();
+ }
+ $users = \OCP\Share::getUsersItemShared($params['itemType'], $params['fileSource'], $uidOwner, true, false);
if (!empty($users)) {
while (!empty($users)) {
$reshareUsers = array();
diff --git a/apps/files_sharing/lib/watcher.php b/apps/files_sharing/lib/watcher.php
index 6fdfc1db36d..c40cf6911b8 100644
--- a/apps/files_sharing/lib/watcher.php
+++ b/apps/files_sharing/lib/watcher.php
@@ -32,9 +32,32 @@ class Shared_Watcher extends Watcher {
* @param string $path
*/
public function checkUpdate($path) {
- if ($path != '') {
- parent::checkUpdate($path);
+ if ($path != '' && parent::checkUpdate($path)) {
+ // since checkUpdate() has already updated the size of the subdirs,
+ // only apply the update to the owner's parent dirs
+
+ // find last parent before reaching the shared storage root,
+ // which is the actual shared dir from the owner
+ $sepPos = strpos($path, '/');
+ if ($sepPos > 0) {
+ $baseDir = substr($path, 0, $sepPos);
+ } else {
+ $baseDir = $path;
+ }
+
+ // find the path relative to the data dir
+ $file = $this->storage->getFile($baseDir);
+ $view = new \OC\Files\View('/' . $file['fileOwner']);
+
+ // find the owner's storage and path
+ list($storage, $internalPath) = $view->resolvePath($file['path']);
+
+ // update the parent dirs' sizes in the owner's cache
+ $storage->getCache()->correctFolderSize(dirname($internalPath));
+
+ return true;
}
+ return false;
}
/**
diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index eff38dcc0fd..ef4345da20e 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -28,7 +28,7 @@ function determineIcon($file, $sharingRoot, $sharingToken) {
$relativePath = substr($file['path'], 6);
$relativePath = substr($relativePath, strlen($sharingRoot));
if($file['isPreviewAvailable']) {
- return OCP\publicPreview_icon($relativePath, $sharingToken);
+ return OCP\publicPreview_icon($relativePath, $sharingToken) . '&c=' . $file['etag'];
}
return OCP\mimetype_icon($file['mimetype']);
}
@@ -77,6 +77,7 @@ if (isset($path)) {
$hasher = new PasswordHash(8, $forcePortable);
if (!($hasher->CheckPassword($password.OC_Config::getValue('passwordsalt', ''),
$linkItem['share_with']))) {
+ OCP\Util::addStyle('files_sharing', 'authenticate');
$tmpl = new OCP\Template('files_sharing', 'authenticate', 'guest');
$tmpl->assign('URL', $url);
$tmpl->assign('wrongpw', true);
@@ -101,6 +102,7 @@ if (isset($path)) {
|| \OC::$session->get('public_link_authenticated') !== $linkItem['id']
) {
// Prompt for password
+ OCP\Util::addStyle('files_sharing', 'authenticate');
$tmpl = new OCP\Template('files_sharing', 'authenticate', 'guest');
$tmpl->assign('URL', $url);
$tmpl->printPage();
@@ -109,6 +111,7 @@ if (isset($path)) {
}
}
$basePath = $path;
+ $rootName = basename($path);
if (isset($_GET['path']) && \OC\Files\Filesystem::isReadable($basePath . $_GET['path'])) {
$getPath = \OC\Files\Filesystem::normalizePath($_GET['path']);
$path .= $getPath;
@@ -147,11 +150,9 @@ if (isset($path)) {
$tmpl->assign('mimetype', \OC\Files\Filesystem::getMimeType($path));
$tmpl->assign('fileTarget', basename($linkItem['file_target']));
$tmpl->assign('dirToken', $linkItem['token']);
+ $tmpl->assign('sharingToken', $token);
$tmpl->assign('disableSharing', true);
$allowPublicUploadEnabled = (bool) ($linkItem['permissions'] & OCP\PERMISSION_CREATE);
- if (\OCP\App::isEnabled('files_encryption')) {
- $allowPublicUploadEnabled = false;
- }
if (OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes') === 'no') {
$allowPublicUploadEnabled = false;
}
@@ -216,8 +217,11 @@ if (isset($path)) {
$list->assign('sharingroot', $basePath);
$breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
$breadcrumbNav->assign('breadcrumb', $breadcrumb);
+ $breadcrumbNav->assign('rootBreadCrumb', $rootName);
$breadcrumbNav->assign('baseURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&path=');
$maxUploadFilesize=OCP\Util::maxUploadFilesize($path);
+ $fileHeader = (!isset($files) or count($files) > 0);
+ $emptyContent = ($allowPublicUploadEnabled and !$fileHeader);
$folder = new OCP\Template('files', 'index', '');
$folder->assign('fileList', $list->fetchPage());
$folder->assign('breadcrumb', $breadcrumbNav->fetchPage());
@@ -231,9 +235,15 @@ if (isset($path)) {
$folder->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
$folder->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
$folder->assign('usedSpacePercent', 0);
+ $folder->assign('fileHeader', $fileHeader);
+ $folder->assign('disableSharing', true);
+ $folder->assign('trash', false);
+ $folder->assign('emptyContent', $emptyContent);
+ $folder->assign('ajaxLoad', false);
$tmpl->assign('folder', $folder->fetchPage());
+ $maxInputFileSize = OCP\Config::getSystemValue('maxZipInputSize', OCP\Util::computerFileSize('800 MB'));
$allowZip = OCP\Config::getSystemValue('allowZipDownload', true)
- && $totalSize <= OCP\Config::getSystemValue('maxZipInputSize', OCP\Util::computerFileSize('800 MB'));
+ && ( $maxInputFileSize === 0 || $totalSize <= $maxInputFileSize);
$tmpl->assign('allowZipDownload', intval($allowZip));
$tmpl->assign('downloadURL',
OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=' . urlencode($getPath));
diff --git a/apps/files_sharing/templates/authenticate.php b/apps/files_sharing/templates/authenticate.php
index 2c89b5df3f6..6b98e6c9f34 100644
--- a/apps/files_sharing/templates/authenticate.php
+++ b/apps/files_sharing/templates/authenticate.php
@@ -1,12 +1,15 @@
<form action="<?php p($_['URL']); ?>" method="post">
<fieldset>
+ <?php if (!isset($_['wrongpw'])): ?>
+ <div class="warning-info"><?php p($l->t('This share is password-protected')); ?></div>
+ <?php endif; ?>
<?php if (isset($_['wrongpw'])): ?>
- <div class="warning"><?php p($l->t('The password is wrong. Try again.')); ?></div>
+ <div class="warning"><?php p($l->t('The password is wrong. Try again.')); ?></div>
<?php endif; ?>
<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="<?php p($l->t('Submit')); ?>" />
+ <input type="submit" value="" class="svg" />
</p>
</fieldset>
</form>
diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php
index c164b3ea2b7..1d527dca8eb 100644
--- a/apps/files_sharing/templates/public.php
+++ b/apps/files_sharing/templates/public.php
@@ -2,8 +2,11 @@
<div id="notification" style="display: none;"></div>
</div>
+<input type="hidden" id="filesApp" name="filesApp" value="1">
+<input type="hidden" id="isPublic" name="isPublic" value="1">
<input type="hidden" name="dir" value="<?php p($_['dir']) ?>" id="dir">
<input type="hidden" name="downloadURL" value="<?php p($_['downloadURL']) ?>" id="downloadURL">
+<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">
@@ -13,10 +16,10 @@
<div class="header-right">
<?php if (isset($_['folder'])): ?>
<span id="details"><?php p($l->t('%s shared the folder %s with you',
- array($_['displayName'], $_['fileTarget']))) ?></span>
+ array($_['displayName'], $_['filename']))) ?></span>
<?php else: ?>
<span id="details"><?php p($l->t('%s shared the file %s with you',
- array($_['displayName'], $_['fileTarget']))) ?></span>
+ array($_['displayName'], $_['filename']))) ?></span>
<?php endif; ?>
@@ -86,13 +89,14 @@
<?php else: ?>
<ul id="noPreview">
<li class="error">
- <?php p($l->t('No preview available for').' '.$_['fileTarget']); ?><br />
+ <?php p($l->t('No preview available for').' '.$_['filename']); ?><br />
<a href="<?php p($_['downloadURL']); ?>" id="download"><img class="svg" alt="Download"
src="<?php print_unescaped(OCP\image_path("core", "actions/download.svg")); ?>"
/><?php p($l->t('Download'))?></a>
</li>
</ul>
<?php endif; ?>
+ <div class="directLink"><label for="directLink"><?php p($l->t('Direct link')) ?></label><input id="directLink" type="text" readonly value="<?php p($_['downloadURL']); ?>"></input></div>
<?php endif; ?>
</div>
<footer>
diff --git a/apps/files_sharing/tests/api.php b/apps/files_sharing/tests/api.php
index c55c186f089..1278e0c4d1f 100644
--- a/apps/files_sharing/tests/api.php
+++ b/apps/files_sharing/tests/api.php
@@ -20,83 +20,33 @@
*
*/
-require_once __DIR__ . '/../../../lib/base.php';
+require_once __DIR__ . '/base.php';
use OCA\Files\Share;
/**
* Class Test_Files_Sharing_Api
*/
-class Test_Files_Sharing_Api extends \PHPUnit_Framework_TestCase {
-
- const TEST_FILES_SHARING_API_USER1 = "test-share-user1";
- const TEST_FILES_SHARING_API_USER2 = "test-share-user2";
-
- public $stateFilesEncryption;
- public $filename;
- public $data;
- /**
- * @var OC_FilesystemView
- */
- public $view;
- public $folder;
-
- public static function setUpBeforeClass() {
- // reset backend
- \OC_User::clearBackends();
- \OC_User::useBackend('database');
-
- // clear share hooks
- \OC_Hook::clear('OCP\\Share');
- \OC::registerShareHooks();
- \OCP\Util::connectHook('OC_Filesystem', 'setup', '\OC\Files\Storage\Shared', 'setup');
-
- // create users
- self::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER1, true);
- self::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, true);
-
- }
+class Test_Files_Sharing_Api extends Test_Files_Sharing_Base {
function setUp() {
- $this->data = 'foobar';
- $this->view = new \OC_FilesystemView('/' . \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER1 . '/files');
+ parent::setUp();
$this->folder = '/folder_share_api_test';
$this->filename = 'share-api-test.txt';
- // remember files_encryption state
- $this->stateFilesEncryption = \OC_App::isEnabled('files_encryption');
-
- //we don't want to tests with app files_encryption enabled
- \OC_App::disable('files_encryption');
-
-
- $this->assertTrue(!\OC_App::isEnabled('files_encryption'));
-
// save file with content
$this->view->file_put_contents($this->filename, $this->data);
$this->view->mkdir($this->folder);
$this->view->file_put_contents($this->folder.'/'.$this->filename, $this->data);
-
}
function tearDown() {
$this->view->unlink($this->filename);
$this->view->deleteAll($this->folder);
- // reset app files_encryption
- if ($this->stateFilesEncryption) {
- \OC_App::enable('files_encryption');
- } else {
- \OC_App::disable('files_encryption');
- }
- }
-
- public static function tearDownAfterClass() {
- // cleanup users
- \OC_User::deleteUser(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER1);
- \OC_User::deleteUser(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2);
+ parent::tearDown();
}
/**
@@ -104,9 +54,6 @@ class Test_Files_Sharing_Api extends \PHPUnit_Framework_TestCase {
*/
function testCreateShare() {
- //login as user1
- \Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER1);
-
// share to user
// simulate a post request
@@ -196,9 +143,9 @@ class Test_Files_Sharing_Api extends \PHPUnit_Framework_TestCase {
\OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_LINK,
null, 1);
- $params = array('itemSource' => $fileInfo['fileid']);
+ $_GET['path'] = $this->filename;
- $result = Share\Api::getShare($params);
+ $result = Share\Api::getAllShares(array());
$this->assertTrue($result->succeeded());
@@ -216,6 +163,60 @@ class Test_Files_Sharing_Api extends \PHPUnit_Framework_TestCase {
* @medium
* @depends testCreateShare
*/
+ function testGetShareFromSourceWithReshares() {
+
+ $fileInfo = $this->view->getFileInfo($this->filename);
+
+ // share the file as user1 to user2
+ \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, 31);
+
+ // login as user2 and reshare the file to user3
+ \Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2);
+
+ \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER3, 31);
+
+ // login as user1 again
+ \Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER1);
+
+ $_GET['path'] = $this->filename;
+
+ $result = Share\Api::getAllShares(array());
+
+ $this->assertTrue($result->succeeded());
+
+ // test should return one share
+ $this->assertTrue(count($result->getData()) === 1);
+
+ // now also ask for the reshares
+ $_GET['reshares'] = 'true';
+
+ $result = Share\Api::getAllShares(array());
+
+ $this->assertTrue($result->succeeded());
+
+ // now we should get two shares, the initial share and the reshare
+ $this->assertTrue(count($result->getData()) === 2);
+
+ // unshare files again
+
+ \Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2);
+
+ \OCP\Share::unshare('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER3);
+
+ \Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER1);
+
+ \OCP\Share::unshare('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2);
+
+ }
+
+ /**
+ * @medium
+ * @depends testCreateShare
+ */
function testGetShareFromId() {
$fileInfo = $this->view->getFileInfo($this->filename);
@@ -295,7 +296,8 @@ class Test_Files_Sharing_Api extends \PHPUnit_Framework_TestCase {
$result = Share\Api::getShare($params);
$this->assertEquals(404, $result->getStatusCode());
- $this->assertEquals('share doesn\'t exist', $result->getMeta()['message']);
+ $meta = $result->getMeta();
+ $this->assertEquals('share doesn\'t exist', $meta['message']);
}
@@ -351,7 +353,8 @@ class Test_Files_Sharing_Api extends \PHPUnit_Framework_TestCase {
$result = Share\Api::updateShare($params);
- $this->assertTrue($result->succeeded(), $result->getMeta()['message']);
+ $meta = $result->getMeta();
+ $this->assertTrue($result->succeeded(), $meta['message']);
$items = \OCP\Share::getItemShared('file', $userShare['file_source']);
@@ -488,50 +491,4 @@ class Test_Files_Sharing_Api extends \PHPUnit_Framework_TestCase {
$this->assertTrue(empty($itemsAfterDelete));
}
-
- /**
- * @param $user
- * @param bool $create
- * @param bool $password
- */
- private static function loginHelper($user, $create = false, $password = false) {
- if ($create) {
- \OC_User::createUser($user, $user);
- }
-
- if ($password === false) {
- $password = $user;
- }
-
- \OC_Util::tearDownFS();
- \OC_User::setUserId('');
- \OC\Files\Filesystem::tearDown();
- \OC_Util::setupFS($user);
- \OC_User::setUserId($user);
-
- $params['uid'] = $user;
- $params['password'] = $password;
- }
-
- /**
- * @brief get some information from a given share
- * @param int $shareID
- * @return array with: item_source, share_type, share_with, item_type, permissions
- */
- private function getShareFromId($shareID) {
- $sql = 'SELECT `item_source`, `share_type`, `share_with`, `item_type`, `permissions` FROM `*PREFIX*share` WHERE `id` = ?';
- $args = array($shareID);
- $query = \OCP\DB::prepare($sql);
- $result = $query->execute($args);
-
- $share = Null;
-
- if ($result && $result->numRows() > 0) {
- $share = $result->fetchRow();
- }
-
- return $share;
-
- }
-
}
diff --git a/apps/files_sharing/tests/base.php b/apps/files_sharing/tests/base.php
new file mode 100644
index 00000000000..3e283271f5d
--- /dev/null
+++ b/apps/files_sharing/tests/base.php
@@ -0,0 +1,143 @@
+<?php
+/**
+ * ownCloud
+ *
+ * @author Bjoern Schiessle
+ * @copyright 2013 Bjoern Schiessle <schiessle@owncloud.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+require_once __DIR__ . '/../../../lib/base.php';
+
+use OCA\Files\Share;
+
+/**
+ * Class Test_Files_Sharing_Base
+ *
+ * Base class for sharing tests.
+ */
+abstract class Test_Files_Sharing_Base extends \PHPUnit_Framework_TestCase {
+
+ const TEST_FILES_SHARING_API_USER1 = "test-share-user1";
+ const TEST_FILES_SHARING_API_USER2 = "test-share-user2";
+ const TEST_FILES_SHARING_API_USER3 = "test-share-user3";
+
+ public $stateFilesEncryption;
+ public $filename;
+ public $data;
+ /**
+ * @var OC_FilesystemView
+ */
+ public $view;
+ public $folder;
+
+ public static function setUpBeforeClass() {
+ // reset backend
+ \OC_User::clearBackends();
+ \OC_User::useBackend('database');
+
+ // clear share hooks
+ \OC_Hook::clear('OCP\\Share');
+ \OC::registerShareHooks();
+ \OCP\Util::connectHook('OC_Filesystem', 'setup', '\OC\Files\Storage\Shared', 'setup');
+
+ // create users
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER1, true);
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER2, true);
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER3, true);
+
+ }
+
+ function setUp() {
+
+ //login as user1
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
+
+ $this->data = 'foobar';
+ $this->view = new \OC_FilesystemView('/' . self::TEST_FILES_SHARING_API_USER1 . '/files');
+ // remember files_encryption state
+ $this->stateFilesEncryption = \OC_App::isEnabled('files_encryption');
+
+ //we don't want to tests with app files_encryption enabled
+ \OC_App::disable('files_encryption');
+
+
+ $this->assertTrue(!\OC_App::isEnabled('files_encryption'));
+ }
+
+ function tearDown() {
+ // reset app files_encryption
+ if ($this->stateFilesEncryption) {
+ \OC_App::enable('files_encryption');
+ } else {
+ \OC_App::disable('files_encryption');
+ }
+ }
+
+ public static function tearDownAfterClass() {
+
+ // cleanup users
+ \OC_User::deleteUser(self::TEST_FILES_SHARING_API_USER1);
+ \OC_User::deleteUser(self::TEST_FILES_SHARING_API_USER2);
+ \OC_User::deleteUser(self::TEST_FILES_SHARING_API_USER3);
+ }
+
+ /**
+ * @param $user
+ * @param bool $create
+ * @param bool $password
+ */
+ protected static function loginHelper($user, $create = false, $password = false) {
+ if ($create) {
+ \OC_User::createUser($user, $user);
+ }
+
+ if ($password === false) {
+ $password = $user;
+ }
+
+ \OC_Util::tearDownFS();
+ \OC_User::setUserId('');
+ \OC\Files\Filesystem::tearDown();
+ \OC_Util::setupFS($user);
+ \OC_User::setUserId($user);
+
+ $params['uid'] = $user;
+ $params['password'] = $password;
+ }
+
+ /**
+ * @brief get some information from a given share
+ * @param int $shareID
+ * @return array with: item_source, share_type, share_with, item_type, permissions
+ */
+ protected function getShareFromId($shareID) {
+ $sql = 'SELECT `item_source`, `share_type`, `share_with`, `item_type`, `permissions` FROM `*PREFIX*share` WHERE `id` = ?';
+ $args = array($shareID);
+ $query = \OCP\DB::prepare($sql);
+ $result = $query->execute($args);
+
+ $share = Null;
+
+ if ($result) {
+ $share = $result->fetchRow();
+ }
+
+ return $share;
+
+ }
+
+}
diff --git a/apps/files_sharing/tests/permissions.php b/apps/files_sharing/tests/permissions.php
new file mode 100644
index 00000000000..e301d384a49
--- /dev/null
+++ b/apps/files_sharing/tests/permissions.php
@@ -0,0 +1,110 @@
+<?php
+/**
+ * ownCloud
+ *
+ * @author Vincent Petry
+ * @copyright 2013 Vincent Petry <pvince81@owncloud.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+require_once __DIR__ . '/base.php';
+
+class Test_Files_Sharing_Permissions extends Test_Files_Sharing_Base {
+
+ function setUp() {
+ parent::setUp();
+
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
+
+ // prepare user1's dir structure
+ $textData = "dummy file data\n";
+ $this->view->mkdir('container');
+ $this->view->mkdir('container/shareddir');
+ $this->view->mkdir('container/shareddir/subdir');
+ $this->view->mkdir('container/shareddirrestricted');
+ $this->view->mkdir('container/shareddirrestricted/subdir');
+ $this->view->file_put_contents('container/shareddir/textfile.txt', $textData);
+ $this->view->file_put_contents('container/shareddirrestricted/textfile1.txt', $textData);
+
+ list($this->ownerStorage, $internalPath) = $this->view->resolvePath('');
+ $this->ownerCache = $this->ownerStorage->getCache();
+ $this->ownerStorage->getScanner()->scan('');
+
+ // share "shareddir" with user2
+ $fileinfo = $this->view->getFileInfo('container/shareddir');
+ \OCP\Share::shareItem('folder', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ self::TEST_FILES_SHARING_API_USER2, 31);
+ $fileinfo2 = $this->view->getFileInfo('container/shareddirrestricted');
+ \OCP\Share::shareItem('folder', $fileinfo2['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ self::TEST_FILES_SHARING_API_USER2, 7);
+
+ // login as user2
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
+
+ // retrieve the shared storage
+ $this->secondView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2);
+ list($this->sharedStorage, $internalPath) = $this->secondView->resolvePath('files/Shared/shareddir');
+ $this->sharedCache = $this->sharedStorage->getCache();
+ }
+
+ function tearDown() {
+ $this->sharedCache->clear();
+
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
+
+ $fileinfo = $this->view->getFileInfo('container/shareddir');
+ \OCP\Share::unshare('folder', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ self::TEST_FILES_SHARING_API_USER2);
+ $fileinfo2 = $this->view->getFileInfo('container/shareddirrestricted');
+ \OCP\Share::unshare('folder', $fileinfo2['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ self::TEST_FILES_SHARING_API_USER2);
+
+ $this->view->deleteAll('container');
+
+ $this->ownerCache->clear();
+
+ parent::tearDown();
+ }
+
+ /**
+ * Test that the permissions of shared directory are returned correctly
+ */
+ function testGetPermissions() {
+ $sharedDirPerms = $this->sharedStorage->getPermissions('shareddir');
+ $this->assertEquals(31, $sharedDirPerms);
+ $sharedDirPerms = $this->sharedStorage->getPermissions('shareddir/textfile.txt');
+ $this->assertEquals(31, $sharedDirPerms);
+ $sharedDirRestrictedPerms = $this->sharedStorage->getPermissions('shareddirrestricted');
+ $this->assertEquals(7, $sharedDirRestrictedPerms);
+ $sharedDirRestrictedPerms = $this->sharedStorage->getPermissions('shareddirrestricted/textfile.txt');
+ $this->assertEquals(7, $sharedDirRestrictedPerms);
+ }
+
+ /**
+ * Test that the permissions of shared directory are returned correctly
+ */
+ function testGetDirectoryPermissions() {
+ $contents = $this->secondView->getDirectoryContent('files/Shared/shareddir');
+ $this->assertEquals('subdir', $contents[0]['name']);
+ $this->assertEquals(31, $contents[0]['permissions']);
+ $this->assertEquals('textfile.txt', $contents[1]['name']);
+ $this->assertEquals(31, $contents[1]['permissions']);
+ $contents = $this->secondView->getDirectoryContent('files/Shared/shareddirrestricted');
+ $this->assertEquals('subdir', $contents[0]['name']);
+ $this->assertEquals(7, $contents[0]['permissions']);
+ $this->assertEquals('textfile1.txt', $contents[1]['name']);
+ $this->assertEquals(7, $contents[1]['permissions']);
+ }
+}
diff --git a/apps/files_sharing/tests/watcher.php b/apps/files_sharing/tests/watcher.php
new file mode 100644
index 00000000000..1a9a54cbcf8
--- /dev/null
+++ b/apps/files_sharing/tests/watcher.php
@@ -0,0 +1,161 @@
+<?php
+/**
+ * ownCloud
+ *
+ * @author Vincent Petry
+ * @copyright 2013 Vincent Petry <pvince81@owncloud.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+require_once __DIR__ . '/base.php';
+
+class Test_Files_Sharing_Watcher extends Test_Files_Sharing_Base {
+
+ function setUp() {
+ parent::setUp();
+
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
+
+ // prepare user1's dir structure
+ $textData = "dummy file data\n";
+ $this->view->mkdir('container');
+ $this->view->mkdir('container/shareddir');
+ $this->view->mkdir('container/shareddir/subdir');
+
+ list($this->ownerStorage, $internalPath) = $this->view->resolvePath('');
+ $this->ownerCache = $this->ownerStorage->getCache();
+ $this->ownerStorage->getScanner()->scan('');
+
+ // share "shareddir" with user2
+ $fileinfo = $this->view->getFileInfo('container/shareddir');
+ \OCP\Share::shareItem('folder', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ self::TEST_FILES_SHARING_API_USER2, 31);
+
+ // login as user2
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
+
+ // retrieve the shared storage
+ $secondView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2);
+ list($this->sharedStorage, $internalPath) = $secondView->resolvePath('files/Shared/shareddir');
+ $this->sharedCache = $this->sharedStorage->getCache();
+ }
+
+ function tearDown() {
+ $this->sharedCache->clear();
+
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
+
+ $fileinfo = $this->view->getFileInfo('container/shareddir');
+ \OCP\Share::unshare('folder', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ self::TEST_FILES_SHARING_API_USER2);
+
+ $this->view->deleteAll('container');
+
+ $this->ownerCache->clear();
+
+ parent::tearDown();
+ }
+
+ /**
+ * Tests that writing a file using the shared storage will propagate the file
+ * size to the owner's parent folders.
+ */
+ function testFolderSizePropagationToOwnerStorage() {
+ $initialSizes = self::getOwnerDirSizes('files/container/shareddir');
+
+ $textData = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ $dataLen = strlen($textData);
+ $this->sharedCache->put('shareddir/bar.txt', array('storage_mtime' => 10));
+ $this->sharedStorage->file_put_contents('shareddir/bar.txt', $textData);
+ $this->sharedCache->put('shareddir', array('storage_mtime' => 10));
+
+ // run the propagation code
+ $result = $this->sharedStorage->getWatcher()->checkUpdate('shareddir');
+
+ $this->assertTrue($result);
+
+ // the owner's parent dirs must have increase size
+ $newSizes = self::getOwnerDirSizes('files/container/shareddir');
+ $this->assertEquals($initialSizes[''] + $dataLen, $newSizes['']);
+ $this->assertEquals($initialSizes['files'] + $dataLen, $newSizes['files']);
+ $this->assertEquals($initialSizes['files/container'] + $dataLen, $newSizes['files/container']);
+ $this->assertEquals($initialSizes['files/container/shareddir'] + $dataLen, $newSizes['files/container/shareddir']);
+
+ // no more updates
+ $result = $this->sharedStorage->getWatcher()->checkUpdate('shareddir');
+
+ $this->assertFalse($result);
+ }
+
+ /**
+ * Tests that writing a file using the shared storage will propagate the file
+ * size to the owner's parent folders.
+ */
+ function testSubFolderSizePropagationToOwnerStorage() {
+ $initialSizes = self::getOwnerDirSizes('files/container/shareddir/subdir');
+
+ $textData = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ $dataLen = strlen($textData);
+ $this->sharedCache->put('shareddir/subdir/bar.txt', array('storage_mtime' => 10));
+ $this->sharedStorage->file_put_contents('shareddir/subdir/bar.txt', $textData);
+ $this->sharedCache->put('shareddir/subdir', array('storage_mtime' => 10));
+
+ // run the propagation code
+ $result = $this->sharedStorage->getWatcher()->checkUpdate('shareddir/subdir');
+
+ $this->assertTrue($result);
+
+ // the owner's parent dirs must have increase size
+ $newSizes = self::getOwnerDirSizes('files/container/shareddir/subdir');
+ $this->assertEquals($initialSizes[''] + $dataLen, $newSizes['']);
+ $this->assertEquals($initialSizes['files'] + $dataLen, $newSizes['files']);
+ $this->assertEquals($initialSizes['files/container'] + $dataLen, $newSizes['files/container']);
+ $this->assertEquals($initialSizes['files/container/shareddir'] + $dataLen, $newSizes['files/container/shareddir']);
+ $this->assertEquals($initialSizes['files/container/shareddir/subdir'] + $dataLen, $newSizes['files/container/shareddir/subdir']);
+
+ // no more updates
+ $result = $this->sharedStorage->getWatcher()->checkUpdate('shareddir/subdir');
+
+ $this->assertFalse($result);
+ }
+
+ function testNoUpdateOnRoot() {
+ // no updates when called for root path
+ $result = $this->sharedStorage->getWatcher()->checkUpdate('');
+
+ $this->assertFalse($result);
+
+ // FIXME: for some reason when running this "naked" test,
+ // there will be remaining nonsensical entries in the
+ // database with a path "test-share-user1/container/..."
+ }
+
+ /**
+ * Returns the sizes of the path and its parent dirs in a hash
+ * where the key is the path and the value is the size.
+ */
+ function getOwnerDirSizes($path) {
+ $result = array();
+
+ while ($path != '' && $path != '' && $path != '.') {
+ $cachedData = $this->ownerCache->get($path);
+ $result[$path] = $cachedData['size'];
+ $path = dirname($path);
+ }
+ $cachedData = $this->ownerCache->get('');
+ $result[''] = $cachedData['size'];
+ return $result;
+ }
+}