summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2013-02-10 19:10:06 -0500
committerMichael Gapczynski <mtgap@owncloud.com>2013-02-10 19:10:06 -0500
commiteeb409a6ec0f5f682ed4893320d70a3a5e3a1483 (patch)
tree1aebaf98634e98eaed238206e336e9f56db3e193 /lib
parent8e3b8c7f47ab12e1612d3fa025e6b9eb7f5ffdb3 (diff)
parent04146f2059e2d038177db544ea9f37a124f0781e (diff)
downloadnextcloud-server-eeb409a6ec0f5f682ed4893320d70a3a5e3a1483.tar.gz
nextcloud-server-eeb409a6ec0f5f682ed4893320d70a3a5e3a1483.zip
Merge branch 'master' into fix-shared-links
Diffstat (limited to 'lib')
-rw-r--r--lib/app.php6
-rw-r--r--lib/connector/sabre/directory.php2
-rw-r--r--lib/connector/sabre/file.php8
-rw-r--r--lib/files/cache/scanner.php18
-rw-r--r--lib/files/mapper.php12
-rw-r--r--lib/files/storage/common.php23
-rw-r--r--lib/helper.php5
-rw-r--r--lib/l10n/bg_BG.php1
-rw-r--r--lib/l10n/ca.php2
-rw-r--r--lib/l10n/cs_CZ.php2
-rw-r--r--lib/l10n/es.php2
-rw-r--r--lib/l10n/fi_FI.php1
-rw-r--r--lib/l10n/fr.php2
-rw-r--r--lib/l10n/it.php2
-rw-r--r--lib/l10n/lv.php2
-rw-r--r--lib/l10n/pt_PT.php2
-rw-r--r--lib/l10n/vi.php1
-rw-r--r--lib/l10n/zh_TW.php2
-rw-r--r--lib/user.php10
-rwxr-xr-xlib/util.php2
20 files changed, 86 insertions, 19 deletions
diff --git a/lib/app.php b/lib/app.php
index ca256ed1aaa..901a8171ef3 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -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/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/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/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/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/user.php b/lib/user.php
index 9dc8cca97a6..37b46118889 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;
+ }
}
}
}
diff --git a/lib/util.php b/lib/util.php
index 54a3f634041..81ad2df3ac6 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -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);
}
/**