diff options
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/appinfo/app.php | 32 | ||||
-rw-r--r-- | apps/files_sharing/appinfo/update.php | 3 | ||||
-rw-r--r-- | apps/files_sharing/css/public.css | 3 | ||||
-rw-r--r-- | apps/files_sharing/l10n/az.php | 4 | ||||
-rw-r--r-- | apps/files_sharing/l10n/bg_BG.php | 1 | ||||
-rw-r--r-- | apps/files_sharing/l10n/cs_CZ.php | 1 | ||||
-rw-r--r-- | apps/files_sharing/l10n/en_GB.php | 1 | ||||
-rw-r--r-- | apps/files_sharing/l10n/fa.php | 1 | ||||
-rw-r--r-- | apps/files_sharing/l10n/ja.php | 5 | ||||
-rw-r--r-- | apps/files_sharing/l10n/pt_BR.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/l10n/pt_PT.php | 1 | ||||
-rw-r--r-- | apps/files_sharing/l10n/sk_SK.php | 1 | ||||
-rw-r--r-- | apps/files_sharing/lib/helper.php | 20 | ||||
-rw-r--r-- | apps/files_sharing/lib/share/file.php | 15 | ||||
-rw-r--r-- | apps/files_sharing/lib/sharedstorage.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/tests/helper.php | 41 | ||||
-rw-r--r-- | apps/files_sharing/tests/share.php | 30 | ||||
-rw-r--r-- | apps/files_sharing/tests/sharedstorage.php | 8 | ||||
-rw-r--r-- | apps/files_sharing/tests/update.php | 5 |
19 files changed, 153 insertions, 23 deletions
diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php index 60bec2b4050..b22c553ec93 100644 --- a/apps/files_sharing/appinfo/app.php +++ b/apps/files_sharing/appinfo/app.php @@ -24,19 +24,22 @@ OCP\Util::addScript('files_sharing', 'external'); OC_FileProxy::register(new OCA\Files\Share\Proxy()); -\OCA\Files\App::getNavigationManager()->add( - array( - "id" => 'sharingin', - "appname" => 'files_sharing', - "script" => 'list.php', - "order" => 10, - "name" => $l->t('Shared with you') - ) -); - -if (\OCP\Util::isSharingDisabledForUser() === false) { +$config = \OC::$server->getConfig(); +if ($config->getAppValue('core', 'shareapi_enabled', 'yes') === 'yes') { \OCA\Files\App::getNavigationManager()->add( + array( + "id" => 'sharingin', + "appname" => 'files_sharing', + "script" => 'list.php', + "order" => 10, + "name" => $l->t('Shared with you') + ) + ); + + if (\OCP\Util::isSharingDisabledForUser() === false) { + + \OCA\Files\App::getNavigationManager()->add( array( "id" => 'sharingout', "appname" => 'files_sharing', @@ -44,8 +47,8 @@ if (\OCP\Util::isSharingDisabledForUser() === false) { "order" => 15, "name" => $l->t('Shared with others') ) - ); - \OCA\Files\App::getNavigationManager()->add( + ); + \OCA\Files\App::getNavigationManager()->add( array( "id" => 'sharinglinks', "appname" => 'files_sharing', @@ -53,5 +56,6 @@ if (\OCP\Util::isSharingDisabledForUser() === false) { "order" => 20, "name" => $l->t('Shared by link') ) - ); + ); + } } diff --git a/apps/files_sharing/appinfo/update.php b/apps/files_sharing/appinfo/update.php index 72acdbac736..e393b1575af 100644 --- a/apps/files_sharing/appinfo/update.php +++ b/apps/files_sharing/appinfo/update.php @@ -113,5 +113,8 @@ function removeSharedFolder($mkdirs = true, $chunkSize = 99) { $query->execute(array()); } + // set config to keep the Shared folder as the default location for new shares + \OCA\Files_Sharing\Helper::setShareFolder('/Shared'); + } } diff --git a/apps/files_sharing/css/public.css b/apps/files_sharing/css/public.css index 8a843c39caa..ef013ca07d7 100644 --- a/apps/files_sharing/css/public.css +++ b/apps/files_sharing/css/public.css @@ -28,8 +28,9 @@ max-width:100%; } +/* fix multiselect bar offset on shared page */ thead { - padding-left: 0 !important; /* fixes multiselect bar offset on shared page */ + left: 0 !important; } #data-upload-form { diff --git a/apps/files_sharing/l10n/az.php b/apps/files_sharing/l10n/az.php index 4c4655c675a..56228610794 100644 --- a/apps/files_sharing/l10n/az.php +++ b/apps/files_sharing/l10n/az.php @@ -5,6 +5,10 @@ $TRANSLATIONS = array( "Couldn't add remote share" => "Uzaqda olan yayımlanmanı əlavə etmək mümkün olmadı", "Shared with you" => "Sizinlə yayımlanan", "Shared with others" => "Hər kəsə yayımlanmış", +"You haven't shared any files yet." => "Siz hələki heç bir faylı yayımlamamısnız.", +"You haven't shared any files by link yet." => "Hələki siz bu link ilə heç bir faylı yayımlamamısıniz.", +"Remote share" => "Uzaq yayımlanma", +"Remote share password" => "Uzaq yayımlanma şifrəsi", "Cancel" => "Dayandır", "Name" => "Ad" ); diff --git a/apps/files_sharing/l10n/bg_BG.php b/apps/files_sharing/l10n/bg_BG.php index bbc4e2dcfee..3d3218578cd 100644 --- a/apps/files_sharing/l10n/bg_BG.php +++ b/apps/files_sharing/l10n/bg_BG.php @@ -1,6 +1,7 @@ <?php $TRANSLATIONS = array( "Server to server sharing is not enabled on this server" => "Споделяне между сървъри не е разрешено на този сървър.", +"Invalid or untrusted SSL certificate" => "Невалиден или ненадежден SSL сертификат", "Couldn't add remote share" => "Неуспешно добавяне на отдалечена споделена директория.", "Shared with you" => "Споделено с теб", "Shared with others" => "Споделено с други", diff --git a/apps/files_sharing/l10n/cs_CZ.php b/apps/files_sharing/l10n/cs_CZ.php index 3752df1e0a2..b4f52dbef7e 100644 --- a/apps/files_sharing/l10n/cs_CZ.php +++ b/apps/files_sharing/l10n/cs_CZ.php @@ -1,6 +1,7 @@ <?php $TRANSLATIONS = array( "Server to server sharing is not enabled on this server" => "Sdílení mezi servery není povoleno", +"Invalid or untrusted SSL certificate" => "Neplatný nebo nedůvěryhodný SSL certifikát", "Couldn't add remote share" => "Nelze přidat vzdálené úložiště", "Shared with you" => "Sdíleno s vámi", "Shared with others" => "Sdíleno s ostatními", diff --git a/apps/files_sharing/l10n/en_GB.php b/apps/files_sharing/l10n/en_GB.php index e3191ce98d9..5ed2859ad26 100644 --- a/apps/files_sharing/l10n/en_GB.php +++ b/apps/files_sharing/l10n/en_GB.php @@ -1,6 +1,7 @@ <?php $TRANSLATIONS = array( "Server to server sharing is not enabled on this server" => "Server to server sharing is not enabled on this server", +"Invalid or untrusted SSL certificate" => "Invalid or untrusted SSL certificate", "Couldn't add remote share" => "Couldn't add remote share", "Shared with you" => "Shared with you", "Shared with others" => "Shared with others", diff --git a/apps/files_sharing/l10n/fa.php b/apps/files_sharing/l10n/fa.php index b19879075e4..5b55438c4ff 100644 --- a/apps/files_sharing/l10n/fa.php +++ b/apps/files_sharing/l10n/fa.php @@ -1,6 +1,7 @@ <?php $TRANSLATIONS = array( "Server to server sharing is not enabled on this server" => "اشتراک سرور به سرور در این سرور فعال نیست .", +"Invalid or untrusted SSL certificate" => "گواهینامه SSL غیر قابل اعتماد یا غیر معتبر است.", "Couldn't add remote share" => "امکان افزودن اشتراک گذاری از راه دور وجود ندارد", "Shared with you" => "موارد به اشتراک گذاشته شده با شما", "Shared with others" => "موارد به اشتراک گذاشته شده با دیگران", diff --git a/apps/files_sharing/l10n/ja.php b/apps/files_sharing/l10n/ja.php index dc45b81c3c1..63ac003c92f 100644 --- a/apps/files_sharing/l10n/ja.php +++ b/apps/files_sharing/l10n/ja.php @@ -1,6 +1,7 @@ <?php $TRANSLATIONS = array( "Server to server sharing is not enabled on this server" => "このサーバーでは、サーバー間の共有が有効ではありません", +"Invalid or untrusted SSL certificate" => "無効または信頼できないSSL証明書", "Couldn't add remote share" => "リモート共有を追加できませんでした", "Shared with you" => "他ユーザーがあなたと共有中", "Shared with others" => "他ユーザーと共有中", @@ -13,8 +14,8 @@ $TRANSLATIONS = array( "Remote share password" => "リモート共有のパスワード", "Cancel" => "キャンセル", "Add remote share" => "リモート共有を追加", -"No ownCloud installation found at {remote}" => "{remote} には ownCloud がインストールされていません", -"Invalid ownCloud url" => "無効な ownCloud URL です", +"No ownCloud installation found at {remote}" => "{remote} にはownCloudがインストールされていません", +"Invalid ownCloud url" => "無効なownCloud URL です", "Shared by" => "共有者:", "This share is password-protected" => "この共有はパスワードで保護されています", "The password is wrong. Try again." => "パスワードが間違っています。再試行してください。", diff --git a/apps/files_sharing/l10n/pt_BR.php b/apps/files_sharing/l10n/pt_BR.php index 3a2ed4cb11a..312196480ab 100644 --- a/apps/files_sharing/l10n/pt_BR.php +++ b/apps/files_sharing/l10n/pt_BR.php @@ -4,7 +4,7 @@ $TRANSLATIONS = array( "Invalid or untrusted SSL certificate" => "Certificado SSL inválido ou não confiável", "Couldn't add remote share" => "Não foi possível adicionar compartilhamento remoto", "Shared with you" => "Compartilhado com você", -"Shared with others" => "Compartilhados com outros", +"Shared with others" => "Compartilhado com outros", "Shared by link" => "Compartilhado por link", "No files have been shared with you yet." => "Nenhum arquivo ainda foi compartilhado com você.", "You haven't shared any files yet." => "Você ainda não compartilhou nenhum arquivo.", diff --git a/apps/files_sharing/l10n/pt_PT.php b/apps/files_sharing/l10n/pt_PT.php index c0b59bfc191..fc5c7cabec5 100644 --- a/apps/files_sharing/l10n/pt_PT.php +++ b/apps/files_sharing/l10n/pt_PT.php @@ -1,6 +1,7 @@ <?php $TRANSLATIONS = array( "Server to server sharing is not enabled on this server" => "A partilha entre servidores não se encontra disponível", +"Invalid or untrusted SSL certificate" => "Certificado SSL inválido ou não confiável", "Couldn't add remote share" => "Ocorreu um erro ao adicionar a partilha remota", "Shared with you" => "Partilhado consigo ", "Shared with others" => "Partilhado com outros", diff --git a/apps/files_sharing/l10n/sk_SK.php b/apps/files_sharing/l10n/sk_SK.php index 723ada575eb..f3231cb1021 100644 --- a/apps/files_sharing/l10n/sk_SK.php +++ b/apps/files_sharing/l10n/sk_SK.php @@ -1,6 +1,7 @@ <?php $TRANSLATIONS = array( "Server to server sharing is not enabled on this server" => "Zdieľanie server-server nie je na tomto serveri povolené", +"Invalid or untrusted SSL certificate" => "Neplatný alebo nedôveryhodný certifikát SSL", "Couldn't add remote share" => "Nemožno pridať vzdialené zdieľanie", "Shared with you" => "Zdieľané s vami", "Shared with others" => "Zdieľané s ostanými", diff --git a/apps/files_sharing/lib/helper.php b/apps/files_sharing/lib/helper.php index c15b1d48114..f444404c2b1 100644 --- a/apps/files_sharing/lib/helper.php +++ b/apps/files_sharing/lib/helper.php @@ -237,4 +237,24 @@ class Helper { return ($result === 'yes') ? true : false; } + /** + * get default share folder + * + * @return string + */ + public static function getShareFolder() { + $shareFolder = \OCP\Config::getSystemValue('share_folder', '/'); + + return \OC\Files\Filesystem::normalizePath($shareFolder); + } + + /** + * set default share folder + * + * @param string $shareFolder + */ + public static function setShareFolder($shareFolder) { + \OCP\Config::setSystemValue('share_folder', $shareFolder); + } + } diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php index 91595461a61..2ae7fdc16ab 100644 --- a/apps/files_sharing/lib/share/file.php +++ b/apps/files_sharing/lib/share/file.php @@ -61,7 +61,8 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent { * @return string */ public function generateTarget($filePath, $shareWith, $exclude = null) { - $target = '/'.basename($filePath); + $shareFolder = \OCA\Files_Sharing\Helper::getShareFolder(); + $target = \OC\Files\Filesystem::normalizePath($shareFolder . '/' . basename($filePath)); // for group shares we return the target right away if ($shareWith === false) { @@ -70,6 +71,18 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent { \OC\Files\Filesystem::initMountPoints($shareWith); $view = new \OC\Files\View('/' . $shareWith . '/files'); + + if (!$view->is_dir($shareFolder)) { + $dir = ''; + $subdirs = explode('/', $shareFolder); + foreach ($subdirs as $subdir) { + $dir = $dir . '/' . $subdir; + if (!$view->is_dir($dir)) { + $view->mkdir($dir); + } + } + } + $excludeList = \OCP\Share::getItemsSharedWithUser('file', $shareWith, self::FORMAT_TARGET_NAMES); if (is_array($exclude)) { $excludeList = array_merge($excludeList, $exclude); diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index 02fcd7041dd..07f6b9da10c 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -377,7 +377,7 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage { list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source); return $storage->free_space($internalPath); } - return \OC\Files\SPACE_UNKNOWN; + return \OCP\Files\FileInfo::SPACE_UNKNOWN; } public function getLocalFile($path) { diff --git a/apps/files_sharing/tests/helper.php b/apps/files_sharing/tests/helper.php new file mode 100644 index 00000000000..6169a9f5094 --- /dev/null +++ b/apps/files_sharing/tests/helper.php @@ -0,0 +1,41 @@ +<?php +/** + * ownCloud + * + * @author Bjoern Schiessle + * @copyright 2014 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__ . '/base.php'; + +class Test_Files_Sharing_Helper extends Test_Files_Sharing_Base { + + /** + * test set and get share folder + */ + function testSetGetShareFolder() { + $this->assertSame('/', \OCA\Files_Sharing\Helper::getShareFolder()); + + \OCA\Files_Sharing\Helper::setShareFolder('/Shared'); + + $this->assertSame('/Shared', \OCA\Files_Sharing\Helper::getShareFolder()); + + // cleanup + \OCP\Config::deleteSystemValue('share_folder'); + + } + +} diff --git a/apps/files_sharing/tests/share.php b/apps/files_sharing/tests/share.php index d3ca1816c75..31246c5df44 100644 --- a/apps/files_sharing/tests/share.php +++ b/apps/files_sharing/tests/share.php @@ -125,6 +125,36 @@ class Test_Files_Sharing extends Test_Files_Sharing_Base { } + function testShareWithDifferentShareFolder() { + + $fileinfo = $this->view->getFileInfo($this->filename); + $folderinfo = $this->view->getFileInfo($this->folder); + + $fileShare = \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, + self::TEST_FILES_SHARING_API_USER2, 31); + $this->assertTrue($fileShare); + + \OCA\Files_Sharing\Helper::setShareFolder('/Shared/subfolder'); + + $folderShare = \OCP\Share::shareItem('folder', $folderinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, + self::TEST_FILES_SHARING_API_USER2, 31); + $this->assertTrue($folderShare); + + self::loginHelper(self::TEST_FILES_SHARING_API_USER2); + + $this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename)); + $this->assertTrue(\OC\Files\Filesystem::file_exists('/Shared/subfolder/' . $this->folder)); + + //cleanup + self::loginHelper(self::TEST_FILES_SHARING_API_USER1); + \OCP\Share::unshare('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, + self::TEST_FILES_SHARING_API_USER2); + \OCP\Share::unshare('folder', $folderinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, + self::TEST_FILES_SHARING_API_USER2); + + \OCP\Config::deleteSystemValue('share_folder'); + } + /** * shared files should never have delete permissions * @dataProvider DataProviderTestFileSharePermissions diff --git a/apps/files_sharing/tests/sharedstorage.php b/apps/files_sharing/tests/sharedstorage.php index 27f3b5150d5..972f9257e25 100644 --- a/apps/files_sharing/tests/sharedstorage.php +++ b/apps/files_sharing/tests/sharedstorage.php @@ -52,9 +52,11 @@ class Test_Files_Sharing_Storage extends Test_Files_Sharing_Base { } /** + * if the parent of the mount point is gone then the mount point should move up + * * @medium */ - function testDeleteParentOfMountPoint() { + function testParentOfMountPointIsGone() { // share to user $fileinfo = $this->view->getFileInfo($this->folder); @@ -79,8 +81,8 @@ class Test_Files_Sharing_Storage extends Test_Files_Sharing_Base { $this->assertFalse($user2View->is_dir($this->folder)); // delete the local folder - $result = $user2View->unlink('/localfolder'); - $this->assertTrue($result); + $fullPath = \OC_Config::getValue('datadirectory') . '/' . self::TEST_FILES_SHARING_API_USER2 . '/files/localfolder'; + rmdir($fullPath); //enforce reload of the mount points self::loginHelper(self::TEST_FILES_SHARING_API_USER2); diff --git a/apps/files_sharing/tests/update.php b/apps/files_sharing/tests/update.php index d3555cc2ee3..be29c38acc3 100644 --- a/apps/files_sharing/tests/update.php +++ b/apps/files_sharing/tests/update.php @@ -152,8 +152,13 @@ class Test_Files_Sharing_Update_Routine extends Test_Files_Sharing_Base { } } + $shareFolder = \OCP\Config::getSystemValue('share_folder', '/'); + + $this->assertSame('/Shared', $shareFolder); + // cleanup $this->cleanupSharedTable(); + \OCP\Config::deleteSystemValue('share_folder'); } |