diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-03-19 11:44:21 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-03-19 11:44:21 +0100 |
commit | c216c4777be147a04ab27c6af9e25e8b2fc9677d (patch) | |
tree | d6cb262ac0a1d697ea9a3edc413e43a3e95b57bc /apps | |
parent | effea790c7200d1a9e5605407dcefc8ab71146b8 (diff) | |
parent | b9fc240b838439444061824cb191ce22c4c4c052 (diff) | |
download | nextcloud-server-c216c4777be147a04ab27c6af9e25e8b2fc9677d.tar.gz nextcloud-server-c216c4777be147a04ab27c6af9e25e8b2fc9677d.zip |
Merge branch 'master' into close-session-faster-master
Conflicts:
apps/files/ajax/upgrade.php
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/ajax/upgrade.php | 44 | ||||
-rw-r--r-- | apps/files/index.php | 135 | ||||
-rw-r--r-- | apps/files/js/upgrade.js | 28 | ||||
-rw-r--r-- | apps/files/l10n/ca.php | 5 | ||||
-rw-r--r-- | apps/files/l10n/cs_CZ.php | 5 | ||||
-rw-r--r-- | apps/files/templates/upgrade.php | 4 | ||||
-rw-r--r-- | apps/files_encryption/l10n/ar.php | 1 | ||||
-rw-r--r-- | apps/files_encryption/l10n/ca.php | 1 | ||||
-rw-r--r-- | apps/files_external/3rdparty/smb4php/smb.php | 16 | ||||
-rw-r--r-- | apps/files_external/l10n/ca.php | 2 | ||||
-rw-r--r-- | apps/files_external/l10n/cs_CZ.php | 2 | ||||
-rwxr-xr-x | apps/files_external/lib/config.php | 8 | ||||
-rw-r--r-- | apps/files_external/tests/mountconfig.php | 145 | ||||
-rw-r--r-- | apps/files_sharing/l10n/ca.php | 1 | ||||
-rw-r--r-- | apps/files_sharing/l10n/cs_CZ.php | 1 | ||||
-rw-r--r-- | apps/user_ldap/l10n/ca.php | 5 |
16 files changed, 226 insertions, 177 deletions
diff --git a/apps/files/ajax/upgrade.php b/apps/files/ajax/upgrade.php deleted file mode 100644 index a3383a8863f..00000000000 --- a/apps/files/ajax/upgrade.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -set_time_limit(0); //scanning can take ages -\OC::$session->close(); - -$user = OC_User::getUser(); -$eventSource = new OC_EventSource(); -$listener = new UpgradeListener($eventSource); -$legacy = new \OC\Files\Cache\Legacy($user); - -if ($legacy->hasItems()) { - OC_Hook::connect('\OC\Files\Cache\Upgrade', 'migrate_path', $listener, 'upgradePath'); - - OC_DB::beginTransaction(); - $upgrade = new \OC\Files\Cache\Upgrade($legacy); - $count = $legacy->getCount(); - $eventSource->send('total', $count); - $upgrade->upgradePath('/' . $user . '/files'); - OC_DB::commit(); -} -\OC\Files\Cache\Upgrade::upgradeDone($user); -$eventSource->send('done', true); -$eventSource->close(); - -class UpgradeListener { - /** - * @var OC_EventSource $eventSource - */ - private $eventSource; - - private $count = 0; - private $lastSend = 0; - - public function __construct($eventSource) { - $this->eventSource = $eventSource; - } - - public function upgradePath($path) { - $this->count++; - if ($this->count > ($this->lastSend + 5)) { - $this->lastSend = $this->count; - $this->eventSource->send('count', $this->count); - } - } -} diff --git a/apps/files/index.php b/apps/files/index.php index ad7a2e210ed..c66cd40fb56 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -62,22 +62,17 @@ if ($isIE8 && isset($_GET['dir'])){ $ajaxLoad = false; $files = array(); $user = OC_User::getUser(); -if (\OC\Files\Cache\Upgrade::needUpgrade($user)) { //dont load anything if we need to upgrade the cache - $needUpgrade = true; -} else { - if ($isIE8){ - // after the redirect above, the URL will have a format - // like "files#?dir=path" which means that no path was given - // (dir is not set). In that specific case, we don't return any - // files because the client will take care of switching the dir - // to the one from the hash, then ajax-load the initial file list - $files = array(); - $ajaxLoad = true; - } - else{ - $files = \OCA\Files\Helper::getFiles($dir); - } - $needUpgrade = false; +if ($isIE8){ + // after the redirect above, the URL will have a format + // like "files#?dir=path" which means that no path was given + // (dir is not set). In that specific case, we don't return any + // files because the client will take care of switching the dir + // to the one from the hash, then ajax-load the initial file list + $files = array(); + $ajaxLoad = true; +} +else{ + $files = \OCA\Files\Helper::getFiles($dir); } $config = \OC::$server->getConfig(); @@ -97,62 +92,56 @@ $breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir $permissions = $dirInfo->getPermissions(); -if ($needUpgrade) { - OCP\Util::addscript('files', 'upgrade'); - $tmpl = new OCP\Template('files', 'upgrade', 'user'); - $tmpl->printPage(); -} else { - // information about storage capacities - $storageInfo=OC_Helper::getStorageInfo($dir); - $freeSpace=$storageInfo['free']; - $uploadLimit=OCP\Util::uploadLimit(); - $maxUploadFilesize=OCP\Util::maxUploadFilesize($dir); - $publicUploadEnabled = $config->getAppValue('core', 'shareapi_allow_public_upload', 'yes'); - // if the encryption app is disabled, than everything is fine (INIT_SUCCESSFUL status code) - $encryptionInitStatus = 2; - if (OC_App::isEnabled('files_encryption')) { - $session = new \OCA\Encryption\Session(new \OC\Files\View('/')); - $encryptionInitStatus = $session->getInitialized(); - } - - $trashEnabled = \OCP\App::isEnabled('files_trashbin'); - $trashEmpty = true; - if ($trashEnabled) { - $trashEmpty = \OCA\Files_Trashbin\Trashbin::isEmpty($user); - } +// information about storage capacities +$storageInfo=OC_Helper::getStorageInfo($dir); +$freeSpace=$storageInfo['free']; +$uploadLimit=OCP\Util::uploadLimit(); +$maxUploadFilesize=OCP\Util::maxUploadFilesize($dir); +$publicUploadEnabled = $config->getAppValue('core', 'shareapi_allow_public_upload', 'yes'); +// if the encryption app is disabled, than everything is fine (INIT_SUCCESSFUL status code) +$encryptionInitStatus = 2; +if (OC_App::isEnabled('files_encryption')) { + $session = new \OCA\Encryption\Session(new \OC\Files\View('/')); + $encryptionInitStatus = $session->getInitialized(); +} - $isCreatable = \OC\Files\Filesystem::isCreatable($dir . '/'); - $fileHeader = (!isset($files) or count($files) > 0); - $emptyContent = ($isCreatable and !$fileHeader) or $ajaxLoad; - - OCP\Util::addscript('files', 'fileactions'); - OCP\Util::addscript('files', 'files'); - OCP\Util::addscript('files', 'keyboardshortcuts'); - $tmpl = new OCP\Template('files', 'index', 'user'); - $tmpl->assign('fileList', $list->fetchPage()); - $tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage()); - $tmpl->assign('dir', $dir); - $tmpl->assign('isCreatable', $isCreatable); - $tmpl->assign('permissions', $permissions); - $tmpl->assign('files', $files); - $tmpl->assign('trash', $trashEnabled); - $tmpl->assign('trashEmpty', $trashEmpty); - $tmpl->assign('uploadMaxFilesize', $maxUploadFilesize); // minimium of freeSpace and uploadLimit - $tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize)); - $tmpl->assign('freeSpace', $freeSpace); - $tmpl->assign('uploadLimit', $uploadLimit); // PHP upload limit - $tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true))); - $tmpl->assign('usedSpacePercent', (int)$storageInfo['relative']); - $tmpl->assign('isPublic', false); - $tmpl->assign('publicUploadEnabled', $publicUploadEnabled); - $tmpl->assign("encryptedFiles", \OCP\Util::encryptedFiles()); - $tmpl->assign("mailNotificationEnabled", $config->getAppValue('core', 'shareapi_allow_mail_notification', 'yes')); - $tmpl->assign("allowShareWithLink", $config->getAppValue('core', 'shareapi_allow_links', 'yes')); - $tmpl->assign("encryptionInitStatus", $encryptionInitStatus); - $tmpl->assign('disableSharing', false); - $tmpl->assign('ajaxLoad', $ajaxLoad); - $tmpl->assign('emptyContent', $emptyContent); - $tmpl->assign('fileHeader', $fileHeader); - - $tmpl->printPage(); +$trashEnabled = \OCP\App::isEnabled('files_trashbin'); +$trashEmpty = true; +if ($trashEnabled) { + $trashEmpty = \OCA\Files_Trashbin\Trashbin::isEmpty($user); } + +$isCreatable = \OC\Files\Filesystem::isCreatable($dir . '/'); +$fileHeader = (!isset($files) or count($files) > 0); +$emptyContent = ($isCreatable and !$fileHeader) or $ajaxLoad; + +OCP\Util::addscript('files', 'fileactions'); +OCP\Util::addscript('files', 'files'); +OCP\Util::addscript('files', 'keyboardshortcuts'); +$tmpl = new OCP\Template('files', 'index', 'user'); +$tmpl->assign('fileList', $list->fetchPage()); +$tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage()); +$tmpl->assign('dir', $dir); +$tmpl->assign('isCreatable', $isCreatable); +$tmpl->assign('permissions', $permissions); +$tmpl->assign('files', $files); +$tmpl->assign('trash', $trashEnabled); +$tmpl->assign('trashEmpty', $trashEmpty); +$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize); // minimium of freeSpace and uploadLimit +$tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize)); +$tmpl->assign('freeSpace', $freeSpace); +$tmpl->assign('uploadLimit', $uploadLimit); // PHP upload limit +$tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true))); +$tmpl->assign('usedSpacePercent', (int)$storageInfo['relative']); +$tmpl->assign('isPublic', false); +$tmpl->assign('publicUploadEnabled', $publicUploadEnabled); +$tmpl->assign("encryptedFiles", \OCP\Util::encryptedFiles()); +$tmpl->assign("mailNotificationEnabled", $config->getAppValue('core', 'shareapi_allow_mail_notification', 'yes')); +$tmpl->assign("allowShareWithLink", $config->getAppValue('core', 'shareapi_allow_links', 'yes')); +$tmpl->assign("encryptionInitStatus", $encryptionInitStatus); +$tmpl->assign('disableSharing', false); +$tmpl->assign('ajaxLoad', $ajaxLoad); +$tmpl->assign('emptyContent', $emptyContent); +$tmpl->assign('fileHeader', $fileHeader); + +$tmpl->printPage(); diff --git a/apps/files/js/upgrade.js b/apps/files/js/upgrade.js deleted file mode 100644 index 714adf824a1..00000000000 --- a/apps/files/js/upgrade.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2014 - * - * This file is licensed under the Affero General Public License version 3 - * or later. - * - * See the COPYING-README file. - * - */ - -/* global OC */ -$(document).ready(function () { - var eventSource, total, bar = $('#progressbar'); - console.log('start'); - bar.progressbar({value: 0}); - eventSource = new OC.EventSource(OC.filePath('files', 'ajax', 'upgrade.php')); - eventSource.listen('total', function (count) { - total = count; - console.log(count + ' files needed to be migrated'); - }); - eventSource.listen('count', function (count) { - bar.progressbar({value: (count / total) * 100}); - console.log(count); - }); - eventSource.listen('done', function () { - document.location.reload(); - }); -}); diff --git a/apps/files/l10n/ca.php b/apps/files/l10n/ca.php index f63f65162a8..e1c7decdbbd 100644 --- a/apps/files/l10n/ca.php +++ b/apps/files/l10n/ca.php @@ -3,7 +3,9 @@ $TRANSLATIONS = array( "Could not move %s - File with this name already exists" => "No s'ha pogut moure %s - Ja hi ha un fitxer amb aquest nom", "Could not move %s" => " No s'ha pogut moure %s", "File name cannot be empty." => "El nom del fitxer no pot ser buit.", +"\"%s\" is an invalid file name." => "\"%s\" no es un fitxer vàlid.", "Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "El nóm no és vàlid, '\\', '/', '<', '>', ':', '\"', '|', '?' i '*' no estan permesos.", +"The target folder has been moved or deleted." => "La carpeta de destí s'ha mogut o eliminat.", "The name %s is already used in the folder %s. Please choose a different name." => "El nom %s ja s'usa en la carpeta %s. Indiqueu un nom diferent.", "Not a valid source" => "No és un origen vàlid", "Server is not allowed to open URLs, please check the server configuration" => "El servidor no té autorització per obrir URLs, comproveu la configuració del servidor", @@ -27,6 +29,8 @@ $TRANSLATIONS = array( "Invalid directory." => "Directori no vàlid.", "Files" => "Fitxers", "Unable to upload {filename} as it is a directory or has 0 bytes" => "No es pot pujar {filename} perquè és una carpeta o té 0 bytes", +"Total file size {size1} exceeds upload limit {size2}" => "Mida total del fitxer {size1} excedeix el límit de pujada {size2}", +"Not enough free space, you are uploading {size1} but only {size2} is left" => "No hi ha prou espai lliure, està carregant {size1} però només pot {size2}", "Upload cancelled." => "La pujada s'ha cancel·lat.", "Could not get result from server." => "No hi ha resposta del servidor.", "File upload is in progress. Leaving the page now will cancel the upload." => "Hi ha una pujada en curs. Si abandoneu la pàgina la pujada es cancel·larà.", @@ -48,6 +52,7 @@ $TRANSLATIONS = array( "_%n file_::_%n files_" => array("%n fitxer","%n fitxers"), "{dirs} and {files}" => "{dirs} i {files}", "_Uploading %n file_::_Uploading %n files_" => array("Pujant %n fitxer","Pujant %n fitxers"), +"\"{name}\" is an invalid file name." => "\"{name}\" no es un fitxer vàlid.", "Your storage is full, files can not be updated or synced anymore!" => "El vostre espai d'emmagatzemament és ple, els fitxers ja no es poden actualitzar o sincronitzar!", "Your storage is almost full ({usedSpacePercent}%)" => "El vostre espai d'emmagatzemament és gairebé ple ({usedSpacePercent}%)", "Encryption App is enabled but your keys are not initialized, please log-out and log-in again" => "L'aplicació d'encriptació està activada però les claus no estan inicialitzades, sortiu i acrediteu-vos de nou.", diff --git a/apps/files/l10n/cs_CZ.php b/apps/files/l10n/cs_CZ.php index 02ab6e15250..3fac6f15c08 100644 --- a/apps/files/l10n/cs_CZ.php +++ b/apps/files/l10n/cs_CZ.php @@ -3,7 +3,9 @@ $TRANSLATIONS = array( "Could not move %s - File with this name already exists" => "Nelze přesunout %s - již existuje soubor se stejným názvem", "Could not move %s" => "Nelze přesunout %s", "File name cannot be empty." => "Název souboru nemůže být prázdný řetězec.", +"\"%s\" is an invalid file name." => "\"%s\" je neplatným názvem souboru.", "Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "Neplatný název, znaky '\\', '/', '<', '>', ':', '\"', '|', '?' a '*' nejsou povoleny.", +"The target folder has been moved or deleted." => "Cílová složka byla přesunuta nebo smazána.", "The name %s is already used in the folder %s. Please choose a different name." => "Název %s ve složce %s již existuje. Vyberte prosím jiné jméno.", "Not a valid source" => "Neplatný zdroj", "Server is not allowed to open URLs, please check the server configuration" => "Server není oprávněn otevírat adresy URL. Ověřte, prosím, konfiguraci serveru.", @@ -27,6 +29,8 @@ $TRANSLATIONS = array( "Invalid directory." => "Neplatný adresář", "Files" => "Soubory", "Unable to upload {filename} as it is a directory or has 0 bytes" => "Nelze nahrát soubor {filename}, protože je to buď adresář nebo má velikost 0 bytů", +"Total file size {size1} exceeds upload limit {size2}" => "Celková velikost souboru {size1} překračuje povolenou velikost pro nahrávání {size2}", +"Not enough free space, you are uploading {size1} but only {size2} is left" => "Není dostatek místa pro uložení, velikost souboru je {size1}, zbývá pouze {size2}", "Upload cancelled." => "Odesílání zrušeno.", "Could not get result from server." => "Nepodařilo se získat výsledek ze serveru.", "File upload is in progress. Leaving the page now will cancel the upload." => "Probíhá odesílání souboru. Opuštění stránky způsobí zrušení nahrávání.", @@ -48,6 +52,7 @@ $TRANSLATIONS = array( "_%n file_::_%n files_" => array("%n soubor","%n soubory","%n souborů"), "{dirs} and {files}" => "{dirs} a {files}", "_Uploading %n file_::_Uploading %n files_" => array("Nahrávám %n soubor","Nahrávám %n soubory","Nahrávám %n souborů"), +"\"{name}\" is an invalid file name." => "\"{name}\" je neplatným názvem souboru.", "Your storage is full, files can not be updated or synced anymore!" => "Vaše úložiště je plné, nelze aktualizovat ani synchronizovat soubory.", "Your storage is almost full ({usedSpacePercent}%)" => "Vaše úložiště je téměř plné ({usedSpacePercent}%)", "Encryption App is enabled but your keys are not initialized, please log-out and log-in again" => "Aplikace pro šifrování je zapnuta, ale vaše klíče nejsou inicializované. Prosím odhlaste se a znovu přihlaste", diff --git a/apps/files/templates/upgrade.php b/apps/files/templates/upgrade.php deleted file mode 100644 index e03f086e47d..00000000000 --- a/apps/files/templates/upgrade.php +++ /dev/null @@ -1,4 +0,0 @@ -<div id="upgrade"> - <?php p($l->t('Upgrading filesystem cache...'));?> - <div id="progressbar" /> -</div> diff --git a/apps/files_encryption/l10n/ar.php b/apps/files_encryption/l10n/ar.php index cf6c265027c..345c01a0d4a 100644 --- a/apps/files_encryption/l10n/ar.php +++ b/apps/files_encryption/l10n/ar.php @@ -16,6 +16,7 @@ $TRANSLATIONS = array( "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." => "يرجى التاكد من ان اصدار PHP 5.3.3 او احدث , مثبت و التاكد من ان OpenSSL مفعل و مهيئ بشكل صحيح. حتى الان برنامج التتشفير تم تعطيلة.", "Following users are not set up for encryption:" => "المستخدمين التاليين لم يتم تعيين لهم التشفيير:", "Initial encryption started... This can take some time. Please wait." => "بدأ التشفير... من الممكن ان ياخذ بعض الوقت. يرجى الانتظار.", +"Initial encryption running... Please try again later." => "جاري تفعيل التشفير المبدئي ، الرجاء المحاولة لاحقا", "Go directly to your " => "انتقل مباشرة الى ", "personal settings" => "اعدادات شخصية", "Encryption" => "التشفير", diff --git a/apps/files_encryption/l10n/ca.php b/apps/files_encryption/l10n/ca.php index 23897c18186..3414796f62b 100644 --- a/apps/files_encryption/l10n/ca.php +++ b/apps/files_encryption/l10n/ca.php @@ -16,6 +16,7 @@ $TRANSLATIONS = array( "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." => "Assegureu-vos que teniu instal·lat PHP 5.3.3 o una versió superior i que està activat Open SSL i habilitada i configurada correctament l'extensió de PHP. De moment, l'aplicació d'encriptació s'ha desactivat.", "Following users are not set up for encryption:" => "Els usuaris següents no estan configurats per a l'encriptació:", "Initial encryption started... This can take some time. Please wait." => "La encriptació inicial ha començat... Pot trigar una estona, espereu.", +"Initial encryption running... Please try again later." => "encriptació inicial en procés... Proveu-ho més tard.", "Go directly to your " => "Vés directament a", "personal settings" => "arranjament personal", "Encryption" => "Xifrat", diff --git a/apps/files_external/3rdparty/smb4php/smb.php b/apps/files_external/3rdparty/smb4php/smb.php index 622942b052a..656930514f0 100644 --- a/apps/files_external/3rdparty/smb4php/smb.php +++ b/apps/files_external/3rdparty/smb4php/smb.php @@ -20,6 +20,7 @@ # GNU General Public License for more details. # # Addition 17/12/2012 Frank Karlitschek (frank@owncloud.org) +# Addition 17/03/2014 Robin McCorkell (rmccorkell@karoshi.org.uk) # On the official website http://www.phpclasses.org/smb4php the # license is listed as LGPL so we assume that this is # dual-licensed GPL/LGPL @@ -238,17 +239,10 @@ class smb { trigger_error ("url_stat(): list failed for host '{$pu['host']}'", E_USER_WARNING); break; case 'share': - if ($o = smb::look ($pu)) { - $found = FALSE; - $lshare = strtolower ($pu['share']); # fix by Eric Leung - foreach ($o['disk'] as $s) if ($lshare == strtolower($s)) { - $found = TRUE; - $stat = stat ("/tmp"); - break; - } - if (! $found) - trigger_error ("url_stat(): disk resource '{$lshare}' not found in '{$pu['host']}'", E_USER_WARNING); - } + if (smb::execute("ls", $pu)) + $stat = stat ("/tmp"); + else + trigger_error ("url_stat(): disk resource '{$pu['share']}' not found in '{$pu['host']}'", E_USER_WARNING); break; case 'path': if ($o = smb::execute ('dir "'.$pu['path'].'"', $pu)) { diff --git a/apps/files_external/l10n/ca.php b/apps/files_external/l10n/ca.php index 40a1ffc9b5c..3e722046296 100644 --- a/apps/files_external/l10n/ca.php +++ b/apps/files_external/l10n/ca.php @@ -5,6 +5,7 @@ $TRANSLATIONS = array( "Grant access" => "Concedeix accés", "Please provide a valid Dropbox app key and secret." => "Proporcioneu una clau d'aplicació i secret vàlids per a Dropbox", "Error configuring Google Drive storage" => "Error en configurar l'emmagatzemament Google Drive", +"Saved" => "Desat", "<b>Warning:</b> \"smbclient\" is not installed. Mounting of CIFS/SMB shares is not possible. Please ask your system administrator to install it." => "<b>Avís:</b> \"smbclient\" no està instal·lat. No es pot muntar la compartició CIFS/SMB. Demaneu a l'administrador del sistema que l'instal·li.", "<b>Warning:</b> The FTP support in PHP is not enabled or installed. Mounting of FTP shares is not possible. Please ask your system administrator to install it." => "<b>Avís:</b> El suport FTP per PHP no està activat o no està instal·lat. No es pot muntar la compartició FTP. Demaneu a l'administrador del sistema que l'instal·li.", "<b>Warning:</b> The Curl support in PHP is not enabled or installed. Mounting of ownCloud / WebDAV or GoogleDrive is not possible. Please ask your system administrator to install it." => "<b>Avís:</b>El suport Curl de PHP no està activat o instal·lat. No es pot muntar ownCloud / WebDAV o GoogleDrive. Demaneu a l'administrador que l'instal·li.", @@ -21,6 +22,7 @@ $TRANSLATIONS = array( "Users" => "Usuaris", "Delete" => "Esborra", "Enable User External Storage" => "Habilita l'emmagatzemament extern d'usuari", +"Allow users to mount the following external storage" => "Permet als usuaris muntar els dispositius externs següents", "SSL root certificates" => "Certificats SSL root", "Import Root Certificate" => "Importa certificat root" ); diff --git a/apps/files_external/l10n/cs_CZ.php b/apps/files_external/l10n/cs_CZ.php index dafe722bc2d..2f7bbd0c4a3 100644 --- a/apps/files_external/l10n/cs_CZ.php +++ b/apps/files_external/l10n/cs_CZ.php @@ -5,6 +5,7 @@ $TRANSLATIONS = array( "Grant access" => "Povolit přístup", "Please provide a valid Dropbox app key and secret." => "Zadejte, prosím, platný klíč a bezpečnostní frázi aplikace Dropbox.", "Error configuring Google Drive storage" => "Chyba při nastavení úložiště Google Drive", +"Saved" => "Uloženo", "<b>Warning:</b> \"smbclient\" is not installed. Mounting of CIFS/SMB shares is not possible. Please ask your system administrator to install it." => "<b>Varování:</b> není nainstalován program \"smbclient\". Není možné připojení oddílů CIFS/SMB. Prosím požádejte svého správce systému ať jej nainstaluje.", "<b>Warning:</b> The FTP support in PHP is not enabled or installed. Mounting of FTP shares is not possible. Please ask your system administrator to install it." => "<b>Varování:</b> podpora FTP v PHP není povolena nebo není nainstalována. Není možné připojení oddílů FTP. Prosím požádejte svého správce systému ať ji nainstaluje.", "<b>Warning:</b> The Curl support in PHP is not enabled or installed. Mounting of ownCloud / WebDAV or GoogleDrive is not possible. Please ask your system administrator to install it." => "<b>Varování:</b> podpora CURL v PHP není povolena nebo není nainstalována. Není možné připojení oddílů ownCloud, WebDAV, či GoogleDrive. Prosím požádejte svého správce systému ať ji nainstaluje.", @@ -21,6 +22,7 @@ $TRANSLATIONS = array( "Users" => "Uživatelé", "Delete" => "Smazat", "Enable User External Storage" => "Zapnout externí uživatelské úložiště", +"Allow users to mount the following external storage" => "Povolit uživatelů připojit externí úložiště", "SSL root certificates" => "Kořenové certifikáty SSL", "Import Root Certificate" => "Importovat kořenového certifikátu" ); diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index 2767076eefa..2c8828c4d51 100755 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -28,6 +28,9 @@ class OC_Mount_Config { const MOUNT_TYPE_GROUP = 'group'; const MOUNT_TYPE_USER = 'user'; + // whether to skip backend test (for unit tests, as this static class is not mockable) + public static $skipTest = false; + /** * Get details on each of the external storage backends, used for the mount config UI * If a custom UI is needed, add the key 'custom' and a javascript file with that name will be loaded @@ -275,6 +278,9 @@ class OC_Mount_Config { } private static function getBackendStatus($class, $options) { + if (self::$skipTest) { + return true; + } foreach ($options as &$option) { $option = str_replace('$user', OCP\User::getUser(), $option); } @@ -321,7 +327,7 @@ class OC_Mount_Config { // Verify that the mount point applies for the current user // Prevent non-admin users from mounting local storage and other disabled backends $allowed_backends = self::getPersonalBackends(); - if ($applicable != OCP\User::getUser() || !in_array($class, $allowed_backends)) { + if ($applicable != OCP\User::getUser() || !isset($allowed_backends[$class])) { return false; } $mountPoint = '/'.$applicable.'/files/'.ltrim($mountPoint, '/'); diff --git a/apps/files_external/tests/mountconfig.php b/apps/files_external/tests/mountconfig.php index 24ebcf51346..a22c7424c69 100644 --- a/apps/files_external/tests/mountconfig.php +++ b/apps/files_external/tests/mountconfig.php @@ -34,6 +34,66 @@ class Test_Mount_Config_Dummy_Storage { * Class Test_Mount_Config */ class Test_Mount_Config extends \PHPUnit_Framework_TestCase { + + private $dataDir; + private $userHome; + private $oldAllowedBackends; + private $allBackends; + + public function setUp() { + \OC_User::setUserId('test'); + $this->userHome = \OC_User::getHome('test'); + mkdir($this->userHome); + + $this->dataDir = \OC_Config::getValue( + 'datadirectory', + \OC::$SERVERROOT . '/data/' + ); + $this->oldAllowedBackends = OCP\Config::getAppValue( + 'files_external', + 'user_mounting_backends', + '' + ); + $this->allBackends = OC_Mount_Config::getBackends(); + OCP\Config::setAppValue( + 'files_external', + 'user_mounting_backends', + implode(',', array_keys($this->allBackends)) + ); + + OC_Mount_Config::$skipTest = true; + } + + public function tearDown() { + OC_Mount_Config::$skipTest = false; + + @unlink($this->dataDir . '/mount.json'); + @unlink($this->userHome . '/mount.json'); + rmdir($this->userHome); + + OCP\Config::setAppValue( + 'files_external', + 'user_mounting_backends', + $this->oldAllowedBackends + ); + } + + /** + * Reads the global config, for checking + */ + private function readGlobalConfig() { + $configFile = $this->dataDir . '/mount.json'; + return json_decode(file_get_contents($configFile), true); + } + + /** + * Reads the user config, for checking + */ + private function readUserConfig() { + $configFile = $this->userHome . '/mount.json'; + return json_decode(file_get_contents($configFile), true); + } + /** * Test mount point validation */ @@ -42,35 +102,88 @@ class Test_Mount_Config extends \PHPUnit_Framework_TestCase { $mountType = 'user'; $applicable = 'all'; $isPersonal = false; - $this->assertEquals(false, OC_Mount_Config::addMountPoint('', $storageClass, array(), $mountType, $applicable, $isPersonal)); - $this->assertEquals(false, OC_Mount_Config::addMountPoint('/', $storageClass, array(), $mountType, $applicable, $isPersonal)); - $this->assertEquals(false, OC_Mount_Config::addMountPoint('Shared', $storageClass, array(), $mountType, $applicable, $isPersonal)); - $this->assertEquals(false, OC_Mount_Config::addMountPoint('/Shared', $storageClass, array(), $mountType, $applicable, $isPersonal)); + $this->assertFalse(OC_Mount_Config::addMountPoint('', $storageClass, array(), $mountType, $applicable, $isPersonal)); + $this->assertFalse(OC_Mount_Config::addMountPoint('/', $storageClass, array(), $mountType, $applicable, $isPersonal)); + $this->assertFalse(OC_Mount_Config::addMountPoint('Shared', $storageClass, array(), $mountType, $applicable, $isPersonal)); + $this->assertFalse(OC_Mount_Config::addMountPoint('/Shared', $storageClass, array(), $mountType, $applicable, $isPersonal)); } + /** + * Test adding a global mount point + */ + public function testAddGlobalMountPoint() { + $mountType = OC_Mount_Config::MOUNT_TYPE_GLOBAL; + $applicable = 'all'; + $isPersonal = false; + + $this->assertEquals(true, OC_Mount_Config::addMountPoint('/ext', '\OC\Files\Storage\SFTP', array(), $mountType, $applicable, $isPersonal)); + + $config = $this->readGlobalConfig(); + $this->assertEquals(1, count($config)); + $this->assertTrue(isset($config[$mountType])); + $this->assertTrue(isset($config[$mountType][$applicable])); + $this->assertTrue(isset($config[$mountType][$applicable]['/$user/files/ext'])); + $this->assertEquals( + '\OC\Files\Storage\SFTP', + $config[$mountType][$applicable]['/$user/files/ext']['class'] + ); + } + + /** + * Test adding a personal mount point + */ public function testAddMountPointSingleUser() { - \OC_User::setUserId('test'); - $mountType = 'user'; + $mountType = OC_Mount_Config::MOUNT_TYPE_USER; + $applicable = 'test'; + $isPersonal = true; + + $this->assertEquals(true, OC_Mount_Config::addMountPoint('/ext', '\OC\Files\Storage\SFTP', array(), $mountType, $applicable, $isPersonal)); + + $config = $this->readUserConfig(); + $this->assertEquals(1, count($config)); + $this->assertTrue(isset($config[$mountType])); + $this->assertTrue(isset($config[$mountType][$applicable])); + $this->assertTrue(isset($config[$mountType][$applicable]['/test/files/ext'])); + $this->assertEquals( + '\OC\Files\Storage\SFTP', + $config[$mountType][$applicable]['/test/files/ext']['class'] + ); + } + + /** + * Test adding a personal mount point using disallowed backend + */ + public function testAddDisallowedBackendMountPointSingleUser() { + $mountType = OC_Mount_Config::MOUNT_TYPE_USER; $applicable = 'test'; $isPersonal = true; + // local - $this->assertEquals(false, OC_Mount_Config::addMountPoint('/ext', '\OC\Files\storage\local', array(), $mountType, $applicable, $isPersonal)); - // non-local - // FIXME: can't test this yet as the class (write operation) is not mockable - // $this->assertEquals(true, OC_Mount_Config::addMountPoint('/ext', '\OC\Files\Storage\SFTP', array(), $mountType, $applicable, $isPersonal)); + $this->assertFalse(OC_Mount_Config::addMountPoint('/ext', '\OC\Files\storage\local', array(), $mountType, $applicable, $isPersonal)); + unset($this->allBackends['\OC\Files\Storage\SFTP']); + OCP\Config::setAppValue( + 'files_external', + 'user_mounting_backends', + implode(',', array_keys($this->allBackends)) + ); + + // non-local but forbidden + $this->assertFalse(OC_Mount_Config::addMountPoint('/ext', '\OC\Files\Storage\SFTP', array(), $mountType, $applicable, $isPersonal)); + + $this->assertFalse(file_exists($this->userHome . '/mount.json')); } + /** + * Test adding a mount point with an non-existant backend + */ public function testAddMountPointUnexistClass() { - \OC_User::setUserId('test'); $storageClass = 'Unexist_Storage'; - $mountType = 'user'; + $mountType = OC_Mount_Config::MOUNT_TYPE_USER; $applicable = 'test'; - $isPersonal = true; - // local - // non-local - $this->assertEquals(false, OC_Mount_Config::addMountPoint('/ext', $storageClass, array(), $mountType, $applicable, $isPersonal)); + $isPersonal = false; + $this->assertFalse(OC_Mount_Config::addMountPoint('/ext', $storageClass, array(), $mountType, $applicable, $isPersonal)); } } diff --git a/apps/files_sharing/l10n/ca.php b/apps/files_sharing/l10n/ca.php index 7068626b7ef..6432219650b 100644 --- a/apps/files_sharing/l10n/ca.php +++ b/apps/files_sharing/l10n/ca.php @@ -11,6 +11,7 @@ $TRANSLATIONS = array( "sharing is disabled" => "s'ha desactivat la compartició", "For more info, please ask the person who sent this link." => "Per més informació contacteu amb qui us ha enviat l'enllaç.", "shared by %s" => "compartit per %s", +"Download %s" => "Baixa %s", "Direct link" => "Enllaç directe" ); $PLURAL_FORMS = "nplurals=2; plural=(n != 1);"; diff --git a/apps/files_sharing/l10n/cs_CZ.php b/apps/files_sharing/l10n/cs_CZ.php index e0a3c27fb4c..5d50ff41316 100644 --- a/apps/files_sharing/l10n/cs_CZ.php +++ b/apps/files_sharing/l10n/cs_CZ.php @@ -11,6 +11,7 @@ $TRANSLATIONS = array( "sharing is disabled" => "sdílení je zakázané", "For more info, please ask the person who sent this link." => "Pro více informací kontaktujte osobu, která vám zaslala tento odkaz.", "shared by %s" => "sdíleno %s", +"Download %s" => "Stáhnout %s", "Direct link" => "Přímý odkaz" ); $PLURAL_FORMS = "nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;"; diff --git a/apps/user_ldap/l10n/ca.php b/apps/user_ldap/l10n/ca.php index 0a012b78e91..940c6ea8b66 100644 --- a/apps/user_ldap/l10n/ca.php +++ b/apps/user_ldap/l10n/ca.php @@ -33,12 +33,14 @@ $TRANSLATIONS = array( "Save" => "Desa", "Test Configuration" => "Comprovació de la configuració", "Help" => "Ajuda", +"Groups meeting these criteria are available in %s:" => "Els grups que compleixen aquests criteris estan disponibles a %s:", "only those object classes:" => "només aquestes classes d'objecte:", "only from those groups:" => "només d'aquests grups", "Edit raw filter instead" => "Edita filtre raw", "Raw LDAP filter" => "Filtre raw LDAP", "The filter specifies which LDAP groups shall have access to the %s instance." => "El filtre especifica quins grups LDAP haurien de tenir accés a la instància %s.", "groups found" => "grups trobats", +"Users login with this attribute:" => "Usuaris acreditats amb aquest atribut:", "LDAP Username:" => "Nom d'usuari LDAP:", "LDAP Email Address:" => "Adreça de correu electrònic LDAP:", "Other Attributes:" => "Altres atributs:", @@ -53,6 +55,7 @@ $TRANSLATIONS = array( "For anonymous access, leave DN and Password empty." => "Per un accés anònim, deixeu la DN i la contrasenya en blanc.", "One Base DN per line" => "Una DN Base per línia", "You can specify Base DN for users and groups in the Advanced tab" => "Podeu especificar DN Base per usuaris i grups a la pestanya Avançat", +"Limit %s access to users meeting these criteria:" => "Limita l'accés a %s usuaris que compleixin amb aquest criteri:", "The filter specifies which LDAP users shall have access to the %s instance." => "El filtre especifica quins usuaris LDAP haurien de tenir accés a la instància %s", "users found" => "usuaris trobats", "Back" => "Enrera", @@ -85,6 +88,8 @@ $TRANSLATIONS = array( "One Group Base DN per line" => "Una DN Base de Grup per línia", "Group Search Attributes" => "Atributs de cerca de grup", "Group-Member association" => "Associació membres-grup", +"Nested Groups" => "Grups imbricats", +"When switched on, groups that contain groups are supported. (Only works if the group member attribute contains DNs.)" => "Quan està activat, els grups que contenen grups estan permesos. (Només funciona si l'atribut del grup membre conté DNs.)", "Special Attributes" => "Atributs especials", "Quota Field" => "Camp de quota", "Quota Default" => "Quota per defecte", |