summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/files/js/filelist.js5
-rw-r--r--apps/files/l10n/fr.php1
-rw-r--r--apps/files/l10n/sv.php2
-rw-r--r--apps/files_encryption/l10n/sv.php1
-rwxr-xr-xapps/files_external/lib/dropbox.php62
-rw-r--r--apps/files_external/lib/streamwrapper.php1
-rw-r--r--apps/files_external/lib/swift.php4
-rw-r--r--apps/files_external/lib/webdav.php1
-rw-r--r--apps/files_external/tests/dropbox.php16
-rw-r--r--apps/files_external/tests/ftp.php8
-rw-r--r--apps/files_external/tests/smb.php5
-rw-r--r--apps/files_trashbin/ajax/delete.php39
-rw-r--r--apps/files_trashbin/js/filelist.js7
-rw-r--r--apps/files_trashbin/js/trash.js48
-rw-r--r--apps/files_trashbin/templates/index.php4
-rw-r--r--apps/files_versions/lib/versions.php23
-rw-r--r--apps/user_ldap/l10n/sv.php4
17 files changed, 174 insertions, 57 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 5cab0707bda..66453740f5d 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -691,8 +691,9 @@ var FileList={
var $fileList = $('#fileList');
var permissions = $('#permissions').val();
var isCreatable = (permissions & OC.PERMISSION_CREATE) !== 0;
- $('#emptycontent').toggleClass('hidden', !isCreatable || $fileList.find('tr').exists());
- $('#filestable th').toggleClass('hidden', $fileList.find('tr').exists() === false);
+ var exists = $fileList.find('tr:first').exists();
+ $('#emptycontent').toggleClass('hidden', !isCreatable || exists);
+ $('#filestable th').toggleClass('hidden', !exists);
},
showMask: function() {
// in case one was shown before
diff --git a/apps/files/l10n/fr.php b/apps/files/l10n/fr.php
index 74f9599ade2..3a902485032 100644
--- a/apps/files/l10n/fr.php
+++ b/apps/files/l10n/fr.php
@@ -43,6 +43,7 @@ $TRANSLATIONS = array(
"Could not rename file" => "Impossible de renommer le fichier",
"replaced {new_name} with {old_name}" => "{new_name} a été remplacé par {old_name}",
"undo" => "annuler",
+"Error deleting file." => "Erreur pendant la suppression du fichier.",
"_%n folder_::_%n folders_" => array("%n dossier","%n dossiers"),
"_%n file_::_%n files_" => array("%n fichier","%n fichiers"),
"{dirs} and {files}" => "{dirs} et {files}",
diff --git a/apps/files/l10n/sv.php b/apps/files/l10n/sv.php
index cbbabae5956..7beb2b7c16d 100644
--- a/apps/files/l10n/sv.php
+++ b/apps/files/l10n/sv.php
@@ -43,6 +43,7 @@ $TRANSLATIONS = array(
"Could not rename file" => "Kan ej byta filnamn",
"replaced {new_name} with {old_name}" => "ersatt {new_name} med {old_name}",
"undo" => "ångra",
+"Error deleting file." => "Kunde inte ta bort filen.",
"_%n folder_::_%n folders_" => array("%n mapp","%n mappar"),
"_%n file_::_%n files_" => array("%n fil","%n filer"),
"{dirs} and {files}" => "{dirs} och {files}",
@@ -60,6 +61,7 @@ $TRANSLATIONS = array(
"Name" => "Namn",
"Size" => "Storlek",
"Modified" => "Ändrad",
+"Invalid folder name. Usage of 'Shared' is reserved." => "Ogiltigt mappnamn. Användande av 'Shared' är reserverat av ownCloud",
"%s could not be renamed" => "%s kunde inte namnändras",
"Upload" => "Ladda upp",
"File handling" => "Filhantering",
diff --git a/apps/files_encryption/l10n/sv.php b/apps/files_encryption/l10n/sv.php
index 87f7aabc7ad..1e509ea08e7 100644
--- a/apps/files_encryption/l10n/sv.php
+++ b/apps/files_encryption/l10n/sv.php
@@ -9,6 +9,7 @@ $TRANSLATIONS = array(
"Private key password successfully updated." => "Den privata nyckelns lösenord uppdaterades utan problem.",
"Could not update the private key password. Maybe the old password was not correct." => "Kunde inte uppdatera lösenordet för den privata nyckeln. Kanske var det gamla lösenordet fel.",
"Encryption app not initialized! Maybe the encryption app was re-enabled during your session. Please try to log out and log back in to initialize the encryption app." => "Krypteringsprogrammet kunde inte initieras! Möjligen blev krypteringsprogrammet återaktiverad under din session. Försök med att logga ut och in igen för att initiera krypteringsprogrammet.",
+"Your private key is not valid! Likely your password was changed outside of %s (e.g. your corporate directory). You can update your private key password in your personal settings to recover access to your encrypted files." => "Din privata lösenordsnyckel är inte giltig! Troligen har ditt lösenord ändrats utanför %s (t.ex. i företagets katalogtjänst). Du kan uppdatera den privata lösenordsnyckeln under dina personliga inställningar för att återfå tillgång till dina filer.",
"Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you." => "Kan ej dekryptera denna fil, förmodligen är det en delad fil. Be ägaren av filen att dela den med dig.",
"Unknown error please check your system settings or contact your administrator" => "Oväntat fel, kolla dina system inställningar eller kontakta din administratör",
"Missing requirements." => "Krav som saknas",
diff --git a/apps/files_external/lib/dropbox.php b/apps/files_external/lib/dropbox.php
index 6e464f4e287..f7d8d98cf03 100755
--- a/apps/files_external/lib/dropbox.php
+++ b/apps/files_external/lib/dropbox.php
@@ -50,6 +50,22 @@ class Dropbox extends \OC\Files\Storage\Common {
}
}
+ private function deleteMetaData($path) {
+ $path = $this->root.$path;
+ if (isset($this->metaData[$path])) {
+ unset($this->metaData[$path]);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @brief Returns the path's metadata
+ * @param $path path for which to return the metadata
+ * @param $list if true, also return the directory's contents
+ * @return directory contents if $list is true, file metadata if $list is
+ * false, null if the file doesn't exist or "false" if the operation failed
+ */
private function getMetaData($path, $list = false) {
$path = $this->root.$path;
if ( ! $list && isset($this->metaData[$path])) {
@@ -62,24 +78,35 @@ class Dropbox extends \OC\Files\Storage\Common {
\OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
return false;
}
+ $contents = array();
if ($response && isset($response['contents'])) {
- $contents = $response['contents'];
// Cache folder's contents
- foreach ($contents as $file) {
- $this->metaData[$path.'/'.basename($file['path'])] = $file;
+ foreach ($response['contents'] as $file) {
+ if (!isset($file['is_deleted']) || !$file['is_deleted']) {
+ $this->metaData[$path.'/'.basename($file['path'])] = $file;
+ $contents[] = $file;
+ }
}
unset($response['contents']);
+ }
+ if (!isset($response['is_deleted']) || !$response['is_deleted']) {
$this->metaData[$path] = $response;
}
- $this->metaData[$path] = $response;
// Return contents of folder only
return $contents;
} else {
try {
$response = $this->dropbox->getMetaData($path, 'false');
- $this->metaData[$path] = $response;
- return $response;
+ if (!isset($response['is_deleted']) || !$response['is_deleted']) {
+ $this->metaData[$path] = $response;
+ return $response;
+ }
+ return null;
} catch (\Exception $exception) {
+ if ($exception instanceof \Dropbox_Exception_NotFound) {
+ // don't log, might be a file_exist check
+ return false;
+ }
\OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
return false;
}
@@ -108,7 +135,7 @@ class Dropbox extends \OC\Files\Storage\Common {
public function opendir($path) {
$contents = $this->getMetaData($path, true);
- if ($contents) {
+ if ($contents !== false) {
$files = array();
foreach ($contents as $file) {
$files[] = basename($file['path']);
@@ -157,9 +184,9 @@ class Dropbox extends \OC\Files\Storage\Common {
}
public function unlink($path) {
- $path = $this->root.$path;
try {
- $this->dropbox->delete($path);
+ $this->dropbox->delete($this->root.$path);
+ $this->deleteMetaData($path);
return true;
} catch (\Exception $exception) {
\OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
@@ -168,10 +195,14 @@ class Dropbox extends \OC\Files\Storage\Common {
}
public function rename($path1, $path2) {
- $path1 = $this->root.$path1;
- $path2 = $this->root.$path2;
try {
- $this->dropbox->move($path1, $path2);
+ // overwrite if target file exists and is not a directory
+ $destMetaData = $this->getMetaData($path2);
+ if (isset($destMetaData) && $destMetaData !== false && !$destMetaData['is_dir']) {
+ $this->unlink($path2);
+ }
+ $this->dropbox->move($this->root.$path1, $this->root.$path2);
+ $this->deleteMetaData($path1);
return true;
} catch (\Exception $exception) {
\OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
@@ -269,7 +300,12 @@ class Dropbox extends \OC\Files\Storage\Common {
}
public function touch($path, $mtime = null) {
- return false;
+ if ($this->file_exists($path)) {
+ return false;
+ } else {
+ $this->file_put_contents($path, '');
+ }
+ return true;
}
}
diff --git a/apps/files_external/lib/streamwrapper.php b/apps/files_external/lib/streamwrapper.php
index 4f3dc889b01..7a1991d4f04 100644
--- a/apps/files_external/lib/streamwrapper.php
+++ b/apps/files_external/lib/streamwrapper.php
@@ -68,6 +68,7 @@ abstract class StreamWrapper extends Common {
}
} else {
$this->file_put_contents($path, '');
+ return true;
}
}
diff --git a/apps/files_external/lib/swift.php b/apps/files_external/lib/swift.php
index 86938ef3bb9..b615d24ce76 100644
--- a/apps/files_external/lib/swift.php
+++ b/apps/files_external/lib/swift.php
@@ -364,7 +364,7 @@ class Swift extends \OC\Files\Storage\Common {
'X-Object-Meta-Timestamp' => $mtime
)
);
- $object->Update($settings);
+ return $object->Update($settings);
} else {
$object = $this->container->DataObject();
if (is_null($mtime)) {
@@ -377,7 +377,7 @@ class Swift extends \OC\Files\Storage\Common {
'X-Object-Meta-Timestamp' => $mtime
)
);
- $object->Create($settings);
+ return $object->Create($settings);
}
}
diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php
index 0837222e511..02f6cb5fc4f 100644
--- a/apps/files_external/lib/webdav.php
+++ b/apps/files_external/lib/webdav.php
@@ -234,6 +234,7 @@ class DAV extends \OC\Files\Storage\Common{
} else {
$this->file_put_contents($path, '');
}
+ return true;
}
public function getFile($path, $target) {
diff --git a/apps/files_external/tests/dropbox.php b/apps/files_external/tests/dropbox.php
index e4e598b06b0..4b052282019 100644
--- a/apps/files_external/tests/dropbox.php
+++ b/apps/files_external/tests/dropbox.php
@@ -21,6 +21,22 @@ class Dropbox extends Storage {
$this->instance = new \OC\Files\Storage\Dropbox($this->config['dropbox']);
}
+ public function directoryProvider() {
+ // doesn't support leading/trailing spaces
+ return array(array('folder'));
+ }
+
+ public function testDropboxTouchReturnValue() {
+ $this->assertFalse($this->instance->file_exists('foo'));
+
+ // true because succeeded
+ $this->assertTrue($this->instance->touch('foo'));
+ $this->assertTrue($this->instance->file_exists('foo'));
+
+ // false because not supported
+ $this->assertFalse($this->instance->touch('foo'));
+ }
+
public function tearDown() {
if ($this->instance) {
$this->instance->unlink('/');
diff --git a/apps/files_external/tests/ftp.php b/apps/files_external/tests/ftp.php
index e146725473a..94ed5630d91 100644
--- a/apps/files_external/tests/ftp.php
+++ b/apps/files_external/tests/ftp.php
@@ -34,19 +34,19 @@ class FTP extends Storage {
'password' => 'ftp',
'root' => '/',
'secure' => false );
- $instance = new OC_Filestorage_FTP($config);
+ $instance = new \OC\Files\Storage\FTP($config);
$this->assertEquals('ftp://ftp:ftp@localhost/', $instance->constructUrl(''));
$config['secure'] = true;
- $instance = new OC_Filestorage_FTP($config);
+ $instance = new \OC\Files\Storage\FTP($config);
$this->assertEquals('ftps://ftp:ftp@localhost/', $instance->constructUrl(''));
$config['secure'] = 'false';
- $instance = new OC_Filestorage_FTP($config);
+ $instance = new \OC\Files\Storage\FTP($config);
$this->assertEquals('ftp://ftp:ftp@localhost/', $instance->constructUrl(''));
$config['secure'] = 'true';
- $instance = new OC_Filestorage_FTP($config);
+ $instance = new \OC\Files\Storage\FTP($config);
$this->assertEquals('ftps://ftp:ftp@localhost/', $instance->constructUrl(''));
}
}
diff --git a/apps/files_external/tests/smb.php b/apps/files_external/tests/smb.php
index 0291f293fa6..199e35af676 100644
--- a/apps/files_external/tests/smb.php
+++ b/apps/files_external/tests/smb.php
@@ -29,6 +29,11 @@ class SMB extends Storage {
}
}
+ public function directoryProvider() {
+ // doesn't support leading/trailing spaces
+ return array(array('folder'));
+ }
+
public function testRenameWithSpaces() {
$this->instance->mkdir('with spaces');
$result = $this->instance->rename('with spaces', 'foo bar');
diff --git a/apps/files_trashbin/ajax/delete.php b/apps/files_trashbin/ajax/delete.php
index 92361b65f63..5498250dbf5 100644
--- a/apps/files_trashbin/ajax/delete.php
+++ b/apps/files_trashbin/ajax/delete.php
@@ -3,10 +3,19 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
-$files = $_POST['files'];
-$dirlisting = $_POST['dirlisting'];
-$list = json_decode($files);
-
+// "empty trash" command
+$deleteAll = false;
+if (isset($_POST['allfiles']) and $_POST['allfiles'] === 'true'){
+ $user = \OCP\User::getUser();
+ $list = OCA\Files_Trashbin\Helper::getTrashFiles('/');
+ $deleteAll = true;
+ $dirlisting = '0';
+}
+else {
+ $files = $_POST['files'];
+ $dirlisting = $_POST['dirlisting'];
+ $list = json_decode($files);
+}
$error = array();
$success = array();
@@ -14,22 +23,30 @@ $success = array();
$i = 0;
foreach ($list as $file) {
if ( $dirlisting === '0') {
- $delimiter = strrpos($file, '.d');
- $filename = substr($file, 0, $delimiter);
- $timestamp = substr($file, $delimiter+2);
+ if ($deleteAll) {
+ $filename = $file['name'];
+ $timestamp = $file['timestamp'];
+ }
+ else {
+ $delimiter = strrpos($file, '.d');
+ $filename = substr($file, 0, $delimiter);
+ $timestamp = substr($file, $delimiter+2);
+ }
} else {
$filename = $file;
$timestamp = null;
}
OCA\Files_Trashbin\Trashbin::delete($filename, $timestamp);
- if (!OCA\Files_Trashbin\Trashbin::file_exists($filename, $timestamp)) {
+ if (OCA\Files_Trashbin\Trashbin::file_exists($filename, $timestamp)) {
+ $error[] = $filename;
+ OC_Log::write('trashbin','can\'t delete ' . $filename . ' permanently.', OC_Log::ERROR);
+ }
+ // only list deleted files if not deleting everything
+ else if (!$deleteAll) {
$success[$i]['filename'] = $file;
$success[$i]['timestamp'] = $timestamp;
$i++;
- } else {
- $error[] = $filename;
- OC_Log::write('trashbin','can\'t delete ' . $filename . ' permanently.', OC_Log::ERROR);
}
}
diff --git a/apps/files_trashbin/js/filelist.js b/apps/files_trashbin/js/filelist.js
index cd5a67ddfe0..f42abb6d029 100644
--- a/apps/files_trashbin/js/filelist.js
+++ b/apps/files_trashbin/js/filelist.js
@@ -22,3 +22,10 @@ FileList.reload = function(){
FileList.linkTo = function(dir){
return OC.linkTo('files_trashbin', 'index.php')+"?dir="+ encodeURIComponent(dir).replace(/%2F/g, '/');
}
+
+FileList.updateEmptyContent = function(){
+ var $fileList = $('#fileList');
+ var exists = $fileList.find('tr:first').exists();
+ $('#emptycontent').toggleClass('hidden', exists);
+ $('#filestable th').toggleClass('hidden', !exists);
+}
diff --git a/apps/files_trashbin/js/trash.js b/apps/files_trashbin/js/trash.js
index 4e6a1e93fa4..84c23d66992 100644
--- a/apps/files_trashbin/js/trash.js
+++ b/apps/files_trashbin/js/trash.js
@@ -19,6 +19,7 @@ $(document).ready(function() {
}
enableActions();
FileList.updateFileSummary();
+ FileList.updateEmptyContent();
}
);
@@ -45,6 +46,7 @@ $(document).ready(function() {
}
enableActions();
FileList.updateFileSummary();
+ FileList.updateEmptyContent();
}
);
@@ -122,34 +124,60 @@ $(document).ready(function() {
}
enableActions();
FileList.updateFileSummary();
+ FileList.updateEmptyContent();
}
);
});
$('.delete').click('click', function(event) {
event.preventDefault();
- var files = getSelectedFiles('file');
- var fileslist = JSON.stringify(files);
- var dirlisting = getSelectedFiles('dirlisting')[0];
+ var allFiles = $('#select_all').is(':checked');
+ var files = [];
+ var params = {};
+ if (allFiles) {
+ params = {
+ allfiles: true
+ };
+ }
+ else {
+ files = getSelectedFiles('file');
+ params = {
+ files: JSON.stringify(files),
+ dirlisting: getSelectedFiles('dirlisting')[0]
+ };
+ };
disableActions();
- for (var i = 0; i < files.length; i++) {
- var deleteAction = $('tr').filterAttr('data-file', files[i]).children("td.date").children(".action.delete");
- deleteAction.removeClass('delete-icon').addClass('progress-icon');
+ if (allFiles) {
+ FileList.showMask();
+ }
+ else {
+ for (var i = 0; i < files.length; i++) {
+ var deleteAction = $('tr').filterAttr('data-file', files[i]).children("td.date").children(".action.delete");
+ deleteAction.removeClass('delete-icon').addClass('progress-icon');
+ }
}
$.post(OC.filePath('files_trashbin', 'ajax', 'delete.php'),
- {files: fileslist, dirlisting: dirlisting},
+ params,
function(result) {
- for (var i = 0; i < result.data.success.length; i++) {
- var row = document.getElementById(result.data.success[i].filename);
- row.parentNode.removeChild(row);
+ if (allFiles) {
+ FileList.hideMask();
+ // simply remove all files
+ $('#fileList').empty();
+ }
+ else {
+ for (var i = 0; i < result.data.success.length; i++) {
+ var row = document.getElementById(result.data.success[i].filename);
+ row.parentNode.removeChild(row);
+ }
}
if (result.status !== 'success') {
OC.dialogs.alert(result.data.message, t('core', 'Error'));
}
enableActions();
FileList.updateFileSummary();
+ FileList.updateEmptyContent();
}
);
diff --git a/apps/files_trashbin/templates/index.php b/apps/files_trashbin/templates/index.php
index 15ba074e45e..f9264d4352c 100644
--- a/apps/files_trashbin/templates/index.php
+++ b/apps/files_trashbin/templates/index.php
@@ -4,9 +4,7 @@
</div>
<div id='notification'></div>
-<?php if (isset($_['files']) && count($_['files']) === 0 && $_['dirlisting'] === false && !$_['ajaxLoad']):?>
- <div id="emptycontent"><?php p($l->t('Nothing in here. Your trash bin is empty!'))?></div>
-<?php endif; ?>
+<div id="emptycontent" <?php if (!(isset($_['files']) && count($_['files']) === 0 && $_['dirlisting'] === false && !$_['ajaxLoad'])):?>class="hidden"<?php endif; ?>><?php p($l->t('Nothing in here. Your trash bin is empty!'))?></div>
<input type="hidden" name="ajaxLoad" id="ajaxLoad" value="<?php p($_['ajaxLoad']); ?>" />
<input type="hidden" id="disableSharing" data-status="<?php p($_['disableSharing']); ?>"></input>
diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php
index 661e98b09d5..b03e1d4e93a 100644
--- a/apps/files_versions/lib/versions.php
+++ b/apps/files_versions/lib/versions.php
@@ -318,22 +318,21 @@ class Storage {
* @return size of vesions
*/
private static function calculateSize($uid) {
- if( \OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true' ) {
- $versions_fileview = new \OC\Files\View('/'.$uid.'/files_versions');
- $versionsRoot = $versions_fileview->getLocalFolder('');
-
- $iterator = new \RecursiveIteratorIterator(
- new \RecursiveDirectoryIterator($versionsRoot),
- \RecursiveIteratorIterator::CHILD_FIRST
- );
+ if (\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED) == 'true') {
+ $view = new \OC\Files\View('/' . $uid . '/files_versions');
$size = 0;
- foreach ($iterator as $path) {
- if ( preg_match('/^.+\.v(\d+)$/', $path, $match) ) {
- $relpath = substr($path, strlen($versionsRoot)-1);
- $size += $versions_fileview->filesize($relpath);
+ $dirContent = $view->getDirectoryContent('/');
+
+ while (!empty($dirContent)) {
+ $path = reset($dirContent);
+ if ($path['type'] === 'dir') {
+ $dirContent = array_merge($dirContent, $view->getDirectoryContent(substr($path['path'], strlen('files_versions'))));
+ } else {
+ $size += $view->filesize(substr($path['path'], strlen('files_versions')));
}
+ unset($dirContent[key($dirContent)]);
}
return $size;
diff --git a/apps/user_ldap/l10n/sv.php b/apps/user_ldap/l10n/sv.php
index 2a1a6e46e03..922985e76f0 100644
--- a/apps/user_ldap/l10n/sv.php
+++ b/apps/user_ldap/l10n/sv.php
@@ -4,6 +4,7 @@ $TRANSLATIONS = array(
"Failed to delete the server configuration" => "Misslyckades med att radera serverinställningen",
"The configuration is valid and the connection could be established!" => "Inställningen är giltig och anslutningen kunde upprättas!",
"The configuration is valid, but the Bind failed. Please check the server settings and credentials." => "Konfigurationen är riktig, men Bind felade. Var vänlig och kontrollera serverinställningar och logininformation.",
+"The configuration is invalid. Please have a look at the logs for further details." => "Inställningen är ogiltig. Vänligen se ownCloud-loggen för fler detaljer.",
"No action specified" => "Ingen åtgärd har angetts",
"No configuration specified" => "Ingen konfiguration har angetts",
"No data specified" => "Ingen data har angetts",
@@ -15,6 +16,9 @@ $TRANSLATIONS = array(
"mappings cleared" => "mappningar rensade",
"Success" => "Lyckat",
"Error" => "Fel",
+"Configuration OK" => "Konfigurationen är OK",
+"Configuration incorrect" => "Felaktig konfiguration",
+"Configuration incomplete" => "Konfigurationen är ej komplett",
"Select groups" => "Välj grupper",
"Select object classes" => "Välj Objekt-klasser",
"Select attributes" => "Välj attribut",