diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/ajax/delete.php | 3 | ||||
-rw-r--r-- | apps/files/js/file-upload.js | 11 | ||||
-rw-r--r-- | apps/files/js/filelist.js | 30 | ||||
-rw-r--r-- | apps/files/l10n/gl.php | 4 | ||||
-rw-r--r-- | apps/files/lib/app.php | 18 | ||||
-rw-r--r-- | apps/files/tests/ajax_rename.php | 46 | ||||
-rw-r--r-- | apps/files_encryption/l10n/gl.php | 6 | ||||
-rw-r--r-- | apps/files_external/l10n/gl.php | 6 | ||||
-rw-r--r-- | apps/files_sharing/ajax/external.php | 28 | ||||
-rw-r--r-- | apps/files_sharing/js/sharedfilelist.js | 2 | ||||
-rw-r--r-- | apps/user_ldap/l10n/gl.php | 2 |
11 files changed, 118 insertions, 38 deletions
diff --git a/apps/files/ajax/delete.php b/apps/files/ajax/delete.php index a28b7b76c95..aed53d5db5a 100644 --- a/apps/files/ajax/delete.php +++ b/apps/files/ajax/delete.php @@ -26,7 +26,8 @@ $success = true; //Now delete foreach ($files as $file) { - if (($dir === '' && $file === 'Shared') || !\OC\Files\Filesystem::unlink($dir . '/' . $file)) { + if (\OC\Files\Filesystem::file_exists($dir . '/' . $file) && + !\OC\Files\Filesystem::unlink($dir . '/' . $file)) { $filesWithError .= $file . "\n"; $success = false; } diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index 2637d13f9ba..ff999bae4ff 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -233,7 +233,8 @@ OC.Upload = { data.originalFiles.selection = { uploads: [], filesToUpload: data.originalFiles.length, - totalBytes: 0 + totalBytes: 0, + biggestFileBytes: 0 }; } var selection = data.originalFiles.selection; @@ -273,13 +274,15 @@ OC.Upload = { // add size selection.totalBytes += file.size; + // update size of biggest file + selection.biggestFileBytes = Math.max(selection.biggestFileBytes, file.size); - // check PHP upload limit - if (selection.totalBytes > $('#upload_limit').val()) { + // check PHP upload limit against biggest file + if (selection.biggestFileBytes > $('#upload_limit').val()) { data.textStatus = 'sizeexceedlimit'; data.errorThrown = t('files', 'Total file size {size1} exceeds upload limit {size2}', { - 'size1': humanFileSize(selection.totalBytes), + 'size1': humanFileSize(selection.biggestFileBytes), 'size2': humanFileSize($('#upload_limit').val()) }); } diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 1bab760a897..fc251c9201a 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -90,6 +90,13 @@ _sortComparator: null, /** + * Whether to do a client side sort. + * When false, clicking on a table header will call reload(). + * When true, clicking on a table header will simply resort the list. + */ + _clientSideSort: false, + + /** * Current directory */ _currentDirectory: null, @@ -368,17 +375,16 @@ sort = $target.attr('data-sort'); if (sort) { if (this._sort === sort) { - this.setSort(sort, (this._sortDirection === 'desc')?'asc':'desc'); + this.setSort(sort, (this._sortDirection === 'desc')?'asc':'desc', true); } else { if ( sort === 'name' ) { //default sorting of name is opposite to size and mtime - this.setSort(sort, 'asc'); + this.setSort(sort, 'asc', true); } else { - this.setSort(sort, 'desc'); + this.setSort(sort, 'desc', true); } } - this.reload(); } }, @@ -915,8 +921,9 @@ * * @param sort sort attribute name * @param direction sort direction, one of "asc" or "desc" + * @param update true to update the list, false otherwise (default) */ - setSort: function(sort, direction) { + setSort: function(sort, direction, update) { var comparator = FileList.Comparators[sort] || FileList.Comparators.name; this._sort = sort; this._sortDirection = (direction === 'desc')?'desc':'asc'; @@ -938,6 +945,15 @@ .removeClass(this.SORT_INDICATOR_DESC_CLASS) .toggleClass('hidden', false) .addClass(direction === 'desc' ? this.SORT_INDICATOR_DESC_CLASS : this.SORT_INDICATOR_ASC_CLASS); + if (update) { + if (this._clientSideSort) { + this.files.sort(this._sortComparator); + this.setFiles(this.files); + } + else { + this.reload(); + } + } }, /** @@ -1322,6 +1338,10 @@ if (!result || result.status === 'error') { OC.dialogs.alert(result.data.message, t('files', 'Could not rename file')); fileInfo = oldFileInfo; + if (result.data.code === 'sourcenotfound') { + self.remove(result.data.newname, {updateSummary: true}); + return; + } } else { fileInfo = result.data; diff --git a/apps/files/l10n/gl.php b/apps/files/l10n/gl.php index 1e73253b80a..11c787ca068 100644 --- a/apps/files/l10n/gl.php +++ b/apps/files/l10n/gl.php @@ -66,8 +66,8 @@ $TRANSLATIONS = array( "\"{name}\" is an invalid file name." => "«{name}» é un nome incorrecto de ficheiro.", "Your storage is full, files can not be updated or synced anymore!" => "O seu espazo de almacenamento está cheo, non é posíbel actualizar ou sincronizar máis os ficheiros!", "Your storage is almost full ({usedSpacePercent}%)" => "O seu espazo de almacenamento está case cheo ({usedSpacePercent}%)", -"Encryption App is enabled but your keys are not initialized, please log-out and log-in again" => "O aplicativo de cifrado está activado, mais as chaves non foron inicializadas, saia da sesión e volva a acceder de novo", -"Invalid private key for Encryption App. Please update your private key password in your personal settings to recover access to your encrypted files." => "A chave privada para o aplicativo de cifrado non é correcta. Actualice o contrasinal da súa chave privada nos seus axustes persoais para recuperar o acceso aos seus ficheiros cifrados.", +"Encryption App is enabled but your keys are not initialized, please log-out and log-in again" => "A aplicación de cifrado está activada, mais as chaves non foron inicializadas, saia da sesión e volva a acceder de novo", +"Invalid private key for Encryption App. Please update your private key password in your personal settings to recover access to your encrypted files." => "A chave privada para a aplicación de cifrado non é correcta. Actualice o contrasinal da súa chave privada nos seus axustes persoais para recuperar o acceso aos seus ficheiros cifrados.", "Encryption was disabled but your files are still encrypted. Please go to your personal settings to decrypt your files." => "O cifrado foi desactivado, mais os ficheiros están cifrados. Vaia á configuración persoal para descifrar os ficheiros.", "{dirs} and {files}" => "{dirs} e {files}", "%s could not be renamed" => "%s non pode cambiar de nome", diff --git a/apps/files/lib/app.php b/apps/files/lib/app.php index e32225d0680..c21e44bff4e 100644 --- a/apps/files/lib/app.php +++ b/apps/files/lib/app.php @@ -71,15 +71,25 @@ class App { 'data' => NULL ); + $normalizedOldPath = \OC\Files\Filesystem::normalizePath($dir . '/' . $oldname); + $normalizedNewPath = \OC\Files\Filesystem::normalizePath($dir . '/' . $newname); + // rename to non-existing folder is denied - if (!$this->view->file_exists($dir)) { + if (!$this->view->file_exists($normalizedOldPath)) { + $result['data'] = array( + 'message' => $this->l10n->t('%s could not be renamed as it has been deleted', array($oldname)), + 'code' => 'sourcenotfound', + 'oldname' => $oldname, + 'newname' => $newname, + ); + }else if (!$this->view->file_exists($dir)) { $result['data'] = array('message' => (string)$this->l10n->t( 'The target folder has been moved or deleted.', array($dir)), 'code' => 'targetnotfound' ); // rename to existing file is denied - } else if ($this->view->file_exists($dir . '/' . $newname)) { + } else if ($this->view->file_exists($normalizedNewPath)) { $result['data'] = array( 'message' => $this->l10n->t( @@ -90,10 +100,10 @@ class App { // rename to "." is denied $newname !== '.' and // THEN try to rename - $this->view->rename($dir . '/' . $oldname, $dir . '/' . $newname) + $this->view->rename($normalizedOldPath, $normalizedNewPath) ) { // successful rename - $meta = $this->view->getFileInfo($dir . '/' . $newname); + $meta = $this->view->getFileInfo($normalizedNewPath); $fileinfo = \OCA\Files\Helper::formatFileInfo($meta); $result['success'] = true; $result['data'] = $fileinfo; diff --git a/apps/files/tests/ajax_rename.php b/apps/files/tests/ajax_rename.php index fed366aa8eb..5ed8b1931f4 100644 --- a/apps/files/tests/ajax_rename.php +++ b/apps/files/tests/ajax_rename.php @@ -73,10 +73,14 @@ class Test_OC_Files_App_Rename extends \PHPUnit_Framework_TestCase { $oldname = 'oldname'; $newname = 'newname'; - $this->viewMock->expects($this->at(0)) + $this->viewMock->expects($this->any()) ->method('file_exists') - ->with('/') - ->will($this->returnValue(true)); + ->with($this->anything()) + ->will($this->returnValueMap(array( + array('/', true), + array('/oldname', true) + ))); + $this->viewMock->expects($this->any()) ->method('getFileInfo') @@ -119,7 +123,7 @@ class Test_OC_Files_App_Rename extends \PHPUnit_Framework_TestCase { $this->viewMock->expects($this->at(0)) ->method('file_exists') - ->with('/unexist') + ->with('/unexist/oldname') ->will($this->returnValue(false)); $this->viewMock->expects($this->any()) @@ -137,6 +141,40 @@ class Test_OC_Files_App_Rename extends \PHPUnit_Framework_TestCase { $result = $this->files->rename($dir, $oldname, $newname); $this->assertFalse($result['success']); + $this->assertEquals('sourcenotfound', $result['data']['code']); + } + + /** + * Test move to a folder that doesn't exist any more + */ + function testRenameToNonExistingFolder() { + $dir = '/'; + $oldname = 'oldname'; + $newname = '/unexist/newname'; + + $this->viewMock->expects($this->any()) + ->method('file_exists') + ->with($this->anything()) + ->will($this->returnValueMap(array( + array('/oldname', true), + array('/unexist', false) + ))); + + $this->viewMock->expects($this->any()) + ->method('getFileInfo') + ->will($this->returnValue(array( + 'fileid' => 123, + 'type' => 'dir', + 'mimetype' => 'httpd/unix-directory', + 'size' => 18, + 'etag' => 'abcdef', + 'directory' => '/unexist', + 'name' => 'new_name', + ))); + + $result = $this->files->rename($dir, $oldname, $newname); + + $this->assertFalse($result['success']); $this->assertEquals('targetnotfound', $result['data']['code']); } } diff --git a/apps/files_encryption/l10n/gl.php b/apps/files_encryption/l10n/gl.php index 6bf9c57552a..7498d0728b8 100644 --- a/apps/files_encryption/l10n/gl.php +++ b/apps/files_encryption/l10n/gl.php @@ -8,18 +8,18 @@ $TRANSLATIONS = array( "Could not change the password. Maybe the old password was not correct." => "Non foi posíbel cambiar o contrasinal. Probabelmente o contrasinal antigo non é o correcto.", "Private key password successfully updated." => "A chave privada foi actualizada correctamente.", "Could not update the private key password. Maybe the old password was not correct." => "Non foi posíbel actualizar o contrasinal da chave privada. É probábel que o contrasinal antigo non sexa correcto.", -"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." => "Non se iniciou o aplicativo de cifrado! Quizais volva a activarse durante a sesión. Tente pechar a sesión e volver iniciala para que tamén se inicie o aplicativo de cifrado.", +"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." => "Non se iniciou a aplicación de cifrado! Quizais volva a activarse durante a sesión. Tente pechar a sesión e volver iniciala para que tamén se inicie a aplicación de cifrado.", "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." => "A chave privada non é correcta! É probábel que o seu contrasinal teña sido cambiado desde o exterior do %s (p.ex. o seu directorio corporativo). Vostede pode actualizar o contrasinal da súa chave privada nos seus axustes persoais para recuperar o acceso aos seus ficheiros", "Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you." => "Non foi posíbel descifrar o ficheiro, probabelmente tratase dun ficheiro compartido. Pídalle ao propietario do ficheiro que volva compartir o ficheiro con vostede.", "Unknown error. Please check your system settings or contact your administrator" => "Produciuse un erro descoñecido. Comprobe os axustes do sistema ou contacte co administrador", "Missing requirements." => "Non se cumpren os requisitos.", -"Please make sure that PHP 5.3.3 or newer is installed and that OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled." => "Asegúrese de que está instalado o PHP 5.3.3 ou posterior e de que o OpenSSL xunto coa extensión PHP estean activados e configurados correctamente. Polo de agora foi desactivado o aplicativo de cifrado.", +"Please make sure that PHP 5.3.3 or newer is installed and that OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled." => "Asegúrese de que está instalado o PHP 5.3.3 ou posterior e de que o OpenSSL xunto coa extensión PHP estean activados e configurados correctamente. Polo de agora foi desactivada a aplicación de cifrado.", "Following users are not set up for encryption:" => "Os seguintes usuarios non teñen configuración para o cifrado:", "Initial encryption started... This can take some time. Please wait." => "Comezou o cifrado inicial... Isto pode levar bastante tempo. Agarde.", "Initial encryption running... Please try again later." => "O cifrado inicial está en execución... Tenteo máis tarde.", "Go directly to your %spersonal settings%s." => "Vaia directamente aos seus %saxustes persoais%s.", "Encryption" => "Cifrado", -"Encryption App is enabled but your keys are not initialized, please log-out and log-in again" => "O aplicativo de cifrado está activado, mais as chaves non foron inicializadas, saia da sesión e volva a acceder de novo", +"Encryption App is enabled but your keys are not initialized, please log-out and log-in again" => "A aplicación de cifrado está activada, mais as chaves non foron inicializadas, saia da sesión e volva a acceder de novo", "Enable recovery key (allow to recover users files in case of password loss):" => "Activar a chave de recuperación (permitirá recuperar os ficheiros dos usuarios no caso de perda do contrasinal):", "Recovery key password" => "Contrasinal da chave de recuperación", "Repeat Recovery key password" => "Repita o contrasinal da chave de recuperación", diff --git a/apps/files_external/l10n/gl.php b/apps/files_external/l10n/gl.php index 3d27f228221..006507a4ba2 100644 --- a/apps/files_external/l10n/gl.php +++ b/apps/files_external/l10n/gl.php @@ -1,7 +1,7 @@ <?php $TRANSLATIONS = array( -"Fetching request tokens failed. Verify that your Dropbox app key and secret are correct." => "Fallou a obtención de marcas de petición. Comprobe que a chave e o código secreto do seu aplicativo Dropbox son correctas.", -"Fetching access tokens failed. Verify that your Dropbox app key and secret are correct." => "Fallou a obtención de marcas de acceso. Comprobe que a chave e o código secreto do seu aplicativo Dropbox son correctas.", +"Fetching request tokens failed. Verify that your Dropbox app key and secret are correct." => "Fallou a obtención de marcas de petición. Comprobe que a chave e o código secreto da súa aplicación Dropbox son correctas.", +"Fetching access tokens failed. Verify that your Dropbox app key and secret are correct." => "Fallou a obtención de marcas de acceso. Comprobe que a chave e o código secreto da súa aplicación Dropbox son correctas.", "Please provide a valid Dropbox app key and secret." => "Forneza unha chave correcta e segreda do Dropbox.", "Step 1 failed. Exception: %s" => "Fallou o paso 1. Excepción: %s", "Step 2 failed. Exception: %s" => "Fallou o paso 2. Excepción: %s", @@ -21,7 +21,7 @@ $TRANSLATIONS = array( "Enable SSL" => "Activar SSL", "Enable Path Style" => "Activar o estilo de ruta", "App key" => "Clave da API", -"App secret" => "Secreto do aplicativo", +"App secret" => "Secreto da aplicación", "Host" => "Servidor", "Username" => "Nome de usuario", "Password" => "Contrasinal", diff --git a/apps/files_sharing/ajax/external.php b/apps/files_sharing/ajax/external.php index 0dbd3ab8c95..37d0607cd3f 100644 --- a/apps/files_sharing/ajax/external.php +++ b/apps/files_sharing/ajax/external.php @@ -33,16 +33,22 @@ $externalManager = new \OCA\Files_Sharing\External\Manager( $name = OCP\Files::buildNotExistingFileName('/', $name); -$mount = $externalManager->addShare($remote, $token, $password, $name, $owner); -/** - * @var \OCA\Files_Sharing\External\Storage $storage - */ -$storage = $mount->getStorage(); -$result = $storage->file_exists(''); -if($result){ - $storage->getScanner()->scanAll(); - \OCP\JSON::success(); +// check for ssl cert +if (substr($remote, 0, 5) === 'https' and !OC_Util::getUrlContent($remote)) { + \OCP\JSON::error(array('data' => array('message' => $l->t("Invalid or untrusted SSL certificate")))); + exit; } else { - $externalManager->removeShare($mount->getMountPoint()); - \OCP\JSON::error(array('data' => array('message' => $l->t("Couldn't add remote share")))); + $mount = $externalManager->addShare($remote, $token, $password, $name, $owner); + /** + * @var \OCA\Files_Sharing\External\Storage $storage + */ + $storage = $mount->getStorage(); + $result = $storage->file_exists(''); + if ($result) { + $storage->getScanner()->scanAll(); + \OCP\JSON::success(); + } else { + $externalManager->removeShare($mount->getMountPoint()); + \OCP\JSON::error(array('data' => array('message' => $l->t("Couldn't add remote share")))); + } } diff --git a/apps/files_sharing/js/sharedfilelist.js b/apps/files_sharing/js/sharedfilelist.js index 7a43185a2d7..d29285dc1de 100644 --- a/apps/files_sharing/js/sharedfilelist.js +++ b/apps/files_sharing/js/sharedfilelist.js @@ -28,6 +28,8 @@ _sharedWithUser: false, _linksOnly: false, + _clientSideSort: true, + initialize: function($el, options) { OCA.Files.FileList.prototype.initialize.apply(this, arguments); if (this.initialized) { diff --git a/apps/user_ldap/l10n/gl.php b/apps/user_ldap/l10n/gl.php index 01d4b9a83df..6dea160392b 100644 --- a/apps/user_ldap/l10n/gl.php +++ b/apps/user_ldap/l10n/gl.php @@ -73,7 +73,7 @@ $TRANSLATIONS = array( "Continue" => "Continuar", "Expert" => "Experto", "Advanced" => "Avanzado", -"<b>Warning:</b> Apps user_ldap and user_webdavauth are incompatible. You may experience unexpected behavior. Please ask your system administrator to disable one of them." => "<b>Aviso:</b> Os aplicativos user_ldap e user_webdavauth son incompatíbeis. Pode acontecer un comportamento estraño. Consulte co administrador do sistema para desactivar un deles.", +"<b>Warning:</b> Apps user_ldap and user_webdavauth are incompatible. You may experience unexpected behavior. Please ask your system administrator to disable one of them." => "<b>Aviso:</b> As aplicacións user_ldap e user_webdavauth son incompatíbeis. Pode acontecer un comportamento estraño. Consulte co administrador do sistema para desactivar unha delas.", "<b>Warning:</b> The PHP LDAP module is not installed, the backend will not work. Please ask your system administrator to install it." => "<b>Aviso:</b> O módulo PHP LDAP non está instalado, o servidor non funcionará. Consulte co administrador do sistema para instalalo.", "Connection Settings" => "Axustes da conexión", "Configuration Active" => "Configuración activa", |