summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--apps/files/l10n/az.php1
-rw-r--r--apps/files/l10n/fy_NL.php7
-rw-r--r--apps/files/l10n/ia.php2
-rw-r--r--apps/files/l10n/tg_TJ.php7
-rw-r--r--apps/files/l10n/tl_PH.php7
-rw-r--r--apps/files_encryption/lib/proxy.php11
-rw-r--r--apps/files_encryption/templates/settings-admin.php6
-rw-r--r--apps/files_encryption/templates/settings-personal.php6
-rw-r--r--apps/files_encryption/tests/proxy.php38
-rw-r--r--apps/files_external/l10n/ia.php1
-rw-r--r--apps/files_external/l10n/pt_PT.php1
-rw-r--r--apps/files_external/l10n/zh_TW.php2
-rw-r--r--apps/files_external/lib/amazons3.php67
-rw-r--r--apps/files_external/tests/amazons3.php28
-rw-r--r--apps/files_sharing/appinfo/app.php3
-rw-r--r--apps/files_sharing/js/public.js31
-rw-r--r--apps/files_sharing/l10n/ru.php12
-rw-r--r--apps/files_sharing/l10n/sl.php1
-rw-r--r--apps/files_sharing/lib/exceptions.php32
-rw-r--r--apps/files_sharing/lib/share/file.php9
-rw-r--r--apps/files_sharing/lib/sharedmount.php21
-rw-r--r--apps/files_sharing/lib/sharedstorage.php17
-rw-r--r--apps/files_sharing/templates/public.php23
-rw-r--r--apps/files_sharing/tests/base.php12
-rw-r--r--apps/files_sharing/tests/share.php160
-rw-r--r--apps/files_sharing/tests/sharedmount.php37
-rw-r--r--apps/user_ldap/appinfo/register_command.php1
-rw-r--r--apps/user_ldap/command/createemptyconfig.php51
-rw-r--r--apps/user_ldap/l10n/es.php2
-rw-r--r--apps/user_ldap/l10n/fy_NL.php6
-rw-r--r--apps/user_ldap/l10n/tg_TJ.php6
-rw-r--r--apps/user_ldap/l10n/tl_PH.php6
-rwxr-xr-xconfig/config.sample.php5
-rw-r--r--core/ajax/preview.php1
-rw-r--r--core/l10n/bg_BG.php1
-rw-r--r--core/l10n/ca.php12
-rw-r--r--core/l10n/cs_CZ.php6
-rw-r--r--core/l10n/de.php2
-rw-r--r--core/l10n/de_DE.php2
-rw-r--r--core/l10n/fr.php1
-rw-r--r--core/l10n/fy_NL.php5
-rw-r--r--core/l10n/ia.php24
-rw-r--r--core/l10n/pt_PT.php6
-rw-r--r--core/l10n/ru.php1
-rw-r--r--core/l10n/sl.php15
-rw-r--r--core/l10n/tg_TJ.php5
-rw-r--r--core/l10n/tl_PH.php5
-rw-r--r--l10n/templates/core.pot6
-rw-r--r--l10n/templates/files.pot2
-rw-r--r--l10n/templates/files_encryption.pot20
-rw-r--r--l10n/templates/files_external.pot2
-rw-r--r--l10n/templates/files_sharing.pot20
-rw-r--r--l10n/templates/files_trashbin.pot2
-rw-r--r--l10n/templates/files_versions.pot2
-rw-r--r--l10n/templates/lib.pot48
-rw-r--r--l10n/templates/private.pot48
-rw-r--r--l10n/templates/settings.pot2
-rw-r--r--l10n/templates/user_ldap.pot6
-rw-r--r--l10n/templates/user_webdavauth.pot2
-rw-r--r--lib/l10n/es.php2
-rw-r--r--lib/l10n/fr.php4
-rw-r--r--lib/l10n/fy_NL.php8
-rw-r--r--lib/l10n/pt_PT.php1
-rw-r--r--lib/l10n/tg_TJ.php8
-rw-r--r--lib/l10n/tl_PH.php8
-rw-r--r--lib/private/appframework/http/request.php1
-rw-r--r--lib/private/config.php134
-rw-r--r--lib/private/legacy/config.php38
-rw-r--r--lib/private/mimetypes.list.php2
-rw-r--r--lib/private/naturalsort.php8
-rw-r--r--lib/private/ocs.php6
-rwxr-xr-xlib/private/preview.php8
-rw-r--r--lib/private/preview/bitmap.php117
-rw-r--r--lib/private/preview/pdf.php48
-rw-r--r--lib/private/preview/tiff.php48
-rw-r--r--lib/private/preview/txt.php2
-rw-r--r--lib/private/share/helper.php127
-rw-r--r--lib/private/share/hooks.php28
-rw-r--r--lib/private/share/share.php603
-rw-r--r--lib/private/templatelayout.php11
-rwxr-xr-xlib/private/util.php23
-rw-r--r--lib/public/share.php4
-rw-r--r--settings/l10n/bn_BD.php9
-rw-r--r--settings/l10n/el.php2
-rw-r--r--settings/l10n/fr.php4
-rw-r--r--settings/l10n/ia.php1
-rw-r--r--settings/l10n/pt_PT.php6
-rw-r--r--settings/l10n/ru.php2
-rw-r--r--settings/l10n/tr.php2
-rw-r--r--tests/lib/config.php132
-rw-r--r--tests/lib/share/backend.php23
-rw-r--r--tests/lib/share/share.php96
93 files changed, 1528 insertions, 854 deletions
diff --git a/.gitignore b/.gitignore
index b24edc91282..a36fd98b79f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
/config/*.config.php
/config/mount.php
/apps/inc.php
+/assets
# ignore all apps except core ones
/apps*/*
diff --git a/apps/files/l10n/az.php b/apps/files/l10n/az.php
index 158dff2fdbb..05e99c11543 100644
--- a/apps/files/l10n/az.php
+++ b/apps/files/l10n/az.php
@@ -47,6 +47,7 @@ $TRANSLATIONS = array(
"Error fetching URL" => "URL-in gətirilməsində səhv baş verdi",
"Share" => "Yayımla",
"Delete" => "Sil",
+"Rename" => "Adı dəyiş",
"Error" => "Səhv",
"Name" => "Ad",
"Size" => "Həcm",
diff --git a/apps/files/l10n/fy_NL.php b/apps/files/l10n/fy_NL.php
new file mode 100644
index 00000000000..0157af093e9
--- /dev/null
+++ b/apps/files/l10n/fy_NL.php
@@ -0,0 +1,7 @@
+<?php
+$TRANSLATIONS = array(
+"_%n folder_::_%n folders_" => array("",""),
+"_%n file_::_%n files_" => array("",""),
+"_Uploading %n file_::_Uploading %n files_" => array("","")
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files/l10n/ia.php b/apps/files/l10n/ia.php
index f33b3f90914..62b07896fdd 100644
--- a/apps/files/l10n/ia.php
+++ b/apps/files/l10n/ia.php
@@ -1,6 +1,7 @@
<?php
$TRANSLATIONS = array(
"Unknown error" => "Error Incognite",
+"File name cannot be empty." => "Le nomine de file non pote esser vacue.",
"The uploaded file was only partially uploaded" => "Le file incargate solmente esseva incargate partialmente",
"No file was uploaded" => "Nulle file esseva incargate.",
"Missing a temporary folder" => "Manca un dossier temporari",
@@ -15,6 +16,7 @@ $TRANSLATIONS = array(
"_%n folder_::_%n folders_" => array("",""),
"_%n file_::_%n files_" => array("",""),
"_Uploading %n file_::_Uploading %n files_" => array("",""),
+"Upload (max. %s)" => "Incargar (max. %s)",
"Maximum upload size" => "Dimension maxime de incargamento",
"Save" => "Salveguardar",
"New" => "Nove",
diff --git a/apps/files/l10n/tg_TJ.php b/apps/files/l10n/tg_TJ.php
new file mode 100644
index 00000000000..0157af093e9
--- /dev/null
+++ b/apps/files/l10n/tg_TJ.php
@@ -0,0 +1,7 @@
+<?php
+$TRANSLATIONS = array(
+"_%n folder_::_%n folders_" => array("",""),
+"_%n file_::_%n files_" => array("",""),
+"_Uploading %n file_::_Uploading %n files_" => array("","")
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files/l10n/tl_PH.php b/apps/files/l10n/tl_PH.php
new file mode 100644
index 00000000000..3c711e6b78a
--- /dev/null
+++ b/apps/files/l10n/tl_PH.php
@@ -0,0 +1,7 @@
+<?php
+$TRANSLATIONS = array(
+"_%n folder_::_%n folders_" => array("",""),
+"_%n file_::_%n files_" => array("",""),
+"_Uploading %n file_::_Uploading %n files_" => array("","")
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n > 1);";
diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php
index b406404a688..3b9dcbe7767 100644
--- a/apps/files_encryption/lib/proxy.php
+++ b/apps/files_encryption/lib/proxy.php
@@ -49,12 +49,17 @@ class Proxy extends \OC_FileProxy {
* @param string $uid user
* @return boolean
*/
- private function isExcludedPath($path, $uid) {
+ protected function isExcludedPath($path, $uid) {
$view = new \OC\Files\View();
- // files outside of the files-folder are excluded
- if(strpos($path, '/' . $uid . '/files/') !== 0) {
+ $path = \OC\Files\Filesystem::normalizePath($path);
+
+ // we only encrypt/decrypt files in the files and files_versions folder
+ if(
+ strpos($path, '/' . $uid . '/files/') !== 0 &&
+ strpos($path, '/' . $uid . '/files_versions/') !== 0) {
+
return true;
}
diff --git a/apps/files_encryption/templates/settings-admin.php b/apps/files_encryption/templates/settings-admin.php
index a97261dc1c9..2d5f7084c96 100644
--- a/apps/files_encryption/templates/settings-admin.php
+++ b/apps/files_encryption/templates/settings-admin.php
@@ -16,18 +16,20 @@
<br/>
<input
type='radio'
+ id='adminEnableRecovery'
name='adminEnableRecovery'
value='1'
<?php echo($_["recoveryEnabled"] === '1' ? 'checked="checked"' : 'disabled'); ?> />
- <?php p($l->t("Enabled")); ?>
+ <label for="adminEnableRecovery"><?php p($l->t("Enabled")); ?></label>
<br/>
<input
type='radio'
+ id='adminDisableRecovery'
name='adminEnableRecovery'
value='0'
<?php echo($_["recoveryEnabled"] === '0' ? 'checked="checked"' : 'disabled'); ?> />
- <?php p($l->t("Disabled")); ?>
+ <label for="adminDisableRecovery"><?php p($l->t("Disabled")); ?></label>
</p>
<br/><br/>
diff --git a/apps/files_encryption/templates/settings-personal.php b/apps/files_encryption/templates/settings-personal.php
index 7c3a700c233..a1221240422 100644
--- a/apps/files_encryption/templates/settings-personal.php
+++ b/apps/files_encryption/templates/settings-personal.php
@@ -46,18 +46,20 @@
<br />
<input
type='radio'
+ id='userEnableRecovery'
name='userEnableRecovery'
value='1'
<?php echo ( $_["recoveryEnabledForUser"] ? 'checked="checked"' : '' ); ?> />
- <?php p( $l->t( "Enabled" ) ); ?>
+ <label for="userEnableRecovery"><?php p( $l->t( "Enabled" ) ); ?></label>
<br />
<input
type='radio'
+ id='userDisableRecovery'
name='userEnableRecovery'
value='0'
<?php echo ( $_["recoveryEnabledForUser"] === false ? 'checked="checked"' : '' ); ?> />
- <?php p( $l->t( "Disabled" ) ); ?>
+ <label for="userDisableRecovery"><?php p( $l->t( "Disabled" ) ); ?></label>
<div id="recoveryEnabledSuccess"><?php p( $l->t( 'File recovery settings updated' ) ); ?></div>
<div id="recoveryEnabledError"><?php p( $l->t( 'Could not update file recovery' ) ); ?></div>
</p>
diff --git a/apps/files_encryption/tests/proxy.php b/apps/files_encryption/tests/proxy.php
index 9ec1f940edd..42637a52e04 100644
--- a/apps/files_encryption/tests/proxy.php
+++ b/apps/files_encryption/tests/proxy.php
@@ -136,4 +136,42 @@ class Test_Encryption_Proxy extends \PHPUnit_Framework_TestCase {
}
+ /**
+ * @dataProvider isExcludedPathProvider
+ */
+ function testIsExcludedPath($path, $expected) {
+ $this->view->mkdir(dirname($path));
+ $this->view->file_put_contents($path, "test");
+
+ $testClass = new DummyProxy();
+
+ $result = $testClass->isExcludedPathTesting($path, $this->userId);
+ $this->assertSame($expected, $result);
+
+ $this->view->deleteAll(dirname($path));
+
+ }
+
+ public function isExcludedPathProvider() {
+ return array(
+ array ('/' . \Test_Encryption_Proxy::TEST_ENCRYPTION_PROXY_USER1 . '/files/test.txt', false),
+ array (\Test_Encryption_Proxy::TEST_ENCRYPTION_PROXY_USER1 . '/files/test.txt', false),
+ array ('/files/test.txt', true),
+ array ('/' . \Test_Encryption_Proxy::TEST_ENCRYPTION_PROXY_USER1 . '/files/versions/test.txt', false),
+ array ('/' . \Test_Encryption_Proxy::TEST_ENCRYPTION_PROXY_USER1 . '/files_versions/test.txt', false),
+ array ('/' . \Test_Encryption_Proxy::TEST_ENCRYPTION_PROXY_USER1 . '/files_trashbin/test.txt', true),
+ array ('/' . \Test_Encryption_Proxy::TEST_ENCRYPTION_PROXY_USER1 . '/file/test.txt', true),
+ );
+ }
+
+}
+
+
+/**
+ * Dummy class to make protected methods available for testing
+ */
+class DummyProxy extends \OCA\Encryption\Proxy {
+ public function isExcludedPathTesting($path, $uid) {
+ return $this->isExcludedPath($path, $uid);
+ }
}
diff --git a/apps/files_external/l10n/ia.php b/apps/files_external/l10n/ia.php
index ed9a1bea6c6..a3ebcf5183b 100644
--- a/apps/files_external/l10n/ia.php
+++ b/apps/files_external/l10n/ia.php
@@ -7,6 +7,7 @@ $TRANSLATIONS = array(
"Share" => "Compartir",
"URL" => "URL",
"Personal" => "Personal",
+"Saved" => "Salveguardate",
"Name" => "Nomine",
"Folder name" => "Nomine de dossier",
"Delete" => "Deler"
diff --git a/apps/files_external/l10n/pt_PT.php b/apps/files_external/l10n/pt_PT.php
index bd8971e8da7..9a12aebae45 100644
--- a/apps/files_external/l10n/pt_PT.php
+++ b/apps/files_external/l10n/pt_PT.php
@@ -47,6 +47,7 @@ $TRANSLATIONS = array(
"Error configuring Google Drive storage" => "Erro ao configurar o armazenamento do Google Drive",
"Personal" => "Pessoal",
"System" => "Sistema",
+"(group)" => "(grupo)",
"Saved" => "Guardado",
"<b>Note:</b> " => "<b>Aviso:</b> ",
" and " => "e",
diff --git a/apps/files_external/l10n/zh_TW.php b/apps/files_external/l10n/zh_TW.php
index e46ce6a9fa6..7dbaebc04d0 100644
--- a/apps/files_external/l10n/zh_TW.php
+++ b/apps/files_external/l10n/zh_TW.php
@@ -12,7 +12,7 @@ $TRANSLATIONS = array(
"Region" => "地區",
"Enable SSL" => "啟用 SSL",
"Host" => "主機",
-"Username" => "使用者名稱:",
+"Username" => "使用者名稱",
"Password" => "密碼",
"Share" => "分享",
"URL" => "URL",
diff --git a/apps/files_external/lib/amazons3.php b/apps/files_external/lib/amazons3.php
index c82b7391021..9daac83e066 100644
--- a/apps/files_external/lib/amazons3.php
+++ b/apps/files_external/lib/amazons3.php
@@ -73,6 +73,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
sleep($this->timeout);
}
}
+
private function cleanKey($path) {
if ($path === '.') {
return '/';
@@ -90,13 +91,13 @@ class AmazonS3 extends \OC\Files\Storage\Common {
$this->bucket = $params['bucket'];
$scheme = ($params['use_ssl'] === 'false') ? 'http' : 'https';
$this->test = isset($params['test']);
- $this->timeout = ( ! isset($params['timeout'])) ? 15 : $params['timeout'];
- $params['region'] = ( ! isset($params['region']) || $params['region'] === '' ) ? 'eu-west-1' : $params['region'];
- $params['hostname'] = ( !isset($params['hostname']) || $params['hostname'] === '' ) ? 's3.amazonaws.com' : $params['hostname'];
+ $this->timeout = (!isset($params['timeout'])) ? 15 : $params['timeout'];
+ $params['region'] = (!isset($params['region']) || $params['region'] === '') ? 'eu-west-1' : $params['region'];
+ $params['hostname'] = (!isset($params['hostname']) || $params['hostname'] === '') ? 's3.amazonaws.com' : $params['hostname'];
if (!isset($params['port']) || $params['port'] === '') {
$params['port'] = ($params['use_ssl'] === 'false') ? 80 : 443;
}
- $base_url = $scheme.'://'.$params['hostname'].':'.$params['port'].'/';
+ $base_url = $scheme . '://' . $params['hostname'] . ':' . $params['port'] . '/';
$this->connection = S3Client::factory(array(
'key' => $params['key'],
@@ -119,7 +120,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
'waiter.interval' => 1,
'waiter.max_attempts' => 15
));
- $this->testTimeout();
+ $this->testTimeout();
} catch (S3Exception $e) {
\OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
throw new \Exception("Creation of bucket failed.");
@@ -128,8 +129,8 @@ class AmazonS3 extends \OC\Files\Storage\Common {
if (!$this->file_exists('.')) {
$result = $this->connection->putObject(array(
'Bucket' => $this->bucket,
- 'Key' => $this->cleanKey('.'),
- 'Body' => '',
+ 'Key' => $this->cleanKey('.'),
+ 'Body' => '',
'ContentType' => 'httpd/unix-directory',
'ContentLength' => 0
));
@@ -145,10 +146,10 @@ class AmazonS3 extends \OC\Files\Storage\Common {
}
try {
- $result = $this->connection->putObject(array(
+ $this->connection->putObject(array(
'Bucket' => $this->bucket,
- 'Key' => $path . '/',
- 'Body' => '',
+ 'Key' => $path . '/',
+ 'Body' => '',
'ContentType' => 'httpd/unix-directory',
'ContentLength' => 0
));
@@ -187,6 +188,10 @@ class AmazonS3 extends \OC\Files\Storage\Common {
public function rmdir($path) {
$path = $this->normalizePath($path);
+ if ($path === '.') {
+ return $this->clearBucket();
+ }
+
if (!$this->file_exists($path)) {
return false;
}
@@ -199,7 +204,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
));
try {
- $result = $this->connection->deleteObjects(array(
+ $this->connection->deleteObjects(array(
'Bucket' => $this->bucket,
'Objects' => $objects['Contents']
));
@@ -212,6 +217,28 @@ class AmazonS3 extends \OC\Files\Storage\Common {
return true;
}
+ protected function clearBucket() {
+ try {
+ $this->connection->clearBucket($this->bucket);
+ // clearBucket() is not working with Ceph, so if it fails we try the slower approach
+ } catch (\Exception $e) {
+ try {
+ $iterator = $this->connection->getIterator('ListObjects', array(
+ 'Bucket' => $this->bucket
+ ));
+
+ foreach ($iterator as $object) {
+ $this->connection->deleteObject(array(
+ 'Bucket' => $this->bucket,
+ 'Key' => $object['Key']
+ ));
+ }
+ } catch (S3Exception $e) {
+ return false;
+ }
+ }
+ }
+
public function opendir($path) {
$path = $this->normalizePath($path);
@@ -271,7 +298,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
$stat['atime'] = time();
return $stat;
- } catch(S3Exception $e) {
+ } catch (S3Exception $e) {
\OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
return false;
}
@@ -302,7 +329,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
public function unlink($path) {
$path = $this->normalizePath($path);
- if ( $this->is_dir($path) ) {
+ if ($this->is_dir($path)) {
return $this->rmdir($path);
}
@@ -446,8 +473,10 @@ class AmazonS3 extends \OC\Files\Storage\Common {
return false;
}
} else {
- if ($this->file_exists($path2)) {
- return false;
+ if ($this->is_dir($path2)) {
+ $this->rmdir($path2);
+ } else if ($this->file_exists($path2)) {
+ $this->unlink($path2);
}
try {
@@ -463,7 +492,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
}
$dh = $this->opendir($path1);
- if(is_resource($dh)) {
+ if (is_resource($dh)) {
while (($file = readdir($dh)) !== false) {
if ($file === '.' || $file === '..') {
continue;
@@ -484,6 +513,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
$path2 = $this->normalizePath($path2);
if ($this->is_file($path1)) {
+
if ($this->copy($path1, $path2) === false) {
return false;
}
@@ -493,9 +523,6 @@ class AmazonS3 extends \OC\Files\Storage\Common {
return false;
}
} else {
- if ($this->file_exists($path2)) {
- return false;
- }
if ($this->copy($path1, $path2) === false) {
return false;
@@ -534,7 +561,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
}
try {
- $result= $this->connection->putObject(array(
+ $result = $this->connection->putObject(array(
'Bucket' => $this->bucket,
'Key' => $this->cleanKey(self::$tmpFiles[$tmpFile]),
'SourceFile' => $tmpFile,
diff --git a/apps/files_external/tests/amazons3.php b/apps/files_external/tests/amazons3.php
index a73b6307b01..8eaece6dad9 100644
--- a/apps/files_external/tests/amazons3.php
+++ b/apps/files_external/tests/amazons3.php
@@ -38,29 +38,11 @@ class AmazonS3 extends Storage {
public function tearDown() {
if ($this->instance) {
- $connection = $this->instance->getConnection();
-
- try {
- // NOTE(berendt): clearBucket() is not working with Ceph
- $iterator = $connection->getIterator('ListObjects', array(
- 'Bucket' => $this->config['amazons3']['bucket']
- ));
-
- foreach ($iterator as $object) {
- $connection->deleteObject(array(
- 'Bucket' => $this->config['amazons3']['bucket'],
- 'Key' => $object['Key']
- ));
- }
- } catch (S3Exception $e) {
- }
-
- $connection->deleteBucket(array(
- 'Bucket' => $this->config['amazons3']['bucket']
- ));
-
- //wait some seconds for completing the replication
- sleep(30);
+ $this->instance->rmdir('');
}
}
+
+ public function testStat() {
+ $this->markTestSkipped('S3 doesn\'t update the parents folder mtime');
+ }
}
diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php
index 543cae7b0c1..f2c454a9ae2 100644
--- a/apps/files_sharing/appinfo/app.php
+++ b/apps/files_sharing/appinfo/app.php
@@ -12,6 +12,9 @@ OC::$CLASSPATH['OCA\Files\Share\Api'] = 'files_sharing/lib/api.php';
OC::$CLASSPATH['OCA\Files\Share\Maintainer'] = 'files_sharing/lib/maintainer.php';
OC::$CLASSPATH['OCA\Files\Share\Proxy'] = 'files_sharing/lib/proxy.php';
+// Exceptions
+OC::$CLASSPATH['OCA\Files_Sharing\Exceptions\BrokenPath'] = 'files_sharing/lib/exceptions.php';
+
\OCP\App::registerAdmin('files_sharing', 'settings-admin');
\OCA\Files_Sharing\Helper::registerHooks();
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js
index 1a2394f300e..b3036254401 100644
--- a/apps/files_sharing/js/public.js
+++ b/apps/files_sharing/js/public.js
@@ -56,6 +56,11 @@ OCA.Sharing.PublicApp = {
}
var mimetype = $('#mimetype').val();
+ var mimetypeIcon = $('#mimetypeIcon').val();
+ mimetypeIcon = mimetypeIcon.substring(0, mimetypeIcon.length - 3);
+ mimetypeIcon = mimetypeIcon + 'svg';
+
+ var previewSupported = $('#previewSupported').val();
if (typeof FileActions !== 'undefined') {
// Show file preview if previewer is available, images are already handled by the template
@@ -68,21 +73,25 @@ OCA.Sharing.PublicApp = {
}
}
+
// dynamically load image previews
- if (mimetype.substr(0, mimetype.indexOf('/')) === 'image') {
-
- var params = {
- x: $(document).width() * window.devicePixelRatio,
- y: $(document).height() * window.devicePixelRatio,
- a: 'true',
- file: encodeURIComponent(this.initialDir + $('#filename').val()),
- t: $('#sharingToken').val(),
- scalingup: 0
- };
+ var params = {
+ x: $(document).width() * window.devicePixelRatio,
+ y: $(document).height() * window.devicePixelRatio,
+ a: 'true',
+ file: encodeURIComponent(this.initialDir + $('#filename').val()),
+ t: $('#sharingToken').val(),
+ scalingup: 0
+ };
- var img = $('<img class="publicpreview">');
+ var img = $('<img class="publicpreview">');
+ if (previewSupported === 'true' || mimetype.substr(0, mimetype.indexOf('/')) === 'image') {
img.attr('src', OC.filePath('files_sharing', 'ajax', 'publicpreview.php') + '?' + OC.buildQueryString(params));
img.appendTo('#imgframe');
+ } else if (mimetype.substr(0, mimetype.indexOf('/')) !== 'video') {
+ img.attr('src', OC.Util.replaceSVGIcon(mimetypeIcon));
+ img.attr('width', 128);
+ img.appendTo('#imgframe');
}
if (this.fileList) {
diff --git a/apps/files_sharing/l10n/ru.php b/apps/files_sharing/l10n/ru.php
index 96cdbb698c9..6d08aff040f 100644
--- a/apps/files_sharing/l10n/ru.php
+++ b/apps/files_sharing/l10n/ru.php
@@ -2,13 +2,13 @@
$TRANSLATIONS = array(
"Server to server sharing is not enabled on this server" => "На данном сервере выключено межсерверное предоставление общих папок",
"The mountpoint name contains invalid characters." => "Имя точки монтирования содержит недопустимые символы.",
-"Invalid or untrusted SSL certificate" => "Не верный или недостоверный сертификат SSL",
+"Invalid or untrusted SSL certificate" => "Недействительный или недоверенный сертификат SSL",
"Couldn't add remote share" => "Невозможно добавить удалённую общую папку",
"Shared with you" => "Доступные для Вас",
"Shared with others" => "Доступные для других",
"Shared by link" => "Доступные по ссылке",
"No files have been shared with you yet." => "Отсутствуют доступные для вас файлы.",
-"You haven't shared any files yet." => "Вы не имеете файлов в открытом доступе",
+"You haven't shared any files yet." => "У вас нет общедоступных файлов",
"You haven't shared any files by link yet." => "Вы ещё не открыли доступ по ссылке ни к одному файлу.",
"Do you want to add the remote share {name} from {owner}@{remote}?" => "Добавить удалённую общую папку {name} из {owner}@{remote}?",
"Remote share" => "Удалённая общая папка",
@@ -16,7 +16,7 @@ $TRANSLATIONS = array(
"Cancel" => "Отменить",
"Add remote share" => "Добавить удалённую общую папку",
"No ownCloud installation found at {remote}" => "Не найдено ownCloud на {remote}",
-"Invalid ownCloud url" => "Не верный ownCloud адрес",
+"Invalid ownCloud url" => "Неверный адрес ownCloud",
"Shared by" => "Опубликовано",
"This share is password-protected" => "Для доступа к информации необходимо ввести пароль",
"The password is wrong. Try again." => "Неверный пароль. Попробуйте еще раз.",
@@ -27,14 +27,14 @@ $TRANSLATIONS = array(
"Reasons might be:" => "Причиной может быть:",
"the item was removed" => "объект был удалён",
"the link expired" => "срок действия ссылки истёк",
-"sharing is disabled" => "доступ к информации заблокирован",
+"sharing is disabled" => "общий доступ отключён",
"For more info, please ask the person who sent this link." => "Для получения дополнительной информации, пожалуйста, свяжитесь с тем, кто отправил Вам эту ссылку.",
"Add to your ownCloud" => "Добавить в свой ownCloud",
"Download" => "Скачать",
"Download %s" => "Скачать %s",
"Direct link" => "Прямая ссылка",
"Remote Shares" => "Удалённые общие папки",
-"Allow other instances to mount public links shared from this server" => "Разрешить удалённым экземплярам монтировать публичные ссылки с данного сервера",
-"Allow users to mount public link shares" => "Разрешить пользователям монтировать ссылки на публичные папки"
+"Allow other instances to mount public links shared from this server" => "Разрешить другим экземплярам Owncloud монтировать ссылки, опубликованные на этом сервере",
+"Allow users to mount public link shares" => "Разрешить пользователям монтировать ссылки на общие папки"
);
$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/sl.php b/apps/files_sharing/l10n/sl.php
index 4ff883eee9d..a7aea4d49d6 100644
--- a/apps/files_sharing/l10n/sl.php
+++ b/apps/files_sharing/l10n/sl.php
@@ -1,6 +1,7 @@
<?php
$TRANSLATIONS = array(
"Server to server sharing is not enabled on this server" => "Na tem strežniku ni omogočena možnost souporabe strežnika s strežnikom.",
+"The mountpoint name contains invalid characters." => "Ime točke priklopa vsebuje neveljavne znake.",
"Invalid or untrusted SSL certificate" => "Neveljavno oziroma nepotrjeno potrdilo SSL",
"Couldn't add remote share" => "Ni mogoče dodati oddaljenega mesta za souporabo",
"Shared with you" => "V souporabi z vami",
diff --git a/apps/files_sharing/lib/exceptions.php b/apps/files_sharing/lib/exceptions.php
new file mode 100644
index 00000000000..2a57a69a95f
--- /dev/null
+++ b/apps/files_sharing/lib/exceptions.php
@@ -0,0 +1,32 @@
+<?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/>.
+ *
+ */
+
+namespace OCA\Files_Sharing\Exceptions;
+
+/**
+ * Expected path with a different root
+ * Possible Error Codes:
+ * 10 - Path not relative to data/ and point to the users file directory
+
+ */
+class BrokenPath extends \Exception {
+}
diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php
index 2ae7fdc16ab..dacdb9308be 100644
--- a/apps/files_sharing/lib/share/file.php
+++ b/apps/files_sharing/lib/share/file.php
@@ -38,7 +38,7 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
// FIXME: attributes should not be set here,
// keeping this pattern for now to avoid unexpected
// regressions
- $this->path = basename($path);
+ $this->path = \OC\Files\Filesystem::normalizePath(basename($path));
return true;
}
return false;
@@ -57,7 +57,7 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
* create unique target
* @param string $filePath
* @param string $shareWith
- * @param string $exclude
+ * @param array $exclude (optional)
* @return string
*/
public function generateTarget($filePath, $shareWith, $exclude = null) {
@@ -83,10 +83,7 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
}
}
- $excludeList = \OCP\Share::getItemsSharedWithUser('file', $shareWith, self::FORMAT_TARGET_NAMES);
- if (is_array($exclude)) {
- $excludeList = array_merge($excludeList, $exclude);
- }
+ $excludeList = (is_array($exclude)) ? $exclude : array();
return \OCA\Files_Sharing\Helper::generateUniqueTarget($target, $excludeList, $view);
}
diff --git a/apps/files_sharing/lib/sharedmount.php b/apps/files_sharing/lib/sharedmount.php
index 564ac43ec74..4ad2d4e6b3e 100644
--- a/apps/files_sharing/lib/sharedmount.php
+++ b/apps/files_sharing/lib/sharedmount.php
@@ -58,7 +58,7 @@ class SharedMount extends Mount implements MoveableMount {
* update fileTarget in the database if the mount point changed
* @param string $newPath
* @param array $share reference to the share which should be modified
- * @return type
+ * @return bool
*/
private static function updateFileTarget($newPath, &$share) {
// if the user renames a mount point from a group share we need to create a new db entry
@@ -91,7 +91,7 @@ class SharedMount extends Mount implements MoveableMount {
* @param string $path the absolute path
* @return string e.g. turns '/admin/files/test.txt' into '/test.txt'
*/
- private function stripUserFilesPath($path) {
+ protected function stripUserFilesPath($path) {
$trimmed = ltrim($path, '/');
$split = explode('/', $trimmed);
@@ -99,8 +99,8 @@ class SharedMount extends Mount implements MoveableMount {
if (count($split) < 3 || $split[1] !== 'files') {
\OCP\Util::writeLog('file sharing',
'Can not strip userid and "files/" from path: ' . $path,
- \OCP\Util::DEBUG);
- return false;
+ \OCP\Util::ERROR);
+ throw new \OCA\Files_Sharing\Exceptions\BrokenPath('Path does not start with /user/files', 10);
}
// skip 'user' and 'files'
@@ -121,7 +121,15 @@ class SharedMount extends Mount implements MoveableMount {
$relTargetPath = $this->stripUserFilesPath($target);
$share = $this->storage->getShare();
- $result = $this->updateFileTarget($relTargetPath, $share);
+ $result = true;
+
+ if (!empty($share['grouped'])) {
+ foreach ($share['grouped'] as $s) {
+ $result = $this->updateFileTarget($relTargetPath, $s) && $result;
+ }
+ } else {
+ $result = $this->updateFileTarget($relTargetPath, $share) && $result;
+ }
if ($result) {
$this->setMountPoint($target);
@@ -144,8 +152,9 @@ class SharedMount extends Mount implements MoveableMount {
*/
public function removeMount() {
$mountManager = \OC\Files\Filesystem::getMountManager();
+ /** @var \OC\Files\Storage\Shared */
$storage = $this->getStorage();
- $result = \OCP\Share::unshareFromSelf($storage->getItemType(), $storage->getMountPoint());
+ $result = $storage->unshareStorage();
$mountManager->removeMount($this->mountPoint);
return $result;
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index 07f6b9da10c..a2b485a2ca1 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -532,4 +532,21 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
return null;
}
+ /**
+ * unshare complete storage, also the grouped shares
+ *
+ * @return bool
+ */
+ public function unshareStorage() {
+ $result = true;
+ if (!empty($this->share['grouped'])) {
+ foreach ($this->share['grouped'] as $share) {
+ $result = $result && \OCP\Share::unshareFromSelf($share['item_type'], $share['file_target']);
+ }
+ }
+ $result = $result && \OCP\Share::unshareFromSelf($this->getItemType(), $this->getMountPoint());
+
+ return $result;
+ }
+
}
diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php
index a4b3289d4c6..46bf90b1b41 100644
--- a/apps/files_sharing/templates/public.php
+++ b/apps/files_sharing/templates/public.php
@@ -1,5 +1,8 @@
<?php /** @var $l OC_L10N */ ?>
-<?php $thumbSize=1024; ?>
+<?php
+$thumbSize=1024;
+$previewSupported = OC\Preview::isMimeSupported($_['mimetype']) ? 'true' : 'false';
+?>
<?php if ( \OC\Preview::isMimeSupported($_['mimetype'])): /* This enables preview images for links (e.g. on Facebook, Google+, ...)*/?>
<link rel="image_src" href="<?php p(OCP\Util::linkToRoute( 'core_ajax_public_preview', array('x' => $thumbSize, 'y' => $thumbSize, 'file' => $_['directory_path'], 't' => $_['dirToken']))); ?>" />
<?php endif; ?>
@@ -15,6 +18,10 @@
<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">
+<input type="hidden" name="previewSupported" value="<?php p($previewSupported); ?>" id="previewSupported">
+<input type="hidden" name="mimetypeIcon" value="<?php p(OC_Helper::mimetypeIcon($_['mimetype'])); ?>" id="mimetypeIcon">
+
+
<header><div id="header" class="<?php p((isset($_['folder']) ? 'share-folder' : 'share-file')) ?>">
<a href="<?php print_unescaped(link_to('', 'index.php')); ?>"
title="" id="owncloud">
@@ -47,23 +54,15 @@
<?php if (isset($_['folder'])): ?>
<?php print_unescaped($_['folder']); ?>
<?php else: ?>
- <?php if (substr($_['mimetype'], 0, strpos($_['mimetype'], '/')) == 'image'): ?>
- <div id="imgframe">
- </div>
- <?php elseif (substr($_['mimetype'], 0, strpos($_['mimetype'], '/')) == 'video'): ?>
+ <?php if (substr($_['mimetype'], 0, strpos($_['mimetype'], '/')) == 'video'): ?>
<div id="imgframe">
<video tabindex="0" controls="" preload="none">
<source src="<?php p($_['downloadURL']); ?>" type="<?php p($_['mimetype']); ?>" />
</video>
</div>
<?php else: ?>
- <div id="imgframe">
- <?php $size = \OC\Preview::isMimeSupported($_['mimetype']) ? 500 : 128 ?>
- <img
- src="<?php p(OCP\Util::linkToRoute( 'core_ajax_public_preview', array('x' => $size, 'y' => $size, 'file' => $_['directory_path'], 't' => $_['dirToken']))); ?>"
- class="publicpreview"
- alt="" />
- </div>
+ <!-- Preview frame is filled via JS to support SVG images for modern browsers -->
+ <div id="imgframe"></div>
<?php endif; ?>
<div class="directDownload">
<a href="<?php p($_['downloadURL']); ?>" id="download" class="button">
diff --git a/apps/files_sharing/tests/base.php b/apps/files_sharing/tests/base.php
index 34ec4a36ede..738ba3493ba 100644
--- a/apps/files_sharing/tests/base.php
+++ b/apps/files_sharing/tests/base.php
@@ -35,6 +35,8 @@ abstract class Test_Files_Sharing_Base extends \PHPUnit_Framework_TestCase {
const TEST_FILES_SHARING_API_USER2 = "test-share-user2";
const TEST_FILES_SHARING_API_USER3 = "test-share-user3";
+ const TEST_FILES_SHARING_API_GROUP1 = "test-share-group1";
+
public $stateFilesEncryption;
public $filename;
public $data;
@@ -60,6 +62,10 @@ abstract class Test_Files_Sharing_Base extends \PHPUnit_Framework_TestCase {
self::loginHelper(self::TEST_FILES_SHARING_API_USER2, true);
self::loginHelper(self::TEST_FILES_SHARING_API_USER3, true);
+ // create group
+ \OC_Group::createGroup(self::TEST_FILES_SHARING_API_GROUP1);
+ \OC_Group::addToGroup(self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_GROUP1);
+
}
function setUp() {
@@ -86,6 +92,9 @@ abstract class Test_Files_Sharing_Base extends \PHPUnit_Framework_TestCase {
} else {
\OC_App::disable('files_encryption');
}
+
+ $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share`');
+ $query->execute();
}
public static function tearDownAfterClass() {
@@ -94,6 +103,9 @@ abstract class Test_Files_Sharing_Base extends \PHPUnit_Framework_TestCase {
\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);
+
+ // delete group
+ \OC_Group::deleteGroup(self::TEST_FILES_SHARING_API_GROUP1);
}
/**
diff --git a/apps/files_sharing/tests/share.php b/apps/files_sharing/tests/share.php
index 31246c5df44..fe80cfca781 100644
--- a/apps/files_sharing/tests/share.php
+++ b/apps/files_sharing/tests/share.php
@@ -57,6 +57,10 @@ class Test_Files_Sharing extends Test_Files_Sharing_Base {
self::$tempStorage = null;
+ // clear database table
+ $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share`');
+ $query->execute();
+
parent::tearDown();
}
@@ -68,10 +72,6 @@ class Test_Files_Sharing extends Test_Files_Sharing_Base {
$fileinfo = $this->view->getFileInfo($this->filename);
- $pathinfo = pathinfo($this->filename);
-
- $duplicate = '/' . $pathinfo['filename'] . ' (2).' . $pathinfo['extension'];
-
$result = \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
\Test_Files_Sharing::TEST_FILES_SHARING_API_USER2, 31);
@@ -84,47 +84,146 @@ class Test_Files_Sharing extends Test_Files_Sharing_Base {
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
$this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
- $this->assertTrue(\OC\Files\Filesystem::file_exists($duplicate));
self::loginHelper(self::TEST_FILES_SHARING_API_USER3);
$this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
- $this->assertFalse(\OC\Files\Filesystem::file_exists($duplicate));
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
\OC\Files\Filesystem::unlink($this->filename);
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
+ // both group share and user share should be gone
$this->assertFalse(\OC\Files\Filesystem::file_exists($this->filename));
- $this->assertTrue(\OC\Files\Filesystem::file_exists($duplicate));
// for user3 nothing should change
self::loginHelper(self::TEST_FILES_SHARING_API_USER3);
$this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
- $this->assertFalse(\OC\Files\Filesystem::file_exists($duplicate));
+ }
+
+ /**
+ * if a file was shared as group share and as individual share they should be grouped
+ */
+ function testGroupingOfShares() {
+
+ $fileinfo = $this->view->getFileInfo($this->filename);
+
+ $result = \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP,
+ \Test_Files_Sharing::TEST_FILES_SHARING_API_GROUP1, \OCP\PERMISSION_READ);
+
+ $this->assertTrue($result);
+
+ $result = \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ \Test_Files_Sharing::TEST_FILES_SHARING_API_USER2, \OCP\PERMISSION_UPDATE);
+
+ $this->assertTrue($result);
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
- \OC\Files\Filesystem::unlink($duplicate);
- self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
- $this->assertFalse(\OC\Files\Filesystem::file_exists($this->filename));
- $this->assertFalse(\OC\Files\Filesystem::file_exists($duplicate));
- // for user3 nothing should change
- self::loginHelper(self::TEST_FILES_SHARING_API_USER3);
- $this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename));
- $this->assertFalse(\OC\Files\Filesystem::file_exists($duplicate));
+ $result = \OCP\Share::getItemSharedWith('file', null);
+
+ $this->assertTrue(is_array($result));
+
+ // test should return exactly one shares created from testCreateShare()
+ $this->assertSame(1, count($result));
+
+ $share = reset($result);
+ $this->assertSame(\OCP\PERMISSION_READ | \OCP\PERMISSION_UPDATE, $share['permissions']);
+
+ \OC\Files\Filesystem::rename($this->filename, $this->filename . '-renamed');
+
+ $result = \OCP\Share::getItemSharedWith('file', null);
+
+ $this->assertTrue(is_array($result));
+
+ // test should return exactly one shares created from testCreateShare()
+ $this->assertSame(1, count($result));
+
+ $share = reset($result);
+ $this->assertSame(\OCP\PERMISSION_READ | \OCP\PERMISSION_UPDATE, $share['permissions']);
+ $this->assertSame($this->filename . '-renamed', $share['file_target']);
- //cleanup
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
- \OCP\Share::unshare('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP,
- 'testGroup');
- \OCP\Share::unshare('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
- self::TEST_FILES_SHARING_API_USER2);
- \OC_Group::removeFromGroup(self::TEST_FILES_SHARING_API_USER2, 'testGroup');
- \OC_Group::removeFromGroup(self::TEST_FILES_SHARING_API_USER2, 'testGroup');
- \OC_Group::deleteGroup('testGroup');
+ // unshare user share
+ $result = \OCP\Share::unshare('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ \Test_Files_Sharing::TEST_FILES_SHARING_API_USER2);
+ $this->assertTrue($result);
+
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
+
+ $result = \OCP\Share::getItemSharedWith('file', null);
+
+ $this->assertTrue(is_array($result));
+
+ // test should return the remaining group share
+ $this->assertSame(1, count($result));
+
+ $share = reset($result);
+ // only the group share permissions should be available now
+ $this->assertSame(\OCP\PERMISSION_READ, $share['permissions']);
+ $this->assertSame($this->filename . '-renamed', $share['file_target']);
}
+ /**
+ * user1 share file to a group and to a user2 in the same group. Then user2
+ * unshares the file from self. Afterwards user1 should no longer see the
+ * single user share to user2. If he re-shares the file to user2 the same target
+ * then the group share should be used to group the item
+ */
+ function testShareAndUnshareFromSelf() {
+ $fileinfo = $this->view->getFileInfo($this->filename);
+
+ // share the file to group1 (user2 is a member of this group) and explicitely to user2
+ \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1, \OCP\PERMISSION_ALL);
+ \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\PERMISSION_ALL);
+
+ // user1 should have to shared files
+ $shares = \OCP\Share::getItemsShared('file');
+ $this->assertSame(2, count($shares));
+
+ // user2 should have two files "welcome.txt" and the shared file,
+ // both the group share and the single share of the same file should be
+ // grouped to one file
+ \Test_Files_Sharing::loginHelper(self::TEST_FILES_SHARING_API_USER2);
+ $dirContent = \OC\Files\Filesystem::getDirectoryContent('/');
+ $this->assertSame(2, count($dirContent));
+ $this->verifyDirContent($dirContent, array('welcome.txt', ltrim($this->filename, '/')));
+
+ // now user2 deletes the share (= unshare from self)
+ \OC\Files\Filesystem::unlink($this->filename);
+
+ // only welcome.txt should exists
+ $dirContent = \OC\Files\Filesystem::getDirectoryContent('/');
+ $this->assertSame(1, count($dirContent));
+ $this->verifyDirContent($dirContent, array('welcome.txt'));
+
+ // login as user1...
+ \Test_Files_Sharing::loginHelper(self::TEST_FILES_SHARING_API_USER1);
+
+ // ... now user1 should have only one shared file, the group share
+ $shares = \OCP\Share::getItemsShared('file');
+ $this->assertSame(1, count($shares));
+
+ // user1 shares a gain the file directly to user2
+ \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\PERMISSION_ALL);
+
+ // user2 should see again welcome.txt and the shared file
+ \Test_Files_Sharing::loginHelper(self::TEST_FILES_SHARING_API_USER2);
+ $dirContent = \OC\Files\Filesystem::getDirectoryContent('/');
+ $this->assertSame(2, count($dirContent));
+ $this->verifyDirContent($dirContent, array('welcome.txt', ltrim($this->filename, '/')));
+
+
+ }
+
+ function verifyDirContent($content, $expected) {
+ foreach ($content as $c) {
+ if (!in_array($c['name'], $expected)) {
+ $this->assertTrue(false, "folder should only contain '" . implode(',', $expected) . "', found: " .$c['name']);
+ }
+ }
+ }
+
function testShareWithDifferentShareFolder() {
$fileinfo = $this->view->getFileInfo($this->filename);
@@ -146,12 +245,6 @@ class Test_Files_Sharing extends Test_Files_Sharing_Base {
$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');
}
@@ -173,18 +266,14 @@ class Test_Files_Sharing extends Test_Files_Sharing_Base {
$this->assertTrue(is_array($result));
// test should return exactly one shares created from testCreateShare()
- $this->assertTrue(count($result) === 1);
+ $this->assertSame(1, count($result), 'more then one share found');
$share = reset($result);
$this->assertSame($expectedPermissions, $share['permissions']);
-
- \OCP\Share::unshare('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
- \Test_Files_Sharing::TEST_FILES_SHARING_API_USER2);
}
function DataProviderTestFileSharePermissions() {
$permission1 = \OCP\PERMISSION_ALL;
- $permission2 = \OCP\PERMISSION_DELETE;
$permission3 = \OCP\PERMISSION_READ;
$permission4 = \OCP\PERMISSION_READ | \OCP\PERMISSION_UPDATE;
$permission5 = \OCP\PERMISSION_READ | \OCP\PERMISSION_DELETE;
@@ -192,7 +281,6 @@ class Test_Files_Sharing extends Test_Files_Sharing_Base {
return array(
array($permission1, \OCP\PERMISSION_ALL & ~\OCP\PERMISSION_DELETE),
- array($permission2, 0),
array($permission3, $permission3),
array($permission4, $permission4),
array($permission5, $permission3),
diff --git a/apps/files_sharing/tests/sharedmount.php b/apps/files_sharing/tests/sharedmount.php
index f8c65734184..ac910944f9f 100644
--- a/apps/files_sharing/tests/sharedmount.php
+++ b/apps/files_sharing/tests/sharedmount.php
@@ -194,4 +194,41 @@ class Test_Files_Sharing_Mount extends Test_Files_Sharing_Base {
\OC_Group::removeFromGroup(self::TEST_FILES_SHARING_API_USER3, 'testGroup');
}
+ /**
+ * @dataProvider dataProviderTestStripUserFilesPath
+ * @param string $path
+ * @param string $expectedResult
+ * @param bool $exception if a exception is expected
+ */
+ function testStripUserFilesPath($path, $expectedResult, $exception) {
+ $testClass = new DummyTestClassSharedMount(null, null);
+ try {
+ $result = $testClass->stripUserFilesPathDummy($path);
+ $this->assertSame($expectedResult, $result);
+ } catch (\Exception $e) {
+ if ($exception) {
+ $this->assertSame(10, $e->getCode());
+ } else {
+ $this->assertTrue(false, "Exception catched, but expected: " . $expectedResult);
+ }
+ }
+ }
+
+ function dataProviderTestStripUserFilesPath() {
+ return array(
+ array('/user/files/foo.txt', '/foo.txt', false),
+ array('/user/files/folder/foo.txt', '/folder/foo.txt', false),
+ array('/data/user/files/foo.txt', null, true),
+ array('/data/user/files/', null, true),
+ array('/files/foo.txt', null, true),
+ array('/foo.txt', null, true),
+ );
+ }
+
+}
+
+class DummyTestClassSharedMount extends \OCA\Files_Sharing\SharedMount {
+ public function stripUserFilesPathDummy($path) {
+ return $this->stripUserFilesPath($path);
+ }
}
diff --git a/apps/user_ldap/appinfo/register_command.php b/apps/user_ldap/appinfo/register_command.php
index 10d992531c4..639597fdb83 100644
--- a/apps/user_ldap/appinfo/register_command.php
+++ b/apps/user_ldap/appinfo/register_command.php
@@ -9,3 +9,4 @@
$application->add(new OCA\user_ldap\Command\ShowConfig());
$application->add(new OCA\user_ldap\Command\SetConfig());
$application->add(new OCA\user_ldap\Command\TestConfig());
+$application->add(new OCA\user_ldap\Command\CreateEmptyConfig());
diff --git a/apps/user_ldap/command/createemptyconfig.php b/apps/user_ldap/command/createemptyconfig.php
new file mode 100644
index 00000000000..32010825361
--- /dev/null
+++ b/apps/user_ldap/command/createemptyconfig.php
@@ -0,0 +1,51 @@
+<?php
+/**
+ * Copyright (c) 2014 Martin Konrad <info@martin-konrad.net>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OCA\user_ldap\Command;
+
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+use \OCA\user_ldap\lib\Helper;
+use \OCA\user_ldap\lib\Configuration;
+
+class CreateEmptyConfig extends Command {
+
+ protected function configure() {
+ $this
+ ->setName('ldap:create-empty-config')
+ ->setDescription('creates an empty LDAP configuration')
+ ;
+ }
+
+
+ protected function execute(InputInterface $input, OutputInterface $output) {
+ $configPrefix = $this->getNewConfigurationPrefix();
+ $output->writeln("Created new configuration with configID '{$configPrefix}'");
+
+ $configHolder = new Configuration($configPrefix);
+ $configHolder->saveConfiguration();
+ }
+
+ protected function getNewConfigurationPrefix() {
+ $serverConnections = Helper::getServerConfigurationPrefixes();
+
+ // first connection uses no prefix
+ if(sizeof($serverConnections) == 0) {
+ return '';
+ }
+
+ sort($serverConnections);
+ $lastKey = array_pop($serverConnections);
+ $lastNumber = intval(str_replace('s', '', $lastKey));
+ $nextPrefix = 's' . str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT);
+ return $nextPrefix;
+ }
+}
diff --git a/apps/user_ldap/l10n/es.php b/apps/user_ldap/l10n/es.php
index ce9a346d8b4..f58efd3a4d9 100644
--- a/apps/user_ldap/l10n/es.php
+++ b/apps/user_ldap/l10n/es.php
@@ -35,7 +35,7 @@ $TRANSLATIONS = array(
"Could not find the desired feature" => "No se puede encontrar la función deseada.",
"Invalid Host" => "Host inválido",
"Server" => "Servidor",
-"User Filter" => "Filtro de Usuario",
+"User Filter" => "Filtro de usuario",
"Login Filter" => "Filtro de Login",
"Group Filter" => "Filtro de grupo",
"Save" => "Guardar",
diff --git a/apps/user_ldap/l10n/fy_NL.php b/apps/user_ldap/l10n/fy_NL.php
new file mode 100644
index 00000000000..3a1e002311c
--- /dev/null
+++ b/apps/user_ldap/l10n/fy_NL.php
@@ -0,0 +1,6 @@
+<?php
+$TRANSLATIONS = array(
+"_%s group found_::_%s groups found_" => array("",""),
+"_%s user found_::_%s users found_" => array("","")
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/user_ldap/l10n/tg_TJ.php b/apps/user_ldap/l10n/tg_TJ.php
new file mode 100644
index 00000000000..3a1e002311c
--- /dev/null
+++ b/apps/user_ldap/l10n/tg_TJ.php
@@ -0,0 +1,6 @@
+<?php
+$TRANSLATIONS = array(
+"_%s group found_::_%s groups found_" => array("",""),
+"_%s user found_::_%s users found_" => array("","")
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/user_ldap/l10n/tl_PH.php b/apps/user_ldap/l10n/tl_PH.php
new file mode 100644
index 00000000000..2371ee70593
--- /dev/null
+++ b/apps/user_ldap/l10n/tl_PH.php
@@ -0,0 +1,6 @@
+<?php
+$TRANSLATIONS = array(
+"_%s group found_::_%s groups found_" => array("",""),
+"_%s user found_::_%s users found_" => array("","")
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n > 1);";
diff --git a/config/config.sample.php b/config/config.sample.php
index 88a52be0335..48f0af9c99d 100755
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -303,7 +303,10 @@ $CONFIG = array(
* - OC\Preview\SVG
* - OC\Preview\Movies
* - OC\Preview\PDF
- * - OC\Preview\Tiff
+ * - OC\Preview\TIFF
+ * - OC\Preview\Illustrator
+ * - OC\Preview\Postscript
+ * - OC\Preview\Photoshop
*/
'enabledPreviewProviders' => array(
'OC\Preview\Image',
diff --git a/core/ajax/preview.php b/core/ajax/preview.php
index d2811f39dd6..56ef5ea847b 100644
--- a/core/ajax/preview.php
+++ b/core/ajax/preview.php
@@ -6,6 +6,7 @@
* See the COPYING-README file.
*/
\OC_Util::checkLoggedIn();
+\OC::$server->getSession()->close();
$file = array_key_exists('file', $_GET) ? (string)$_GET['file'] : '';
$maxX = array_key_exists('x', $_GET) ? (int)$_GET['x'] : '36';
diff --git a/core/l10n/bg_BG.php b/core/l10n/bg_BG.php
index 2e0cb374cff..70eb05afd16 100644
--- a/core/l10n/bg_BG.php
+++ b/core/l10n/bg_BG.php
@@ -88,6 +88,7 @@ $TRANSLATIONS = array(
"Send" => "Изпрати",
"Set expiration date" => "Посочи дата на изтичане",
"Expiration date" => "Дата на изтичане",
+"Adding user..." => "Добавяне на потребител...",
"group" => "група",
"Resharing is not allowed" => "Повторно споделяне не е разрешено.",
"Shared in {item} with {user}" => "Споделено в {item} с {user}.",
diff --git a/core/l10n/ca.php b/core/l10n/ca.php
index 5b397766be1..8f23961feff 100644
--- a/core/l10n/ca.php
+++ b/core/l10n/ca.php
@@ -68,6 +68,7 @@ $TRANSLATIONS = array(
"Strong password" => "Contrasenya forta",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "El servidor web no està configurat correctament per permetre la sincronització de fitxers perquè la interfície WebDAV sembla no funcionar correctament.",
"This server has no working internet connection. This means that some of the features like mounting of external storage, notifications about updates or installation of 3rd party apps don´t work. Accessing files from remote and sending of notification emails might also not work. We suggest to enable internet connection for this server if you want to have all features." => "Aquest servidor no té cap connexió a internet que funcioni. Això significa que algunes de les característiques com el muntatge d'emmagatzemament extern, les notificacions quant a actualitzacions o la instal·lació d'aplicacions de tercers no funcionarà. L'accés remot a fitxers i l'enviament de correus electrònics podria tampoc no funcionar. Us suggerim que habiliteu la connexió a internet per aquest servidor si voleu tenir totes les característiques.",
+"Error occurred while checking server setup" => "Hi ha hagut un error en comprovar la configuració del servidor",
"Shared" => "Compartit",
"Shared with {recipients}" => "Compartit amb {recipients}",
"Share" => "Comparteix",
@@ -87,6 +88,7 @@ $TRANSLATIONS = array(
"Send" => "Envia",
"Set expiration date" => "Estableix la data de venciment",
"Expiration date" => "Data de venciment",
+"Adding user..." => "Afegint usuari...",
"group" => "grup",
"Resharing is not allowed" => "No es permet compartir de nou",
"Shared in {item} with {user}" => "Compartit en {item} amb {user}",
@@ -142,9 +144,19 @@ $TRANSLATIONS = array(
"Error favoriting" => "Error en posar a preferits",
"Error unfavoriting" => "Error en treure de preferits",
"Access forbidden" => "Accés prohibit",
+"File not found" => "No s'ha trobat l'arxiu",
+"The specified document has not been found on the server." => "El document especificat no s'ha trobat al servidor.",
+"You can click here to return to %s." => "Pots clicar aquí per tornar a %s.",
"Hey there,\n\njust letting you know that %s shared %s with you.\nView it: %s\n\n" => "Ei,\n\nnomés fer-te saber que %s ha compartit %s amb tu.\nMira-ho a: %s\n\n",
"The share will expire on %s." => "La compartició venç el %s.",
"Cheers!" => "Salut!",
+"The server encountered an internal error and was unable to complete your request." => "El servidor ha trobat un error intern i no pot finalitzar la teva petició.",
+"More details can be found in the server log." => "Pots trobar més detalls al llistat del servidor.",
+"Technical details" => "Detalls tècnics",
+"Remote Address: %s" => "Adreça remota: %s",
+"Code: %s" => "Codi: %s",
+"Message: %s" => "Missatge: %s",
+"File: %s" => "Fitxer: %s",
"Security Warning" => "Avís de seguretat",
"Your PHP version is vulnerable to the NULL Byte attack (CVE-2006-7243)" => "La versió de PHP que useu és vulnerable a l'atac per NULL Byte (CVE-2006-7243)",
"Please update your PHP installation to use %s securely." => "Actualitzeu la instal·lació de PHP per usar %s de forma segura.",
diff --git a/core/l10n/cs_CZ.php b/core/l10n/cs_CZ.php
index 90a217d3bda..79ac796e611 100644
--- a/core/l10n/cs_CZ.php
+++ b/core/l10n/cs_CZ.php
@@ -88,6 +88,7 @@ $TRANSLATIONS = array(
"Send" => "Odeslat",
"Set expiration date" => "Nastavit datum vypršení platnosti",
"Expiration date" => "Datum vypršení platnosti",
+"Adding user..." => "Přidávám uživatele...",
"group" => "skupina",
"Resharing is not allowed" => "Sdílení již sdílené položky není povoleno",
"Shared in {item} with {user}" => "Sdíleno v {item} s {user}",
@@ -144,11 +145,12 @@ $TRANSLATIONS = array(
"Error unfavoriting" => "Chyba při odznačování jako oblíbené",
"Access forbidden" => "Přístup zakázán",
"File not found" => "Soubor nenalezen",
-"The specified document has not been found on the server." => "Vybraný dokument nebyl na serveru nalezen.",
-"You can click here to return to %s." => "Kliknout zde pro návrat na %s.",
+"The specified document has not been found on the server." => "Požadovaný dokument nebyl na serveru nalezen.",
+"You can click here to return to %s." => "Klikněte zde pro návrat na %s.",
"Hey there,\n\njust letting you know that %s shared %s with you.\nView it: %s\n\n" => "Hej ty tam,\n\njen ti chci dát vědět, že %s sdílel %s s tebou.\nZobraz si to: %s\n\n",
"The share will expire on %s." => "Sdílení vyprší %s.",
"Cheers!" => "Ať slouží!",
+"The server encountered an internal error and was unable to complete your request." => "Server zaznamenal interní chybu a nebyl schopen dokončit váš požadavek.",
"Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report." => "Kontaktujte prosím administrátora serveru, pokud se bude tato chyba opakovat. Připojte do svého hlášení níže zobrazené technické detaily.",
"More details can be found in the server log." => "Více podrobností k nalezení v serverovém logu.",
"Technical details" => "Technické detaily",
diff --git a/core/l10n/de.php b/core/l10n/de.php
index 67d110c7ea1..ada6e70080d 100644
--- a/core/l10n/de.php
+++ b/core/l10n/de.php
@@ -88,7 +88,7 @@ $TRANSLATIONS = array(
"Send" => "Senden",
"Set expiration date" => "Setze ein Ablaufdatum",
"Expiration date" => "Ablaufdatum",
-"Adding user..." => "Füge Nutzer hinzu...",
+"Adding user..." => "Benutzer wird hinzugefügt …",
"group" => "Gruppe",
"Resharing is not allowed" => "Weiterverteilen ist nicht erlaubt",
"Shared in {item} with {user}" => "Für {user} in {item} freigegeben",
diff --git a/core/l10n/de_DE.php b/core/l10n/de_DE.php
index 8d242a1047c..84d15a31de7 100644
--- a/core/l10n/de_DE.php
+++ b/core/l10n/de_DE.php
@@ -88,7 +88,7 @@ $TRANSLATIONS = array(
"Send" => "Senden",
"Set expiration date" => "Ein Ablaufdatum setzen",
"Expiration date" => "Ablaufdatum",
-"Adding user..." => "Füge Nutzer hinzu...",
+"Adding user..." => "Benutzer wird hinzugefügt …",
"group" => "Gruppe",
"Resharing is not allowed" => "Das Weiterverteilen ist nicht erlaubt",
"Shared in {item} with {user}" => "Freigegeben in {item} von {user}",
diff --git a/core/l10n/fr.php b/core/l10n/fr.php
index c378183ad1d..4319e3915bc 100644
--- a/core/l10n/fr.php
+++ b/core/l10n/fr.php
@@ -88,6 +88,7 @@ $TRANSLATIONS = array(
"Send" => "Envoyer",
"Set expiration date" => "Spécifier la date d'expiration",
"Expiration date" => "Date d'expiration",
+"Adding user..." => "Utilisateur en cours d'ajout...",
"group" => "groupe",
"Resharing is not allowed" => "Le repartage n'est pas autorisé",
"Shared in {item} with {user}" => "Partagé dans {item} avec {user}",
diff --git a/core/l10n/fy_NL.php b/core/l10n/fy_NL.php
new file mode 100644
index 00000000000..aff098dff1f
--- /dev/null
+++ b/core/l10n/fy_NL.php
@@ -0,0 +1,5 @@
+<?php
+$TRANSLATIONS = array(
+"_{count} file conflict_::_{count} file conflicts_" => array("","")
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/core/l10n/ia.php b/core/l10n/ia.php
index be244b04828..941f831c01c 100644
--- a/core/l10n/ia.php
+++ b/core/l10n/ia.php
@@ -1,11 +1,17 @@
<?php
$TRANSLATIONS = array(
+"Couldn't send mail to following users: %s " => "On non pote inviar message de e-posta a le usatores sequente: %s",
"Turned on maintenance mode" => "Activate modo de mantenentia",
"Turned off maintenance mode" => "De-activar modo de mantenentia",
"Updated database" => "Base de datos actualisate",
+"Checked database schema update" => "Il ha verificate actualisation de schema de base de datos",
+"Checked database schema update for apps" => "Il ha verificate actualisation de schema de base de datos pro apps",
+"Updated \"%s\" to %s" => "Actualisava \"%s\" a %s",
+"Disabled incompatible apps: %s" => "Apps non compatibile ha essite dishabilitate: %s",
"No image or file provided" => "Il forniva necun imagine o file",
"Unknown filetype" => "Typo de file incognite",
"Invalid image" => "Imagine invalide",
+"No temporary profile picture available, try again" => "Necun photo de profilo temporanee disponibile, essaya novemente",
"Sunday" => "Dominica",
"Monday" => "Lunedi",
"Tuesday" => "Martedi",
@@ -31,6 +37,7 @@ $TRANSLATIONS = array(
"Image" => "Imagine",
"Audio" => "Audio",
"Saving..." => "Salveguardante...",
+"Couldn't send reset email. Please contact your administrator." => "On non pote inviar message de configurar ex novo. Pro favor continge tu administrator.",
"I know what I'm doing" => "Io sape lo que io es facente",
"Reset password" => "Reinitialisar contrasigno",
"Password can not be changed. Please contact your administrator." => "Contrasigno non pote esser modificate. Pro favor continge tu administrator.",
@@ -51,7 +58,9 @@ $TRANSLATIONS = array(
"So-so password" => "Contrasigno passabile",
"Good password" => "Contrasigno bon",
"Strong password" => "Contrasigno forte",
+"Error occurred while checking server setup" => "Un error occurreva quando on verificava le configuration de le servitor.",
"Shared" => "Compartite",
+"Shared with {recipients}" => "Compatite con {recipients}",
"Share" => "Compartir",
"Error" => "Error",
"Error while sharing" => "Error quando on compartiva",
@@ -68,6 +77,7 @@ $TRANSLATIONS = array(
"Send" => "Invia",
"Set expiration date" => "Fixa data de expiration",
"Expiration date" => "Data de expiration",
+"Adding user..." => "Addente usator...",
"group" => "gruppo",
"Resharing is not allowed" => "Il non es permittite compartir plus que un vice",
"Shared in {item} with {user}" => "Compartite in {item} con {user}",
@@ -91,10 +101,13 @@ $TRANSLATIONS = array(
"Add" => "Adder",
"Edit tags" => "Modifica etiquettas",
"Please reload the page." => "Pro favor recarga le pagina.",
+"The update was unsuccessful." => "Le actualisation esseva successose.",
"The update was successful. Redirecting you to ownCloud now." => "Le actualisation terminava con successo. On redirige nunc a tu ownCloud.",
"%s password reset" => "%s contrasigno re-fixate",
"Use the following link to reset your password: {link}" => "Usa le ligamine sequente pro re-fixar tu contrasigno: {link}",
+"You will receive a link to reset your password via Email." => "Tu recipera un ligamine pro re-configurar tu contrasigno via e-posta.",
"Username" => "Nomine de usator",
+"Yes, I really want to reset my password now" => "Si, io vermente vole re-configurar mi contrasigno nunc",
"Reset" => "Re-fixar",
"New password" => "Nove contrasigno",
"New Password" => "Nove contrasigno",
@@ -107,8 +120,18 @@ $TRANSLATIONS = array(
"Error loading tags" => "Error quando on cargava etiquettas",
"Tag already exists" => "Etiquetta ja existe",
"Access forbidden" => "Accesso prohibite",
+"File not found" => "File non trovate",
+"The specified document has not been found on the server." => "Le documento specificate non ha essite trovate sur le servitor.",
"The share will expire on %s." => "Le compartir expirara le %s.",
"Cheers!" => "Acclamationes!",
+"Technical details" => "Detalios technic",
+"Remote Address: %s" => "Adresse remote: %s",
+"Request ID: %s" => "ID de requesta: %s",
+"Code: %s" => "Codice: %s",
+"Message: %s" => "Message: %s",
+"File: %s" => "File: %s",
+"Line: %s" => "Rango: %s",
+"Trace" => "Tracia",
"Security Warning" => "Aviso de securitate",
"Please update your PHP installation to use %s securely." => "Pro favor actualisa tu installation de PHP pro usar %s con securitate.",
"Create an <strong>admin account</strong>" => "Crear un <strong>conto de administration</strong>",
@@ -127,6 +150,7 @@ $TRANSLATIONS = array(
"Log out" => "Clauder le session",
"Server side authentication failed!" => "Il falleva authentication de latere servitor!",
"Please contact your administrator." => "Pro favor continge tu administrator.",
+"Forgot your password? Reset it!" => "Tu oblidava tu contrasigno? Re-configura lo!",
"remember" => "memora",
"Log in" => "Aperir session",
"Alternative Logins" => "Accessos de autorisation alternative",
diff --git a/core/l10n/pt_PT.php b/core/l10n/pt_PT.php
index d6a940f6cfd..67bca0bb43c 100644
--- a/core/l10n/pt_PT.php
+++ b/core/l10n/pt_PT.php
@@ -87,6 +87,7 @@ $TRANSLATIONS = array(
"Send" => "Enviar",
"Set expiration date" => "Especificar data de expiração",
"Expiration date" => "Data de expiração",
+"Adding user..." => "A adicionar utilizador...",
"group" => "grupo",
"Resharing is not allowed" => "Não é permitido partilhar de novo",
"Shared in {item} with {user}" => "Partilhado em {item} com {user}",
@@ -148,6 +149,11 @@ $TRANSLATIONS = array(
"Hey there,\n\njust letting you know that %s shared %s with you.\nView it: %s\n\n" => "Olá,\n\napenas para informar que %s partilhou »%s« consigo.\nConsulte aqui: %s\n",
"The share will expire on %s." => "Esta partilha vai expirar em %s.",
"Cheers!" => "Parabéns!",
+"The server encountered an internal error and was unable to complete your request." => "O servidor encontrou um erro interno e não conseguiu concluir o seu pedido.",
+"Technical details" => "Detalhes técnicos",
+"Remote Address: %s" => "Endereço remoto: %s",
+"Message: %s" => "Mensagem: %s",
+"File: %s" => "Ficheiro: %s",
"Security Warning" => "Aviso de Segurança",
"Your PHP version is vulnerable to the NULL Byte attack (CVE-2006-7243)" => "A sua versão do PHP é vulnerável ao ataque Byte Null (CVE-2006-7243)",
"Please update your PHP installation to use %s securely." => "Por favor atualize a sua versão PHP instalada para usar o %s com segurança.",
diff --git a/core/l10n/ru.php b/core/l10n/ru.php
index ce8ab0ea96f..3528de072a2 100644
--- a/core/l10n/ru.php
+++ b/core/l10n/ru.php
@@ -88,6 +88,7 @@ $TRANSLATIONS = array(
"Send" => "Отправить",
"Set expiration date" => "Установить срок доступа",
"Expiration date" => "Дата окончания",
+"Adding user..." => "Добавляем пользователя...",
"group" => "группа",
"Resharing is not allowed" => "Общий доступ не разрешен",
"Shared in {item} with {user}" => "Общий доступ к {item} с {user}",
diff --git a/core/l10n/sl.php b/core/l10n/sl.php
index cc350690f4c..b6a7b9206f2 100644
--- a/core/l10n/sl.php
+++ b/core/l10n/sl.php
@@ -66,8 +66,9 @@ $TRANSLATIONS = array(
"So-so password" => "Slabo geslo",
"Good password" => "Dobro geslo",
"Strong password" => "Odlično geslo",
-"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Spletni stražnik še ni ustrezno nastavljen in ne omogoča usklajevanja, saj je nastavitev WebDAV okvarjena.",
-"This server has no working internet connection. This means that some of the features like mounting of external storage, notifications about updates or installation of 3rd party apps don´t work. Accessing files from remote and sending of notification emails might also not work. We suggest to enable internet connection for this server if you want to have all features." => "Na voljo ni delujoče internetne povezave. To pomeni, da nekaterih možnosti, kot so priklapljanje zunanje shrambe, obveščanja o posodobitvah in nameščanje programov tretje roke ni podprto. Dostop do datotek z oddaljenih mest in pošiljanje obvestil preko elektronske pošte je verjetno še vedno mogoče. Za omogočanje vseh zmožnosti mora biti vzpostavljena tudi ustrezna internetna povezava.",
+"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Spletni stražnik še ni ustrezno nastavljen in ne omogoča usklajevanja, saj je nastavitev vmesnika WebDAV okvarjena.",
+"This server has no working internet connection. This means that some of the features like mounting of external storage, notifications about updates or installation of 3rd party apps don´t work. Accessing files from remote and sending of notification emails might also not work. We suggest to enable internet connection for this server if you want to have all features." => "Na voljo ni delujoče internetne povezave. To pomeni, da nekaterih možnosti, kot so priklapljanje zunanje shrambe, obveščanja o posodobitvah in nameščanje programov tretje roke ni podprto. Dostop do datotek z oddaljenih mest in pošiljanje obvestil preko elektronske pošte prav tako verjetno ne deluje. Za omogočanje vseh zmožnosti mora biti vzpostavljena tudi ustrezna internetna povezava.",
+"Error occurred while checking server setup" => "Prišlo je do napake med preverjanjem nastavitev strežnika",
"Shared" => "V souporabi",
"Shared with {recipients}" => "V souporabi z {recipients}",
"Share" => "Souporaba",
@@ -87,6 +88,7 @@ $TRANSLATIONS = array(
"Send" => "Pošlji",
"Set expiration date" => "Nastavi datum preteka",
"Expiration date" => "Datum preteka",
+"Adding user..." => "Dodajanje uporabnika ...",
"group" => "skupina",
"Resharing is not allowed" => "Nadaljnja souporaba ni dovoljena",
"Shared in {item} with {user}" => "V souporabi v {item} z uporabnikom {user}",
@@ -148,6 +150,15 @@ $TRANSLATIONS = array(
"Hey there,\n\njust letting you know that %s shared %s with you.\nView it: %s\n\n" => "Pozdravljeni,\n\noseba %s vam je omogočila souporabo %s.\nVir si lahko ogledate: %s\n\n",
"The share will expire on %s." => "Povezava souporabe bo potekla %s.",
"Cheers!" => "Na zdravje!",
+"The server encountered an internal error and was unable to complete your request." => "Prišlo je do notranje napake, zato ni mogoče končati zahteve.",
+"More details can be found in the server log." => "Več podrobnosti je zabeleženih v dnevniku strežnika.",
+"Technical details" => "Tehnične podrobnosti",
+"Remote Address: %s" => "Oddaljen naslov: %s",
+"Request ID: %s" => "ID zahteve: %s",
+"Code: %s" => "Koda: %s",
+"Message: %s" => "Sporočilo: %s",
+"File: %s" => "Datoteka: %s",
+"Line: %s" => "Vrstica: %s",
"Security Warning" => "Varnostno opozorilo",
"Your PHP version is vulnerable to the NULL Byte attack (CVE-2006-7243)" => "Uporabljena različica PHP je ranljiva za napad NULL Byte (CVE-2006-7243)",
"Please update your PHP installation to use %s securely." => "Za varno uporabo storitve %s, je treba posodobiti namestitev PHP",
diff --git a/core/l10n/tg_TJ.php b/core/l10n/tg_TJ.php
new file mode 100644
index 00000000000..aff098dff1f
--- /dev/null
+++ b/core/l10n/tg_TJ.php
@@ -0,0 +1,5 @@
+<?php
+$TRANSLATIONS = array(
+"_{count} file conflict_::_{count} file conflicts_" => array("","")
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/core/l10n/tl_PH.php b/core/l10n/tl_PH.php
new file mode 100644
index 00000000000..e012fb1656e
--- /dev/null
+++ b/core/l10n/tl_PH.php
@@ -0,0 +1,5 @@
+<?php
+$TRANSLATIONS = array(
+"_{count} file conflict_::_{count} file conflicts_" => array("","")
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n > 1);";
diff --git a/l10n/templates/core.pot b/l10n/templates/core.pot
index 35477fb7b6f..23f38440711 100644
--- a/l10n/templates/core.pot
+++ b/l10n/templates/core.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-09-29 01:54-0400\n"
+"POT-Creation-Date: 2014-10-07 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -566,14 +566,14 @@ msgstr ""
msgid "New Password"
msgstr ""
-#: setup/controller.php:139
+#: setup/controller.php:144
#, php-format
msgid ""
"Mac OS X is not supported and %s will not work properly on this platform. "
"Use it at your own risk! "
msgstr ""
-#: setup/controller.php:143
+#: setup/controller.php:148
msgid "For the best results, please consider using a GNU/Linux server instead."
msgstr ""
diff --git a/l10n/templates/files.pot b/l10n/templates/files.pot
index 3ba2e61c8f4..65b3d72180e 100644
--- a/l10n/templates/files.pot
+++ b/l10n/templates/files.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-09-29 01:54-0400\n"
+"POT-Creation-Date: 2014-10-07 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files_encryption.pot b/l10n/templates/files_encryption.pot
index c21d1bbc2b5..5f7df8fdc1a 100644
--- a/l10n/templates/files_encryption.pot
+++ b/l10n/templates/files_encryption.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-09-29 01:54-0400\n"
+"POT-Creation-Date: 2014-10-07 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -130,31 +130,31 @@ msgstr ""
msgid "Repeat Recovery key password"
msgstr ""
-#: templates/settings-admin.php:22 templates/settings-personal.php:52
+#: templates/settings-admin.php:23 templates/settings-personal.php:53
msgid "Enabled"
msgstr ""
-#: templates/settings-admin.php:30 templates/settings-personal.php:60
+#: templates/settings-admin.php:32 templates/settings-personal.php:62
msgid "Disabled"
msgstr ""
-#: templates/settings-admin.php:35
+#: templates/settings-admin.php:37
msgid "Change recovery key password:"
msgstr ""
-#: templates/settings-admin.php:41
+#: templates/settings-admin.php:43
msgid "Old Recovery key password"
msgstr ""
-#: templates/settings-admin.php:48
+#: templates/settings-admin.php:50
msgid "New Recovery key password"
msgstr ""
-#: templates/settings-admin.php:54
+#: templates/settings-admin.php:56
msgid "Repeat New Recovery key password"
msgstr ""
-#: templates/settings-admin.php:59
+#: templates/settings-admin.php:61
msgid "Change Password"
msgstr ""
@@ -194,10 +194,10 @@ msgid ""
"files in case of password loss"
msgstr ""
-#: templates/settings-personal.php:61
+#: templates/settings-personal.php:63
msgid "File recovery settings updated"
msgstr ""
-#: templates/settings-personal.php:62
+#: templates/settings-personal.php:64
msgid "Could not update file recovery"
msgstr ""
diff --git a/l10n/templates/files_external.pot b/l10n/templates/files_external.pot
index 09f4c7834f3..32aa17f8943 100644
--- a/l10n/templates/files_external.pot
+++ b/l10n/templates/files_external.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-09-29 01:54-0400\n"
+"POT-Creation-Date: 2014-10-07 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files_sharing.pot b/l10n/templates/files_sharing.pot
index ff140e8bc06..2362f5bdac4 100644
--- a/l10n/templates/files_sharing.pot
+++ b/l10n/templates/files_sharing.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-09-29 01:54-0400\n"
+"POT-Creation-Date: 2014-10-07 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -33,15 +33,15 @@ msgstr ""
msgid "Couldn't add remote share"
msgstr ""
-#: appinfo/app.php:36 js/app.js:34
+#: appinfo/app.php:39 js/app.js:34
msgid "Shared with you"
msgstr ""
-#: appinfo/app.php:48 js/app.js:53
+#: appinfo/app.php:51 js/app.js:53
msgid "Shared with others"
msgstr ""
-#: appinfo/app.php:57 js/app.js:72
+#: appinfo/app.php:60 js/app.js:72
msgid "Shared by link"
msgstr ""
@@ -77,11 +77,11 @@ msgstr ""
msgid "Add remote share"
msgstr ""
-#: js/public.js:204
+#: js/public.js:213
msgid "No ownCloud installation found at {remote}"
msgstr ""
-#: js/public.js:205
+#: js/public.js:214
msgid "Invalid ownCloud url"
msgstr ""
@@ -133,20 +133,20 @@ msgstr ""
msgid "For more info, please ask the person who sent this link."
msgstr ""
-#: templates/public.php:31
+#: templates/public.php:38
msgid "Add to your ownCloud"
msgstr ""
-#: templates/public.php:40
+#: templates/public.php:47
msgid "Download"
msgstr ""
-#: templates/public.php:71
+#: templates/public.php:70
#, php-format
msgid "Download %s"
msgstr ""
-#: templates/public.php:75
+#: templates/public.php:74
msgid "Direct link"
msgstr ""
diff --git a/l10n/templates/files_trashbin.pot b/l10n/templates/files_trashbin.pot
index 8b307059bde..3338c5060b0 100644
--- a/l10n/templates/files_trashbin.pot
+++ b/l10n/templates/files_trashbin.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-09-29 01:54-0400\n"
+"POT-Creation-Date: 2014-10-07 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files_versions.pot b/l10n/templates/files_versions.pot
index 3a66b295714..53e8a5551ef 100644
--- a/l10n/templates/files_versions.pot
+++ b/l10n/templates/files_versions.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-09-29 01:54-0400\n"
+"POT-Creation-Date: 2014-10-07 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/lib.pot b/l10n/templates/lib.pot
index b5da5ec3d5d..4f46ac610d4 100644
--- a/l10n/templates/lib.pot
+++ b/l10n/templates/lib.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-09-29 01:54-0400\n"
+"POT-Creation-Date: 2014-10-07 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -273,126 +273,126 @@ msgstr ""
msgid "%s shared »%s« with you"
msgstr ""
-#: private/share/share.php:494
+#: private/share/share.php:505
#, php-format
msgid "Sharing %s failed, because the file does not exist"
msgstr ""
-#: private/share/share.php:501
+#: private/share/share.php:512
#, php-format
msgid "You are not allowed to share %s"
msgstr ""
-#: private/share/share.php:531
+#: private/share/share.php:542
#, php-format
msgid "Sharing %s failed, because the user %s is the item owner"
msgstr ""
-#: private/share/share.php:537
+#: private/share/share.php:548
#, php-format
msgid "Sharing %s failed, because the user %s does not exist"
msgstr ""
-#: private/share/share.php:546
+#: private/share/share.php:557
#, php-format
msgid ""
"Sharing %s failed, because the user %s is not a member of any groups that %s "
"is a member of"
msgstr ""
-#: private/share/share.php:559 private/share/share.php:587
+#: private/share/share.php:570 private/share/share.php:598
#, php-format
msgid "Sharing %s failed, because this item is already shared with %s"
msgstr ""
-#: private/share/share.php:567
+#: private/share/share.php:578
#, php-format
msgid "Sharing %s failed, because the group %s does not exist"
msgstr ""
-#: private/share/share.php:574
+#: private/share/share.php:585
#, php-format
msgid "Sharing %s failed, because %s is not a member of the group %s"
msgstr ""
-#: private/share/share.php:628
+#: private/share/share.php:639
msgid ""
"You need to provide a password to create a public link, only protected links "
"are allowed"
msgstr ""
-#: private/share/share.php:657
+#: private/share/share.php:668
#, php-format
msgid "Sharing %s failed, because sharing with links is not allowed"
msgstr ""
-#: private/share/share.php:664
+#: private/share/share.php:675
#, php-format
msgid "Share type %s is not valid for %s"
msgstr ""
-#: private/share/share.php:866
+#: private/share/share.php:899
#, php-format
msgid ""
"Setting permissions for %s failed, because the permissions exceed "
"permissions granted to %s"
msgstr ""
-#: private/share/share.php:927
+#: private/share/share.php:960
#, php-format
msgid "Setting permissions for %s failed, because the item was not found"
msgstr ""
-#: private/share/share.php:965
+#: private/share/share.php:998
#, php-format
msgid ""
"Cannot set expiration date. Shares cannot expire later than %s after they "
"have been shared"
msgstr ""
-#: private/share/share.php:973
+#: private/share/share.php:1006
msgid "Cannot set expiration date. Expiration date is in the past"
msgstr ""
-#: private/share/share.php:1098
+#: private/share/share.php:1132
#, php-format
msgid "Sharing backend %s must implement the interface OCP\\Share_Backend"
msgstr ""
-#: private/share/share.php:1105
+#: private/share/share.php:1139
#, php-format
msgid "Sharing backend %s not found"
msgstr ""
-#: private/share/share.php:1111
+#: private/share/share.php:1145
#, php-format
msgid "Sharing backend for %s not found"
msgstr ""
-#: private/share/share.php:1529
+#: private/share/share.php:1812
#, php-format
msgid "Sharing %s failed, because the user %s is the original sharer"
msgstr ""
-#: private/share/share.php:1538
+#: private/share/share.php:1822
#, php-format
msgid ""
"Sharing %s failed, because the permissions exceed permissions granted to %s"
msgstr ""
-#: private/share/share.php:1554
+#: private/share/share.php:1838
#, php-format
msgid "Sharing %s failed, because resharing is not allowed"
msgstr ""
-#: private/share/share.php:1566
+#: private/share/share.php:1852
#, php-format
msgid ""
"Sharing %s failed, because the sharing backend for %s could not find its "
"source"
msgstr ""
-#: private/share/share.php:1580
+#: private/share/share.php:1866
#, php-format
msgid ""
"Sharing %s failed, because the file could not be found in the file cache"
diff --git a/l10n/templates/private.pot b/l10n/templates/private.pot
index af8cf4fb947..382e521250d 100644
--- a/l10n/templates/private.pot
+++ b/l10n/templates/private.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-09-29 01:54-0400\n"
+"POT-Creation-Date: 2014-10-07 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -232,126 +232,126 @@ msgstr ""
msgid "%s shared »%s« with you"
msgstr ""
-#: share/share.php:494
+#: share/share.php:505
#, php-format
msgid "Sharing %s failed, because the file does not exist"
msgstr ""
-#: share/share.php:501
+#: share/share.php:512
#, php-format
msgid "You are not allowed to share %s"
msgstr ""
-#: share/share.php:531
+#: share/share.php:542
#, php-format
msgid "Sharing %s failed, because the user %s is the item owner"
msgstr ""
-#: share/share.php:537
+#: share/share.php:548
#, php-format
msgid "Sharing %s failed, because the user %s does not exist"
msgstr ""
-#: share/share.php:546
+#: share/share.php:557
#, php-format
msgid ""
"Sharing %s failed, because the user %s is not a member of any groups that %s "
"is a member of"
msgstr ""
-#: share/share.php:559 share/share.php:587
+#: share/share.php:570 share/share.php:598
#, php-format
msgid "Sharing %s failed, because this item is already shared with %s"
msgstr ""
-#: share/share.php:567
+#: share/share.php:578
#, php-format
msgid "Sharing %s failed, because the group %s does not exist"
msgstr ""
-#: share/share.php:574
+#: share/share.php:585
#, php-format
msgid "Sharing %s failed, because %s is not a member of the group %s"
msgstr ""
-#: share/share.php:628
+#: share/share.php:639
msgid ""
"You need to provide a password to create a public link, only protected links "
"are allowed"
msgstr ""
-#: share/share.php:657
+#: share/share.php:668
#, php-format
msgid "Sharing %s failed, because sharing with links is not allowed"
msgstr ""
-#: share/share.php:664
+#: share/share.php:675
#, php-format
msgid "Share type %s is not valid for %s"
msgstr ""
-#: share/share.php:866
+#: share/share.php:899
#, php-format
msgid ""
"Setting permissions for %s failed, because the permissions exceed "
"permissions granted to %s"
msgstr ""
-#: share/share.php:927
+#: share/share.php:960
#, php-format
msgid "Setting permissions for %s failed, because the item was not found"
msgstr ""
-#: share/share.php:965
+#: share/share.php:998
#, php-format
msgid ""
"Cannot set expiration date. Shares cannot expire later than %s after they "
"have been shared"
msgstr ""
-#: share/share.php:973
+#: share/share.php:1006
msgid "Cannot set expiration date. Expiration date is in the past"
msgstr ""
-#: share/share.php:1098
+#: share/share.php:1132
#, php-format
msgid "Sharing backend %s must implement the interface OCP\\Share_Backend"
msgstr ""
-#: share/share.php:1105
+#: share/share.php:1139
#, php-format
msgid "Sharing backend %s not found"
msgstr ""
-#: share/share.php:1111
+#: share/share.php:1145
#, php-format
msgid "Sharing backend for %s not found"
msgstr ""
-#: share/share.php:1529
+#: share/share.php:1812
#, php-format
msgid "Sharing %s failed, because the user %s is the original sharer"
msgstr ""
-#: share/share.php:1538
+#: share/share.php:1822
#, php-format
msgid ""
"Sharing %s failed, because the permissions exceed permissions granted to %s"
msgstr ""
-#: share/share.php:1554
+#: share/share.php:1838
#, php-format
msgid "Sharing %s failed, because resharing is not allowed"
msgstr ""
-#: share/share.php:1566
+#: share/share.php:1852
#, php-format
msgid ""
"Sharing %s failed, because the sharing backend for %s could not find its "
"source"
msgstr ""
-#: share/share.php:1580
+#: share/share.php:1866
#, php-format
msgid ""
"Sharing %s failed, because the file could not be found in the file cache"
diff --git a/l10n/templates/settings.pot b/l10n/templates/settings.pot
index d964efc8da6..b9d5f860b8c 100644
--- a/l10n/templates/settings.pot
+++ b/l10n/templates/settings.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-09-29 01:54-0400\n"
+"POT-Creation-Date: 2014-10-07 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/user_ldap.pot b/l10n/templates/user_ldap.pot
index 5f02d05a2f1..4b3e070c204 100644
--- a/l10n/templates/user_ldap.pot
+++ b/l10n/templates/user_ldap.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-09-29 01:54-0400\n"
+"POT-Creation-Date: 2014-10-07 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -157,11 +157,11 @@ msgid_plural "%s users found"
msgstr[0] ""
msgstr[1] ""
-#: lib/wizard.php:392 lib/wizard.php:1128
+#: lib/wizard.php:394 lib/wizard.php:1130
msgid "Could not find the desired feature"
msgstr ""
-#: lib/wizard.php:935 lib/wizard.php:947
+#: lib/wizard.php:937 lib/wizard.php:949
msgid "Invalid Host"
msgstr ""
diff --git a/l10n/templates/user_webdavauth.pot b/l10n/templates/user_webdavauth.pot
index 1e06e443871..4e1a05093a7 100644
--- a/l10n/templates/user_webdavauth.pot
+++ b/l10n/templates/user_webdavauth.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-09-29 01:54-0400\n"
+"POT-Creation-Date: 2014-10-07 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/lib/l10n/es.php b/lib/l10n/es.php
index ac0715497eb..04253fc7b0c 100644
--- a/lib/l10n/es.php
+++ b/lib/l10n/es.php
@@ -51,7 +51,7 @@ $TRANSLATIONS = array(
"Set an admin username." => "Configurar un nombre de usuario del administrador",
"Set an admin password." => "Configurar la contraseña del administrador.",
"Can't create or write into the data directory %s" => "No es posible crear o escribir en el directorio de datos %s",
-"%s shared »%s« with you" => "%s ha compatido »%s« contigo",
+"%s shared »%s« with you" => "%s ha compartido »%s« contigo",
"Sharing %s failed, because the file does not exist" => "No se pudo compartir %s porque el archivo no existe",
"You are not allowed to share %s" => "Usted no está autorizado para compartir %s",
"Sharing %s failed, because the user %s is the item owner" => "Compartiendo %s ha fallado, ya que el usuario %s es el dueño del elemento",
diff --git a/lib/l10n/fr.php b/lib/l10n/fr.php
index 83d6cc6ea92..744d8ba8617 100644
--- a/lib/l10n/fr.php
+++ b/lib/l10n/fr.php
@@ -4,7 +4,7 @@ $TRANSLATIONS = array(
"This can usually be fixed by giving the webserver write access to the config directory" => "Ce problème est généralement résolu en donnant au serveur web un accès en écriture à ce répertoire",
"See %s" => "Voir %s",
"This can usually be fixed by %sgiving the webserver write access to the config directory%s." => "Ce problème est généralement résolu %sen donnant au serveur web un accès en écriture au répertoire de configuration%s.",
-"Sample configuration detected" => "Configuration d'example détectée",
+"Sample configuration detected" => "Configuration d'exemple détectée",
"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" => "Il a été détecté que le configuration donnée à titre d'exemple a été copiée. Cela peut rendre votre installation inopérante et n'est pas supporté. Veuillez lire la documentation avant d'effectuer des modifications dans config.php",
"Help" => "Aide",
"Personal" => "Personnel",
@@ -14,7 +14,7 @@ $TRANSLATIONS = array(
"App \\\"%s\\\" can't be installed because it is not compatible with this version of ownCloud." => "L'application \\\"%s\\\" ne peut pas être installée car elle n'est pas compatible avec cette version de ownCloud.",
"No app name specified" => "Aucun nom d'application spécifié",
"Unknown filetype" => "Type de fichier inconnu",
-"Invalid image" => "Image invalide",
+"Invalid image" => "Image non valable",
"web services under your control" => "services web sous votre contrôle",
"App directory already exists" => "Le dossier de l'application existe déjà",
"Can't create app folder. Please fix permissions. %s" => "Impossible de créer le dossier de l'application. Corrigez les droits d'accès. %s",
diff --git a/lib/l10n/fy_NL.php b/lib/l10n/fy_NL.php
new file mode 100644
index 00000000000..15f78e0bce6
--- /dev/null
+++ b/lib/l10n/fy_NL.php
@@ -0,0 +1,8 @@
+<?php
+$TRANSLATIONS = array(
+"_%n minute ago_::_%n minutes ago_" => array("",""),
+"_%n hour ago_::_%n hours ago_" => array("",""),
+"_%n day go_::_%n days ago_" => array("",""),
+"_%n month ago_::_%n months ago_" => array("","")
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/pt_PT.php b/lib/l10n/pt_PT.php
index 6351dcde734..20cfef8a2cb 100644
--- a/lib/l10n/pt_PT.php
+++ b/lib/l10n/pt_PT.php
@@ -50,6 +50,7 @@ $TRANSLATIONS = array(
"PostgreSQL username and/or password not valid" => "Nome de utilizador/password do PostgreSQL inválido",
"Set an admin username." => "Definir um nome de utilizador de administrador",
"Set an admin password." => "Definiar uma password de administrador",
+"Can't create or write into the data directory %s" => "Não é possível criar ou escrever a directoria data %s",
"%s shared »%s« with you" => "%s partilhado »%s« consigo",
"Sharing %s failed, because the file does not exist" => "A partilha de %s falhou, porque o ficheiro não existe",
"You are not allowed to share %s" => "Não está autorizado a partilhar %s",
diff --git a/lib/l10n/tg_TJ.php b/lib/l10n/tg_TJ.php
new file mode 100644
index 00000000000..15f78e0bce6
--- /dev/null
+++ b/lib/l10n/tg_TJ.php
@@ -0,0 +1,8 @@
+<?php
+$TRANSLATIONS = array(
+"_%n minute ago_::_%n minutes ago_" => array("",""),
+"_%n hour ago_::_%n hours ago_" => array("",""),
+"_%n day go_::_%n days ago_" => array("",""),
+"_%n month ago_::_%n months ago_" => array("","")
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/tl_PH.php b/lib/l10n/tl_PH.php
new file mode 100644
index 00000000000..406ff5f5a26
--- /dev/null
+++ b/lib/l10n/tl_PH.php
@@ -0,0 +1,8 @@
+<?php
+$TRANSLATIONS = array(
+"_%n minute ago_::_%n minutes ago_" => array("",""),
+"_%n hour ago_::_%n hours ago_" => array("",""),
+"_%n day go_::_%n days ago_" => array("",""),
+"_%n month ago_::_%n months ago_" => array("","")
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n > 1);";
diff --git a/lib/private/appframework/http/request.php b/lib/private/appframework/http/request.php
index 8b68ca486ff..350694dca81 100644
--- a/lib/private/appframework/http/request.php
+++ b/lib/private/appframework/http/request.php
@@ -350,7 +350,6 @@ class Request implements \ArrayAccess, \Countable, IRequest {
/**
* Checks if the CSRF check was correct
* @return bool true if CSRF check passed
- * @see OC_Util::$callLifespan
* @see OC_Util::callRegister()
*/
public function passesCSRFCheck() {
diff --git a/lib/private/config.php b/lib/private/config.php
index 82a1c46c9d5..7bf3863e2a6 100644
--- a/lib/private/config.php
+++ b/lib/private/config.php
@@ -1,37 +1,12 @@
<?php
/**
- * ownCloud
- *
* @author Frank Karlitschek
* @author Jakob Sack
* @copyright 2012 Frank Karlitschek frank@owncloud.org
*
- * 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/>.
- *
- */
-/*
- *
- * An example of config.php
- *
- * <?php
- * $CONFIG = array(
- * "database" => "mysql",
- * "firstrun" => false,
- * "pi" => 3.14
- * );
- * ?>
- *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
*/
namespace OC;
@@ -41,26 +16,45 @@ namespace OC;
* configuration file of ownCloud.
*/
class Config {
- // associative array key => value
+ /** @var array Associative array ($key => $value) */
protected $cache = array();
-
+ /** @var string */
protected $configDir;
- protected $configFilename;
-
+ /** @var string */
+ protected $configFilePath;
+ /** @var string */
+ protected $configFileName;
+ /** @var bool */
protected $debugMode;
/**
- * @param string $configDir path to the config dir, needs to end with '/'
+ * @param string $configDir Path to the config dir, needs to end with '/'
+ * @param string $fileName (Optional) Name of the config file. Defaults to config.php
*/
- public function __construct($configDir) {
+ public function __construct($configDir, $fileName = 'config.php') {
$this->configDir = $configDir;
- $this->configFilename = $this->configDir.'config.php';
+ $this->configFilePath = $this->configDir.$fileName;
+ $this->configFileName = $fileName;
$this->readData();
- $this->setDebugMode(defined('DEBUG') && DEBUG);
+ $this->debugMode = (defined('DEBUG') && DEBUG);
+ }
+
+ /**
+ * Enables or disables the debug mode
+ * @param bool $state True to enable, false to disable
+ */
+ public function setDebugMode($state) {
+ $this->debugMode = $state;
+ $this->writeData();
+ $this->cache;
}
- public function setDebugMode($enable) {
- $this->debugMode = $enable;
+ /**
+ * Returns whether the debug mode is enabled or disabled
+ * @return bool True when enabled, false otherwise
+ */
+ public function isDebugMode() {
+ return $this->debugMode;
}
/**
@@ -128,27 +122,43 @@ class Config {
* Loads the config file
*
* Reads the config file and saves it to the cache
+ *
+ * @throws \Exception If no lock could be acquired or the config file has not been found
*/
private function readData() {
- // Default config
- $configFiles = array($this->configFilename);
- // Add all files in the config dir ending with config.php
- $extra = glob($this->configDir.'*.config.php');
+ // Default config should always get loaded
+ $configFiles = array($this->configFilePath);
+
+ // Add all files in the config dir ending with the same file name
+ $extra = glob($this->configDir.'*.'.$this->configFileName);
if (is_array($extra)) {
natsort($extra);
$configFiles = array_merge($configFiles, $extra);
}
+
// Include file and merge config
foreach ($configFiles as $file) {
- if (!file_exists($file)) {
+ if(!@touch($file) && $file === $this->configFilePath) {
+ // Writing to the main config might not be possible, e.g. if the wrong
+ // permissions are set (likely on a new installation)
continue;
}
+ $filePointer = fopen($file, 'r');
+
+ // Try to acquire a file lock
+ if(!flock($filePointer, LOCK_SH)) {
+ throw new \Exception(sprintf('Could not acquire a shared lock on the config file %s', $file));
+ }
+
unset($CONFIG);
- // ignore errors on include, this can happen when doing a fresh install
- @include $file;
- if (isset($CONFIG) && is_array($CONFIG)) {
+ include $file;
+ if(isset($CONFIG) && is_array($CONFIG)) {
$this->cache = array_merge($this->cache, $CONFIG);
}
+
+ // Close the file pointer and release the lock
+ flock($filePointer, LOCK_UN);
+ fclose($filePointer);
}
}
@@ -157,6 +167,8 @@ class Config {
*
* Saves the config to the config file.
*
+ * @throws HintException If the config file cannot be written to
+ * @throws \Exception If no file lock can be acquired
*/
private function writeData() {
// Create a php file ...
@@ -168,18 +180,34 @@ class Config {
$content .= var_export($this->cache, true);
$content .= ";\n";
- // Write the file
- $result = @file_put_contents($this->configFilename, $content);
- if (!$result) {
- $defaults = new \OC_Defaults;
+ touch ($this->configFilePath);
+ $filePointer = fopen($this->configFilePath, 'r+');
+
+ // Prevent others not to read the config
+ chmod($this->configFilePath, 0640);
+
+ // File does not exist, this can happen when doing a fresh install
+ if(!is_resource ($filePointer)) {
$url = \OC_Helper::linkToDocs('admin-dir_permissions');
throw new HintException(
"Can't write into config directory!",
'This can usually be fixed by '
- .'<a href="' . $url . '" target="_blank">giving the webserver write access to the config directory</a>.');
+ .'<a href="' . $url . '" target="_blank">giving the webserver write access to the config directory</a>.');
}
- // Prevent others not to read the config
- @chmod($this->configFilename, 0640);
+
+ // Try to acquire a file lock
+ if(!flock($filePointer, LOCK_EX)) {
+ throw new \Exception(sprintf('Could not acquire an exclusive lock on the config file %s', $this->configFilePath));
+ }
+
+ // Write the config and release the lock
+ ftruncate ($filePointer, 0);
+ fwrite($filePointer, $content);
+ fflush($filePointer);
+ flock($filePointer, LOCK_UN);
+ fclose($filePointer);
+
+ // Clear the opcode cache
\OC_Util::clearOpcodeCache();
}
}
diff --git a/lib/private/legacy/config.php b/lib/private/legacy/config.php
index 4d6fefc4e17..13ff0dbe040 100644
--- a/lib/private/legacy/config.php
+++ b/lib/private/legacy/config.php
@@ -6,32 +6,9 @@
* @author Jakob Sack
* @copyright 2012 Frank Karlitschek frank@owncloud.org
*
- * 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/>.
- *
- */
-/*
- *
- * An example of config.php
- *
- * <?php
- * $CONFIG = array(
- * "database" => "mysql",
- * "firstrun" => false,
- * "pi" => 3.14
- * );
- * ?>
- *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
*/
/**
@@ -42,11 +19,13 @@
*/
class OC_Config {
- /**
- * @var \OC\Config
- */
+ /** @var \OC\Config */
public static $object;
+ /**
+ * Returns the config instance
+ * @return \OC\Config
+ */
public static function getObject() {
return self::$object;
}
@@ -92,7 +71,6 @@ class OC_Config {
* @param string $key key
*
* This function removes a key from the config.php.
- *
*/
public static function deleteKey($key) {
self::$object->deleteKey($key);
diff --git a/lib/private/mimetypes.list.php b/lib/private/mimetypes.list.php
index a44ec1daa1e..4f11829859a 100644
--- a/lib/private/mimetypes.list.php
+++ b/lib/private/mimetypes.list.php
@@ -61,6 +61,7 @@ return array(
'dv' => array('video/dv', null),
'eot' => array('application/vnd.ms-fontobject', null),
'epub' => array('application/epub+zip', null),
+ 'eps' => array('application/postscript', null),
'exe' => array('application/x-ms-dos-executable', null),
'flac' => array('audio/flac', null),
'flv' => array('video/x-flv', null),
@@ -120,6 +121,7 @@ return array(
'ppt' => array('application/vnd.ms-powerpoint', null),
'pptm' => array('application/vnd.ms-powerpoint.presentation.macroEnabled.12', null),
'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', null),
+ 'ps' => array('application/postscript', null),
'psd' => array('application/x-photoshop', null),
'py' => array('text/x-python', null),
'rar' => array('application/x-rar-compressed', null),
diff --git a/lib/private/naturalsort.php b/lib/private/naturalsort.php
index e10ce8e45e7..eb00f99a672 100644
--- a/lib/private/naturalsort.php
+++ b/lib/private/naturalsort.php
@@ -55,7 +55,7 @@ class NaturalSort {
/**
* Returns the string collator
- * @return Collator string collator
+ * @return \Collator string collator
*/
private function getCollator() {
if (!isset($this->collator)) {
@@ -73,9 +73,9 @@ class NaturalSort {
/**
* Compare two strings to provide a natural sort
- * @param $a first string to compare
- * @param $b second string to compare
- * @return -1 if $b comes before $a, 1 if $a comes before $b
+ * @param string $a first string to compare
+ * @param string $b second string to compare
+ * @return int -1 if $b comes before $a, 1 if $a comes before $b
* or 0 if the strings are identical
*/
public function compare($a, $b) {
diff --git a/lib/private/ocs.php b/lib/private/ocs.php
index aeb3d259b30..214b28fa22c 100644
--- a/lib/private/ocs.php
+++ b/lib/private/ocs.php
@@ -30,7 +30,7 @@
class OC_OCS {
/**
- * reads input date from get/post/cookies and converts the date to a special data-type
+ * reads input data from get/post and converts the date to a special data-type
*
* @param string $method HTTP method to read the key from
* @param string $key Parameter to read
@@ -93,8 +93,8 @@ class OC_OCS {
}
/**
- * generated some debug information to make it easier to find faild API calls
- * @return string data string
+ * generated some debug information to make it easier to find failed API calls
+ * @return string data
*/
private static function getDebugOutput() {
$txt='';
diff --git a/lib/private/preview.php b/lib/private/preview.php
index c93f5d5516f..4b21e324037 100755
--- a/lib/private/preview.php
+++ b/lib/private/preview.php
@@ -19,11 +19,10 @@ use OCP\Files\NotFoundException;
require_once 'preview/image.php';
require_once 'preview/movies.php';
require_once 'preview/mp3.php';
-require_once 'preview/pdf.php';
require_once 'preview/svg.php';
require_once 'preview/txt.php';
require_once 'preview/office.php';
-require_once 'preview/tiff.php';
+require_once 'preview/bitmap.php';
class Preview {
//the thumbnail folder
@@ -691,7 +690,10 @@ class Preview {
* - OC\Preview\SVG
* - OC\Preview\Movies
* - OC\Preview\PDF
- * - OC\Preview\Tiff
+ * - OC\Preview\TIFF
+ * - OC\Preview\Illustrator
+ * - OC\Preview\Postscript
+ * - OC\Preview\Photoshop
*/
if(empty(self::$enabledProviders)) {
self::$enabledProviders = \OC::$server->getConfig()->getSystemValue('enabledPreviewProviders', array(
diff --git a/lib/private/preview/bitmap.php b/lib/private/preview/bitmap.php
new file mode 100644
index 00000000000..748a63a6afa
--- /dev/null
+++ b/lib/private/preview/bitmap.php
@@ -0,0 +1,117 @@
+<?php
+/**
+ * Copyright (c) 2013-2014 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+namespace OC\Preview;
+
+use Imagick;
+
+if (extension_loaded('imagick')) {
+
+ $checkImagick = new Imagick();
+
+ class Bitmap extends Provider {
+
+ public function getMimeType() {
+ return null;
+ }
+
+ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
+ $tmpPath = $fileview->toTmpFile($path);
+
+ //create imagick object from bitmap or vector file
+ try{
+ // Layer 0 contains either the bitmap or
+ // a flat representation of all vector layers
+ $bp = new Imagick($tmpPath . '[0]');
+
+ $bp->setImageFormat('png');
+ } catch (\Exception $e) {
+ \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
+ return false;
+ }
+
+ unlink($tmpPath);
+
+ //new bitmap image object
+ $image = new \OC_Image($bp);
+ //check if image object is valid
+ return $image->valid() ? $image : false;
+ }
+
+ }
+
+ if(count($checkImagick->queryFormats('PDF')) === 1) {
+
+ //.pdf
+ class PDF extends Bitmap {
+
+ public function getMimeType() {
+ return '/application\/pdf/';
+ }
+
+ }
+
+ \OC\Preview::registerProvider('OC\Preview\PDF');
+ }
+
+ if(count($checkImagick->queryFormats('TIFF')) === 1) {
+
+ //.tiff
+ class TIFF extends Bitmap {
+
+ public function getMimeType() {
+ return '/image\/tiff/';
+ }
+
+ }
+
+ \OC\Preview::registerProvider('OC\Preview\TIFF');
+ }
+
+ if(count($checkImagick->queryFormats('AI')) === 1) {
+
+ //.ai
+ class Illustrator extends Bitmap {
+
+ public function getMimeType() {
+ return '/application\/illustrator/';
+ }
+
+ }
+
+ \OC\Preview::registerProvider('OC\Preview\Illustrator');
+ }
+
+ // Requires adding 'eps' => array('application/postscript', null), to lib/private/mimetypes.list.php
+ if(count($checkImagick->queryFormats('EPS')) === 1) {
+
+ //.eps
+ class Postscript extends Bitmap {
+
+ public function getMimeType() {
+ return '/application\/postscript/';
+ }
+
+ }
+
+ \OC\Preview::registerProvider('OC\Preview\Postscript');
+ }
+
+ if(count($checkImagick->queryFormats('PSD')) === 1) {
+
+ //.psd
+ class Photoshop extends Bitmap {
+
+ public function getMimeType() {
+ return '/application\/x-photoshop/';
+ }
+
+ }
+
+ \OC\Preview::registerProvider('OC\Preview\Photoshop');
+ }
+}
diff --git a/lib/private/preview/pdf.php b/lib/private/preview/pdf.php
deleted file mode 100644
index 4b88b1a31e2..00000000000
--- a/lib/private/preview/pdf.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-namespace OC\Preview;
-
-use Imagick;
-
-if (extension_loaded('imagick')) {
-
- $checkImagick = new Imagick();
-
- if(count($checkImagick->queryFormats('PDF')) === 1) {
-
- class PDF extends Provider {
-
- public function getMimeType() {
- return '/application\/pdf/';
- }
-
- public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
- $tmpPath = $fileview->toTmpFile($path);
-
- //create imagick object from pdf
- try{
- $pdf = new Imagick($tmpPath . '[0]');
- $pdf->setImageFormat('jpg');
- } catch (\Exception $e) {
- \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
- return false;
- }
-
- unlink($tmpPath);
-
- //new image object
- $image = new \OC_Image($pdf);
- //check if image object is valid
- return $image->valid() ? $image : false;
- }
-
- }
-
- \OC\Preview::registerProvider('OC\Preview\PDF');
- }
-}
diff --git a/lib/private/preview/tiff.php b/lib/private/preview/tiff.php
deleted file mode 100644
index c435ec71352..00000000000
--- a/lib/private/preview/tiff.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * Copyright (c) 2013-2014 Georg Ehrke georg@ownCloud.com
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-namespace OC\Preview;
-
-use Imagick;
-
-if (extension_loaded('imagick')) {
-
- $checkImagick = new Imagick();
-
- if(count($checkImagick->queryFormats('TIFF')) === 1) {
-
- class TIFF extends Provider {
-
- public function getMimeType() {
- return '/image\/tiff/';
- }
-
- public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
- $tmpPath = $fileview->toTmpFile($path);
-
- //create imagick object from TIFF
- try{
- $tiff = new Imagick($tmpPath);
- $tiff->setImageFormat('png');
- } catch (\Exception $e) {
- \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
- return false;
- }
-
- unlink($tmpPath);
-
- //new image object
- $image = new \OC_Image($tiff);
- //check if image object is valid
- return $image->valid() ? $image : false;
- }
-
- }
-
- \OC\Preview::registerProvider('OC\Preview\TIFF');
- }
-}
diff --git a/lib/private/preview/txt.php b/lib/private/preview/txt.php
index 2ac77faf48b..7f01b980c0e 100644
--- a/lib/private/preview/txt.php
+++ b/lib/private/preview/txt.php
@@ -34,7 +34,7 @@ class TXT extends Provider {
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
$content = $fileview->fopen($path, 'r');
- $content = stream_get_contents($content);
+ $content = stream_get_contents($content,3000);
//don't create previews of empty text files
if(trim($content) === '') {
diff --git a/lib/private/share/helper.php b/lib/private/share/helper.php
index 46e3c280488..2418535c9d5 100644
--- a/lib/private/share/helper.php
+++ b/lib/private/share/helper.php
@@ -35,8 +35,8 @@ class Helper extends \OC\Share\Constants {
* @throws \Exception
* @return string Item target
*/
- public static function generateTarget($itemType, $itemSource, $shareType, $shareWith, $uidOwner,
- $suggestedTarget = null, $groupParent = null) {
+ public static function generateTarget($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $suggestedTarget = null, $groupParent = null) {
+ // FIXME: $uidOwner and $groupParent seems to be unused
$backend = \OC\Share\Share::getBackend($itemType);
if ($shareType == self::SHARE_TYPE_LINK) {
if (isset($suggestedTarget)) {
@@ -54,91 +54,28 @@ class Helper extends \OC\Share\Constants {
if ($shareType == self::SHARE_TYPE_USER) {
// Share with is a user, so set share type to user and groups
$shareType = self::$shareTypeUserAndGroups;
- $userAndGroups = array_merge(array($shareWith), \OC_Group::getUserGroups($shareWith));
- } else {
- $userAndGroups = false;
}
- $exclude = null;
- // Backend has 3 opportunities to generate a unique target
- for ($i = 0; $i < 2; $i++) {
- // Check if suggested target exists first
- if ($i == 0 && isset($suggestedTarget)) {
- $target = $suggestedTarget;
- } else {
- if ($shareType == self::SHARE_TYPE_GROUP) {
- $target = $backend->generateTarget($itemSource, false, $exclude);
- } else {
- $target = $backend->generateTarget($itemSource, $shareWith, $exclude);
- }
- if (is_array($exclude) && in_array($target, $exclude)) {
- break;
- }
- }
- // Check if target already exists
- $checkTarget = \OC\Share\Share::getItems($itemType, $target, $shareType, $shareWith);
- if (!empty($checkTarget)) {
- foreach ($checkTarget as $item) {
- // Skip item if it is the group parent row
- if (isset($groupParent) && $item['id'] == $groupParent) {
- if (count($checkTarget) == 1) {
- return $target;
- } else {
- continue;
- }
- }
- if ($item['uid_owner'] == $uidOwner) {
- if ($itemType == 'file' || $itemType == 'folder') {
- $meta = \OC\Files\Filesystem::getFileInfo($itemSource);
- if ($item['file_source'] == $meta['fileid']) {
- return $target;
- }
- } else if ($item['item_source'] == $itemSource) {
- return $target;
- }
- }
- }
- if (!isset($exclude)) {
- $exclude = array();
- }
- // Find similar targets to improve backend's chances to generate a unqiue target
- if ($userAndGroups) {
- if ($column == 'file_target') {
- $checkTargets = \OC_DB::prepare('SELECT `'.$column.'` FROM `*PREFIX*share`'
- .' WHERE `item_type` IN (\'file\', \'folder\')'
- .' AND `share_type` IN (?,?,?)'
- .' AND `share_with` IN (\''.implode('\',\'', $userAndGroups).'\')');
- $result = $checkTargets->execute(array(self::SHARE_TYPE_USER, self::SHARE_TYPE_GROUP,
- self::$shareTypeGroupUserUnique));
- } else {
- $checkTargets = \OC_DB::prepare('SELECT `'.$column.'` FROM `*PREFIX*share`'
- .' WHERE `item_type` = ? AND `share_type` IN (?,?,?)'
- .' AND `share_with` IN (\''.implode('\',\'', $userAndGroups).'\')');
- $result = $checkTargets->execute(array($itemType, self::SHARE_TYPE_USER,
- self::SHARE_TYPE_GROUP, self::$shareTypeGroupUserUnique));
- }
- } else {
- if ($column == 'file_target') {
- $checkTargets = \OC_DB::prepare('SELECT `'.$column.'` FROM `*PREFIX*share`'
- .' WHERE `item_type` IN (\'file\', \'folder\')'
- .' AND `share_type` = ? AND `share_with` = ?');
- $result = $checkTargets->execute(array(self::SHARE_TYPE_GROUP, $shareWith));
- } else {
- $checkTargets = \OC_DB::prepare('SELECT `'.$column.'` FROM `*PREFIX*share`'
- .' WHERE `item_type` = ? AND `share_type` = ? AND `share_with` = ?');
- $result = $checkTargets->execute(array($itemType, self::SHARE_TYPE_GROUP, $shareWith));
- }
- }
- while ($row = $result->fetchRow()) {
- $exclude[] = $row[$column];
- }
- } else {
- return $target;
+ $exclude = array();
+
+ $result = \OCP\Share::getItemsSharedWithUser($itemType, $shareWith);
+ foreach ($result as $row) {
+ if ($row['permissions'] > 0) {
+ $exclude[] = $row[$column];
}
}
+
+ // Check if suggested target exists first
+ if (!isset($suggestedTarget)) {
+ $suggestedTarget = $itemSource;
+ }
+ if ($shareType == self::SHARE_TYPE_GROUP) {
+ $target = $backend->generateTarget($suggestedTarget, false, $exclude);
+ } else {
+ $target = $backend->generateTarget($suggestedTarget, $shareWith, $exclude);
+ }
+
+ return $target;
}
- $message = 'Sharing backend registered for '.$itemType.' did not generate a unique target for '.$itemSource;
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
- throw new \Exception($message);
}
/**
@@ -146,10 +83,12 @@ class Helper extends \OC\Share\Constants {
* @param int $parent Id of item to delete
* @param bool $excludeParent If true, exclude the parent from the delete (optional)
* @param string $uidOwner The user that the parent was shared with (optional)
+ * @param int $newParent new parent for the childrens
*/
- public static function delete($parent, $excludeParent = false, $uidOwner = null) {
+ public static function delete($parent, $excludeParent = false, $uidOwner = null, $newParent = null) {
$ids = array($parent);
$deletedItems = array();
+ $changeParent = array();
$parents = array($parent);
while (!empty($parents)) {
$parents = "'".implode("','", $parents)."'";
@@ -167,8 +106,6 @@ class Helper extends \OC\Share\Constants {
// Reset parents array, only go through loop again if items are found
$parents = array();
while ($item = $result->fetchRow()) {
- $ids[] = $item['id'];
- $parents[] = $item['id'];
$tmpItem = array(
'id' => $item['id'],
'shareWith' => $item['share_with'],
@@ -179,12 +116,28 @@ class Helper extends \OC\Share\Constants {
if (isset($item['file_target'])) {
$tmpItem['fileTarget'] = $item['file_target'];
}
- $deletedItems[] = $tmpItem;
+ // if we have a new parent for the child we remember the child
+ // to update the parent, if not we add it to the list of items
+ // which should be deleted
+ if ($newParent !== null) {
+ $changeParent[] = $item['id'];
+ } else {
+ $deletedItems[] = $tmpItem;
+ $ids[] = $item['id'];
+ $parents[] = $item['id'];
+ }
}
}
if ($excludeParent) {
unset($ids[0]);
}
+
+ if (!empty($changeParent)) {
+ $idList = "'".implode("','", $changeParent)."'";
+ $query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `parent` = ? WHERE `id` IN ('.$idList.')');
+ $query->execute(array($newParent));
+ }
+
if (!empty($ids)) {
$idList = "'".implode("','", $ids)."'";
$query = \OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `id` IN ('.$idList.')');
diff --git a/lib/private/share/hooks.php b/lib/private/share/hooks.php
index 9ac64d888ea..66b197b921b 100644
--- a/lib/private/share/hooks.php
+++ b/lib/private/share/hooks.php
@@ -45,6 +45,7 @@ class Hooks extends \OC\Share\Constants {
* @param array $arguments
*/
public static function post_addToGroup($arguments) {
+
// Find the group shares and check if the user needs a unique target
$query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `share_type` = ? AND `share_with` = ?');
$result = $query->execute(array(self::SHARE_TYPE_GROUP, $arguments['gid']));
@@ -52,18 +53,25 @@ class Hooks extends \OC\Share\Constants {
.' `item_target`, `parent`, `share_type`, `share_with`, `uid_owner`, `permissions`,'
.' `stime`, `file_source`, `file_target`) VALUES (?,?,?,?,?,?,?,?,?,?,?)');
while ($item = $result->fetchRow()) {
- if ($item['item_type'] == 'file' || $item['item_type'] == 'file') {
- $itemTarget = null;
- } else {
- $itemTarget = Helper::generateTarget($item['item_type'], $item['item_source'], self::SHARE_TYPE_USER,
- $arguments['uid'], $item['uid_owner'], $item['item_target'], $item['id']);
- }
- if (isset($item['file_source'])) {
- $fileTarget = Helper::generateTarget($item['item_type'], $item['item_source'], self::SHARE_TYPE_USER,
- $arguments['uid'], $item['uid_owner'], $item['file_target'], $item['id']);
+
+ $sourceExists = \OC\Share\Share::getItemSharedWithBySource($item['item_type'], $item['item_source'], self::FORMAT_NONE, null, true, $arguments['uid']);
+
+ if ($sourceExists) {
+ $fileTarget = $sourceExists['file_target'];
+ $itemTarget = $sourceExists['item_target'];
} else {
- $fileTarget = null;
+ $itemTarget = Helper::generateTarget($item['item_type'], $item['item_source'], self::SHARE_TYPE_USER, $arguments['uid'],
+ $item['owner'], null, $item['parent']);
+
+ // do we also need a file target
+ if ($item['item_type'] === 'file' || $item['item_type'] === 'folder') {
+ $fileTarget = Helper::generateTarget('file', $item['file_target'], self::SHARE_TYPE_USER, $arguments['uid'],
+ $item['owner'], null, $item['parent']);
+ } else {
+ $fileTarget = null;
+ }
}
+
// Insert an extra row for the group share if the item or file target is unique for this user
if ($itemTarget != $item['item_target'] || $fileTarget != $item['file_target']) {
$query->execute(array($item['item_type'], $item['item_source'], $itemTarget, $item['id'],
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index 8441e6a94c4..d861f0510e4 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -294,23 +294,32 @@ class Share extends \OC\Share\Constants {
$shares = array();
+ $column = ($itemType === 'file' || $itemType === 'folder') ? 'file_source' : 'item_source';
+
+ $where = ' `' . $column . '` = ? AND `item_type` = ? ';
+ $arguments = array($itemSource, $itemType);
+ // for link shares $user === null
+ if ($user !== null) {
+ $where .= ' AND `share_with` = ? ';
+ $arguments[] = $user;
+ }
+
// first check if there is a db entry for the specific user
$query = \OC_DB::prepare(
- 'SELECT `file_target`, `permissions`, `expiration`
+ 'SELECT *
FROM
`*PREFIX*share`
- WHERE
- `item_source` = ? AND `item_type` = ? AND `share_with` = ?'
+ WHERE' . $where
);
- $result = \OC_DB::executeAudited($query, array($itemSource, $itemType, $user));
+ $result = \OC_DB::executeAudited($query, $arguments);
while ($row = $result->fetchRow()) {
$shares[] = $row;
}
//if didn't found a result than let's look for a group share.
- if(empty($shares)) {
+ if(empty($shares) && $user !== null) {
$groups = \OC_Group::getUserGroups($user);
$query = \OC_DB::prepare(
@@ -318,7 +327,7 @@ class Share extends \OC\Share\Constants {
FROM
`*PREFIX*share`
WHERE
- `item_source` = ? AND `item_type` = ? AND `share_with` in (?)'
+ `' . $column . '` = ? AND `item_type` = ? AND `share_with` in (?)'
);
$result = \OC_DB::executeAudited($query, array($itemSource, $itemType, implode(',', $groups)));
@@ -339,11 +348,13 @@ class Share extends \OC\Share\Constants {
* @param int $format (optional) Format type must be defined by the backend
* @param mixed $parameters
* @param boolean $includeCollections
- * @return mixed Return depends on format
+ * @param string $shareWith (optional) define against which user should be checked, default: current user
+ * @return array
*/
public static function getItemSharedWithBySource($itemType, $itemSource, $format = self::FORMAT_NONE,
- $parameters = null, $includeCollections = false) {
- return self::getItems($itemType, $itemSource, self::$shareTypeUserAndGroups, \OC_User::getUser(), null, $format,
+ $parameters = null, $includeCollections = false, $shareWith = null) {
+ $shareWith = ($shareWith === null) ? \OC_User::getUser() : $shareWith;
+ return self::getItems($itemType, $itemSource, self::$shareTypeUserAndGroups, $shareWith, null, $format,
$parameters, 1, $includeCollections, true);
}
@@ -679,9 +690,31 @@ class Share extends \OC\Share\Constants {
* @return boolean true on success or false on failure
*/
public static function unshare($itemType, $itemSource, $shareType, $shareWith) {
- $item = self::getItems($itemType, $itemSource, $shareType, $shareWith, \OC_User::getUser(),self::FORMAT_NONE, null, 1);
- if (!empty($item)) {
- self::unshareItem($item);
+
+ // check if it is a valid itemType
+ self::getBackend($itemType);
+
+ $items = self::getItemSharedWithUser($itemType, $itemSource, $shareWith);
+
+ $toDelete = array();
+ $newParent = null;
+ $currentUser = \OC_User::getUser();
+ foreach ($items as $item) {
+ // delete the item with the expected share_type and owner
+ if ((int)$item['share_type'] === (int)$shareType && $item['uid_owner'] === $currentUser) {
+ $toDelete = $item;
+ // if there is more then one result we don't have to delete the children
+ // but update their parent. For group shares the new parent should always be
+ // the original group share and not the db entry with the unique name
+ } else if ((int)$item['share_type'] === self::$shareTypeGroupUserUnique) {
+ $newParent = $item['parent'];
+ } else {
+ $newParent = $item['id'];
+ }
+ }
+
+ if (!empty($toDelete)) {
+ self::unshareItem($toDelete, $newParent);
return true;
}
return false;
@@ -773,7 +806,7 @@ class Share extends \OC\Share\Constants {
}
}
- if (!$itemUnshared && isset($groupShare)) {
+ if (!$itemUnshared && isset($groupShare) && !isset($uniqueGroupShare)) {
$query = \OC_DB::prepare('INSERT INTO `*PREFIX*share`'
.' (`item_type`, `item_source`, `item_target`, `parent`, `share_type`,'
.' `share_with`, `uid_owner`, `permissions`, `stime`, `file_source`, `file_target`)'
@@ -1054,9 +1087,10 @@ class Share extends \OC\Share\Constants {
/**
* Unshares a share given a share data array
* @param array $item Share data (usually database row)
+ * @param int new parent ID
* @return null
*/
- protected static function unshareItem(array $item) {
+ protected static function unshareItem(array $item, $newParent = null) {
// Pass all the vars we have for now, they may be useful
$hookParams = array(
'id' => $item['id'],
@@ -1073,7 +1107,7 @@ class Share extends \OC\Share\Constants {
}
\OC_Hook::emit('OCP\Share', 'pre_unshare', $hookParams);
- $deletedShares = Helper::delete($item['id']);
+ $deletedShares = Helper::delete($item['id'], false, null, $newParent);
$deletedShares[] = $hookParams;
$hookParams['deletedShares'] = $deletedShares;
\OC_Hook::emit('OCP\Share', 'post_unshare', $hookParams);
@@ -1292,13 +1326,17 @@ class Share extends \OC\Share\Constants {
$queryArgs = array_merge($queryArgs, $collectionTypes);
}
}
+
+ if ($shareType == self::$shareTypeUserAndGroups && $limit === 1) {
+ // Make sure the unique user target is returned if it exists,
+ // unique targets should follow the group share in the database
+ // If the limit is not 1, the filtering can be done later
+ $where .= ' ORDER BY `*PREFIX*share`.`id` DESC';
+ } else {
+ $where .= ' ORDER BY `*PREFIX*share`.`id` ASC';
+ }
+
if ($limit != -1 && !$includeCollections) {
- if ($shareType == self::$shareTypeUserAndGroups) {
- // Make sure the unique user target is returned if it exists,
- // unique targets should follow the group share in the database
- // If the limit is not 1, the filtering can be done later
- $where .= ' ORDER BY `*PREFIX*share`.`id` DESC';
- }
// The limit must be at least 3, because filtering needs to be done
if ($limit < 3) {
$queryLimit = 3;
@@ -1307,7 +1345,6 @@ class Share extends \OC\Share\Constants {
}
} else {
$queryLimit = null;
- $where .= ' ORDER BY `*PREFIX*share`.`id` ASC';
}
$select = self::createSelectStatement($format, $fileDependent, $uidOwner);
$root = strlen($root);
@@ -1315,7 +1352,7 @@ class Share extends \OC\Share\Constants {
$result = $query->execute($queryArgs);
if (\OC_DB::isError($result)) {
\OC_Log::write('OCP\Share',
- \OC_DB::getErrorMessage($result) . ', select=' . $select . ' where=' . $where,
+ \OC_DB::getErrorMessage($result) . ', select=' . $select . ' where=',
\OC_Log::ERROR);
}
$items = array();
@@ -1329,6 +1366,12 @@ class Share extends \OC\Share\Constants {
$row['share_type'] = self::SHARE_TYPE_GROUP;
$row['unique_name'] = true; // remember that we use a unique name for this user
$row['share_with'] = $items[$row['parent']]['share_with'];
+ // if the group share was unshared from the user we keep the permission, otherwise
+ // we take the permission from the parent because this is always the up-to-date
+ // permission for the group share
+ if ($row['permissions'] > 0) {
+ $row['permissions'] = $items[$row['parent']]['permissions'];
+ }
// Remove the parent group share
unset($items[$row['parent']]);
if ($row['permissions'] == 0) {
@@ -1336,10 +1379,10 @@ class Share extends \OC\Share\Constants {
}
} else if (!isset($uidOwner)) {
// Check if the same target already exists
- if (isset($targets[$row[$column]])) {
+ if (isset($targets[$row['id']])) {
// Check if the same owner shared with the user twice
// through a group and user share - this is allowed
- $id = $targets[$row[$column]];
+ $id = $targets[$row['id']];
if (isset($items[$id]) && $items[$id]['uid_owner'] == $row['uid_owner']) {
// Switch to group share type to ensure resharing conditions aren't bypassed
if ($items[$id]['share_type'] != self::SHARE_TYPE_GROUP) {
@@ -1355,12 +1398,12 @@ class Share extends \OC\Share\Constants {
unset($items[$id]);
$id = $row['id'];
}
- // Combine the permissions for the item
$items[$id]['permissions'] |= (int)$row['permissions'];
- continue;
+
}
- } else {
- $targets[$row[$column]] = $row['id'];
+ continue;
+ } elseif (!empty($row['parent'])) {
+ $targets[$row['parent']] = $row['id'];
}
}
// Remove root from file source paths if retrieving own shared items
@@ -1398,6 +1441,7 @@ class Share extends \OC\Share\Constants {
}
}
}
+
if($checkExpireDate) {
if (self::expireItem($row)) {
continue;
@@ -1415,8 +1459,17 @@ class Share extends \OC\Share\Constants {
$row['displayname_owner'] = \OCP\User::getDisplayName($row['uid_owner']);
}
- $items[$row['id']] = $row;
+ if ($row['permissions'] > 0) {
+ $items[$row['id']] = $row;
+ }
+
+ }
+
+ // group items if we are looking for items shared with the current user
+ if (isset($shareWith) && $shareWith === \OCP\User::getUser()) {
+ $items = self::groupItems($items, $itemType);
}
+
if (!empty($items)) {
$collectionItems = array();
foreach ($items as &$row) {
@@ -1502,6 +1555,47 @@ class Share extends \OC\Share\Constants {
}
/**
+ * group items with link to the same source
+ *
+ * @param array $items
+ * @param string $itemType
+ * @return array of grouped items
+ */
+ protected static function groupItems($items, $itemType) {
+
+ $fileSharing = ($itemType === 'file' || $itemType === 'folder') ? true : false;
+
+ $result = array();
+
+ foreach ($items as $item) {
+ $grouped = false;
+ foreach ($result as $key => $r) {
+ // for file/folder shares we need to compare file_source, otherwise we compare item_source
+ // only group shares if they already point to the same target, otherwise the file where shared
+ // before grouping of shares was added. In this case we don't group them toi avoid confusions
+ if (( $fileSharing && $item['file_source'] === $r['file_source'] && $item['file_target'] === $r['file_target']) ||
+ (!$fileSharing && $item['item_source'] === $r['item_source'] && $item['item_target'] === $r['item_target'])) {
+ // add the first item to the list of grouped shares
+ if (!isset($result[$key]['grouped'])) {
+ $result[$key]['grouped'][] = $result[$key];
+ }
+ $result[$key]['permissions'] = (int) $item['permissions'] | (int) $r['permissions'];
+ $result[$key]['grouped'][] = $item;
+ $grouped = true;
+ break;
+ }
+ }
+
+ if (!$grouped) {
+ $result[] = $item;
+ }
+
+ }
+
+ return $result;
+ }
+
+/**
* Put shared item into the database
* @param string $itemType Item type
* @param string $itemSource Item source
@@ -1518,121 +1612,34 @@ class Share extends \OC\Share\Constants {
*/
private static function put($itemType, $itemSource, $shareType, $shareWith, $uidOwner,
$permissions, $parentFolder = null, $token = null, $itemSourceName = null, \DateTime $expirationDate = null) {
- $backend = self::getBackend($itemType);
- $l = \OC::$server->getL10N('lib');
- // Check if this is a reshare
- if ($checkReshare = self::getItemSharedWithBySource($itemType, $itemSource, self::FORMAT_NONE, null, true)) {
-
- // Check if attempting to share back to owner
- if ($checkReshare['uid_owner'] == $shareWith && $shareType == self::SHARE_TYPE_USER) {
- $message = 'Sharing %s failed, because the user %s is the original sharer';
- $message_t = $l->t('Sharing %s failed, because the user %s is the original sharer', array($itemSourceName, $shareWith));
-
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
- throw new \Exception($message_t);
- }
- // Check if share permissions is granted
- if (self::isResharingAllowed() && (int)$checkReshare['permissions'] & \OCP\PERMISSION_SHARE) {
- if (~(int)$checkReshare['permissions'] & $permissions) {
- $message = 'Sharing %s failed, because the permissions exceed permissions granted to %s';
- $message_t = $l->t('Sharing %s failed, because the permissions exceed permissions granted to %s', array($itemSourceName, $uidOwner));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $uidOwner), \OC_Log::ERROR);
- throw new \Exception($message_t);
- } else {
- // TODO Don't check if inside folder
- $parent = $checkReshare['id'];
- $itemSource = $checkReshare['item_source'];
- $fileSource = $checkReshare['file_source'];
- $suggestedItemTarget = $checkReshare['item_target'];
- $suggestedFileTarget = $checkReshare['file_target'];
- $filePath = $checkReshare['file_target'];
- $expirationDate = min($expirationDate, $checkReshare['expiration']);
- }
- } else {
- $message = 'Sharing %s failed, because resharing is not allowed';
- $message_t = $l->t('Sharing %s failed, because resharing is not allowed', array($itemSourceName));
+ $queriesToExecute = array();
+ $suggestedItemTarget = null;
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName), \OC_Log::ERROR);
- throw new \Exception($message_t);
- }
- } else {
- $parent = null;
- $suggestedItemTarget = null;
- $suggestedFileTarget = null;
- if (!$backend->isValidSource($itemSource, $uidOwner)) {
- $message = 'Sharing %s failed, because the sharing backend for '
- .'%s could not find its source';
- $message_t = $l->t('Sharing %s failed, because the sharing backend for %s could not find its source', array($itemSource, $itemType));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSource, $itemType), \OC_Log::ERROR);
- throw new \Exception($message_t);
- }
- if ($backend instanceof \OCP\Share_Backend_File_Dependent) {
- $filePath = $backend->getFilePath($itemSource, $uidOwner);
- if ($itemType == 'file' || $itemType == 'folder') {
- $fileSource = $itemSource;
- } else {
- $meta = \OC\Files\Filesystem::getFileInfo($filePath);
- $fileSource = $meta['fileid'];
- }
- if ($fileSource == -1) {
- $message = 'Sharing %s failed, because the file could not be found in the file cache';
- $message_t = $l->t('Sharing %s failed, because the file could not be found in the file cache', array($itemSource));
-
- \OC_Log::write('OCP\Share', sprintf($message, $itemSource), \OC_Log::ERROR);
- throw new \Exception($message_t);
- }
- } else {
- $filePath = null;
- $fileSource = null;
- }
+ $result = self::checkReshare($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, $itemSourceName, $expirationDate);
+ if(!empty($result)) {
+ $parent = $result['parent'];
+ $itemSource = $result['itemSource'];
+ $fileSource = $result['fileSource'];
+ $suggestedItemTarget = $result['suggestedItemTarget'];
+ $suggestedFileTarget = $result['suggestedFileTarget'];
+ $filePath = $result['filePath'];
+ $expirationDate = $result['expirationDate'];
}
- // Share with a group
+ $isGroupShare = false;
if ($shareType == self::SHARE_TYPE_GROUP) {
- $groupItemTarget = Helper::generateTarget($itemType, $itemSource, $shareType, $shareWith['group'],
- $uidOwner, $suggestedItemTarget);
- $run = true;
- $error = '';
- \OC_Hook::emit('OCP\Share', 'pre_shared', array(
- 'itemType' => $itemType,
- 'itemSource' => $itemSource,
- 'itemTarget' => $groupItemTarget,
- 'shareType' => $shareType,
- 'shareWith' => $shareWith['group'],
- 'uidOwner' => $uidOwner,
- 'permissions' => $permissions,
- 'fileSource' => $fileSource,
- 'expiration' => $expirationDate,
- 'token' => $token,
- 'run' => &$run,
- 'error' => &$error
- ));
-
- if ($run === false) {
- throw new \Exception($error);
- }
-
- if (isset($fileSource)) {
- if ($parentFolder) {
- if ($parentFolder === true) {
- $groupFileTarget = Helper::generateTarget('file', $filePath, $shareType,
- $shareWith['group'], $uidOwner, $suggestedFileTarget);
- // Set group default file target for future use
- $parentFolders[0]['folder'] = $groupFileTarget;
- } else {
- // Get group default file target
- $groupFileTarget = $parentFolder[0]['folder'].$itemSource;
- $parent = $parentFolder[0]['id'];
- }
- } else {
- $groupFileTarget = Helper::generateTarget('file', $filePath, $shareType, $shareWith['group'],
- $uidOwner, $suggestedFileTarget);
- }
- } else {
- $groupFileTarget = null;
+ $isGroupShare = true;
+ $users = \OC_Group::usersInGroup($shareWith['group']);
+ // remove current user from list
+ if (in_array(\OCP\User::getUser(), $users)) {
+ unset($users[array_search(\OCP\User::getUser(), $users)]);
}
- $queriesToExecute = array();
+ $groupItemTarget = Helper::generateTarget($itemType, $itemSource, $shareType, $shareWith['group'],
+ $uidOwner, $suggestedItemTarget);
+ $groupFileTarget = $filePath;
+
+ // add group share to table and remember the id as parent
$queriesToExecute['groupShare'] = array(
'itemType' => $itemType,
'itemSource' => $itemSource,
@@ -1643,165 +1650,231 @@ class Share extends \OC\Share\Constants {
'permissions' => $permissions,
'shareTime' => time(),
'fileSource' => $fileSource,
- 'fileTarget' => $groupFileTarget,
+ 'fileTarget' => $filePath,
'token' => $token,
'parent' => $parent,
'expiration' => $expirationDate,
);
- // Loop through all users of this group in case we need to add an extra row
- foreach ($shareWith['users'] as $uid) {
- $itemTarget = Helper::generateTarget($itemType, $itemSource, self::SHARE_TYPE_USER, $uid,
+
+ } else {
+ $users = array($shareWith);
+ $itemTarget = Helper::generateTarget($itemType, $itemSource, $shareType, $shareWith, $uidOwner,
+ $suggestedItemTarget);
+ }
+
+ $run = true;
+ $error = '';
+ $preHookData = array(
+ 'itemType' => $itemType,
+ 'itemSource' => $itemSource,
+ 'shareType' => $shareType,
+ 'uidOwner' => $uidOwner,
+ 'permissions' => $permissions,
+ 'fileSource' => $fileSource,
+ 'expiration' => $expirationDate,
+ 'token' => $token,
+ 'run' => &$run,
+ 'error' => &$error
+ );
+
+ $preHookData['itemTarget'] = ($isGroupShare) ? $groupItemTarget : $itemTarget;
+ $preHookData['shareWith'] = ($isGroupShare) ? $shareWith['group'] : $shareWith;
+
+ \OC_Hook::emit('OCP\Share', 'pre_shared', $preHookData);
+
+ if ($run === false) {
+ throw new \Exception($error);
+ }
+
+ foreach ($users as $user) {
+ $sourceId = ($itemType === 'file' || $itemType === 'folder') ? $fileSource : $itemSource;
+ $sourceExists = self::getItemSharedWithBySource($itemType, $sourceId, self::FORMAT_NONE, null, true, $user);
+
+ $shareType = ($isGroupShare) ? self::$shareTypeGroupUserUnique : $shareType;
+
+ if ($sourceExists) {
+ $fileTarget = $sourceExists['file_target'];
+ $itemTarget = $sourceExists['item_target'];
+
+ // for group shares we don't need a additional entry if the target is the same
+ if($isGroupShare && $groupItemTarget === $itemTarget) {
+ continue;
+ }
+
+ } elseif(!$sourceExists && !$isGroupShare) {
+
+ $itemTarget = Helper::generateTarget($itemType, $itemSource, self::SHARE_TYPE_USER, $user,
$uidOwner, $suggestedItemTarget, $parent);
if (isset($fileSource)) {
if ($parentFolder) {
if ($parentFolder === true) {
- $fileTarget = Helper::generateTarget('file', $filePath, self::SHARE_TYPE_USER, $uid,
+ $fileTarget = Helper::generateTarget('file', $filePath, self::SHARE_TYPE_USER, $user,
$uidOwner, $suggestedFileTarget, $parent);
if ($fileTarget != $groupFileTarget) {
- $parentFolders[$uid]['folder'] = $fileTarget;
+ $parentFolders[$user]['folder'] = $fileTarget;
}
- } else if (isset($parentFolder[$uid])) {
- $fileTarget = $parentFolder[$uid]['folder'].$itemSource;
- $parent = $parentFolder[$uid]['id'];
+ } else if (isset($parentFolder[$user])) {
+ $fileTarget = $parentFolder[$user]['folder'].$itemSource;
+ $parent = $parentFolder[$user]['id'];
}
} else {
$fileTarget = Helper::generateTarget('file', $filePath, self::SHARE_TYPE_USER,
- $uid, $uidOwner, $suggestedFileTarget, $parent);
+ $user, $uidOwner, $suggestedFileTarget, $parent);
}
} else {
$fileTarget = null;
}
- // Insert an extra row for the group share if the item or file target is unique for this user
- if ($itemTarget != $groupItemTarget || (isset($fileSource) && $fileTarget != $groupFileTarget)) {
- $queriesToExecute[] = array(
- 'itemType' => $itemType,
- 'itemSource' => $itemSource,
- 'itemTarget' => $itemTarget,
- 'shareType' => self::$shareTypeGroupUserUnique,
- 'shareWith' => $uid,
- 'uidOwner' => $uidOwner,
- 'permissions' => $permissions,
- 'shareTime' => time(),
- 'fileSource' => $fileSource,
- 'fileTarget' => $fileTarget,
- 'token' => $token,
- //'parent' => $parent,
- 'expiration' => $expirationDate,
- );
+
+ } else {
+
+ // group share which doesn't exists until now, check if we need a unique target for this user
+
+ $itemTarget = Helper::generateTarget($itemType, $itemSource, self::SHARE_TYPE_USER, $user,
+ $uidOwner, $suggestedItemTarget, $parent);
+
+ // do we also need a file target
+ if (isset($fileSource)) {
+ $fileTarget = Helper::generateTarget('file', $filePath, self::SHARE_TYPE_USER, $user,
+ $uidOwner, $suggestedFileTarget, $parent);
+ } else {
+ $fileTarget = null;
+ }
+
+ if ($itemTarget === $groupItemTarget && (isset($fileSource) && $fileTarget === $groupItemTarget)) {
+ continue;
}
}
+ $queriesToExecute[] = array(
+ 'itemType' => $itemType,
+ 'itemSource' => $itemSource,
+ 'itemTarget' => $itemTarget,
+ 'shareType' => $shareType,
+ 'shareWith' => $user,
+ 'uidOwner' => $uidOwner,
+ 'permissions' => $permissions,
+ 'shareTime' => time(),
+ 'fileSource' => $fileSource,
+ 'fileTarget' => $fileTarget,
+ 'token' => $token,
+ 'parent' => $parent,
+ 'expiration' => $expirationDate,
+ );
+
+ }
+
+ if ($isGroupShare) {
self::insertShare($queriesToExecute['groupShare']);
// Save this id, any extra rows for this group share will need to reference it
$parent = \OC_DB::insertid('*PREFIX*share');
unset($queriesToExecute['groupShare']);
+ }
- foreach ($queriesToExecute as $shareQuery) {
- $shareQuery['parent'] = $parent;
- self::insertShare($shareQuery);
- }
+ foreach ($queriesToExecute as $shareQuery) {
+ $shareQuery['parent'] = $parent;
+ self::insertShare($shareQuery);
+ }
- \OC_Hook::emit('OCP\Share', 'post_shared', array(
- 'itemType' => $itemType,
- 'itemSource' => $itemSource,
- 'itemTarget' => $groupItemTarget,
- 'parent' => $parent,
- 'shareType' => $shareType,
- 'shareWith' => $shareWith['group'],
- 'uidOwner' => $uidOwner,
- 'permissions' => $permissions,
- 'fileSource' => $fileSource,
- 'fileTarget' => $groupFileTarget,
- 'id' => $parent,
- 'token' => $token,
- 'expirationDate' => $expirationDate,
- ));
-
- if ($parentFolder === true) {
- // Return parent folders to preserve file target paths for potential children
- return $parentFolders;
+ $postHookData = array(
+ 'itemType' => $itemType,
+ 'itemSource' => $itemSource,
+ 'parent' => $parent,
+ 'shareType' => $shareType,
+ 'uidOwner' => $uidOwner,
+ 'permissions' => $permissions,
+ 'fileSource' => $fileSource,
+ 'id' => $parent,
+ 'token' => $token,
+ 'expirationDate' => $expirationDate,
+ );
+
+ $postHookData['shareWith'] = ($isGroupShare) ? $shareWith['group'] : $shareWith;
+ $postHookData['itemTarget'] = ($isGroupShare) ? $groupItemTarget : $itemTarget;
+ $postHookData['fileTarget'] = ($isGroupShare) ? $groupFileTarget : $fileTarget;
+
+ \OC_Hook::emit('OCP\Share', 'post_shared', $postHookData);
+
+
+ return true;
+ }
+
+ private static function checkReshare($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, $itemSourceName, $expirationDate) {
+ $backend = self::getBackend($itemType);
+
+ $l = \OC::$server->getL10N('lib');
+ $result = array();
+
+ $checkReshare = self::getItemSharedWithBySource($itemType, $itemSource, self::FORMAT_NONE, null, true);
+ if ($checkReshare) {
+ // Check if attempting to share back to owner
+ if ($checkReshare['uid_owner'] == $shareWith && $shareType == self::SHARE_TYPE_USER) {
+ $message = 'Sharing %s failed, because the user %s is the original sharer';
+ $message_t = $l->t('Sharing %s failed, because the user %s is the original sharer', array($itemSourceName, $shareWith));
+
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
+ throw new \Exception($message_t);
}
- } else {
- $itemTarget = Helper::generateTarget($itemType, $itemSource, $shareType, $shareWith, $uidOwner,
- $suggestedItemTarget);
- $run = true;
- $error = '';
- \OC_Hook::emit('OCP\Share', 'pre_shared', array(
- 'itemType' => $itemType,
- 'itemSource' => $itemSource,
- 'itemTarget' => $itemTarget,
- 'shareType' => $shareType,
- 'shareWith' => $shareWith,
- 'uidOwner' => $uidOwner,
- 'permissions' => $permissions,
- 'fileSource' => $fileSource,
- 'token' => $token,
- 'expirationDate' => $expirationDate,
- 'run' => &$run,
- 'error' => &$error,
- ));
-
- if ($run === false) {
- throw new \Exception($error);
- }
-
- if (isset($fileSource)) {
- if ($parentFolder) {
- if ($parentFolder === true) {
- $fileTarget = Helper::generateTarget('file', $filePath, $shareType, $shareWith,
- $uidOwner, $suggestedFileTarget);
- $parentFolders['folder'] = $fileTarget;
- } else {
- $fileTarget = $parentFolder['folder'].$itemSource;
- $parent = $parentFolder['id'];
- }
+
+ // Check if share permissions is granted
+ if (self::isResharingAllowed() && (int)$checkReshare['permissions'] & \OCP\PERMISSION_SHARE) {
+ if (~(int)$checkReshare['permissions'] & $permissions) {
+ $message = 'Sharing %s failed, because the permissions exceed permissions granted to %s';
+ $message_t = $l->t('Sharing %s failed, because the permissions exceed permissions granted to %s', array($itemSourceName, $uidOwner));
+
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $uidOwner), \OC_Log::ERROR);
+ throw new \Exception($message_t);
} else {
- $fileTarget = Helper::generateTarget('file', $filePath, $shareType, $shareWith, $uidOwner,
- $suggestedFileTarget);
+ // TODO Don't check if inside folder
+ $result['parent'] = $checkReshare['id'];
+ $result['itemSource'] = $checkReshare['item_source'];
+ $result['fileSource'] = $checkReshare['file_source'];
+ $result['suggestedItemTarget'] = $checkReshare['item_target'];
+ $result['suggestedFileTarget'] = $checkReshare['file_target'];
+ $result['filePath'] = $checkReshare['file_target'];
+ $result['expirationDate'] = min($expirationDate, $checkReshare['expiration']);
}
} else {
- $fileTarget = null;
- }
+ $message = 'Sharing %s failed, because resharing is not allowed';
+ $message_t = $l->t('Sharing %s failed, because resharing is not allowed', array($itemSourceName));
- self::insertShare(array(
- 'itemType' => $itemType,
- 'itemSource' => $itemSource,
- 'itemTarget' => $itemTarget,
- 'shareType' => $shareType,
- 'shareWith' => $shareWith,
- 'uidOwner' => $uidOwner,
- 'permissions' => $permissions,
- 'shareTime' => time(),
- 'fileSource' => $fileSource,
- 'fileTarget' => $fileTarget,
- 'token' => $token,
- 'parent' => $parent,
- 'expiration' => $expirationDate,
- ));
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName), \OC_Log::ERROR);
+ throw new \Exception($message_t);
+ }
+ } else {
+ $result['parent'] = null;
+ $result['suggestedItemTarget'] = null;
+ $result['suggestedFileTarget'] = null;
+ $result['itemSource'] = $itemSource;
+ $result['expirationDate'] = $expirationDate;
+ if (!$backend->isValidSource($itemSource, $uidOwner)) {
+ $message = 'Sharing %s failed, because the sharing backend for '
+ .'%s could not find its source';
+ $message_t = $l->t('Sharing %s failed, because the sharing backend for %s could not find its source', array($itemSource, $itemType));
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSource, $itemType), \OC_Log::ERROR);
+ throw new \Exception($message_t);
+ }
+ if ($backend instanceof \OCP\Share_Backend_File_Dependent) {
+ $result['filePath'] = $backend->getFilePath($itemSource, $uidOwner);
+ if ($itemType == 'file' || $itemType == 'folder') {
+ $result['fileSource'] = $itemSource;
+ } else {
+ $meta = \OC\Files\Filesystem::getFileInfo($result['filePath']);
+ $result['fileSource'] = $meta['fileid'];
+ }
+ if ($result['fileSource'] == -1) {
+ $message = 'Sharing %s failed, because the file could not be found in the file cache';
+ $message_t = $l->t('Sharing %s failed, because the file could not be found in the file cache', array($itemSource));
- $id = \OC_DB::insertid('*PREFIX*share');
- \OC_Hook::emit('OCP\Share', 'post_shared', array(
- 'itemType' => $itemType,
- 'itemSource' => $itemSource,
- 'itemTarget' => $itemTarget,
- 'parent' => $parent,
- 'shareType' => $shareType,
- 'shareWith' => $shareWith,
- 'uidOwner' => $uidOwner,
- 'permissions' => $permissions,
- 'fileSource' => $fileSource,
- 'fileTarget' => $fileTarget,
- 'id' => $id,
- 'token' => $token,
- 'expirationDate' => $expirationDate,
- ));
- if ($parentFolder === true) {
- $parentFolders['id'] = $id;
- // Return parent folder to preserve file target paths for potential children
- return $parentFolders;
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSource), \OC_Log::ERROR);
+ throw new \Exception($message_t);
+ }
+ } else {
+ $result['filePath'] = null;
+ $result['fileSource'] = null;
}
}
- return true;
+
+ return $result;
}
private static function insertShare(array $shareData)
@@ -1877,9 +1950,9 @@ class Share extends \OC\Share\Constants {
$select = '*';
if ($format == self::FORMAT_STATUSES) {
if ($fileDependent) {
- $select = '`*PREFIX*share`.`id`, `*PREFIX*share`.`parent`, `share_type`, `path`, `storage`, `share_with`, `uid_owner` , `file_source`, `stime`';
+ $select = '`*PREFIX*share`.`id`, `*PREFIX*share`.`parent`, `share_type`, `path`, `storage`, `share_with`, `uid_owner` , `file_source`, `stime`, `*PREFIX*share`.`permissions`';
} else {
- $select = '`id`, `parent`, `share_type`, `share_with`, `uid_owner`, `item_source`, `stime`';
+ $select = '`id`, `parent`, `share_type`, `share_with`, `uid_owner`, `item_source`, `stime`, `*PREFIX*share`.`permissions`';
}
} else {
if (isset($uidOwner)) {
diff --git a/lib/private/templatelayout.php b/lib/private/templatelayout.php
index 7ac0bd97abe..e9172fd2da5 100644
--- a/lib/private/templatelayout.php
+++ b/lib/private/templatelayout.php
@@ -3,6 +3,7 @@ use Assetic\Asset\AssetCollection;
use Assetic\Asset\FileAsset;
use Assetic\AssetWriter;
use Assetic\Filter\CssRewriteFilter;
+use Assetic\Filter\CssImportFilter;
/**
* Copyright (c) 2012 Bart Visscher <bartv@thisnet.nl>
@@ -167,7 +168,15 @@ class OC_TemplateLayout extends OC_Template {
$assetPath = $root . '/' . $file;
$sourceRoot = \OC::$SERVERROOT;
$sourcePath = substr($assetPath, strlen(\OC::$SERVERROOT));
- return new FileAsset($assetPath, array(new CssRewriteFilter()), $sourceRoot, $sourcePath);
+ return new FileAsset(
+ $assetPath,
+ array(
+ new CssRewriteFilter(),
+ new CssImportFilter()
+ ),
+ $sourceRoot,
+ $sourcePath
+ );
}, $cssFiles);
$cssCollection = new AssetCollection($cssFiles);
$cssCollection->setTargetPath("assets/$cssHash.css");
diff --git a/lib/private/util.php b/lib/private/util.php
index 46a61716333..304db827a1a 100755
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -847,8 +847,10 @@ class OC_Util {
*/
public static function getDefaultPageUrl() {
$urlGenerator = \OC::$server->getURLGenerator();
- if (isset($_REQUEST['redirect_url'])) {
- $location = urldecode($_REQUEST['redirect_url']);
+ // Deny the redirect if the URL contains a @
+ // This prevents unvalidated redirects like ?redirect_url=:user@domain.com
+ if (isset($_REQUEST['redirect_url']) && strpos($_REQUEST['redirect_url'], '@') === false) {
+ $location = $urlGenerator->getAbsoluteURL(urldecode($_REQUEST['redirect_url']));
} else {
$defaultPage = OC_Appconfig::getValue('core', 'defaultpage');
if ($defaultPage) {
@@ -897,28 +899,13 @@ class OC_Util {
}
/**
- * Static lifespan (in seconds) when a request token expires.
- *
- * @see OC_Util::callRegister()
- * @see OC_Util::isCallRegistered()
- * @description
- * Also required for the client side to compute the point in time when to
- * request a fresh token. The client will do so when nearly 97% of the
- * time span coded here has expired.
- */
- public static $callLifespan = 3600; // 3600 secs = 1 hour
-
- /**
* Register an get/post call. Important to prevent CSRF attacks.
*
- * @todo Write howto: CSRF protection guide
* @return string Generated token.
* @description
* Creates a 'request token' (random) and stores it inside the session.
* Ever subsequent (ajax) request must use such a valid token to succeed,
* otherwise the request will be denied as a protection against CSRF.
- * The tokens expire after a fixed lifespan.
- * @see OC_Util::$callLifespan
* @see OC_Util::isCallRegistered()
*/
public static function callRegister() {
@@ -938,7 +925,6 @@ class OC_Util {
* Check an ajax get/post call if the request token is valid.
*
* @return boolean False if request token is not set or is invalid.
- * @see OC_Util::$callLifespan
* @see OC_Util::callRegister()
*/
public static function isCallRegistered() {
@@ -948,7 +934,6 @@ class OC_Util {
/**
* Check an ajax get/post call if the request token is valid. Exit if not.
*
- * @todo Write howto
* @return void
*/
public static function callCheck() {
diff --git a/lib/public/share.php b/lib/public/share.php
index c8b64cc187c..449d1fa211e 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -139,7 +139,7 @@ class Share extends \OC\Share\Constants {
* @param int $format (optional) Format type must be defined by the backend
* @param mixed $parameters
* @param bool $includeCollections
- * @return mixed Return depends on format
+ * @return array
*/
public static function getItemSharedWithBySource($itemType, $itemSource, $format = self::FORMAT_NONE,
$parameters = null, $includeCollections = false) {
@@ -361,7 +361,7 @@ interface Share_Backend {
* Get a unique name of the item for the specified user
* @param string $itemSource
* @param string|false $shareWith User the item is being shared with
- * @param array|null $exclude List of similar item names already existing as shared items
+ * @param array|null $exclude List of similar item names already existing as shared items @deprecated since version OC7
* @return string Target name
*
* This function needs to verify that the user does not already have an item with this name.
diff --git a/settings/l10n/bn_BD.php b/settings/l10n/bn_BD.php
index f4e1b722a00..58b2a245e32 100644
--- a/settings/l10n/bn_BD.php
+++ b/settings/l10n/bn_BD.php
@@ -96,10 +96,19 @@ $TRANSLATIONS = array(
"Import Root Certificate" => "রুট সনদপত্রটি আমদানি করুন",
"Login Name" => "প্রবেশ",
"Create" => "তৈরী কর",
+"Admin Recovery Password" => "প্রশাসক পূণরূদ্ধার কুটশব্দ",
+"Add Group" => "গ্রুপ যোগ কর",
"Group" => "গোষ্ঠীসমূহ",
+"Everyone" => "সকলে",
+"Admins" => "প্রশাসন",
"Unlimited" => "অসীম",
"Other" => "অন্যান্য",
"Username" => "ব্যবহারকারী",
+"Quota" => "কোটা",
+"Storage Location" => "সংরক্ষণাগার এর অবস্থান",
+"Last Login" => "শেষ লগইন",
+"change full name" => "পুরোনাম পরিবর্তন করুন",
+"set new password" => "নতুন কূটশব্দ নির্ধারণ করুন",
"Default" => "পূর্বনির্ধারিত"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/settings/l10n/el.php b/settings/l10n/el.php
index 572a2ae7173..16c2b16e7f3 100644
--- a/settings/l10n/el.php
+++ b/settings/l10n/el.php
@@ -118,6 +118,8 @@ $TRANSLATIONS = array(
"We strongly suggest to install the required packages on your system to support one of the following locales: %s." => "Συνιστούμε σοβαρά να εγκαταστήσετε τα απαιτούμενα πακέτα στο σύστημά σας ώστε να υποστηρίζεται μια από τις ακόλουθες ρυθμίσεις τοποθεσίας: %s.",
"URL generation in notification emails" => "Δημιουργία URL στις ειδοποιήσεις ηλεκτρονικού ταχυδρομείου",
"If your installation is not installed in the root of the domain and uses system cron, there can be issues with the URL generation. To avoid these problems, please set the \"overwritewebroot\" option in your config.php file to the webroot path of your installation (Suggested: \"%s\")" => "Αν η εγκατάστασή σας δεν είναι εγκατεστημένη στη ρίζα της περιοχής και χρησιμοποιεί το cron του συστήματος, μπορεί να υπάρξουν ζητήματα με τη δημιουργία URL. Για να αποφύγετε αυτά τα προβλήματα, παρακαλώ ρυθμίστε την επιλογή \"overwritewebroot\" στον config.php φάκελό σας στη διαδρομή webroot της εγκατάστασής σας (Suggested: \"%s\")",
+"Connectivity checks" => "Έλεγχοι συνδεσιμότητας",
+"No problems found" => "Δεν βρέθηκαν προβλήματα",
"Please double check the <a href='%s'>installation guides</a>." => "Ελέγξτε ξανά τις <a href='%s'>οδηγίες εγκατάστασης</a>.",
"Cron" => "Cron",
"Last cron was executed at %s." => "Η τελευταία εκτέλεση του cron ήταν στις %s",
diff --git a/settings/l10n/fr.php b/settings/l10n/fr.php
index 8df2eb3732a..6a077f66c27 100644
--- a/settings/l10n/fr.php
+++ b/settings/l10n/fr.php
@@ -1,7 +1,7 @@
<?php
$TRANSLATIONS = array(
"Invalid value supplied for %s" => "Valeur fournie pour %s non valable",
-"Saved" => "Sauvegarder",
+"Saved" => "Sauvegardé",
"test email settings" => "tester les paramètres d'e-mail",
"If you received this email, the settings seem to be correct." => "Si vous recevez cet email, c'est que les paramètres sont corrects",
"A problem occurred while sending the e-mail. Please revisit your settings." => "Une erreur est survenue lors de l'envoi de l'e-mail. Veuillez vérifier vos paramètres.",
@@ -168,7 +168,7 @@ $TRANSLATIONS = array(
"More Apps" => "Plus d'applications…",
"Select an App" => "Sélectionner une Application",
"Documentation:" => "Documentation :",
-"See application page at apps.owncloud.com" => "Voir la page des applications à l'url apps.owncloud.com",
+"See application page at apps.owncloud.com" => "Voir la page de l'application sur apps.owncloud.com",
"See application website" => "Voir le site web de l'application",
"<span class=\"licence\"></span>-licensed by <span class=\"author\"></span>" => "Distribué sous licence <span class=\"licence\"></span>, par <span class=\"author\"></span>",
"Enable only for specific groups" => "Activer uniquement pour certains groupes",
diff --git a/settings/l10n/ia.php b/settings/l10n/ia.php
index 68da624b95e..608beddbe61 100644
--- a/settings/l10n/ia.php
+++ b/settings/l10n/ia.php
@@ -1,5 +1,6 @@
<?php
$TRANSLATIONS = array(
+"Saved" => "Salveguardate",
"Email sent" => "Message de e-posta inviate",
"Language changed" => "Linguage cambiate",
"Invalid request" => "Requesta invalide",
diff --git a/settings/l10n/pt_PT.php b/settings/l10n/pt_PT.php
index 38e93ab2f86..ac318109742 100644
--- a/settings/l10n/pt_PT.php
+++ b/settings/l10n/pt_PT.php
@@ -67,6 +67,7 @@ $TRANSLATIONS = array(
"So-so password" => "Password aceitável",
"Good password" => "Password Forte",
"Strong password" => "Password muito forte",
+"Valid until {date}" => "Válido até {date}",
"Delete" => "Eliminar",
"Decrypting files... Please wait, this can take some time." => "A desencriptar os ficheiros... Por favor aguarde, esta operação pode demorar algum tempo.",
"Delete encryption keys permanently." => "Excluir as chaves encriptadas de forma permanente.",
@@ -117,6 +118,7 @@ $TRANSLATIONS = array(
"We strongly suggest to install the required packages on your system to support one of the following locales: %s." => "Recomendamos fortemente que instale no seu sistema todos os pacotes necessários para suportar os seguintes locales: %s.",
"URL generation in notification emails" => "Geração URL em e-mails de notificação",
"If your installation is not installed in the root of the domain and uses system cron, there can be issues with the URL generation. To avoid these problems, please set the \"overwritewebroot\" option in your config.php file to the webroot path of your installation (Suggested: \"%s\")" => "Se a sua instalação não está instalada na raiz do domínio e usa o sistema cron, pode haver problemas com a geração de URL. Para evitar esses problemas, por favor, defina a opção \"overwritewebroot\" no ficheiro config.php para o caminho webroot da sua instalação (sugestão: \"%s\")",
+"No problems found" => "Nenhum problema encontrado",
"Please double check the <a href='%s'>installation guides</a>." => "Por favor verifique <a href='%s'>installation guides</a>.",
"Cron" => "Cron",
"Last cron was executed at %s." => "O ultimo cron foi executado em %s.",
@@ -199,6 +201,8 @@ $TRANSLATIONS = array(
"Language" => "Idioma",
"Help translate" => "Ajude a traduzir",
"SSL root certificates" => "Certificados SSL de raiz",
+"Valid until" => "Válido até",
+"Valid until %s" => "Válido até %s",
"Import Root Certificate" => "Importar Certificado Root",
"The encryption app is no longer enabled, please decrypt all your files" => "A aplicação de encriptação já não está ativa, por favor desincripte todos os seus ficheiros",
"Log-in password" => "Password de entrada",
@@ -206,6 +210,8 @@ $TRANSLATIONS = array(
"Your encryption keys are moved to a backup location. If something went wrong you can restore the keys. Only delete them permanently if you are sure that all files are decrypted correctly." => "As suas chaves de encriptação foram movidas para um local de segurança. Em caso de algo correr mal você pode restaurar as chaves. Só deve eliminar as chaves permanentemente se tiver certeza absoluta que os ficheiros são decrepitados correctamente.",
"Restore Encryption Keys" => "Restaurar as chaves de encriptação",
"Delete Encryption Keys" => "Apagar as chaves de encriptação",
+"Show storage location" => "Mostrar a localização do armazenamento",
+"Show last log in" => "Mostrar ultimo acesso de entrada",
"Login Name" => "Nome de utilizador",
"Create" => "Criar",
"Admin Recovery Password" => "Recuperar password de administrador",
diff --git a/settings/l10n/ru.php b/settings/l10n/ru.php
index 2e6273e806c..e9f41756919 100644
--- a/settings/l10n/ru.php
+++ b/settings/l10n/ru.php
@@ -111,11 +111,13 @@ $TRANSLATIONS = array(
"Your PHP version is outdated" => "Ваша версия PHP устарела",
"Your PHP version is outdated. We strongly recommend to update to 5.3.8 or newer because older versions are known to be broken. It is possible that this installation is not working correctly." => "Ваша версия PHP устарела. Мы настоятельно рекомендуем обновиться до 5.3.8 или новее, так как старые версии работают не корректно. Вполне возможно, что эта установка не работает должным образом.",
"PHP charset is not set to UTF-8" => "Кодировка PHP не совпадает с UTF-8",
+"PHP charset is not set to UTF-8. This can cause major issues with non-ASCII characters in file names. We highly recommend to change the value of 'default_charset' php.ini to 'UTF-8'." => "Кодировка PHP не совпадает с UTF-8. Это может вызвать трудности с именами файлов, содержащими нелатинские символы. Мы настоятельно рекомендуем сменить значение переменной default_charset в файле php.ini на UTF-8.",
"Locale not working" => "Локализация не работает",
"System locale can not be set to a one which supports UTF-8." => "Невозможно установить системную локаль, поддерживающую UTF-8",
"This means that there might be problems with certain characters in file names." => "Это значит, что могут быть проблемы с некоторыми символами в именах файлов.",
"We strongly suggest to install the required packages on your system to support one of the following locales: %s." => "Мы настоятельно рекомендуем установить требуемые пакеты в систему, для поддержки одной из следующих локалей: %s.",
"URL generation in notification emails" => "Генерирование URL в уведомляющих электронных письмах",
+"If your installation is not installed in the root of the domain and uses system cron, there can be issues with the URL generation. To avoid these problems, please set the \"overwritewebroot\" option in your config.php file to the webroot path of your installation (Suggested: \"%s\")" => "Если ваша копия ownCloud установлена не в корне домена и использует планировщик cron системы, возможны проблемы с правильной генерацией URL. Чтобы избежать этого, установите опцию verwritewebroot файла config.php равной пути папки установки. (Вероятно, это \"%s\".)",
"Connectivity checks" => "Проверка соединения",
"No problems found" => "Проблемы не найдены",
"Please double check the <a href='%s'>installation guides</a>." => "Пожалуйста, дважды просмотрите <a href='%s'>инструкции по установке</a>.",
diff --git a/settings/l10n/tr.php b/settings/l10n/tr.php
index dcfdab6ed95..ce7f7cd5b19 100644
--- a/settings/l10n/tr.php
+++ b/settings/l10n/tr.php
@@ -100,7 +100,7 @@ $TRANSLATIONS = array(
"TLS" => "TLS",
"Security Warning" => "Güvenlik Uyarısı",
"You are accessing %s via HTTP. We strongly suggest you configure your server to require using HTTPS instead." => "%s erişiminiz HTTP aracılığıyla yapılıyor. Sunucunuzu, HTTPS kullanımını zorlamak üzere yapılandırmanızı şiddetle öneririz.",
-"Your data directory and your files are probably accessible from the internet. The .htaccess file is not working. We strongly suggest that you configure your webserver in a way that the data directory is no longer accessible or you move the data directory outside the webserver document root." => "data dizininiz ve dosyalarınız büyük ihtimalle internet üzerinden erişilebilir. .htaccess dosyası çalışmıyor. Web sunucunuzu yapılandırarak data dizinine erişimi kapatmanızı veya data dizinini web sunucu belge kök dizini dışına almanızı şiddetle tavsiye ederiz.",
+"Your data directory and your files are probably accessible from the internet. The .htaccess file is not working. We strongly suggest that you configure your webserver in a way that the data directory is no longer accessible or you move the data directory outside the webserver document root." => "Veri dizininiz ve dosyalarınız muhtemelen İnternet üzerinden erişilebilir. .htaccess dosyası çalışmıyor. Web sunucunuzu yapılandırarak veri dizinine erişimi kapatmanızı veya veri dizinini web sunucu belge kök dizini dışına almanızı şiddetle tavsiye ederiz.",
"Setup Warning" => "Kurulum Uyarısı",
"PHP is apparently setup to strip inline doc blocks. This will make several core apps inaccessible." => "PHP satırıçi doc bloklarını ayıklamak üzere yapılandırılmış gibi görünüyor. Bu, bazı çekirdek (core) uygulamalarını erişilemez yapacak.",
"This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator." => "Bu, muhtemelen Zend OPcache veya eAccelerator gibi bir önbellek/hızlandırıcı nedeniyle gerçekleşir.",
diff --git a/tests/lib/config.php b/tests/lib/config.php
index f739df3ce97..180f6b1649b 100644
--- a/tests/lib/config.php
+++ b/tests/lib/config.php
@@ -7,82 +7,134 @@
*/
class Test_Config extends PHPUnit_Framework_TestCase {
- const CONFIG_FILE = 'static://config.php';
- const CONFIG_DIR = 'static://';
- const TESTCONTENT = '<?php $CONFIG=array("foo"=>"bar");';
+ const TESTCONTENT = '<?php $CONFIG=array("foo"=>"bar", "beers" => array("Appenzeller", "Guinness", "Kölsch"), "alcohol_free" => false);';
- /**
- * @var \OC\Config
- */
+ /** @var array */
+ private $initialConfig = array('foo' => 'bar', 'beers' => array('Appenzeller', 'Guinness', 'Kölsch'), 'alcohol_free' => false);
+ /** @var string */
+ private $configFile;
+ /** @var \OC\Config */
private $config;
+ /** @var string */
+ private $randomTmpDir;
function setUp() {
- file_put_contents(self::CONFIG_FILE, self::TESTCONTENT);
- $this->config = new OC\Config(self::CONFIG_DIR);
+ $this->randomTmpDir = \OC_Helper::tmpFolder();
+ $this->configFile = $this->randomTmpDir.'testconfig.php';
+ file_put_contents($this->configFile, self::TESTCONTENT);
+ $this->config = new OC\Config($this->randomTmpDir, 'testconfig.php');
}
- public function testReadData() {
- $config = new OC\Config('/non-existing');
- $this->assertAttributeEquals(array(), 'cache', $config);
-
- $this->assertAttributeEquals(array('foo' => 'bar'), 'cache', $this->config);
+ public function tearDown() {
+ unlink($this->configFile);
}
public function testGetKeys() {
- $this->assertEquals(array('foo'), $this->config->getKeys());
+ $expectedConfig = array('foo', 'beers', 'alcohol_free');
+ $this->assertSame($expectedConfig, $this->config->getKeys());
}
public function testGetValue() {
- $this->assertEquals('bar', $this->config->getValue('foo'));
- $this->assertEquals(null, $this->config->getValue('bar'));
- $this->assertEquals('moo', $this->config->getValue('bar', 'moo'));
+ $this->assertSame('bar', $this->config->getValue('foo'));
+ $this->assertSame(null, $this->config->getValue('bar'));
+ $this->assertSame('moo', $this->config->getValue('bar', 'moo'));
+ $this->assertSame(false, $this->config->getValue('alcohol_free', 'someBogusValue'));
+ $this->assertSame(array('Appenzeller', 'Guinness', 'Kölsch'), $this->config->getValue('beers', 'someBogusValue'));
+ $this->assertSame(array('Appenzeller', 'Guinness', 'Kölsch'), $this->config->getValue('beers'));
}
public function testSetValue() {
$this->config->setDebugMode(false);
$this->config->setValue('foo', 'moo');
- $this->assertAttributeEquals(array('foo' => 'moo'), 'cache', $this->config);
- $content = file_get_contents(self::CONFIG_FILE);
+ $expectedConfig = $this->initialConfig;
+ $expectedConfig['foo'] = 'moo';
+ $this->assertAttributeEquals($expectedConfig, 'cache', $this->config);
- $expected = "<?php\n\$CONFIG = array (\n 'foo' => 'moo',\n);\n";
+ $content = file_get_contents($this->configFile);
+ $expected = "<?php\n\$CONFIG = array (\n 'foo' => 'moo',\n 'beers' => \n array (\n 0 => 'Appenzeller',\n " .
+ " 1 => 'Guinness',\n 2 => 'Kölsch',\n ),\n 'alcohol_free' => false,\n);\n";
$this->assertEquals($expected, $content);
+
$this->config->setValue('bar', 'red');
- $this->assertAttributeEquals(array('foo' => 'moo', 'bar' => 'red'), 'cache', $this->config);
- $content = file_get_contents(self::CONFIG_FILE);
+ $this->config->setValue('apps', array('files', 'gallery'));
+ $expectedConfig['bar'] = 'red';
+ $expectedConfig['apps'] = array('files', 'gallery');
+ $this->assertAttributeEquals($expectedConfig, 'cache', $this->config);
- $expected = "<?php\n\$CONFIG = array (\n 'foo' => 'moo',\n 'bar' => 'red',\n);\n";
+ $content = file_get_contents($this->configFile);
+
+ $expected = "<?php\n\$CONFIG = array (\n 'foo' => 'moo',\n 'beers' => \n array (\n 0 => 'Appenzeller',\n " .
+ " 1 => 'Guinness',\n 2 => 'Kölsch',\n ),\n 'alcohol_free' => false,\n 'bar' => 'red',\n 'apps' => \n " .
+ " array (\n 0 => 'files',\n 1 => 'gallery',\n ),\n);\n";
$this->assertEquals($expected, $content);
}
public function testDeleteKey() {
$this->config->setDebugMode(false);
$this->config->deleteKey('foo');
- $this->assertAttributeEquals(array(), 'cache', $this->config);
- $content = file_get_contents(self::CONFIG_FILE);
+ $expectedConfig = $this->initialConfig;
+ unset($expectedConfig['foo']);
+ $this->assertAttributeEquals($expectedConfig, 'cache', $this->config);
+ $content = file_get_contents($this->configFile);
- $expected = "<?php\n\$CONFIG = array (\n);\n";
+ $expected = "<?php\n\$CONFIG = array (\n 'beers' => \n array (\n 0 => 'Appenzeller',\n " .
+ " 1 => 'Guinness',\n 2 => 'Kölsch',\n ),\n 'alcohol_free' => false,\n);\n";
$this->assertEquals($expected, $content);
}
- public function testSavingDebugMode() {
+ public function testSetDebugMode() {
$this->config->setDebugMode(true);
- $this->config->deleteKey('foo'); // change something so we save to the config file
- $this->assertAttributeEquals(array(), 'cache', $this->config);
+ $this->assertAttributeEquals($this->initialConfig, 'cache', $this->config);
$this->assertAttributeEquals(true, 'debugMode', $this->config);
- $content = file_get_contents(self::CONFIG_FILE);
+ $content = file_get_contents($this->configFile);
+ $expected = "<?php\ndefine('DEBUG',true);\n\$CONFIG = array (\n 'foo' => 'bar',\n 'beers' => \n array (\n 0 => 'Appenzeller',\n " .
+ " 1 => 'Guinness',\n 2 => 'Kölsch',\n ),\n 'alcohol_free' => false,\n);\n";
+ $this->assertEquals($expected, $content);
- $expected = "<?php\ndefine('DEBUG',true);\n\$CONFIG = array (\n);\n";
+ $this->config->setDebugMode(false);
+ $this->assertAttributeEquals($this->initialConfig, 'cache', $this->config);
+ $this->assertAttributeEquals(false, 'debugMode', $this->config);
+ $content = file_get_contents($this->configFile);
+ $expected = "<?php\n\$CONFIG = array (\n 'foo' => 'bar',\n 'beers' => \n array (\n 0 => 'Appenzeller',\n " .
+ " 1 => 'Guinness',\n 2 => 'Kölsch',\n ),\n 'alcohol_free' => false,\n);\n";
$this->assertEquals($expected, $content);
}
- /**
- * @expectedException \OC\HintException
- */
- public function testWriteData() {
- if (\OC_Util::runningOnWindows()) {
- throw new \OC\HintException('this is ireelevent for windows');
- }
- $config = new OC\Config('/non-writable');
- $config->setValue('foo', 'bar');
+ public function testIsDebugMode() {
+ // Default
+ $this->assertFalse($this->config->isDebugMode());
+
+ // Manually set to false
+ $this->config->setDebugMode(false);
+ $this->assertFalse($this->config->isDebugMode());
+
+ // Manually set to true
+ $this->config->setDebugMode(true);
+ $this->assertTrue($this->config->isDebugMode());
+ }
+
+ public function testConfigMerge() {
+ // Create additional config
+ $additionalConfig = '<?php $CONFIG=array("php53"=>"totallyOutdated");';
+ $additionalConfigPath = $this->randomTmpDir.'additionalConfig.testconfig.php';
+ file_put_contents($additionalConfigPath, $additionalConfig);
+
+ // Reinstantiate the config to force a read-in of the additional configs
+ $this->config = new \OC\Config($this->randomTmpDir, 'testconfig.php');
+
+ // Ensure that the config value can be read and the config has not been modified
+ $this->assertSame('totallyOutdated', $this->config->getValue('php53', 'bogusValue'));
+ $this->assertEquals(self::TESTCONTENT, file_get_contents($this->configFile));
+
+ // Write a new value to the config
+ $this->config->setValue('CoolWebsites', array('demo.owncloud.org', 'owncloud.org', 'owncloud.com'));
+ $expected = "<?php\n\$CONFIG = array (\n 'foo' => 'bar',\n 'beers' => \n array (\n 0 => 'Appenzeller',\n " .
+ " 1 => 'Guinness',\n 2 => 'Kölsch',\n ),\n 'alcohol_free' => false,\n 'php53' => 'totallyOutdated',\n 'CoolWebsites' => \n array (\n " .
+ " 0 => 'demo.owncloud.org',\n 1 => 'owncloud.org',\n 2 => 'owncloud.com',\n ),\n);\n";
+ $this->assertEquals($expected, file_get_contents($this->configFile));
+
+ // Cleanup
+ unlink($additionalConfigPath);
}
+
}
diff --git a/tests/lib/share/backend.php b/tests/lib/share/backend.php
index 420bd9d88b3..50ce24e07b6 100644
--- a/tests/lib/share/backend.php
+++ b/tests/lib/share/backend.php
@@ -38,19 +38,36 @@ class Test_Share_Backend implements OCP\Share_Backend {
public function generateTarget($itemSource, $shareWith, $exclude = null) {
// Always make target be test.txt to cause conflicts
- $target = 'test.txt';
- if (isset($exclude)) {
+
+ if (substr($itemSource, 0, strlen('test')) !== 'test') {
+ $target = "test.txt";
+ } else {
+ $target = $itemSource;
+ }
+
+
+ $shares = \OCP\Share::getItemsSharedWithUser('test', $shareWith);
+
+ $knownTargets = array();
+ foreach ($shares as $share) {
+ $knownTargets[] = $share['item_target'];
+ }
+
+
+ if (in_array($target, $knownTargets)) {
$pos = strrpos($target, '.');
$name = substr($target, 0, $pos);
$ext = substr($target, $pos);
$append = '';
$i = 1;
- while (in_array($name.$append.$ext, $exclude)) {
+ while (in_array($name.$append.$ext, $knownTargets)) {
$append = $i;
$i++;
}
$target = $name.$append.$ext;
+
}
+
return $target;
}
diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php
index 0a8d7856915..3d99883f2de 100644
--- a/tests/lib/share/share.php
+++ b/tests/lib/share/share.php
@@ -48,8 +48,8 @@ class Test_Share extends PHPUnit_Framework_TestCase {
OC_User::setUserId($this->user1);
OC_Group::clearBackends();
OC_Group::useBackend(new OC_Group_Dummy);
- $this->group1 = uniqid('group_');
- $this->group2 = uniqid('group_');
+ $this->group1 = uniqid('group1_');
+ $this->group2 = uniqid('group2_');
OC_Group::createGroup($this->group1);
OC_Group::createGroup($this->group2);
OC_Group::addToGroup($this->user1, $this->group1);
@@ -541,7 +541,7 @@ class Test_Share extends PHPUnit_Framework_TestCase {
OC_User::setUserId($this->user2);
$this->assertEquals(array(OCP\PERMISSION_READ | OCP\PERMISSION_UPDATE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
OC_User::setUserId($this->user4);
- $this->assertEquals(array(), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
+ $this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
// Valid share with same person - group then user
OC_User::setUserId($this->user1);
@@ -757,20 +757,88 @@ class Test_Share extends PHPUnit_Framework_TestCase {
array(false, array('share_with' => '1234567890', 'share_type' => '3', 'id' => 101)),
array(false, array('share_with' => '1234567890', 'share_type' => 3, 'id' => 101)),
);
+ }
- /*
- if (!isset($linkItem['share_with'])) {
- return true;
- }
+ /**
+ * @dataProvider dataProviderTestGroupItems
+ * @param type $ungrouped
+ * @param type $grouped
+ */
+ function testGroupItems($ungrouped, $grouped) {
- if ($linkItem['share_type'] != \OCP\Share::SHARE_TYPE_LINK) {
- return true;
- }
+ $result = DummyShareClass::groupItemsTest($ungrouped);
- if ( \OC::$server->getSession()->exists('public_link_authenticated')
- && \OC::$server->getSession()->get('public_link_authenticated') === $linkItem['id'] ) {
- return true;
+ $this->compareArrays($grouped, $result);
+
+ }
+
+ function compareArrays($result, $expectedResult) {
+ foreach ($expectedResult as $key => $value) {
+ if (is_array($value)) {
+ $this->compareArrays($result[$key], $value);
+ } else {
+ $this->assertSame($value, $result[$key]);
+ }
}
- * */
+ }
+
+ function dataProviderTestGroupItems() {
+ return array(
+ // one array with one share
+ array(
+ array( // input
+ array('item_source' => 1, 'permissions' => \OCP\PERMISSION_ALL, 'item_target' => 't1')),
+ array( // expected result
+ array('item_source' => 1, 'permissions' => \OCP\PERMISSION_ALL, 'item_target' => 't1'))),
+ // two shares both point to the same source
+ array(
+ array( // input
+ array('item_source' => 1, 'permissions' => \OCP\PERMISSION_READ, 'item_target' => 't1'),
+ array('item_source' => 1, 'permissions' => \OCP\PERMISSION_UPDATE, 'item_target' => 't1'),
+ ),
+ array( // expected result
+ array('item_source' => 1, 'permissions' => \OCP\PERMISSION_READ | \OCP\PERMISSION_UPDATE, 'item_target' => 't1',
+ 'grouped' => array(
+ array('item_source' => 1, 'permissions' => \OCP\PERMISSION_READ, 'item_target' => 't1'),
+ array('item_source' => 1, 'permissions' => \OCP\PERMISSION_UPDATE, 'item_target' => 't1'),
+ )
+ ),
+ )
+ ),
+ // two shares both point to the same source but with different targets
+ array(
+ array( // input
+ array('item_source' => 1, 'permissions' => \OCP\PERMISSION_READ, 'item_target' => 't1'),
+ array('item_source' => 1, 'permissions' => \OCP\PERMISSION_UPDATE, 'item_target' => 't2'),
+ ),
+ array( // expected result
+ array('item_source' => 1, 'permissions' => \OCP\PERMISSION_READ, 'item_target' => 't1'),
+ array('item_source' => 1, 'permissions' => \OCP\PERMISSION_UPDATE, 'item_target' => 't2'),
+ )
+ ),
+ // three shares two point to the same source
+ array(
+ array( // input
+ array('item_source' => 1, 'permissions' => \OCP\PERMISSION_READ, 'item_target' => 't1'),
+ array('item_source' => 2, 'permissions' => \OCP\PERMISSION_CREATE, 'item_target' => 't2'),
+ array('item_source' => 1, 'permissions' => \OCP\PERMISSION_UPDATE, 'item_target' => 't1'),
+ ),
+ array( // expected result
+ array('item_source' => 1, 'permissions' => \OCP\PERMISSION_READ | \OCP\PERMISSION_UPDATE, 'item_target' => 't1',
+ 'grouped' => array(
+ array('item_source' => 1, 'permissions' => \OCP\PERMISSION_READ, 'item_target' => 't1'),
+ array('item_source' => 1, 'permissions' => \OCP\PERMISSION_UPDATE, 'item_target' => 't1'),
+ )
+ ),
+ array('item_source' => 2, 'permissions' => \OCP\PERMISSION_CREATE, 'item_target' => 't2'),
+ )
+ ),
+ );
+ }
+}
+
+class DummyShareClass extends \OC\Share\Share {
+ public static function groupItemsTest($items) {
+ return parent::groupItems($items, 'test');
}
}