summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-09-30 10:06:36 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2013-09-30 10:06:36 +0200
commitfe352664a2694c8ecb60ad835461829ae285cde7 (patch)
treef2461e5f3d977f13c93735ddc39dc466b7257323 /lib
parent39599019e5c3e47c5d03a1b63b438cacdab5b37e (diff)
parent5899485ca17045e93528c29d1ed63b02192c4191 (diff)
downloadnextcloud-server-fe352664a2694c8ecb60ad835461829ae285cde7.tar.gz
nextcloud-server-fe352664a2694c8ecb60ad835461829ae285cde7.zip
Merge branch 'master' into fixing-4546-master
Conflicts: lib/connector/sabre/directory.php
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php1
-rw-r--r--lib/connector/sabre/directory.php8
-rw-r--r--lib/connector/sabre/file.php9
-rw-r--r--lib/connector/sabre/node.php11
-rw-r--r--lib/connector/sabre/objecttree.php44
-rw-r--r--lib/db.php10
-rw-r--r--lib/db/oracleconnection.php50
-rw-r--r--lib/files/cache/cache.php4
-rw-r--r--lib/files/cache/scanner.php52
-rw-r--r--lib/files/view.php14
-rw-r--r--lib/l10n/ca.php3
-rw-r--r--lib/l10n/cs_CZ.php3
-rw-r--r--lib/l10n/da.php3
-rw-r--r--lib/l10n/de.php3
-rw-r--r--lib/l10n/de_DE.php3
-rw-r--r--lib/l10n/en_GB.php11
-rw-r--r--lib/l10n/et_EE.php3
-rw-r--r--lib/l10n/fi_FI.php7
-rw-r--r--lib/l10n/fr.php3
-rw-r--r--lib/l10n/gl.php3
-rw-r--r--lib/l10n/it.php3
-rw-r--r--lib/l10n/ja_JP.php3
-rw-r--r--lib/l10n/lt_LT.php3
-rw-r--r--lib/l10n/nl.php16
-rw-r--r--lib/l10n/nn_NO.php2
-rw-r--r--lib/l10n/pa.php16
-rw-r--r--lib/l10n/pt_BR.php3
-rw-r--r--lib/l10n/pt_PT.php2
-rw-r--r--lib/l10n/ro.php8
-rw-r--r--lib/l10n/ru.php17
-rw-r--r--lib/l10n/sr@latin.php8
-rw-r--r--lib/legacy/preferences.php146
-rw-r--r--lib/preferences.php153
-rw-r--r--lib/preview/txt.php10
-rw-r--r--lib/public/share.php41
-rw-r--r--lib/public/user.php2
-rw-r--r--lib/search/provider/file.php3
-rw-r--r--lib/search/result.php4
-rw-r--r--lib/user.php17
-rw-r--r--lib/user/http.php6
-rw-r--r--lib/user/manager.php19
-rw-r--r--lib/user/session.php19
-rw-r--r--lib/user/user.php18
-rwxr-xr-xlib/util.php9
44 files changed, 606 insertions, 167 deletions
diff --git a/lib/base.php b/lib/base.php
index d3d570e3f37..395d8486a5e 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -366,6 +366,7 @@ class OC {
self::$loader->registerPrefix('Doctrine\\Common', 'doctrine/common/lib');
self::$loader->registerPrefix('Doctrine\\DBAL', 'doctrine/dbal/lib');
self::$loader->registerPrefix('Symfony\\Component\\Routing', 'symfony/routing');
+ self::$loader->registerPrefix('Symfony\\Component\\Console', 'symfony/console');
self::$loader->registerPrefix('Sabre\\VObject', '3rdparty');
self::$loader->registerPrefix('Sabre_', '3rdparty');
self::$loader->registerPrefix('Patchwork', '3rdparty');
diff --git a/lib/connector/sabre/directory.php b/lib/connector/sabre/directory.php
index 8a092c2455a..ddeef271a5b 100644
--- a/lib/connector/sabre/directory.php
+++ b/lib/connector/sabre/directory.php
@@ -78,7 +78,13 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
}
// rename to correct path
- \OC\Files\Filesystem::rename($partpath, $newPath);
+ $renameOkay = \OC\Files\Filesystem::rename($partpath, $newPath);
+ $fileExists = \OC\Files\Filesystem::file_exists($newPath);
+ if ($renameOkay === false || $fileExists === false) {
+ \OC_Log::write('webdav', '\OC\Files\Filesystem::rename() failed', \OC_Log::ERROR);
+ \OC\Files\Filesystem::unlink($partpath);
+ throw new Sabre_DAV_Exception();
+ }
// allow sync clients to send the mtime along in a header
$mtime = OC_Request::hasModificationTime();
diff --git a/lib/connector/sabre/file.php b/lib/connector/sabre/file.php
index 61bdcd5e0ae..433b1148552 100644
--- a/lib/connector/sabre/file.php
+++ b/lib/connector/sabre/file.php
@@ -74,7 +74,14 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
}
// rename to correct path
- \OC\Files\Filesystem::rename($partpath, $this->path);
+ $renameOkay = \OC\Files\Filesystem::rename($partpath, $this->path);
+ $fileExists = \OC\Files\Filesystem::file_exists($this->path);
+ if ($renameOkay === false || $fileExists === false) {
+ \OC_Log::write('webdav', '\OC\Files\Filesystem::rename() failed', \OC_Log::ERROR);
+ \OC\Files\Filesystem::unlink($partpath);
+ throw new Sabre_DAV_Exception();
+ }
+
//allow sync clients to send the mtime along in a header
$mtime = OC_Request::hasModificationTime();
diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php
index 0bffa58af78..29b7f9e53a5 100644
--- a/lib/connector/sabre/node.php
+++ b/lib/connector/sabre/node.php
@@ -78,6 +78,11 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
*/
public function setName($name) {
+ // rename is only allowed if the update privilege is granted
+ if (!\OC\Files\Filesystem::isUpdatable($this->path)) {
+ throw new \Sabre_DAV_Exception_Forbidden();
+ }
+
list($parentPath, ) = Sabre_DAV_URLUtil::splitPath($this->path);
list(, $newName) = Sabre_DAV_URLUtil::splitPath($name);
@@ -135,6 +140,12 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
* Even if the modification time is set to a custom value the access time is set to now.
*/
public function touch($mtime) {
+
+ // touch is only allowed if the update privilege is granted
+ if (!\OC\Files\Filesystem::isUpdatable($this->path)) {
+ throw new \Sabre_DAV_Exception_Forbidden();
+ }
+
\OC\Files\Filesystem::touch($this->path, $mtime);
}
diff --git a/lib/connector/sabre/objecttree.php b/lib/connector/sabre/objecttree.php
index acff45ed5e2..80c3840b99d 100644
--- a/lib/connector/sabre/objecttree.php
+++ b/lib/connector/sabre/objecttree.php
@@ -11,6 +11,14 @@ namespace OC\Connector\Sabre;
use OC\Files\Filesystem;
class ObjectTree extends \Sabre_DAV_ObjectTree {
+
+ /**
+ * keep this public to allow mock injection during unit test
+ *
+ * @var \OC\Files\View
+ */
+ public $fileView;
+
/**
* Returns the INode object for the requested path
*
@@ -21,14 +29,16 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
public function getNodeForPath($path) {
$path = trim($path, '/');
- if (isset($this->cache[$path])) return $this->cache[$path];
+ if (isset($this->cache[$path])) {
+ return $this->cache[$path];
+ }
// Is it the root node?
if (!strlen($path)) {
return $this->rootNode;
}
- $info = Filesystem::getFileInfo($path);
+ $info = $this->getFileView()->getFileInfo($path);
if (!$info) {
throw new \Sabre_DAV_Exception_NotFound('File with name ' . $path . ' could not be located');
@@ -64,7 +74,25 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
list($sourceDir,) = \Sabre_DAV_URLUtil::splitPath($sourcePath);
list($destinationDir,) = \Sabre_DAV_URLUtil::splitPath($destinationPath);
- Filesystem::rename($sourcePath, $destinationPath);
+ // check update privileges
+ $fs = $this->getFileView();
+ if (!$fs->isUpdatable($sourcePath)) {
+ throw new \Sabre_DAV_Exception_Forbidden();
+ }
+ if ($sourceDir !== $destinationDir) {
+ // for a full move we need update privileges on sourcePath and sourceDir as well as destinationDir
+ if (!$fs->isUpdatable($sourceDir)) {
+ throw new \Sabre_DAV_Exception_Forbidden();
+ }
+ if (!$fs->isUpdatable($destinationDir)) {
+ throw new \Sabre_DAV_Exception_Forbidden();
+ }
+ }
+
+ $renameOkay = $fs->rename($sourcePath, $destinationPath);
+ if (!$renameOkay) {
+ throw new \Sabre_DAV_Exception_Forbidden('');
+ }
$this->markDirty($sourceDir);
$this->markDirty($destinationDir);
@@ -101,4 +129,14 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
list($destinationDir,) = \Sabre_DAV_URLUtil::splitPath($destination);
$this->markDirty($destinationDir);
}
+
+ /**
+ * @return \OC\Files\View
+ */
+ public function getFileView() {
+ if (is_null($this->fileView)) {
+ $this->fileView = \OC\Files\Filesystem::getView();
+ }
+ return $this->fileView;
+ }
}
diff --git a/lib/db.php b/lib/db.php
index f090f474243..1e5d12649df 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -75,6 +75,7 @@ class OC_DB {
// do nothing if the connection already has been established
if (!self::$connection) {
$config = new \Doctrine\DBAL\Configuration();
+ $eventManager = new \Doctrine\Common\EventManager();
switch($type) {
case 'sqlite':
case 'sqlite3':
@@ -86,6 +87,7 @@ class OC_DB {
'driver' => 'pdo_sqlite',
);
$connectionParams['adapter'] = '\OC\DB\AdapterSqlite';
+ $connectionParams['wrapperClass'] = 'OC\DB\Connection';
break;
case 'mysql':
$connectionParams = array(
@@ -98,6 +100,7 @@ class OC_DB {
'driver' => 'pdo_mysql',
);
$connectionParams['adapter'] = '\OC\DB\Adapter';
+ $connectionParams['wrapperClass'] = 'OC\DB\Connection';
break;
case 'pgsql':
$connectionParams = array(
@@ -109,6 +112,7 @@ class OC_DB {
'driver' => 'pdo_pgsql',
);
$connectionParams['adapter'] = '\OC\DB\AdapterPgSql';
+ $connectionParams['wrapperClass'] = 'OC\DB\Connection';
break;
case 'oci':
$connectionParams = array(
@@ -123,6 +127,8 @@ class OC_DB {
$connectionParams['port'] = $port;
}
$connectionParams['adapter'] = '\OC\DB\AdapterOCI8';
+ $connectionParams['wrapperClass'] = 'OC\DB\OracleConnection';
+ $eventManager->addEventSubscriber(new \Doctrine\DBAL\Event\Listeners\OracleSessionInit);
break;
case 'mssql':
$connectionParams = array(
@@ -135,14 +141,14 @@ class OC_DB {
'driver' => 'pdo_sqlsrv',
);
$connectionParams['adapter'] = '\OC\DB\AdapterSQLSrv';
+ $connectionParams['wrapperClass'] = 'OC\DB\Connection';
break;
default:
return false;
}
- $connectionParams['wrapperClass'] = 'OC\DB\Connection';
$connectionParams['tablePrefix'] = OC_Config::getValue('dbtableprefix', 'oc_' );
try {
- self::$connection = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
+ self::$connection = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config, $eventManager);
if ($type === 'sqlite' || $type === 'sqlite3') {
// Sqlite doesn't handle query caching and schema changes
// TODO: find a better way to handle this
diff --git a/lib/db/oracleconnection.php b/lib/db/oracleconnection.php
new file mode 100644
index 00000000000..e2fc4644f47
--- /dev/null
+++ b/lib/db/oracleconnection.php
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\DB;
+
+class OracleConnection extends Connection {
+ /**
+ * Quote the keys of the array
+ */
+ private function quoteKeys(array $data) {
+ $return = array();
+ foreach($data as $key => $value) {
+ $return[$this->quoteIdentifier($key)] = $value;
+ }
+ return $return;
+ }
+
+ /*
+ * {@inheritDoc}
+ */
+ public function insert($tableName, array $data, array $types = array()) {
+ $tableName = $this->quoteIdentifier($tableName);
+ $data = $this->quoteKeys($data);
+ return parent::insert($tableName, $data, $types);
+ }
+
+ /*
+ * {@inheritDoc}
+ */
+ public function update($tableName, array $data, array $identifier, array $types = array()) {
+ $tableName = $this->quoteIdentifier($tableName);
+ $data = $this->quoteKeys($data);
+ $identifier = $this->quoteKeys($identifier);
+ return parent::update($tableName, $data, $identifier, $types);
+ }
+
+ /*
+ * {@inheritDoc}
+ */
+ public function delete($tableName, array $identifier) {
+ $tableName = $this->quoteIdentifier($tableName);
+ $identifier = $this->quoteKeys($identifier);
+ return parent::delete($tableName, $identifier);
+ }
+}
diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php
index 39e36684b7b..e69733727af 100644
--- a/lib/files/cache/cache.php
+++ b/lib/files/cache/cache.php
@@ -201,7 +201,6 @@ class Cache {
$data['path'] = $file;
$data['parent'] = $this->getParentId($file);
$data['name'] = \OC_Util::basename($file);
- $data['encrypted'] = isset($data['encrypted']) ? ((int)$data['encrypted']) : 0;
list($queryParts, $params) = $this->buildParts($data);
$queryParts[] = '`storage`';
@@ -265,6 +264,9 @@ class Cache {
$params[] = $value;
$queryParts[] = '`mtime`';
}
+ } elseif ($name === 'encrypted') {
+ // Boolean to integer conversion
+ $value = $value ? 1 : 0;
}
$params[] = $value;
$queryParts[] = '`' . $name . '`';
diff --git a/lib/files/cache/scanner.php b/lib/files/cache/scanner.php
index 9d180820e9d..96f84609cf2 100644
--- a/lib/files/cache/scanner.php
+++ b/lib/files/cache/scanner.php
@@ -36,6 +36,11 @@ class Scanner extends BasicEmitter {
*/
private $cache;
+ /**
+ * @var \OC\Files\Cache\Permissions $permissionsCache
+ */
+ private $permissionsCache;
+
const SCAN_RECURSIVE = true;
const SCAN_SHALLOW = false;
@@ -46,6 +51,7 @@ class Scanner extends BasicEmitter {
$this->storage = $storage;
$this->storageId = $this->storage->getId();
$this->cache = $storage->getCache();
+ $this->permissionsCache = $storage->getPermissionsCache();
}
/**
@@ -96,22 +102,48 @@ class Scanner extends BasicEmitter {
}
}
$newData = $data;
- if ($reuseExisting and $cacheData = $this->cache->get($file)) {
- // only reuse data if the file hasn't explicitly changed
- if (isset($data['mtime']) && isset($cacheData['mtime']) && $data['mtime'] === $cacheData['mtime']) {
- if (($reuseExisting & self::REUSE_SIZE) && ($data['size'] === -1)) {
- $data['size'] = $cacheData['size'];
+ $cacheData = $this->cache->get($file);
+ if ($cacheData) {
+ $this->permissionsCache->remove($cacheData['fileid']);
+ if ($reuseExisting) {
+ // prevent empty etag
+ $etag = $cacheData['etag'];
+ $propagateETagChange = false;
+ if (empty($etag)) {
+ $etag = $data['etag'];
+ $propagateETagChange = true;
}
- if ($reuseExisting & self::REUSE_ETAG) {
- $data['etag'] = $cacheData['etag'];
+ // only reuse data if the file hasn't explicitly changed
+ if (isset($data['mtime']) && isset($cacheData['mtime']) && $data['mtime'] === $cacheData['mtime']) {
+ if (($reuseExisting & self::REUSE_SIZE) && ($data['size'] === -1)) {
+ $data['size'] = $cacheData['size'];
+ }
+ if ($reuseExisting & self::REUSE_ETAG) {
+ $data['etag'] = $etag;
+ if ($propagateETagChange) {
+ $parent = $file;
+ while ($parent !== '') {
+ $parent = dirname($parent);
+ if ($parent === '.') {
+ $parent = '';
+ }
+ $parentCacheData = $this->cache->get($parent);
+ $this->cache->update($parentCacheData['fileid'], array(
+ 'etag' => $this->storage->getETag($parent),
+ ));
+ }
+ }
+ }
}
+ // Only update metadata that has changed
+ $newData = array_diff($data, $cacheData);
}
- // Only update metadata that has changed
- $newData = array_diff($data, $cacheData);
}
if (!empty($newData)) {
$this->cache->put($file, $newData);
}
+ } else {
+ $this->cache->remove($file);
}
return $data;
}
@@ -159,7 +191,7 @@ class Scanner extends BasicEmitter {
$newChildren = array();
if ($this->storage->is_dir($path) && ($dh = $this->storage->opendir($path))) {
\OC_DB::beginTransaction();
- if(is_resource($dh)) {
+ if (is_resource($dh)) {
while (($file = readdir($dh)) !== false) {
$child = ($path) ? $path . '/' . $file : $file;
if (!Filesystem::isIgnoredDir($file)) {
diff --git a/lib/files/view.php b/lib/files/view.php
index 968b755a661..aa08a5f7cc9 100644
--- a/lib/files/view.php
+++ b/lib/files/view.php
@@ -500,7 +500,7 @@ class View {
} else {
if ($this->is_dir($path1) && ($dh = $this->opendir($path1))) {
$result = $this->mkdir($path2);
- if(is_resource($dh)) {
+ if (is_resource($dh)) {
while (($file = readdir($dh)) !== false) {
if (!Filesystem::isIgnoredDir($file)) {
$result = $this->copy($path1 . '/' . $file, $path2 . '/' . $file);
@@ -975,7 +975,7 @@ class View {
/**
* search for files by mimetype
*
- * @param string $query
+ * @param string $mimetype
* @return array
*/
public function searchByMime($mimetype) {
@@ -998,7 +998,7 @@ class View {
$results = $cache->$method($query);
foreach ($results as $result) {
- if (substr($mountPoint . $result['path'], 0, $rootLength) === $this->fakeRoot) {
+ if (substr($mountPoint . $result['path'], 0, $rootLength + 1) === $this->fakeRoot . '/') {
$result['path'] = substr($mountPoint . $result['path'], $rootLength);
$files[] = $result;
}
@@ -1012,9 +1012,11 @@ class View {
$relativeMountPoint = substr($mountPoint, $rootLength);
$results = $cache->$method($query);
- foreach ($results as $result) {
- $result['path'] = $relativeMountPoint . $result['path'];
- $files[] = $result;
+ if ($results) {
+ foreach ($results as $result) {
+ $result['path'] = $relativeMountPoint . $result['path'];
+ $files[] = $result;
+ }
}
}
}
diff --git a/lib/l10n/ca.php b/lib/l10n/ca.php
index 166455e652c..a8769224705 100644
--- a/lib/l10n/ca.php
+++ b/lib/l10n/ca.php
@@ -8,6 +8,9 @@ $TRANSLATIONS = array(
"Users" => "Usuaris",
"Admin" => "Administració",
"Failed to upgrade \"%s\"." => "Ha fallat l'actualització \"%s\".",
+"Custom profile pictures don't work with encryption yet" => "Les imatges de perfil personals encara no funcionen amb encriptació",
+"Unknown filetype" => "Tipus de fitxer desconegut",
+"Invalid image" => "Imatge no vàlida",
"web services under your control" => "controleu els vostres serveis web",
"cannot open \"%s\"" => "no es pot obrir \"%s\"",
"ZIP download is turned off." => "La baixada en ZIP està desactivada.",
diff --git a/lib/l10n/cs_CZ.php b/lib/l10n/cs_CZ.php
index fed9ad03c01..ed31ae79529 100644
--- a/lib/l10n/cs_CZ.php
+++ b/lib/l10n/cs_CZ.php
@@ -8,6 +8,9 @@ $TRANSLATIONS = array(
"Users" => "Uživatelé",
"Admin" => "Administrace",
"Failed to upgrade \"%s\"." => "Selhala aktualizace verze \"%s\".",
+"Custom profile pictures don't work with encryption yet" => "Vlastní profilové obrázky zatím nefungují v kombinaci se šifrováním",
+"Unknown filetype" => "Neznámý typ souboru",
+"Invalid image" => "Chybný obrázek",
"web services under your control" => "webové služby pod Vaší kontrolou",
"cannot open \"%s\"" => "nelze otevřít \"%s\"",
"ZIP download is turned off." => "Stahování v ZIPu je vypnuto.",
diff --git a/lib/l10n/da.php b/lib/l10n/da.php
index 26903142763..05a43f42ed9 100644
--- a/lib/l10n/da.php
+++ b/lib/l10n/da.php
@@ -8,6 +8,9 @@ $TRANSLATIONS = array(
"Users" => "Brugere",
"Admin" => "Admin",
"Failed to upgrade \"%s\"." => "Upgradering af \"%s\" fejlede",
+"Custom profile pictures don't work with encryption yet" => "Personligt profilbillede virker endnu ikke sammen med kryptering",
+"Unknown filetype" => "Ukendt filtype",
+"Invalid image" => "Ugyldigt billede",
"web services under your control" => "Webtjenester under din kontrol",
"cannot open \"%s\"" => "Kan ikke åbne \"%s\"",
"ZIP download is turned off." => "ZIP-download er slået fra.",
diff --git a/lib/l10n/de.php b/lib/l10n/de.php
index 7a3e2c43e6b..87e7a67b47b 100644
--- a/lib/l10n/de.php
+++ b/lib/l10n/de.php
@@ -8,6 +8,9 @@ $TRANSLATIONS = array(
"Users" => "Benutzer",
"Admin" => "Administration",
"Failed to upgrade \"%s\"." => "Konnte \"%s\" nicht aktualisieren.",
+"Custom profile pictures don't work with encryption yet" => "Individuelle Profilbilder werden noch nicht von der Verschlüsselung unterstützt",
+"Unknown filetype" => "Unbekannter Dateityp",
+"Invalid image" => "Ungültiges Bild",
"web services under your control" => "Web-Services unter Deiner Kontrolle",
"cannot open \"%s\"" => "Öffnen von \"%s\" fehlgeschlagen",
"ZIP download is turned off." => "Der ZIP-Download ist deaktiviert.",
diff --git a/lib/l10n/de_DE.php b/lib/l10n/de_DE.php
index 0a72f443e4d..09be0eea22d 100644
--- a/lib/l10n/de_DE.php
+++ b/lib/l10n/de_DE.php
@@ -8,6 +8,9 @@ $TRANSLATIONS = array(
"Users" => "Benutzer",
"Admin" => "Administrator",
"Failed to upgrade \"%s\"." => "Konnte \"%s\" nicht aktualisieren.",
+"Custom profile pictures don't work with encryption yet" => "Individuelle Profilbilder werden noch nicht von der Verschlüsselung unterstützt",
+"Unknown filetype" => "Unbekannter Dateityp",
+"Invalid image" => "Ungültiges Bild",
"web services under your control" => "Web-Services unter Ihrer Kontrolle",
"cannot open \"%s\"" => "Öffnen von \"%s\" fehlgeschlagen",
"ZIP download is turned off." => "Der ZIP-Download ist deaktiviert.",
diff --git a/lib/l10n/en_GB.php b/lib/l10n/en_GB.php
index f799c071c76..d02f553eda8 100644
--- a/lib/l10n/en_GB.php
+++ b/lib/l10n/en_GB.php
@@ -8,6 +8,9 @@ $TRANSLATIONS = array(
"Users" => "Users",
"Admin" => "Admin",
"Failed to upgrade \"%s\"." => "Failed to upgrade \"%s\".",
+"Custom profile pictures don't work with encryption yet" => "Custom profile pictures don't work with encryption yet",
+"Unknown filetype" => "Unknown filetype",
+"Invalid image" => "Invalid image",
"web services under your control" => "web services under your control",
"cannot open \"%s\"" => "cannot open \"%s\"",
"ZIP download is turned off." => "ZIP download is turned off.",
@@ -54,13 +57,13 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Your web server is not yet properly setup to allow files synchronisation because the WebDAV interface seems to be broken.",
"Please double check the <a href='%s'>installation guides</a>." => "Please double check the <a href='%s'>installation guides</a>.",
"seconds ago" => "seconds ago",
-"_%n minute ago_::_%n minutes ago_" => array("","%n minutes ago"),
-"_%n hour ago_::_%n hours ago_" => array("","%n hours ago"),
+"_%n minute ago_::_%n minutes ago_" => array("%n minute ago","%n minutes ago"),
+"_%n hour ago_::_%n hours ago_" => array("%n hour ago","%n hours ago"),
"today" => "today",
"yesterday" => "yesterday",
-"_%n day go_::_%n days ago_" => array("","%n days ago"),
+"_%n day go_::_%n days ago_" => array("%n day go","%n days ago"),
"last month" => "last month",
-"_%n month ago_::_%n months ago_" => array("","%n months ago"),
+"_%n month ago_::_%n months ago_" => array("%n month ago","%n months ago"),
"last year" => "last year",
"years ago" => "years ago",
"Caused by:" => "Caused by:",
diff --git a/lib/l10n/et_EE.php b/lib/l10n/et_EE.php
index 8e3aa55c4ed..85dfaeb52d5 100644
--- a/lib/l10n/et_EE.php
+++ b/lib/l10n/et_EE.php
@@ -8,6 +8,9 @@ $TRANSLATIONS = array(
"Users" => "Kasutajad",
"Admin" => "Admin",
"Failed to upgrade \"%s\"." => "Ebaõnnestunud uuendus \"%s\".",
+"Custom profile pictures don't work with encryption yet" => "Kohandatud profiili pildid ei toimi veel koos krüpteeringuga",
+"Unknown filetype" => "Tundmatu failitüüp",
+"Invalid image" => "Vigane pilt",
"web services under your control" => "veebitenused sinu kontrolli all",
"cannot open \"%s\"" => "ei suuda avada \"%s\"",
"ZIP download is turned off." => "ZIP-ina allalaadimine on välja lülitatud.",
diff --git a/lib/l10n/fi_FI.php b/lib/l10n/fi_FI.php
index 2e69df43ad2..1d2bdab749c 100644
--- a/lib/l10n/fi_FI.php
+++ b/lib/l10n/fi_FI.php
@@ -1,11 +1,16 @@
<?php
$TRANSLATIONS = array(
"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "Sovellusta \"%s\" ei voi asentaa, koska se ei ole yhteensopiva käytössä olevan ownCloud-version kanssa.",
+"No app name specified" => "Sovelluksen nimeä ei määritelty",
"Help" => "Ohje",
"Personal" => "Henkilökohtainen",
"Settings" => "Asetukset",
"Users" => "Käyttäjät",
"Admin" => "Ylläpitäjä",
+"Failed to upgrade \"%s\"." => "Kohteen \"%s\" päivitys epäonnistui.",
+"Custom profile pictures don't work with encryption yet" => "Omavalintaiset profiilikuvat eivät toimi salauksen kanssa vielä",
+"Unknown filetype" => "Tuntematon tiedostotyyppi",
+"Invalid image" => "Virheellinen kuva",
"web services under your control" => "verkkopalvelut hallinnassasi",
"ZIP download is turned off." => "ZIP-lataus on poistettu käytöstä.",
"Files need to be downloaded one by one." => "Tiedostot on ladattava yksittäin.",
@@ -15,6 +20,8 @@ $TRANSLATIONS = array(
"No path specified when installing app from local file" => "Polkua ei määritelty sovellusta asennettaessa paikallisesta tiedostosta",
"Archives of type %s are not supported" => "Tyypin %s arkistot eivät ole tuettuja",
"App does not provide an info.xml file" => "Sovellus ei sisällä info.xml-tiedostoa",
+"App can't be installed because of not allowed code in the App" => "Sovellusta ei voi asentaa, koska sovellus sisältää kiellettyä koodia",
+"App can't be installed because it is not compatible with this version of ownCloud" => "Sovellusta ei voi asentaa, koska se ei ole yhteensopiva käytössä olevan ownCloud-version kanssa",
"App directory already exists" => "Sovelluskansio on jo olemassa",
"Can't create app folder. Please fix permissions. %s" => "Sovelluskansion luominen ei onnistu. Korjaa käyttöoikeudet. %s",
"Application is not enabled" => "Sovellusta ei ole otettu käyttöön",
diff --git a/lib/l10n/fr.php b/lib/l10n/fr.php
index da3ec4ce372..ab3d618849e 100644
--- a/lib/l10n/fr.php
+++ b/lib/l10n/fr.php
@@ -8,6 +8,9 @@ $TRANSLATIONS = array(
"Users" => "Utilisateurs",
"Admin" => "Administration",
"Failed to upgrade \"%s\"." => "Echec de la mise à niveau \"%s\".",
+"Custom profile pictures don't work with encryption yet" => "Les images de profil personnalisées ne fonctionnent pas encore avec le système de chiffrement.",
+"Unknown filetype" => "Type de fichier inconnu",
+"Invalid image" => "Image invalide",
"web services under your control" => "services web sous votre contrôle",
"cannot open \"%s\"" => "impossible d'ouvrir \"%s\"",
"ZIP download is turned off." => "Téléchargement ZIP désactivé.",
diff --git a/lib/l10n/gl.php b/lib/l10n/gl.php
index a8fee3b1bc1..406272d690f 100644
--- a/lib/l10n/gl.php
+++ b/lib/l10n/gl.php
@@ -8,6 +8,9 @@ $TRANSLATIONS = array(
"Users" => "Usuarios",
"Admin" => "Administración",
"Failed to upgrade \"%s\"." => "Non foi posíbel anovar «%s».",
+"Custom profile pictures don't work with encryption yet" => "As imaxes personalizadas de perfil aínda non funcionan co cifrado",
+"Unknown filetype" => "Tipo de ficheiro descoñecido",
+"Invalid image" => "Imaxe incorrecta",
"web services under your control" => "servizos web baixo o seu control",
"cannot open \"%s\"" => "non foi posíbel abrir «%s»",
"ZIP download is turned off." => "As descargas ZIP están desactivadas.",
diff --git a/lib/l10n/it.php b/lib/l10n/it.php
index c3a040048ec..b00789bc86f 100644
--- a/lib/l10n/it.php
+++ b/lib/l10n/it.php
@@ -8,6 +8,9 @@ $TRANSLATIONS = array(
"Users" => "Utenti",
"Admin" => "Admin",
"Failed to upgrade \"%s\"." => "Aggiornamento non riuscito \"%s\".",
+"Custom profile pictures don't work with encryption yet" => "Le immagini personalizzate del profilo non funzionano ancora con la cifratura",
+"Unknown filetype" => "Tipo di file sconosciuto",
+"Invalid image" => "Immagine non valida",
"web services under your control" => "servizi web nelle tue mani",
"cannot open \"%s\"" => "impossibile aprire \"%s\"",
"ZIP download is turned off." => "Lo scaricamento in formato ZIP è stato disabilitato.",
diff --git a/lib/l10n/ja_JP.php b/lib/l10n/ja_JP.php
index 2d37001ca19..b9e6a0e6924 100644
--- a/lib/l10n/ja_JP.php
+++ b/lib/l10n/ja_JP.php
@@ -8,6 +8,9 @@ $TRANSLATIONS = array(
"Users" => "ユーザ",
"Admin" => "管理",
"Failed to upgrade \"%s\"." => "\"%s\" へのアップグレードに失敗しました。",
+"Custom profile pictures don't work with encryption yet" => "暗号無しでは利用不可なカスタムプロフィール画像",
+"Unknown filetype" => "不明なファイルタイプ",
+"Invalid image" => "無効な画像",
"web services under your control" => "管理下のウェブサービス",
"cannot open \"%s\"" => "\"%s\" が開けません",
"ZIP download is turned off." => "ZIPダウンロードは無効です。",
diff --git a/lib/l10n/lt_LT.php b/lib/l10n/lt_LT.php
index 1fd9b9ea634..db8d96c1018 100644
--- a/lib/l10n/lt_LT.php
+++ b/lib/l10n/lt_LT.php
@@ -8,6 +8,9 @@ $TRANSLATIONS = array(
"Users" => "Vartotojai",
"Admin" => "Administravimas",
"Failed to upgrade \"%s\"." => "Nepavyko pakelti „%s“ versijos.",
+"Custom profile pictures don't work with encryption yet" => "Saviti profilio paveiksliukai dar neveikia su šifravimu",
+"Unknown filetype" => "Nežinomas failo tipas",
+"Invalid image" => "Netinkamas paveikslėlis",
"web services under your control" => "jūsų valdomos web paslaugos",
"cannot open \"%s\"" => "nepavyksta atverti „%s“",
"ZIP download is turned off." => "ZIP atsisiuntimo galimybė yra išjungta.",
diff --git a/lib/l10n/nl.php b/lib/l10n/nl.php
index e546c1f3179..20374f1f0f8 100644
--- a/lib/l10n/nl.php
+++ b/lib/l10n/nl.php
@@ -1,5 +1,6 @@
<?php
$TRANSLATIONS = array(
+"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "App \"%s\" kan niet worden geïnstalleerd omdat die niet compatible is met deze versie van ownCloud.",
"No app name specified" => "De app naam is niet gespecificeerd.",
"Help" => "Help",
"Personal" => "Persoonlijk",
@@ -7,6 +8,9 @@ $TRANSLATIONS = array(
"Users" => "Gebruikers",
"Admin" => "Beheerder",
"Failed to upgrade \"%s\"." => "Upgrade \"%s\" mislukt.",
+"Custom profile pictures don't work with encryption yet" => "Maatwerk profielafbeelding werkt nog niet met versleuteling",
+"Unknown filetype" => "Onbekend bestandsformaat",
+"Invalid image" => "Ongeldige afbeelding",
"web services under your control" => "Webdiensten in eigen beheer",
"cannot open \"%s\"" => "Kon \"%s\" niet openen",
"ZIP download is turned off." => "ZIP download is uitgeschakeld.",
@@ -14,6 +18,18 @@ $TRANSLATIONS = array(
"Back to Files" => "Terug naar bestanden",
"Selected files too large to generate zip file." => "De geselecteerde bestanden zijn te groot om een zip bestand te maken.",
"Download the files in smaller chunks, seperately or kindly ask your administrator." => "Download de bestanden in kleinere brokken, appart of vraag uw administrator.",
+"No source specified when installing app" => "Geen bron opgegeven bij installatie van de app",
+"No href specified when installing app from http" => "Geen href opgegeven bij installeren van de app vanaf http",
+"No path specified when installing app from local file" => "Geen pad opgegeven bij installeren van de app vanaf een lokaal bestand",
+"Archives of type %s are not supported" => "Archiefbestanden van type %s niet ondersteund",
+"Failed to open archive when installing app" => "Kon archiefbestand bij installatie van de app niet openen",
+"App does not provide an info.xml file" => "De app heeft geen info.xml bestand",
+"App can't be installed because of not allowed code in the App" => "De app kan niet worden geïnstalleerd wegens onjuiste code in de app",
+"App can't be installed because it is not compatible with this version of ownCloud" => "De app kan niet worden geïnstalleerd omdat die niet compatible is met deze versie van ownCloud",
+"App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" => "De app kan niet worden geïnstallerd omdat het de <shipped>true</shipped> tag bevat die niet is toegestaan voor niet gepubliceerde apps",
+"App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" => "De app kan niet worden geïnstalleerd omdat de versie in info.xml/version niet dezelfde is als de versie zoals die in de app store staat vermeld",
+"App directory already exists" => "App directory bestaat al",
+"Can't create app folder. Please fix permissions. %s" => "Kan de app map niet aanmaken, Herstel de permissies. %s",
"Application is not enabled" => "De applicatie is niet actief",
"Authentication error" => "Authenticatie fout",
"Token expired. Please reload page." => "Token verlopen. Herlaad de pagina.",
diff --git a/lib/l10n/nn_NO.php b/lib/l10n/nn_NO.php
index d5da8c64415..e8bf8dfdef4 100644
--- a/lib/l10n/nn_NO.php
+++ b/lib/l10n/nn_NO.php
@@ -5,6 +5,8 @@ $TRANSLATIONS = array(
"Settings" => "Innstillingar",
"Users" => "Brukarar",
"Admin" => "Administrer",
+"Unknown filetype" => "Ukjend filtype",
+"Invalid image" => "Ugyldig bilete",
"web services under your control" => "Vev tjenester under din kontroll",
"Authentication error" => "Feil i autentisering",
"Files" => "Filer",
diff --git a/lib/l10n/pa.php b/lib/l10n/pa.php
new file mode 100644
index 00000000000..069fea6e710
--- /dev/null
+++ b/lib/l10n/pa.php
@@ -0,0 +1,16 @@
+<?php
+$TRANSLATIONS = array(
+"Settings" => "ਸੈਟਿੰਗ",
+"Files" => "ਫਾਇਲਾਂ",
+"seconds ago" => "ਸਕਿੰਟ ਪਹਿਲਾਂ",
+"_%n minute ago_::_%n minutes ago_" => array("",""),
+"_%n hour ago_::_%n hours ago_" => array("",""),
+"today" => "ਅੱਜ",
+"yesterday" => "ਕੱਲ੍ਹ",
+"_%n day go_::_%n days ago_" => array("",""),
+"last month" => "ਪਿਛਲੇ ਮਹੀਨੇ",
+"_%n month ago_::_%n months ago_" => array("",""),
+"last year" => "ਪਿਛਲੇ ਸਾਲ",
+"years ago" => "ਸਾਲਾਂ ਪਹਿਲਾਂ"
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/pt_BR.php b/lib/l10n/pt_BR.php
index 72bc1f36a1e..7a580799701 100644
--- a/lib/l10n/pt_BR.php
+++ b/lib/l10n/pt_BR.php
@@ -8,6 +8,9 @@ $TRANSLATIONS = array(
"Users" => "Usuários",
"Admin" => "Admin",
"Failed to upgrade \"%s\"." => "Falha na atualização de \"%s\".",
+"Custom profile pictures don't work with encryption yet" => "Fotos de perfil personalizados ainda não funcionam com criptografia",
+"Unknown filetype" => "Tipo de arquivo desconhecido",
+"Invalid image" => "Imagem inválida",
"web services under your control" => "serviços web sob seu controle",
"cannot open \"%s\"" => "não pode abrir \"%s\"",
"ZIP download is turned off." => "Download ZIP está desligado.",
diff --git a/lib/l10n/pt_PT.php b/lib/l10n/pt_PT.php
index bf540012249..6e2bcba7b10 100644
--- a/lib/l10n/pt_PT.php
+++ b/lib/l10n/pt_PT.php
@@ -6,6 +6,8 @@ $TRANSLATIONS = array(
"Users" => "Utilizadores",
"Admin" => "Admin",
"Failed to upgrade \"%s\"." => "A actualização \"%s\" falhou.",
+"Unknown filetype" => "Ficheiro desconhecido",
+"Invalid image" => "Imagem inválida",
"web services under your control" => "serviços web sob o seu controlo",
"cannot open \"%s\"" => "Não foi possível abrir \"%s\"",
"ZIP download is turned off." => "Descarregamento em ZIP está desligado.",
diff --git a/lib/l10n/ro.php b/lib/l10n/ro.php
index b338b349239..76dafcd03e0 100644
--- a/lib/l10n/ro.php
+++ b/lib/l10n/ro.php
@@ -5,6 +5,8 @@ $TRANSLATIONS = array(
"Settings" => "Setări",
"Users" => "Utilizatori",
"Admin" => "Admin",
+"Unknown filetype" => "Tip fișier necunoscut",
+"Invalid image" => "Imagine invalidă",
"web services under your control" => "servicii web controlate de tine",
"ZIP download is turned off." => "Descărcarea ZIP este dezactivată.",
"Files need to be downloaded one by one." => "Fișierele trebuie descărcate unul câte unul.",
@@ -19,11 +21,11 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Serverul de web nu este încă setat corespunzător pentru a permite sincronizarea fișierelor deoarece interfața WebDAV pare a fi întreruptă.",
"Please double check the <a href='%s'>installation guides</a>." => "Vă rugăm să verificați <a href='%s'>ghiduri de instalare</a>.",
"seconds ago" => "secunde în urmă",
-"_%n minute ago_::_%n minutes ago_" => array("","",""),
-"_%n hour ago_::_%n hours ago_" => array("","",""),
+"_%n minute ago_::_%n minutes ago_" => array("","","acum %n minute"),
+"_%n hour ago_::_%n hours ago_" => array("","","acum %n ore"),
"today" => "astăzi",
"yesterday" => "ieri",
-"_%n day go_::_%n days ago_" => array("","",""),
+"_%n day go_::_%n days ago_" => array("","","acum %n zile"),
"last month" => "ultima lună",
"_%n month ago_::_%n months ago_" => array("","",""),
"last year" => "ultimul an",
diff --git a/lib/l10n/ru.php b/lib/l10n/ru.php
index c3b6a077b72..501065f8b5f 100644
--- a/lib/l10n/ru.php
+++ b/lib/l10n/ru.php
@@ -1,11 +1,16 @@
<?php
$TRANSLATIONS = array(
+"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "Приложение \"%s\" нельзя установить, так как оно не совместимо с текущей версией ownCloud.",
+"No app name specified" => "Не выбрано имя приложения",
"Help" => "Помощь",
"Personal" => "Личное",
"Settings" => "Конфигурация",
"Users" => "Пользователи",
"Admin" => "Admin",
"Failed to upgrade \"%s\"." => "Не смог обновить \"%s\".",
+"Custom profile pictures don't work with encryption yet" => "Пользовательские картинки профиля ещё не поддерживают шифрование",
+"Unknown filetype" => "Неизвестный тип файла",
+"Invalid image" => "Изображение повреждено",
"web services under your control" => "веб-сервисы под вашим управлением",
"cannot open \"%s\"" => "не могу открыть \"%s\"",
"ZIP download is turned off." => "ZIP-скачивание отключено.",
@@ -13,6 +18,18 @@ $TRANSLATIONS = array(
"Back to Files" => "Назад к файлам",
"Selected files too large to generate zip file." => "Выбранные файлы слишком велики, чтобы создать zip файл.",
"Download the files in smaller chunks, seperately or kindly ask your administrator." => "Загрузите файл маленьшими порциями, раздельно или вежливо попросите Вашего администратора.",
+"No source specified when installing app" => "Не указан источник при установке приложения",
+"No href specified when installing app from http" => "Не указан атрибут href при установке приложения через http",
+"No path specified when installing app from local file" => "Не указан путь при установке приложения из локального файла",
+"Archives of type %s are not supported" => "Архивы %s не поддерживаются",
+"Failed to open archive when installing app" => "Не возможно открыть архив при установке приложения",
+"App does not provide an info.xml file" => "Приложение не имеет файла info.xml",
+"App can't be installed because of not allowed code in the App" => "Приложение невозможно установить. В нем содержится запрещенный код.",
+"App can't be installed because it is not compatible with this version of ownCloud" => "Приложение невозможно установить. Не совместимо с текущей версией ownCloud.",
+"App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" => "Приложение невозможно установить. Оно содержит параметр <shipped>true</shipped> который не допустим для приложений, не входящих в поставку.",
+"App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" => "Приложение невозможно установить. Версия в info.xml/version не совпадает с версией заявленной в магазине приложений",
+"App directory already exists" => "Папка приложения уже существует",
+"Can't create app folder. Please fix permissions. %s" => "Не удалось создать директорию. Исправьте права доступа. %s",
"Application is not enabled" => "Приложение не разрешено",
"Authentication error" => "Ошибка аутентификации",
"Token expired. Please reload page." => "Токен просрочен. Перезагрузите страницу.",
diff --git a/lib/l10n/sr@latin.php b/lib/l10n/sr@latin.php
index 5ba51bc0ba7..d8fa9289221 100644
--- a/lib/l10n/sr@latin.php
+++ b/lib/l10n/sr@latin.php
@@ -8,9 +8,15 @@ $TRANSLATIONS = array(
"Authentication error" => "Greška pri autentifikaciji",
"Files" => "Fajlovi",
"Text" => "Tekst",
+"seconds ago" => "Pre par sekundi",
"_%n minute ago_::_%n minutes ago_" => array("","",""),
"_%n hour ago_::_%n hours ago_" => array("","",""),
+"today" => "Danas",
+"yesterday" => "juče",
"_%n day go_::_%n days ago_" => array("","",""),
-"_%n month ago_::_%n months ago_" => array("","","")
+"last month" => "prošlog meseca",
+"_%n month ago_::_%n months ago_" => array("","",""),
+"last year" => "prošle godine",
+"years ago" => "pre nekoliko godina"
);
$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
diff --git a/lib/legacy/preferences.php b/lib/legacy/preferences.php
new file mode 100644
index 00000000000..a663db7598b
--- /dev/null
+++ b/lib/legacy/preferences.php
@@ -0,0 +1,146 @@
+<?php
+/**
+ * ownCloud
+ *
+ * @author Frank Karlitschek
+ * @author Jakob Sack
+ * @copyright 2012 Frank Karlitschek frank@owncloud.org
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/**
+ * This class provides an easy way for storing user preferences.
+ */
+OC_Preferences::$object = new \OC\Preferences(OC_DB::getConnection());
+class OC_Preferences{
+ public static $object;
+ /**
+ * @brief Get all users using the preferences
+ * @return array with user ids
+ *
+ * This function returns a list of all users that have at least one entry
+ * in the preferences table.
+ */
+ public static function getUsers() {
+ return self::$object->getUsers();
+ }
+
+ /**
+ * @brief Get all apps of a user
+ * @param string $user user
+ * @return array with app ids
+ *
+ * This function returns a list of all apps of the user that have at least
+ * one entry in the preferences table.
+ */
+ public static function getApps( $user ) {
+ return self::$object->getApps( $user );
+ }
+
+ /**
+ * @brief Get the available keys for an app
+ * @param string $user user
+ * @param string $app the app we are looking for
+ * @return array with key names
+ *
+ * This function gets all keys of an app of an user. Please note that the
+ * values are not returned.
+ */
+ public static function getKeys( $user, $app ) {
+ return self::$object->getKeys( $user, $app );
+ }
+
+ /**
+ * @brief Gets the preference
+ * @param string $user user
+ * @param string $app app
+ * @param string $key key
+ * @param string $default = null, default value if the key does not exist
+ * @return string the value or $default
+ *
+ * This function gets a value from the preferences table. If the key does
+ * not exist the default value will be returned
+ */
+ public static function getValue( $user, $app, $key, $default = null ) {
+ return self::$object->getValue( $user, $app, $key, $default );
+ }
+
+ /**
+ * @brief sets a value in the preferences
+ * @param string $user user
+ * @param string $app app
+ * @param string $key key
+ * @param string $value value
+ * @return bool
+ *
+ * Adds a value to the preferences. If the key did not exist before, it
+ * will be added automagically.
+ */
+ public static function setValue( $user, $app, $key, $value ) {
+ self::$object->setValue( $user, $app, $key, $value );
+ return true;
+ }
+
+ /**
+ * @brief Deletes a key
+ * @param string $user user
+ * @param string $app app
+ * @param string $key key
+ *
+ * Deletes a key.
+ */
+ public static function deleteKey( $user, $app, $key ) {
+ self::$object->deleteKey( $user, $app, $key );
+ return true;
+ }
+
+ /**
+ * @brief Remove app of user from preferences
+ * @param string $user user
+ * @param string $app app
+ * @return bool
+ *
+ * Removes all keys in preferences belonging to the app and the user.
+ */
+ public static function deleteApp( $user, $app ) {
+ self::$object->deleteApp( $user, $app );
+ return true;
+ }
+
+ /**
+ * @brief Remove user from preferences
+ * @param string $user user
+ * @return bool
+ *
+ * Removes all keys in preferences belonging to the user.
+ */
+ public static function deleteUser( $user ) {
+ self::$object->deleteUser( $user );
+ return true;
+ }
+
+ /**
+ * @brief Remove app from all users
+ * @param string $app app
+ * @return bool
+ *
+ * Removes all keys in preferences belonging to the app.
+ */
+ public static function deleteAppFromAllUsers( $app ) {
+ self::$object->deleteAppFromAllUsers( $app );
+ return true;
+ }
+}
diff --git a/lib/preferences.php b/lib/preferences.php
index 11ca760830e..359d9a83589 100644
--- a/lib/preferences.php
+++ b/lib/preferences.php
@@ -34,10 +34,21 @@
*
*/
+namespace OC;
+
+use \OC\DB\Connection;
+
+
/**
* This class provides an easy way for storing user preferences.
*/
-class OC_Preferences{
+class Preferences {
+ protected $conn;
+
+ public function __construct(Connection $conn) {
+ $this->conn = $conn;
+ }
+
/**
* @brief Get all users using the preferences
* @return array with user ids
@@ -45,14 +56,13 @@ class OC_Preferences{
* This function returns a list of all users that have at least one entry
* in the preferences table.
*/
- public static function getUsers() {
- // No need for more comments
- $query = OC_DB::prepare( 'SELECT DISTINCT( `userid` ) FROM `*PREFIX*preferences`' );
- $result = $query->execute();
+ public function getUsers() {
+ $query = 'SELECT DISTINCT `userid` FROM `*PREFIX*preferences`';
+ $result = $this->conn->executeQuery( $query );
$users = array();
- while( $row = $result->fetchRow()) {
- $users[] = $row["userid"];
+ while( $userid = $result->fetchColumn()) {
+ $users[] = $userid;
}
return $users;
@@ -66,14 +76,13 @@ class OC_Preferences{
* This function returns a list of all apps of the user that have at least
* one entry in the preferences table.
*/
- public static function getApps( $user ) {
- // No need for more comments
- $query = OC_DB::prepare( 'SELECT DISTINCT( `appid` ) FROM `*PREFIX*preferences` WHERE `userid` = ?' );
- $result = $query->execute( array( $user ));
+ public function getApps( $user ) {
+ $query = 'SELECT DISTINCT `appid` FROM `*PREFIX*preferences` WHERE `userid` = ?';
+ $result = $this->conn->executeQuery( $query, array( $user ) );
$apps = array();
- while( $row = $result->fetchRow()) {
- $apps[] = $row["appid"];
+ while( $appid = $result->fetchColumn()) {
+ $apps[] = $appid;
}
return $apps;
@@ -88,14 +97,13 @@ class OC_Preferences{
* This function gets all keys of an app of an user. Please note that the
* values are not returned.
*/
- public static function getKeys( $user, $app ) {
- // No need for more comments
- $query = OC_DB::prepare( 'SELECT `configkey` FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ?' );
- $result = $query->execute( array( $user, $app ));
+ public function getKeys( $user, $app ) {
+ $query = 'SELECT `configkey` FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ?';
+ $result = $this->conn->executeQuery( $query, array( $user, $app ));
$keys = array();
- while( $row = $result->fetchRow()) {
- $keys[] = $row["configkey"];
+ while( $key = $result->fetchColumn()) {
+ $keys[] = $key;
}
return $keys;
@@ -112,16 +120,14 @@ class OC_Preferences{
* This function gets a value from the preferences table. If the key does
* not exist the default value will be returned
*/
- public static function getValue( $user, $app, $key, $default = null ) {
+ public function getValue( $user, $app, $key, $default = null ) {
// Try to fetch the value, return default if not exists.
- $query = OC_DB::prepare( 'SELECT `configvalue` FROM `*PREFIX*preferences`'
- .' WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?' );
- $result = $query->execute( array( $user, $app, $key ));
-
- $row = $result->fetchRow();
+ $query = 'SELECT `configvalue` FROM `*PREFIX*preferences`'
+ .' WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?';
+ $row = $this->conn->fetchAssoc( $query, array( $user, $app, $key ));
if($row) {
return $row["configvalue"];
- }else{
+ } else {
return $default;
}
}
@@ -132,29 +138,36 @@ class OC_Preferences{
* @param string $app app
* @param string $key key
* @param string $value value
- * @return bool
*
* Adds a value to the preferences. If the key did not exist before, it
* will be added automagically.
*/
- public static function setValue( $user, $app, $key, $value ) {
+ public function setValue( $user, $app, $key, $value ) {
// Check if the key does exist
- $query = OC_DB::prepare( 'SELECT `configvalue` FROM `*PREFIX*preferences`'
- .' WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?' );
- $values=$query->execute(array($user, $app, $key))->fetchAll();
- $exists=(count($values)>0);
+ $query = 'SELECT COUNT(*) FROM `*PREFIX*preferences`'
+ .' WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?';
+ $count = $this->conn->fetchColumn( $query, array( $user, $app, $key ));
+ $exists = $count > 0;
if( !$exists ) {
- $query = OC_DB::prepare( 'INSERT INTO `*PREFIX*preferences`'
- .' ( `userid`, `appid`, `configkey`, `configvalue` ) VALUES( ?, ?, ?, ? )' );
- $query->execute( array( $user, $app, $key, $value ));
+ $data = array(
+ 'userid' => $user,
+ 'appid' => $app,
+ 'configkey' => $key,
+ 'configvalue' => $value,
+ );
+ $this->conn->insert('*PREFIX*preferences', $data);
+ } else {
+ $data = array(
+ 'configvalue' => $value,
+ );
+ $where = array(
+ 'userid' => $user,
+ 'appid' => $app,
+ 'configkey' => $key,
+ );
+ $this->conn->update('*PREFIX*preferences', $data, $where);
}
- else{
- $query = OC_DB::prepare( 'UPDATE `*PREFIX*preferences` SET `configvalue` = ?'
- .' WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?' );
- $query->execute( array( $value, $user, $app, $key ));
- }
- return true;
}
/**
@@ -162,62 +175,58 @@ class OC_Preferences{
* @param string $user user
* @param string $app app
* @param string $key key
- * @return bool
*
* Deletes a key.
*/
- public static function deleteKey( $user, $app, $key ) {
- // No need for more comments
- $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences`'
- .' WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?' );
- $query->execute( array( $user, $app, $key ));
-
- return true;
+ public function deleteKey( $user, $app, $key ) {
+ $where = array(
+ 'userid' => $user,
+ 'appid' => $app,
+ 'configkey' => $key,
+ );
+ $this->conn->delete('*PREFIX*preferences', $where);
}
/**
* @brief Remove app of user from preferences
* @param string $user user
* @param string $app app
- * @return bool
*
- * Removes all keys in appconfig belonging to the app and the user.
+ * Removes all keys in preferences belonging to the app and the user.
*/
- public static function deleteApp( $user, $app ) {
- // No need for more comments
- $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ?' );
- $query->execute( array( $user, $app ));
-
- return true;
+ public function deleteApp( $user, $app ) {
+ $where = array(
+ 'userid' => $user,
+ 'appid' => $app,
+ );
+ $this->conn->delete('*PREFIX*preferences', $where);
}
/**
* @brief Remove user from preferences
* @param string $user user
- * @return bool
*
- * Removes all keys in appconfig belonging to the user.
+ * Removes all keys in preferences belonging to the user.
*/
- public static function deleteUser( $user ) {
- // No need for more comments
- $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `userid` = ?' );
- $query->execute( array( $user ));
-
- return true;
+ public function deleteUser( $user ) {
+ $where = array(
+ 'userid' => $user,
+ );
+ $this->conn->delete('*PREFIX*preferences', $where);
}
/**
* @brief Remove app from all users
* @param string $app app
- * @return bool
*
* Removes all keys in preferences belonging to the app.
*/
- public static function deleteAppFromAllUsers( $app ) {
- // No need for more comments
- $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `appid` = ?' );
- $query->execute( array( $app ));
-
- return true;
+ public function deleteAppFromAllUsers( $app ) {
+ $where = array(
+ 'appid' => $app,
+ );
+ $this->conn->delete('*PREFIX*preferences', $where);
}
}
+
+require_once __DIR__.'/legacy/'.basename(__FILE__);
diff --git a/lib/preview/txt.php b/lib/preview/txt.php
index a487330691e..77e728eb364 100644
--- a/lib/preview/txt.php
+++ b/lib/preview/txt.php
@@ -9,11 +9,21 @@ namespace OC\Preview;
class TXT extends Provider {
+ private static $blacklist = array(
+ 'text/calendar',
+ 'text/vcard',
+ );
+
public function getMimeType() {
return '/text\/.*/';
}
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
+ $mimetype = $fileview->getMimeType($path);
+ if(in_array($mimetype, self::$blacklist)) {
+ return false;
+ }
+
$content = $fileview->fopen($path, 'r');
$content = stream_get_contents($content);
diff --git a/lib/public/share.php b/lib/public/share.php
index 9ab956d84b9..6c5783f1179 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -106,22 +106,22 @@ class Share {
}
return false;
}
-
+
/**
* @brief Prepare a path to be passed to DB as file_target
* @return string Prepared path
*/
public static function prepFileTarget( $path ) {
-
+
// Paths in DB are stored with leading slashes, so add one if necessary
if ( substr( $path, 0, 1 ) !== '/' ) {
-
+
$path = '/' . $path;
-
+
}
-
+
return $path;
-
+
}
/**
@@ -256,7 +256,7 @@ class Share {
return self::getItems($itemType, $itemTarget, self::$shareTypeUserAndGroups, \OC_User::getUser(), null, $format,
$parameters, 1, $includeCollections);
}
-
+
/**
* @brief Get the item of item type shared with the current user by source
* @param string Item type
@@ -293,7 +293,18 @@ class Share {
if (\OC_DB::isError($result)) {
\OC_Log::write('OCP\Share', \OC_DB::getErrorMessage($result) . ', token=' . $token, \OC_Log::ERROR);
}
- return $result->fetchRow();
+ $row = $result->fetchRow();
+
+ if (!empty($row['expiration'])) {
+ $now = new \DateTime();
+ $expirationDate = new \DateTime($row['expiration'], new \DateTimeZone('UTC'));
+ if ($now > $expirationDate) {
+ self::delete($row['id']);
+ return false;
+ }
+ }
+
+ return $row;
}
/**
@@ -450,6 +461,7 @@ class Share {
$uidOwner, self::FORMAT_NONE, null, 1)) {
// remember old token
$oldToken = $checkExists['token'];
+ $oldPermissions = $checkExists['permissions'];
//delete the old share
self::delete($checkExists['id']);
}
@@ -460,8 +472,11 @@ class Share {
$hasher = new \PasswordHash(8, $forcePortable);
$shareWith = $hasher->HashPassword($shareWith.\OC_Config::getValue('passwordsalt', ''));
} else {
- // reuse the already set password
- $shareWith = $checkExists['share_with'];
+ // reuse the already set password, but only if we change permissions
+ // otherwise the user disabled the password protection
+ if ($checkExists && (int)$permissions !== (int)$oldPermissions) {
+ $shareWith = $checkExists['share_with'];
+ }
}
// Generate token
@@ -745,10 +760,10 @@ class Share {
/**
* @brief Get the backend class for the specified item type
- * @param string Item type
- * @return Sharing backend object
+ * @param string $itemType
+ * @return Share_Backend
*/
- private static function getBackend($itemType) {
+ public static function getBackend($itemType) {
if (isset(self::$backends[$itemType])) {
return self::$backends[$itemType];
} else if (isset(self::$backendTypes[$itemType]['class'])) {
diff --git a/lib/public/user.php b/lib/public/user.php
index 23ff991642d..576a64d7048 100644
--- a/lib/public/user.php
+++ b/lib/public/user.php
@@ -102,7 +102,7 @@ class User {
* @brief Check if the password is correct
* @param $uid The username
* @param $password The password
- * @returns true/false
+ * @returns mixed username on success, false otherwise
*
* Check if the password is correct without logging in the user
*/
diff --git a/lib/search/provider/file.php b/lib/search/provider/file.php
index 4d88c2a87f1..9bd50931517 100644
--- a/lib/search/provider/file.php
+++ b/lib/search/provider/file.php
@@ -10,6 +10,7 @@ class OC_Search_Provider_File extends OC_Search_Provider{
$mime = $fileData['mimetype'];
$name = basename($path);
+ $container = dirname($path);
$text = '';
$skip = false;
if($mime=='httpd/unix-directory') {
@@ -37,7 +38,7 @@ class OC_Search_Provider_File extends OC_Search_Provider{
}
}
if(!$skip) {
- $results[] = new OC_Search_Result($name, $text, $link, $type);
+ $results[] = new OC_Search_Result($name, $text, $link, $type, $container);
}
}
return $results;
diff --git a/lib/search/result.php b/lib/search/result.php
index 08beaea151c..42275c2df11 100644
--- a/lib/search/result.php
+++ b/lib/search/result.php
@@ -7,6 +7,7 @@ class OC_Search_Result{
public $text;
public $link;
public $type;
+ public $container;
/**
* create a new search result
@@ -15,10 +16,11 @@ class OC_Search_Result{
* @param string $link link for the result
* @param string $type the type of result as human readable string ('File', 'Music', etc)
*/
- public function __construct($name, $text, $link, $type) {
+ public function __construct($name, $text, $link, $type, $container) {
$this->name=$name;
$this->text=$text;
$this->link=$link;
$this->type=$type;
+ $this->container=$container;
}
}
diff --git a/lib/user.php b/lib/user.php
index 0f6f40aec9a..ed75b0bc17c 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -177,6 +177,7 @@ class OC_User {
* setup the configured backends in config.php
*/
public static function setupBackends() {
+ OC_App::loadApps(array('prelogin'));
$backends = OC_Config::getValue('user_backends', array());
foreach ($backends as $i => $config) {
$class = $config['class'];
@@ -410,22 +411,18 @@ class OC_User {
* @brief Check if the password is correct
* @param string $uid The username
* @param string $password The password
- * @return bool
+ * @return mixed user id a string on success, false otherwise
*
* Check if the password is correct without logging in the user
* returns the user id or false
*/
public static function checkPassword($uid, $password) {
- $user = self::getManager()->get($uid);
- if ($user) {
- if ($user->checkPassword($password)) {
- return $user->getUID();
- } else {
- return false;
- }
- } else {
- return false;
+ $manager = self::getManager();
+ $username = $manager->checkPassword($uid, $password);
+ if ($username !== false) {
+ return $username->getUID();
}
+ return false;
}
/**
diff --git a/lib/user/http.php b/lib/user/http.php
index 1e044ed4188..e99afe59ba7 100644
--- a/lib/user/http.php
+++ b/lib/user/http.php
@@ -79,7 +79,11 @@ class OC_User_HTTP extends OC_User_Backend {
curl_close($ch);
- return $status==200;
+ if($status === 200) {
+ return $uid;
+ }
+
+ return false;
}
/**
diff --git a/lib/user/manager.php b/lib/user/manager.php
index 8dc9bfe2729..13286bc28a4 100644
--- a/lib/user/manager.php
+++ b/lib/user/manager.php
@@ -119,6 +119,25 @@ class Manager extends PublicEmitter {
}
/**
+ * Check if the password is valid for the user
+ *
+ * @param $loginname
+ * @param $password
+ * @return mixed the User object on success, false otherwise
+ */
+ public function checkPassword($loginname, $password) {
+ foreach ($this->backends as $backend) {
+ if($backend->implementsActions(\OC_USER_BACKEND_CHECK_PASSWORD)) {
+ $uid = $backend->checkPassword($loginname, $password);
+ if ($uid !== false) {
+ return $this->getUserObject($uid, $backend);
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
* search by user id
*
* @param string $pattern
diff --git a/lib/user/session.php b/lib/user/session.php
index 9a6c669e935..b5e9385234d 100644
--- a/lib/user/session.php
+++ b/lib/user/session.php
@@ -121,15 +121,16 @@ class Session implements Emitter {
*/
public function login($uid, $password) {
$this->manager->emit('\OC\User', 'preLogin', array($uid, $password));
- $user = $this->manager->get($uid);
- if ($user) {
- $result = $user->checkPassword($password);
- if ($result and $user->isEnabled()) {
- $this->setUser($user);
- $this->manager->emit('\OC\User', 'postLogin', array($user, $password));
- return true;
- } else {
- return false;
+ $user = $this->manager->checkPassword($uid, $password);
+ if($user !== false) {
+ if (!is_null($user)) {
+ if ($user->isEnabled()) {
+ $this->setUser($user);
+ $this->manager->emit('\OC\User', 'postLogin', array($user, $password));
+ return true;
+ } else {
+ return false;
+ }
}
} else {
return false;
diff --git a/lib/user/user.php b/lib/user/user.php
index 8115c43198c..e5f842944f1 100644
--- a/lib/user/user.php
+++ b/lib/user/user.php
@@ -106,24 +106,6 @@ class User {
}
/**
- * Check if the password is valid for the user
- *
- * @param $password
- * @return bool
- */
- public function checkPassword($password) {
- if ($this->backend->implementsActions(\OC_USER_BACKEND_CHECK_PASSWORD)) {
- $result = $this->backend->checkPassword($this->uid, $password);
- if ($result !== false) {
- $this->uid = $result;
- }
- return !($result === false);
- } else {
- return false;
- }
- }
-
- /**
* Set the password of the user
*
* @param string $password
diff --git a/lib/util.php b/lib/util.php
index 41f5f1d16be..d4f4eed1ca7 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -730,12 +730,6 @@ class OC_Util {
'baseUri' => OC_Helper::linkToRemote('webdav'),
);
- // save the old timeout so that we can restore it later
- $oldTimeout = ini_get("default_socket_timeout");
-
- // use a 5 sec timeout for the check. Should be enough for local requests.
- ini_set("default_socket_timeout", 5);
-
$client = new \Sabre_DAV_Client($settings);
// for this self test we don't care if the ssl certificate is self signed and the peer cannot be verified.
@@ -752,9 +746,6 @@ class OC_Util {
$return = false;
}
- // restore the original timeout
- ini_set("default_socket_timeout", $oldTimeout);
-
return $return;
}