diff options
author | Thomas Mueller <thomas.mueller@tmit.eu> | 2013-02-11 21:42:27 +0100 |
---|---|---|
committer | Thomas Mueller <thomas.mueller@tmit.eu> | 2013-02-11 21:42:27 +0100 |
commit | 037fcde1334d7b4d2bdeaaad0a71adc692b27ff8 (patch) | |
tree | 6f10b1a8d54cfea8cc3adf343de0bbf0f115f3d2 /lib | |
parent | f58ed7a509da54fcd29e21dc6fc75528822157a4 (diff) | |
parent | 58e57151e51a02788377f761b183c15cd03b0ef0 (diff) | |
download | nextcloud-server-037fcde1334d7b4d2bdeaaad0a71adc692b27ff8.tar.gz nextcloud-server-037fcde1334d7b4d2bdeaaad0a71adc692b27ff8.zip |
Merge branch 'master' into fixing-1424-master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/app.php | 8 | ||||
-rw-r--r-- | lib/connector/sabre/directory.php | 2 | ||||
-rw-r--r-- | lib/connector/sabre/file.php | 8 | ||||
-rw-r--r-- | lib/files/cache/scanner.php | 18 | ||||
-rw-r--r-- | lib/files/filesystem.php | 4 | ||||
-rw-r--r-- | lib/files/mapper.php | 12 | ||||
-rw-r--r-- | lib/files/storage/common.php | 23 | ||||
-rw-r--r-- | lib/files/storage/local.php | 2 | ||||
-rw-r--r-- | lib/files/storage/temporary.php | 1 | ||||
-rw-r--r-- | lib/filesystem.php | 4 | ||||
-rw-r--r-- | lib/helper.php | 5 | ||||
-rw-r--r-- | lib/l10n/bg_BG.php | 1 | ||||
-rw-r--r-- | lib/l10n/ca.php | 2 | ||||
-rw-r--r-- | lib/l10n/cs_CZ.php | 2 | ||||
-rw-r--r-- | lib/l10n/es.php | 2 | ||||
-rw-r--r-- | lib/l10n/fi_FI.php | 1 | ||||
-rw-r--r-- | lib/l10n/fr.php | 2 | ||||
-rw-r--r-- | lib/l10n/gl.php | 8 | ||||
-rw-r--r-- | lib/l10n/it.php | 2 | ||||
-rw-r--r-- | lib/l10n/lv.php | 2 | ||||
-rw-r--r-- | lib/l10n/pt_PT.php | 2 | ||||
-rw-r--r-- | lib/l10n/ru_RU.php | 2 | ||||
-rw-r--r-- | lib/l10n/sk_SK.php | 10 | ||||
-rw-r--r-- | lib/l10n/sv.php | 2 | ||||
-rw-r--r-- | lib/l10n/vi.php | 1 | ||||
-rw-r--r-- | lib/l10n/zh_TW.php | 2 | ||||
-rw-r--r-- | lib/ocs/cloud.php | 2 | ||||
-rw-r--r-- | lib/setup.php | 124 | ||||
-rw-r--r-- | lib/user.php | 12 | ||||
-rwxr-xr-x | lib/util.php | 4 |
30 files changed, 184 insertions, 86 deletions
diff --git a/lib/app.php b/lib/app.php index ca256ed1aaa..bf7eeef0181 100644 --- a/lib/app.php +++ b/lib/app.php @@ -671,7 +671,7 @@ class OC_App{ $info['update']=false; } else { $info['internal']=false; - $info['internallabel']='3rd Party App'; + $info['internallabel']='3rd Party'; $info['internalclass']='externalapp'; $info['update']=OC_Installer::isUpdateAvailable($app); } @@ -709,10 +709,10 @@ class OC_App{ * @return array, multi-dimensional array of apps. Keys: id, name, type, typename, personid, license, detailpage, preview, changed, description */ public static function getAppstoreApps( $filter = 'approved' ) { - $catagoryNames = OC_OCSClient::getCategories(); - if ( is_array( $catagoryNames ) ) { + $categoryNames = OC_OCSClient::getCategories(); + if ( is_array( $categoryNames ) ) { // Check that categories of apps were retrieved correctly - if ( ! $categories = array_keys( $catagoryNames ) ) { + if ( ! $categories = array_keys( $categoryNames ) ) { return false; } diff --git a/lib/connector/sabre/directory.php b/lib/connector/sabre/directory.php index b210602bbf4..c4062170d5e 100644 --- a/lib/connector/sabre/directory.php +++ b/lib/connector/sabre/directory.php @@ -121,7 +121,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa $paths = array(); foreach($folder_content as $info) { $paths[] = $this->path.'/'.$info['name']; - $properties[$this->path.'/'.$info['name']][self::GETETAG_PROPERTYNAME] = $info['etag']; + $properties[$this->path.'/'.$info['name']][self::GETETAG_PROPERTYNAME] = '"' . $info['etag'] . '"'; } if(count($paths)>0) { // diff --git a/lib/connector/sabre/file.php b/lib/connector/sabre/file.php index 1c18a391742..521c5f0571d 100644 --- a/lib/connector/sabre/file.php +++ b/lib/connector/sabre/file.php @@ -45,7 +45,13 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D */ public function put($data) { - \OC\Files\Filesystem::file_put_contents($this->path,$data); + // mark file as partial while uploading (ignored by the scanner) + $partpath = $this->path . '.part'; + + \OC\Files\Filesystem::file_put_contents($partpath, $data); + + // rename to correct path + \OC\Files\Filesystem::rename($partpath, $this->path); return OC_Connector_Sabre_Node::getETagPropertyForPath($this->path); } diff --git a/lib/files/cache/scanner.php b/lib/files/cache/scanner.php index 9a5546dce3f..5a9a119458e 100644 --- a/lib/files/cache/scanner.php +++ b/lib/files/cache/scanner.php @@ -97,7 +97,7 @@ class Scanner { if ($this->storage->is_dir($path) && ($dh = $this->storage->opendir($path))) { \OC_DB::beginTransaction(); while ($file = readdir($dh)) { - if ($file !== '.' and $file !== '..') { + if (!$this->isIgnoredFile($file)) { $child = ($path) ? $path . '/' . $file : $file; $data = $this->scanFile($child); if ($data) { @@ -133,6 +133,22 @@ class Scanner { } return $size; } + + /** + * @brief check if the file should be ignored when scanning + * NOTE: files with a '.part' extension are ignored as well! + * prevents unfinished put requests to be scanned + * @param String $file + * @return boolean + */ + private function isIgnoredFile($file) { + if ($file === '.' || $file === '..' + || pathinfo($file,PATHINFO_EXTENSION) === 'part') + { + return true; + } + return false; + } /** * walk over any folders that are not fully scanned yet and scan them diff --git a/lib/files/filesystem.php b/lib/files/filesystem.php index 71bf3d8708d..a0c3c4b9b75 100644 --- a/lib/files/filesystem.php +++ b/lib/files/filesystem.php @@ -190,14 +190,14 @@ class Filesystem { } } - static public function init($root) { + static public function init($user, $root) { if (self::$defaultInstance) { return false; } self::$defaultInstance = new View($root); //load custom mount config - self::initMountPoints(); + self::initMountPoints($user); self::$loaded = true; diff --git a/lib/files/mapper.php b/lib/files/mapper.php index 90e4e1ca669..71b665e49bb 100644 --- a/lib/files/mapper.php +++ b/lib/files/mapper.php @@ -114,8 +114,8 @@ class Mapper private function resolveLogicPath($logicPath) { $logicPath = $this->stripLast($logicPath); - $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*file_map` WHERE `logic_path` = ?'); - $result = $query->execute(array($logicPath)); + $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*file_map` WHERE `logic_path_hash` = ?'); + $result = $query->execute(array(md5($logicPath))); $result = $result->fetchRow(); return $result['physic_path']; @@ -123,8 +123,8 @@ class Mapper private function resolvePhysicalPath($physicalPath) { $physicalPath = $this->stripLast($physicalPath); - $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*file_map` WHERE `physic_path` = ?'); - $result = $query->execute(array($physicalPath)); + $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*file_map` WHERE `physic_path_hash` = ?'); + $result = $query->execute(array(md5($physicalPath))); $result = $result->fetchRow(); return $result['logic_path']; @@ -151,8 +151,8 @@ class Mapper } private function insert($logicPath, $physicalPath) { - $query = \OC_DB::prepare('INSERT INTO `*PREFIX*file_map`(`logic_path`,`physic_path`) VALUES(?,?)'); - $query->execute(array($logicPath, $physicalPath)); + $query = \OC_DB::prepare('INSERT INTO `*PREFIX*file_map`(`logic_path`, `physic_path`, `logic_path_hash`, `physic_path_hash`) VALUES(?, ?, ?, ?)'); + $query->execute(array($logicPath, $physicalPath, md5($logicPath), md5($physicalPath))); } private function slugifyPath($path, $index=null) { diff --git a/lib/files/storage/common.php b/lib/files/storage/common.php index 591803f0440..ce9e7ead6d1 100644 --- a/lib/files/storage/common.php +++ b/lib/files/storage/common.php @@ -277,4 +277,27 @@ abstract class Common implements \OC\Files\Storage\Storage { return uniqid(); } } + + /** + * clean a path, i.e. remove all redundant '.' and '..' + * making sure that it can't point to higher than '/' + * @param $path The path to clean + * @return string cleaned path + */ + public function cleanPath($path) { + if (strlen($path) == 0 or $path[0] != '/') { + $path = '/' . $path; + } + + $output = array(); + foreach (explode('/', $path) as $chunk) { + if ($chunk == '..') { + array_pop($output); + } else if ($chunk == '.') { + } else { + $output[] = $chunk; + } + } + return implode('/', $output); + } } diff --git a/lib/files/storage/local.php b/lib/files/storage/local.php index d387a898320..9fe01135866 100644 --- a/lib/files/storage/local.php +++ b/lib/files/storage/local.php @@ -23,6 +23,8 @@ class Local extends \OC\Files\Storage\Common{ $this->datadir.='/'; } } + public function __destruct() { + } public function getId(){ return 'local::'.$this->datadir; } diff --git a/lib/files/storage/temporary.php b/lib/files/storage/temporary.php index 542d2cd9f48..d84dbda2e39 100644 --- a/lib/files/storage/temporary.php +++ b/lib/files/storage/temporary.php @@ -21,6 +21,7 @@ class Temporary extends Local{ } public function __destruct() { + parent::__destruct(); $this->cleanUp(); } } diff --git a/lib/filesystem.php b/lib/filesystem.php index 57cca902303..e86bea6bff9 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -58,8 +58,8 @@ class OC_Filesystem { /** * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem */ - static public function init($root) { - return \OC\Files\Filesystem::init($root); + static public function init($user, $root) { + return \OC\Files\Filesystem::init($user, $root); } /** diff --git a/lib/helper.php b/lib/helper.php index a0fbdd10394..2713ffed451 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -436,8 +436,9 @@ class OC_Helper { //FIXME: should also check for value validation (i.e. the email is an email). public static function init_var($s, $d="") { $r = $d; - if(isset($_REQUEST[$s]) && !empty($_REQUEST[$s])) - $r = stripslashes(htmlspecialchars($_REQUEST[$s])); + if(isset($_REQUEST[$s]) && !empty($_REQUEST[$s])) { + $r = OC_Util::sanitizeHTML($_REQUEST[$s]); + } return $r; } diff --git a/lib/l10n/bg_BG.php b/lib/l10n/bg_BG.php index 31f37458b81..fed7f29cbb2 100644 --- a/lib/l10n/bg_BG.php +++ b/lib/l10n/bg_BG.php @@ -9,6 +9,7 @@ "Files need to be downloaded one by one." => "Файловете трябва да се изтеглят един по един.", "Back to Files" => "Назад към файловете", "Selected files too large to generate zip file." => "Избраните файлове са прекалено големи за генерирането на ZIP архив.", +"couldn't be determined" => "не може да се определи", "Application is not enabled" => "Приложението не е включено.", "Authentication error" => "Възникна проблем с идентификацията", "Token expired. Please reload page." => "Ключът е изтекъл, моля презаредете страницата", diff --git a/lib/l10n/ca.php b/lib/l10n/ca.php index f6401fa39b6..d34220f8f5c 100644 --- a/lib/l10n/ca.php +++ b/lib/l10n/ca.php @@ -16,6 +16,8 @@ "Files" => "Fitxers", "Text" => "Text", "Images" => "Imatges", +"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.", +"Please double check the <a href='%s'>installation guides</a>." => "Comproveu les <a href='%s'>guies d'instal·lació</a>.", "seconds ago" => "segons enrere", "1 minute ago" => "fa 1 minut", "%d minutes ago" => "fa %d minuts", diff --git a/lib/l10n/cs_CZ.php b/lib/l10n/cs_CZ.php index 2c823194b96..f3fd1a24819 100644 --- a/lib/l10n/cs_CZ.php +++ b/lib/l10n/cs_CZ.php @@ -16,6 +16,8 @@ "Files" => "Soubory", "Text" => "Text", "Images" => "Obrázky", +"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Váš webový server není správně nastaven pro umožnění synchronizace, protože rozhraní WebDAV je rozbité.", +"Please double check the <a href='%s'>installation guides</a>." => "Zkonzultujte, prosím, <a href='%s'>průvodce instalací</a>.", "seconds ago" => "před vteřinami", "1 minute ago" => "před 1 minutou", "%d minutes ago" => "před %d minutami", diff --git a/lib/l10n/es.php b/lib/l10n/es.php index 8bbc8a8f7b4..f3b03b56652 100644 --- a/lib/l10n/es.php +++ b/lib/l10n/es.php @@ -16,6 +16,8 @@ "Files" => "Archivos", "Text" => "Texto", "Images" => "Imágenes", +"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Su servidor web aún no está configurado adecuadamente para permitir sincronización de archivos ya que la interfaz WebDAV parece no estar funcionando.", +"Please double check the <a href='%s'>installation guides</a>." => "Por favor, vuelva a comprobar las <a href='%s'>guías de instalación</a>.", "seconds ago" => "hace segundos", "1 minute ago" => "hace 1 minuto", "%d minutes ago" => "hace %d minutos", diff --git a/lib/l10n/fi_FI.php b/lib/l10n/fi_FI.php index b8d4b137431..fb94dd8404c 100644 --- a/lib/l10n/fi_FI.php +++ b/lib/l10n/fi_FI.php @@ -16,6 +16,7 @@ "Files" => "Tiedostot", "Text" => "Teksti", "Images" => "Kuvat", +"Please double check the <a href='%s'>installation guides</a>." => "Lue tarkasti <a href='%s'>asennusohjeet</a>.", "seconds ago" => "sekuntia sitten", "1 minute ago" => "1 minuutti sitten", "%d minutes ago" => "%d minuuttia sitten", diff --git a/lib/l10n/fr.php b/lib/l10n/fr.php index c6bf8f7f9c3..852fe1ddc4a 100644 --- a/lib/l10n/fr.php +++ b/lib/l10n/fr.php @@ -16,6 +16,8 @@ "Files" => "Fichiers", "Text" => "Texte", "Images" => "Images", +"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Votre serveur web, n'est pas correctement configuré pour permettre la synchronisation des fichiers, car l'interface WebDav ne fonctionne pas comme il faut.", +"Please double check the <a href='%s'>installation guides</a>." => "Veuillez vous référer au <a href='%s'>guide d'installation</a>.", "seconds ago" => "à l'instant", "1 minute ago" => "il y a 1 minute", "%d minutes ago" => "il y a %d minutes", diff --git a/lib/l10n/gl.php b/lib/l10n/gl.php index 532b3443b44..c49e8134af1 100644 --- a/lib/l10n/gl.php +++ b/lib/l10n/gl.php @@ -5,18 +5,20 @@ "Users" => "Usuarios", "Apps" => "Aplicativos", "Admin" => "Administración", -"ZIP download is turned off." => "As descargas ZIP están desactivadas", +"ZIP download is turned off." => "As descargas ZIP están desactivadas.", "Files need to be downloaded one by one." => "Os ficheiros necesitan seren descargados de un en un.", "Back to Files" => "Volver aos ficheiros", "Selected files too large to generate zip file." => "Os ficheiros seleccionados son demasiado grandes como para xerar un ficheiro zip.", -"couldn't be determined" => "non puido ser determinado", +"couldn't be determined" => "non foi posíbel determinalo", "Application is not enabled" => "O aplicativo non está activado", "Authentication error" => "Produciuse un erro na autenticación", "Token expired. Please reload page." => "Testemuña caducada. Recargue a páxina.", "Files" => "Ficheiros", "Text" => "Texto", "Images" => "Imaxes", -"seconds ago" => "hai segundos", +"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "O seu servidor web non está aínda configurado adecuadamente para permitir a sincronización de ficheiros xa que semella que a interface WebDAV non está a funcionar.", +"Please double check the <a href='%s'>installation guides</a>." => "Volva comprobar as <a href='%s'>guías de instalación</a>", +"seconds ago" => "segundos atrás", "1 minute ago" => "hai 1 minuto", "%d minutes ago" => "hai %d minutos", "1 hour ago" => "Vai 1 hora", diff --git a/lib/l10n/it.php b/lib/l10n/it.php index eb404db7fb5..d339bd5b1ca 100644 --- a/lib/l10n/it.php +++ b/lib/l10n/it.php @@ -16,6 +16,8 @@ "Files" => "File", "Text" => "Testo", "Images" => "Immagini", +"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Il tuo server web non è configurato correttamente per consentire la sincronizzazione dei file poiché l'interfaccia WebDAV sembra essere danneggiata.", +"Please double check the <a href='%s'>installation guides</a>." => "Leggi attentamente le <a href='%s'>guide d'installazione</a>.", "seconds ago" => "secondi fa", "1 minute ago" => "1 minuto fa", "%d minutes ago" => "%d minuti fa", diff --git a/lib/l10n/lv.php b/lib/l10n/lv.php index 9f2a0dea749..cc70f760a22 100644 --- a/lib/l10n/lv.php +++ b/lib/l10n/lv.php @@ -16,6 +16,8 @@ "Files" => "Datnes", "Text" => "Teksts", "Images" => "Attēli", +"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Jūsu serveris vēl nav pareizi iestatīts, lai ļautu sinhronizēt datnes, jo izskatās, ka WebDAV saskarne ir salauzta.", +"Please double check the <a href='%s'>installation guides</a>." => "Lūdzu, vēlreiz pārbaudiet <a href='%s'>instalēšanas palīdzību</a>.", "seconds ago" => "sekundes atpakaļ", "1 minute ago" => "pirms 1 minūtes", "%d minutes ago" => "pirms %d minūtēm", diff --git a/lib/l10n/pt_PT.php b/lib/l10n/pt_PT.php index e35bb489c49..67b8078ddfa 100644 --- a/lib/l10n/pt_PT.php +++ b/lib/l10n/pt_PT.php @@ -16,6 +16,8 @@ "Files" => "Ficheiros", "Text" => "Texto", "Images" => "Imagens", +"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "O seu servidor web não está configurado correctamente para autorizar sincronização de ficheiros, pois o interface WebDAV parece estar com problemas.", +"Please double check the <a href='%s'>installation guides</a>." => "Por favor verifique <a href='%s'>installation guides</a>.", "seconds ago" => "há alguns segundos", "1 minute ago" => "há 1 minuto", "%d minutes ago" => "há %d minutos", diff --git a/lib/l10n/ru_RU.php b/lib/l10n/ru_RU.php index 03da09236ea..de770563662 100644 --- a/lib/l10n/ru_RU.php +++ b/lib/l10n/ru_RU.php @@ -16,6 +16,8 @@ "Files" => "Файлы", "Text" => "Текст", "Images" => "Изображения", +"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Ваш веб сервер ещё не достаточно точно настроен для возможности синхронизации, т.к. похоже, что интерфейс WebDAV сломан.", +"Please double check the <a href='%s'>installation guides</a>." => "Пожалуйста проверте дважды <a href='%s'>гиды по установке</a>.", "seconds ago" => "секунд назад", "1 minute ago" => "1 минуту назад", "%d minutes ago" => "%d минут назад", diff --git a/lib/l10n/sk_SK.php b/lib/l10n/sk_SK.php index 81f23ffdc50..16df7f2e199 100644 --- a/lib/l10n/sk_SK.php +++ b/lib/l10n/sk_SK.php @@ -2,13 +2,13 @@ "Help" => "Pomoc", "Personal" => "Osobné", "Settings" => "Nastavenia", -"Users" => "Užívatelia", +"Users" => "Používatelia", "Apps" => "Aplikácie", -"Admin" => "Správca", +"Admin" => "Administrátor", "ZIP download is turned off." => "Sťahovanie súborov ZIP je vypnuté.", "Files need to be downloaded one by one." => "Súbory musia byť nahrávané jeden za druhým.", "Back to Files" => "Späť na súbory", -"Selected files too large to generate zip file." => "Zvolené súbory sú príliž veľké na vygenerovanie zip súboru.", +"Selected files too large to generate zip file." => "Zvolené súbory sú príliš veľké na vygenerovanie zip súboru.", "couldn't be determined" => "nedá sa zistiť", "Application is not enabled" => "Aplikácia nie je zapnutá", "Authentication error" => "Chyba autentifikácie", @@ -16,6 +16,8 @@ "Files" => "Súbory", "Text" => "Text", "Images" => "Obrázky", +"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Váš webový server nie je správne nastavený na synchronizáciu, pretože rozhranie WebDAV je poškodené.", +"Please double check the <a href='%s'>installation guides</a>." => "Prosím skontrolujte <a href='%s'>inštalačnú príručku</a>.", "seconds ago" => "pred sekundami", "1 minute ago" => "pred 1 minútou", "%d minutes ago" => "pred %d minútami", @@ -28,7 +30,7 @@ "%d months ago" => "Pred %d mesiacmi.", "last year" => "minulý rok", "years ago" => "pred rokmi", -"%s is available. Get <a href=\"%s\">more information</a>" => "%s je dostupné. Získať <a href=\"%s\">viac informácií</a>", +"%s is available. Get <a href=\"%s\">more information</a>" => "%s je dostupné. Získať <a href=\"%s\">pre viac informácií</a>", "up to date" => "aktuálny", "updates check is disabled" => "sledovanie aktualizácií je vypnuté", "Could not find category \"%s\"" => "Nemožno nájsť danú kategóriu \"%s\"" diff --git a/lib/l10n/sv.php b/lib/l10n/sv.php index 36f00636b2b..63ca60e89cd 100644 --- a/lib/l10n/sv.php +++ b/lib/l10n/sv.php @@ -16,6 +16,8 @@ "Files" => "Filer", "Text" => "Text", "Images" => "Bilder", +"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Din webbserver är inte korrekt konfigurerad för att tillåta filsynkronisering eftersom WebDAV inte verkar fungera.", +"Please double check the <a href='%s'>installation guides</a>." => "Var god kontrollera <a href='%s'>installationsguiden</a>.", "seconds ago" => "sekunder sedan", "1 minute ago" => "1 minut sedan", "%d minutes ago" => "%d minuter sedan", diff --git a/lib/l10n/vi.php b/lib/l10n/vi.php index 8b7242ae611..ea9660093ae 100644 --- a/lib/l10n/vi.php +++ b/lib/l10n/vi.php @@ -9,6 +9,7 @@ "Files need to be downloaded one by one." => "Tập tin cần phải được tải về từng người một.", "Back to Files" => "Trở lại tập tin", "Selected files too large to generate zip file." => "Tập tin được chọn quá lớn để tạo tập tin ZIP.", +"couldn't be determined" => "không thể phát hiện được", "Application is not enabled" => "Ứng dụng không được BẬT", "Authentication error" => "Lỗi xác thực", "Token expired. Please reload page." => "Mã Token đã hết hạn. Hãy tải lại trang.", diff --git a/lib/l10n/zh_TW.php b/lib/l10n/zh_TW.php index 62ab8fedd52..91b0329e246 100644 --- a/lib/l10n/zh_TW.php +++ b/lib/l10n/zh_TW.php @@ -16,6 +16,8 @@ "Files" => "檔案", "Text" => "文字", "Images" => "圖片", +"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "您的網頁伺服器尚未被正確設定來進行檔案同步,因為您的 WebDAV 界面似乎無法使用。", +"Please double check the <a href='%s'>installation guides</a>." => "請參考<a href='%s'>安裝指南</a>。", "seconds ago" => "幾秒前", "1 minute ago" => "1 分鐘前", "%d minutes ago" => "%d 分鐘前", diff --git a/lib/ocs/cloud.php b/lib/ocs/cloud.php index 179ed8f3107..820d24a8e0c 100644 --- a/lib/ocs/cloud.php +++ b/lib/ocs/cloud.php @@ -45,7 +45,7 @@ class OC_OCS_Cloud { if(OC_User::userExists($parameters['user'])) { // calculate the disc space $userDir = '/'.$parameters['user'].'/files'; - \OC\Files\Filesystem::init($useDir); + \OC\Files\Filesystem::init($parameters['user'], $userDir); $rootInfo = \OC\Files\Filesystem::getFileInfo(''); $sharedInfo = \OC\Files\Filesystem::getFileInfo('/Shared'); $used = $rootInfo['size'] - $sharedInfo['size']; diff --git a/lib/setup.php b/lib/setup.php index f342142c957..cfaf7288663 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -19,18 +19,25 @@ class DatabaseSetupException extends Exception } class OC_Setup { + + public static function getTrans(){ + return OC_L10N::get('lib'); + } + public static function install($options) { + $l = self::getTrans(); + $error = array(); $dbtype = $options['dbtype']; if(empty($options['adminlogin'])) { - $error[] = 'Set an admin username.'; + $error[] = $l->t('Set an admin username.'); } if(empty($options['adminpass'])) { - $error[] = 'Set an admin password.'; + $error[] = $l->t('Set an admin password.'); } if(empty($options['directory'])) { - $error[] = 'Specify a data folder.'; + $error[] = $l->t('Specify a data folder.'); } if($dbtype=='mysql' or $dbtype == 'pgsql' or $dbtype == 'oci') { //mysql and postgresql needs more config options @@ -43,16 +50,16 @@ class OC_Setup { if(empty($options['dbuser'])) { - $error[] = "$dbprettyname enter the database username."; + $error[] = $l->t("%s enter the database username.", array($dbprettyname)); } if(empty($options['dbname'])) { - $error[] = "$dbprettyname enter the database name."; + $error[] = $l->t("%s enter the database name.", array($dbprettyname)); } if(substr_count($options['dbname'], '.') >= 1) { - $error[] = "$dbprettyname you may not use dots in the database name"; + $error[] = $l->t("%s you may not use dots in the database name", array($dbprettyname)); } if($dbtype != 'oci' && empty($options['dbhost'])) { - $error[] = "$dbprettyname set the database host."; + $error[] = $l->t("%s set the database host.", array($dbprettyname)); } } @@ -116,8 +123,8 @@ class OC_Setup { self::setupPostgreSQLDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix, $username); } catch (Exception $e) { $error[] = array( - 'error' => 'PostgreSQL username and/or password not valid', - 'hint' => 'You need to enter either an existing account or the administrator.' + 'error' => $l->t('PostgreSQL username and/or password not valid'), + 'hint' => $l->t('You need to enter either an existing account or the administrator.') ); return $error; } @@ -139,8 +146,8 @@ class OC_Setup { self::setupOCIDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix, $dbtablespace, $username); } catch (Exception $e) { $error[] = array( - 'error' => 'Oracle username and/or password not valid', - 'hint' => 'You need to enter either an existing account or the administrator.' + 'error' => $l->t('Oracle username and/or password not valid'), + 'hint' => $l->t('You need to enter either an existing account or the administrator.') ); return $error; } @@ -190,9 +197,11 @@ class OC_Setup { private static function setupMySQLDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix, $username) { //check if the database user has admin right + $l = self::getTrans(); $connection = @mysql_connect($dbhost, $dbuser, $dbpass); if(!$connection) { - throw new DatabaseSetupException('MySQL username and/or password not valid','You need to enter either an existing account or the administrator.'); + throw new DatabaseSetupException($l->t('MySQL username and/or password not valid'), + $l->t('You need to enter either an existing account or the administrator.')); } $oldUser=OC_Config::getValue('dbuser', false); @@ -239,11 +248,12 @@ class OC_Setup { private static function createMySQLDatabase($name, $user, $connection) { //we cant use OC_BD functions here because we need to connect as the administrative user. + $l = self::getTrans(); $query = "CREATE DATABASE IF NOT EXISTS `$name`"; $result = mysql_query($query, $connection); if(!$result) { - $entry='DB Error: "'.mysql_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; + $entry = $l->t('DB Error: "%s"', array(mysql_error($connection))) . '<br />'; + $entry .= $l->t('Offending command was: "%s"', array($query)) . '<br />'; echo($entry); } $query="GRANT ALL PRIVILEGES ON `$name` . * TO '$user'"; @@ -253,15 +263,18 @@ class OC_Setup { private static function createDBUser($name, $password, $connection) { // we need to create 2 accounts, one for global use and one for local user. if we don't specify the local one, // the anonymous user would take precedence when there is one. + $l = self::getTrans(); $query = "CREATE USER '$name'@'localhost' IDENTIFIED BY '$password'"; $result = mysql_query($query, $connection); if (!$result) { - throw new DatabaseSetupException("MySQL user '" . "$name" . "'@'localhost' already exists","Delete this user from MySQL."); + throw new DatabaseSetupException($l->t("MySQL user '%s'@'localhost' exists already.", + array($name)), $l->t("Drop this user from MySQL", array($name))); } $query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'"; $result = mysql_query($query, $connection); if (!$result) { - throw new DatabaseSetupException("MySQL user '" . "$name" . "'@'%' already exists","Delete this user from MySQL."); + throw new DatabaseSetupException($l->t("MySQL user '%s'@'%%' already exists", array($name)), + $l->t("Drop this user from MySQL.")); } } @@ -269,12 +282,13 @@ class OC_Setup { $e_host = addslashes($dbhost); $e_user = addslashes($dbuser); $e_password = addslashes($dbpass); + $l = self::getTrans(); //check if the database user has admin rights $connection_string = "host='$e_host' dbname=postgres user='$e_user' password='$e_password'"; $connection = @pg_connect($connection_string); if(!$connection) { - throw new Exception('PostgreSQL username and/or password not valid'); + throw new Exception($l->t('PostgreSQL username and/or password not valid')); } $e_user = pg_escape_string($dbuser); //check for roles creation rights in postgresql @@ -319,7 +333,7 @@ class OC_Setup { $connection_string = "host='$e_host' dbname='$e_dbname' user='$e_user' password='$e_password'"; $connection = @pg_connect($connection_string); if(!$connection) { - throw new Exception('PostgreSQL username and/or password not valid'); + throw new Exception($l->t('PostgreSQL username and/or password not valid')); } $query = "select count(*) FROM pg_class WHERE relname='{$dbtableprefix}users' limit 1"; $result = pg_query($connection, $query); @@ -332,14 +346,16 @@ class OC_Setup { } private static function pg_createDatabase($name, $user, $connection) { + //we cant use OC_BD functions here because we need to connect as the administrative user. + $l = self::getTrans(); $e_name = pg_escape_string($name); $e_user = pg_escape_string($user); $query = "select datname from pg_database where datname = '$e_name'"; $result = pg_query($connection, $query); if(!$result) { - $entry='DB Error: "'.pg_last_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; + $entry = $l->t('DB Error: "%s"', array(pg_last_error($connection))) . '<br />'; + $entry .= $l->t('Offending command was: "%s"', array($query)) . '<br />'; echo($entry); } if(! pg_fetch_row($result)) { @@ -347,8 +363,8 @@ class OC_Setup { $query = "CREATE DATABASE \"$e_name\" OWNER \"$e_user\""; $result = pg_query($connection, $query); if(!$result) { - $entry='DB Error: "'.pg_last_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; + $entry = $l->t('DB Error: "%s"', array(pg_last_error($connection))) . '<br />'; + $entry .= $l->t('Offending command was: "%s"', array($query)) . '<br />'; echo($entry); } else { @@ -359,13 +375,14 @@ class OC_Setup { } private static function pg_createDBUser($name, $password, $connection) { + $l = self::getTrans(); $e_name = pg_escape_string($name); $e_password = pg_escape_string($password); $query = "select * from pg_roles where rolname='$e_name';"; $result = pg_query($connection, $query); if(!$result) { - $entry='DB Error: "'.pg_last_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; + $entry = $l->t('DB Error: "%s"', array(pg_last_error($connection))) . '<br />'; + $entry .= $l->t('Offending command was: "%s"', array($query)) . '<br />'; echo($entry); } @@ -374,8 +391,8 @@ class OC_Setup { $query = "CREATE USER \"$e_name\" CREATEDB PASSWORD '$e_password';"; $result = pg_query($connection, $query); if(!$result) { - $entry='DB Error: "'.pg_last_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; + $entry = $l->t('DB Error: "%s"', array(pg_last_error($connection))) . '<br />'; + $entry .= $l->t('Offending command was: "%s"', array($query)) . '<br />'; echo($entry); } } @@ -383,14 +400,15 @@ class OC_Setup { $query = "ALTER ROLE \"$e_name\" WITH PASSWORD '$e_password';"; $result = pg_query($connection, $query); if(!$result) { - $entry='DB Error: "'.pg_last_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; + $entry = $l->t('DB Error: "%s"', array(pg_last_error($connection))) . '<br />'; + $entry .= $l->t('Offending command was: "%s"', array($query)) . '<br />'; echo($entry); } } } private static function setupOCIDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix, $dbtablespace, $username) { + $l = self::getTrans(); $e_host = addslashes($dbhost); $e_dbname = addslashes($dbname); //check if the database user has admin right @@ -402,15 +420,15 @@ class OC_Setup { $connection = @oci_connect($dbuser, $dbpass, $easy_connect_string); if(!$connection) { $e = oci_error(); - throw new Exception('Oracle username and/or password not valid'); + throw new Exception($l->t('Oracle username and/or password not valid')); } //check for roles creation rights in oracle $query="SELECT count(*) FROM user_role_privs, role_sys_privs WHERE user_role_privs.granted_role = role_sys_privs.role AND privilege = 'CREATE ROLE'"; $stmt = oci_parse($connection, $query); if (!$stmt) { - $entry='DB Error: "'.oci_last_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; + $entry = $l->t('DB Error: "%s"', array(oci_last_error($connection))) . '<br />'; + $entry .= $l->t('Offending command was: "%s"', array($query)) . '<br />'; echo($entry); } $result = oci_execute($stmt); @@ -468,15 +486,15 @@ class OC_Setup { } $connection = @oci_connect($dbuser, $dbpass, $easy_connect_string); if(!$connection) { - throw new Exception('Oracle username and/or password not valid'); + throw new Exception($l->t('Oracle username and/or password not valid')); } $query = "SELECT count(*) FROM user_tables WHERE table_name = :un"; $stmt = oci_parse($connection, $query); $un = $dbtableprefix.'users'; oci_bind_by_name($stmt, ':un', $un); if (!$stmt) { - $entry='DB Error: "'.oci_last_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; + $entry = $l->t('DB Error: "%s"', array(oci_last_error($connection))) . '<br />'; + $entry .= $l->t('Offending command was: "%s"', array($query)) . '<br />'; echo($entry); } $result = oci_execute($stmt); @@ -497,19 +515,19 @@ class OC_Setup { * @param resource $connection */ private static function oci_createDBUser($name, $password, $tablespace, $connection) { - + $l = self::getTrans(); $query = "SELECT * FROM all_users WHERE USERNAME = :un"; $stmt = oci_parse($connection, $query); if (!$stmt) { - $entry='DB Error: "'.oci_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; + $entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; + $entry .= $l->t('Offending command was: "%s"', array($query)) . '<br />'; echo($entry); } oci_bind_by_name($stmt, ':un', $name); $result = oci_execute($stmt); if(!$result) { - $entry='DB Error: "'.oci_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; + $entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; + $entry .= $l->t('Offending command was: "%s"', array($query)) . '<br />'; echo($entry); } @@ -519,31 +537,32 @@ class OC_Setup { $query = 'CREATE USER '.$name.' IDENTIFIED BY "'.$password.'" DEFAULT TABLESPACE '.$tablespace; //TODO set default tablespace $stmt = oci_parse($connection, $query); if (!$stmt) { - $entry='DB Error: "'.oci_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; + $entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; + $entry .= $l->t('Offending command was: "%s"', array($query)) . '<br />'; echo($entry); } //oci_bind_by_name($stmt, ':un', $name); $result = oci_execute($stmt); if(!$result) { - $entry='DB Error: "'.oci_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.', name:'.$name.', password:'.$password.'<br />'; + $entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; + $entry .= $l->t('Offending command was: "%s", name: %s, password: %s', + array($query, $name, $password)) . '<br />'; echo($entry); } } else { // change password of the existing role $query = "ALTER USER :un IDENTIFIED BY :pw"; $stmt = oci_parse($connection, $query); if (!$stmt) { - $entry='DB Error: "'.oci_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; + $entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; + $entry .= $l->t('Offending command was: "%s"', array($query)) . '<br />'; echo($entry); } oci_bind_by_name($stmt, ':un', $name); oci_bind_by_name($stmt, ':pw', $password); $result = oci_execute($stmt); if(!$result) { - $entry='DB Error: "'.oci_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; + $entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; + $entry .= $l->t('Offending command was: "%s"', array($query)) . '<br />'; echo($entry); } } @@ -551,14 +570,15 @@ class OC_Setup { $query = 'GRANT CREATE SESSION, CREATE TABLE, CREATE SEQUENCE, CREATE TRIGGER, UNLIMITED TABLESPACE TO '.$name; $stmt = oci_parse($connection, $query); if (!$stmt) { - $entry='DB Error: "'.oci_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; + $entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; + $entry .= $l->t('Offending command was: "%s"', array($query)) . '<br />'; echo($entry); } $result = oci_execute($stmt); if(!$result) { - $entry='DB Error: "'.oci_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.', name:'.$name.', password:'.$password.'<br />'; + $entry = $l->t('DB Error: "%s"', array(oci_error($connection))) . '<br />'; + $entry .= $l->t('Offending command was: "%s", name: %s, password: %s', + array($query, $name, $password)) . '<br />'; echo($entry); } } @@ -616,10 +636,10 @@ class OC_Setup { */ public static function postSetupCheck($params) { // setup was successful -> webdav testing now + $l = self::getTrans(); if (OC_Util::isWebDAVWorking()) { header("Location: ".OC::$WEBROOT.'/'); } else { - $l=OC_L10N::get('lib'); $error = $l->t('Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken.'); $hint = $l->t('Please double check the <a href=\'%s\'>installation guides</a>.', 'http://doc.owncloud.org/server/5.0/admin_manual/installation.html'); diff --git a/lib/user.php b/lib/user.php index 76c4c45ee30..0ab224bb15f 100644 --- a/lib/user.php +++ b/lib/user.php @@ -445,10 +445,12 @@ class OC_User { * Check whether a specified user can change his display name */ public static function canUserChangeDisplayName($uid) { - foreach(self::$_usedBackends as $backend) { - if($backend->implementsActions(OC_USER_BACKEND_SET_DISPLAYNAME)) { - if($backend->userExists($uid)) { - return true; + if (OC_Config::getValue('allow_user_to_change_display_name', true)) { + foreach(self::$_usedBackends as $backend) { + if($backend->implementsActions(OC_USER_BACKEND_SET_DISPLAYNAME)) { + if($backend->userExists($uid)) { + return true; + } } } } @@ -485,7 +487,7 @@ class OC_User { */ public static function getHome($uid) { foreach(self::$_usedBackends as $backend) { - if($backend->implementsActions(OC_USER_BACKEND_GET_HOME)) { + if($backend->implementsActions(OC_USER_BACKEND_GET_HOME) && $backend->userExists($uid)) { $result=$backend->getHome($uid); if($result) { return $result; diff --git a/lib/util.php b/lib/util.php index a5fe4cb175a..81ad2df3ac6 100755 --- a/lib/util.php +++ b/lib/util.php @@ -51,7 +51,7 @@ class OC_Util { mkdir( $userdirectory, 0755, true ); } //jail the user into his "home" directory - \OC\Files\Filesystem::init($user_dir); + \OC\Files\Filesystem::init($user, $user_dir); $quotaProxy=new OC_FileProxy_Quota(); $fileOperationProxy = new OC_FileProxy_FileOperations(); @@ -74,7 +74,7 @@ class OC_Util { */ public static function getVersion() { // hint: We only can count up. So the internal version number of ownCloud 4.5 will be 4.90.0. This is not visible to the user - return array(4, 91, 9); + return array(4, 91, 10); } /** |