diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php
index 8f6c42d6620b49a7718c07085038b8e81cf4d69d..754c34ef088b46e70b7584fe680aa4743f63b0de 100644
--- a/apps/files/ajax/upload.php
+++ b/apps/files/ajax/upload.php
@@ -139,7 +139,8 @@ if (strpos($dir, '..') === false) {
 							'originalname' => $files['tmp_name'][$i],
 							'uploadMaxFilesize' => $maxUploadFileSize,
 							'maxHumanFilesize' => $maxHumanFileSize,
-							'permissions' => $meta['permissions'] & $allowedPermissions
+							'permissions' => $meta['permissions'] & $allowedPermissions,
+							'directory' => \OC\Files\Filesystem::normalizePath(stripslashes($dir)),
 						);
 					}
 
@@ -166,7 +167,8 @@ if (strpos($dir, '..') === false) {
 					'originalname' => $files['tmp_name'][$i],
 					'uploadMaxFilesize' => $maxUploadFileSize,
 					'maxHumanFilesize' => $maxHumanFileSize,
-					'permissions' => $meta['permissions'] & $allowedPermissions
+					'permissions' => $meta['permissions'] & $allowedPermissions,
+					'directory' => \OC\Files\Filesystem::normalizePath(stripslashes($dir)),
 				);
 			}
 		}
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index f538af10362bbda67a7e10378552c2f62f48340c..a855d6cbe593e55647f76c511260fdcd1a3208ec 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -435,10 +435,9 @@ window.FileList={
 								tr.attr('data-file', newname);
 								var path = td.children('a.name').attr('href');
 								td.children('a.name').attr('href', path.replace(encodeURIComponent(oldname), encodeURIComponent(newname)));
+								var basename = newname;
 								if (newname.indexOf('.') > 0 && tr.data('type') !== 'dir') {
-									var basename=newname.substr(0,newname.lastIndexOf('.'));
-								} else {
-									var basename=newname;
+									basename = newname.substr(0,newname.lastIndexOf('.'));
 								}
 								td.find('a.name span.nametext').text(basename);
 								if (newname.indexOf('.') > 0 && tr.data('type') !== 'dir') {
@@ -544,10 +543,9 @@ window.FileList={
 		td.children('a.name .span').text(newName);
 		var path = td.children('a.name').attr('href');
 		td.children('a.name').attr('href', path.replace(encodeURIComponent(oldName), encodeURIComponent(newName)));
+		var basename = newName;
 		if (newName.indexOf('.') > 0) {
-			var basename = newName.substr(0, newName.lastIndexOf('.'));
-		} else {
-			var basename = newName;
+			basename = newName.substr(0, newName.lastIndexOf('.'));
 		}
 		td.children('a.name').empty();
 		var span = $('<span class="nametext"></span>');
@@ -924,8 +922,8 @@ $(document).ready(function() {
 				data.context.find('td.filesize').text(humanFileSize(size));
 
 			} else {
-				// only append new file if dragged onto current dir's crumb (last)
-				if (data.context && data.context.hasClass('crumb') && !data.context.hasClass('last')) {
+				// only append new file if uploaded into the current folder
+				if (file.directory !== FileList.getCurrentDirectory()) {
 					return;
 				}
 
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index a535700c1b33949beb5c5a5d20fc6a08e539a6bc..1ec4c4ec7abf5edfdc9db81ca3e298d094b9c8a1 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -405,7 +405,7 @@ $(document).ready(function() {
 	Files.resizeBreadcrumbs(width, true);
 
 	// display storage warnings
-	setTimeout ( "Files.displayStorageWarnings()", 100 );
+	setTimeout(Files.displayStorageWarnings, 100);
 	OC.Notification.setDefault(Files.displayStorageWarnings);
 
 	// only possible at the moment if user is logged in
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index 4c4b3f2040ffd84a6da6da45205d64242a78917f..83abf3ba9de61700f3f8990d915068fd26a381e3 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -80,8 +80,15 @@ class Hooks {
 
 		// Check if first-run file migration has already been performed
 		$ready = false;
-		if ($util->getMigrationStatus() === Util::MIGRATION_OPEN) {
+		$migrationStatus = $util->getMigrationStatus();
+		if ($migrationStatus === Util::MIGRATION_OPEN) {
 			$ready = $util->beginMigration();
+		} elseif ($migrationStatus === Util::MIGRATION_IN_PROGRESS) {
+			// refuse login as long as the initial encryption is running
+			while ($migrationStatus === Util::MIGRATION_IN_PROGRESS) {
+				sleep(60);
+				$migrationStatus = $util->getMigrationStatus();
+			}
 		}
 
 		// If migration not yet done
diff --git a/apps/files_encryption/tests/hooks.php b/apps/files_encryption/tests/hooks.php
index c26cba6406dbe1e7027527c77c94a0945fcc756a..44525791743cbb3bc5475340c86cfe2e3daa5118 100644
--- a/apps/files_encryption/tests/hooks.php
+++ b/apps/files_encryption/tests/hooks.php
@@ -36,8 +36,8 @@ use OCA\Encryption;
  */
 class Test_Encryption_Hooks extends \PHPUnit_Framework_TestCase {
 
-	const TEST_ENCRYPTION_HOOKS_USER1 = "test-proxy-user1";
-	const TEST_ENCRYPTION_HOOKS_USER2 = "test-proxy-user2";
+	const TEST_ENCRYPTION_HOOKS_USER1 = "test-encryption-hooks-user1";
+	const TEST_ENCRYPTION_HOOKS_USER2 = "test-encryption-hooks-user2";
 
 	/**
 	 * @var \OC_FilesystemView
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index 01d588b372161f22d979bf4ec40e5549fd879900..48fc4dfe46e9949630e8578fb8dea97f8fcb4de9 100755
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -61,7 +61,7 @@ class OC_Mount_Config {
 			'configuration' => array(
 				'configured' => '#configured',
 				'app_key' => 'App key',
-				'app_secret' => 'App secret',
+				'app_secret' => '*App secret',
 				'token' => '#token',
 				'token_secret' => '#token_secret'),
 				'custom' => 'dropbox');
@@ -80,7 +80,7 @@ class OC_Mount_Config {
 			'configuration' => array(
 				'configured' => '#configured',
 				'client_id' => 'Client ID',
-				'client_secret' => 'Client secret',
+				'client_secret' => '*Client secret',
 				'token' => '#token'),
 				'custom' => 'google');
 
diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php
index 86e324409fec0fdf78e957f48ae0722cbeb5f796..1b102f9e5f8e74ef6058cdc9bb792361e7809a8c 100644
--- a/apps/files_sharing/lib/cache.php
+++ b/apps/files_sharing/lib/cache.php
@@ -92,12 +92,11 @@ class Shared_Cache extends Cache {
 		} else {
 			$query = \OC_DB::prepare(
 				'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`,'
-				.' `size`, `mtime`, `encrypted`'
+				.' `size`, `mtime`, `encrypted`, `unencrypted_size`'
 				.' FROM `*PREFIX*filecache` WHERE `fileid` = ?');
 			$result = $query->execute(array($file));
 			$data = $result->fetchRow();
 			$data['fileid'] = (int)$data['fileid'];
-			$data['size'] = (int)$data['size'];
 			$data['mtime'] = (int)$data['mtime'];
 			$data['storage_mtime'] = (int)$data['storage_mtime'];
 			$data['encrypted'] = (bool)$data['encrypted'];
@@ -106,6 +105,12 @@ class Shared_Cache extends Cache {
 			if ($data['storage_mtime'] === 0) {
 				$data['storage_mtime'] = $data['mtime'];
 			}
+			if ($data['encrypted'] or ($data['unencrypted_size'] > 0 and $data['mimetype'] === 'httpd/unix-directory')) {
+				$data['encrypted_size'] = (int)$data['size'];
+				$data['size'] = (int)$data['unencrypted_size'];
+			} else {
+				$data['size'] = (int)$data['size'];
+			}
 			return $data;
 		}
 		return false;
@@ -334,6 +339,12 @@ class Shared_Cache extends Cache {
 				}
 				$row['mimetype'] = $this->getMimetype($row['mimetype']);
 				$row['mimepart'] = $this->getMimetype($row['mimepart']);
+				if ($row['encrypted'] or ($row['unencrypted_size'] > 0 and $row['mimetype'] === 'httpd/unix-directory')) {
+					$row['encrypted_size'] = $row['size'];
+					$row['size'] = $row['unencrypted_size'];
+				} else {
+					$row['size'] = $row['size'];
+				}
 				$files[] = $row;
 			}
 		}
diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php
index c956c55a1dfea209a75a8e7fab0f54b93deee727..ec0f368386fef3560595496259982bebfa3e3316 100644
--- a/apps/files_sharing/lib/share/file.php
+++ b/apps/files_sharing/lib/share/file.php
@@ -91,10 +91,17 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
 				$file['name'] = basename($item['file_target']);
 				$file['mimetype'] = $item['mimetype'];
 				$file['mimepart'] = $item['mimepart'];
-				$file['size'] = $item['size'];
 				$file['mtime'] = $item['mtime'];
 				$file['encrypted'] = $item['encrypted'];
 				$file['etag'] = $item['etag'];
+				$storage = \OC\Files\Filesystem::getStorage('/');
+				$cache = $storage->getCache();
+				if ($item['encrypted'] or ($item['unencrypted_size'] > 0 and $cache->getMimetype($item['mimetype']) === 'httpd/unix-directory')) {
+					$file['size'] = $item['unencrypted_size'];
+					$file['encrypted_size'] = $item['size'];
+				} else {
+					$file['size'] = $item['size'];
+				}
 				$files[] = $file;
 			}
 			return $files;
diff --git a/apps/user_ldap/appinfo/info.xml b/apps/user_ldap/appinfo/info.xml
index 148a72cecbb4449d27a248719a1f1e3d70de5609..9cc908e8522220f1c045d475e511d45fde81a51b 100644
--- a/apps/user_ldap/appinfo/info.xml
+++ b/apps/user_ldap/appinfo/info.xml
@@ -14,4 +14,7 @@
 	<types>
 		<authentication/>
 	</types>
+	<documentation>
+		<admin>http://doc.owncloud.org/server/6.0/go.php?to=admin-ldap</admin>
+	</documentation>
 </info>
diff --git a/apps/user_ldap/js/settings.js b/apps/user_ldap/js/settings.js
index acf88ef58a4bade9e198744a8086301b8431a833..792638f2b58cab8a65c89c8afff66c988e432363 100644
--- a/apps/user_ldap/js/settings.js
+++ b/apps/user_ldap/js/settings.js
@@ -240,6 +240,7 @@ var LdapWizard = {
 					LdapWizard.hideSpinner('#ldap_base');
 					LdapWizard.showInfoBox('Please specify a Base DN');
 					LdapWizard.showInfoBox('Could not determine Base DN');
+					$('#ldap_base').prop('disabled', false);
 				}
 			);
 		}
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index 72f9c740921233e84820b3e35cce8860f7da093b..b619f62f29695151d1132c5ed10667647809cf60 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -729,7 +729,7 @@ class Access extends LDAPUtility {
 			}
 		} else {
 			if(!is_null($limit)) {
-				\OCP\Util::writeLog('user_ldap', 'Paged search failed :(', \OCP\Util::INFO);
+				\OCP\Util::writeLog('user_ldap', 'Paged search was not available', \OCP\Util::INFO);
 			}
 		}
 	}
diff --git a/apps/user_ldap/lib/ildapwrapper.php b/apps/user_ldap/lib/ildapwrapper.php
index 20587cba7dbdc5faaae067168fcfca46036e95b3..e60cf5ec63f97b3fb5913206392dc728ff71d52e 100644
--- a/apps/user_ldap/lib/ildapwrapper.php
+++ b/apps/user_ldap/lib/ildapwrapper.php
@@ -145,9 +145,11 @@ interface ILDAPWrapper {
 	 * @param $baseDN The DN of the entry to read from
 	 * @param $filter An LDAP filter
 	 * @param $attr array of the attributes to read
+	 * @param $attrsonly optional, 1 if only attribute types shall be returned
+	 * @param $limit optional, limits the result entries
 	 * @return an LDAP search result resource, false on error
 	 */
-	public function search($link, $baseDN, $filter, $attr);
+	public function search($link, $baseDN, $filter, $attr, $attrsonly = 0, $limit = 0);
 
 	/**
 	 * @brief Sets the value of the specified option to be $value
diff --git a/apps/user_ldap/lib/ldap.php b/apps/user_ldap/lib/ldap.php
index dda8533c41fc9dde4bf37c9955839a0152423e57..a99c6480121551696084d3e4a4a8af3aad689098 100644
--- a/apps/user_ldap/lib/ldap.php
+++ b/apps/user_ldap/lib/ldap.php
@@ -85,9 +85,9 @@ class LDAP implements ILDAPWrapper {
 		return $this->invokeLDAPMethod('read', $link, $baseDN, $filter, $attr);
 	}
 
-	public function search($link, $baseDN, $filter, $attr) {
-		return $this->invokeLDAPMethod('search', $link, $baseDN,
-										$filter, $attr);
+	public function search($link, $baseDN, $filter, $attr, $attrsonly = 0, $limit = 0) {
+		return $this->invokeLDAPMethod('search', $link, $baseDN, $filter,
+										$attr, $attrsonly, $limit);
 	}
 
 	public function setOption($link, $option, $value) {
diff --git a/apps/user_ldap/lib/wizard.php b/apps/user_ldap/lib/wizard.php
index b70ede8599c5e93772279b1efb7c983427a14198..00623b74fb1d57b676601c78557823bf0159054e 100644
--- a/apps/user_ldap/lib/wizard.php
+++ b/apps/user_ldap/lib/wizard.php
@@ -567,6 +567,10 @@ class Wizard extends LDAPUtility {
 		//get a result set > 0 on a proper base
 		$rr = $this->ldap->search($cr, $base, 'objectClass=*', array('dn'), 0, 1);
 		if(!$this->ldap->isResource($rr)) {
+			$errorNo  = $this->ldap->errno($cr);
+			$errorMsg = $this->ldap->error($cr);
+			\OCP\Util::writeLog('user_ldap', 'Wiz: Could not search base '.$base.
+							' Error '.$errorNo.': '.$errorMsg, \OCP\Util::INFO);
 			return false;
 		}
 		$entries = $this->ldap->countEntries($cr, $rr);
@@ -1010,6 +1014,7 @@ class Wizard extends LDAPUtility {
 			$this->configuration->ldapPort);
 
 		$this->ldap->setOption($cr, LDAP_OPT_PROTOCOL_VERSION, 3);
+		$this->ldap->setOption($cr, LDAP_OPT_REFERRALS, 0);
 		$this->ldap->setOption($cr, LDAP_OPT_NETWORK_TIMEOUT, self::LDAP_NW_TIMEOUT);
 		if($this->configuration->ldapTLS === 1) {
 			$this->ldap->startTls($cr);
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php
index a19af86086c91d7b5dc76ab29aa953806835270f..619a992bd122e2ba2b7d5c850c683c16a0f250b3 100644
--- a/apps/user_ldap/user_ldap.php
+++ b/apps/user_ldap/user_ldap.php
@@ -85,15 +85,14 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface {
 			return;
 		}
 
-		$jpegPhoto = $this->access->readAttribute($dn, 'jpegPhoto');
-		\OCP\Config::setUserValue($uid, 'user_ldap', 'lastJpegPhotoLookup', time());
-		if(!$jpegPhoto || !is_array($jpegPhoto) || !isset($jpegPhoto[0])) {
+		$avatarImage = $this->getAvatarImage($uid, $dn);
+		if($avatarImage === false) {
 			//not set, nothing left to do;
 			return;
 		}
 
 		$image = new \OCP\Image();
-		$image->loadFromBase64(base64_encode($jpegPhoto[0]));
+		$image->loadFromBase64(base64_encode($avatarImage));
 
 		if(!$image->valid()) {
 			\OCP\Util::writeLog('user_ldap', 'jpegPhoto data invalid for '.$dn,
@@ -128,8 +127,7 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface {
 		if(!$dn) {
 			return false;
 		}
-		$jpegPhoto = $this->access->readAttribute($dn, 'jpegPhoto');
-		if(!$jpegPhoto || !is_array($jpegPhoto) || !isset($jpegPhoto[0])) {
+		if($this->getAvatarImage($uid, $dn) === false) {
 			//The user is allowed to change his avatar in ownCloud only if no
 			//avatar is provided by LDAP
 			return true;
@@ -137,6 +135,26 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface {
 		return false;
 	}
 
+	/**
+	 * @brief reads the image from LDAP that shall be used as Avatar
+	 * @param $uid string, the ownCloud user name
+	 * @param $dn string, the user DN
+	 * @return image data (provided by LDAP) | false
+	 */
+	private function getAvatarImage($uid, $dn) {
+		$attributes = array('jpegPhoto', 'thumbnailPhoto');
+		foreach($attributes as $attribute) {
+			$result = $this->access->readAttribute($dn, $attribute);
+			\OCP\Config::setUserValue($uid, 'user_ldap', 'lastJpegPhotoLookup',
+									  time());
+			if($result !== false && is_array($result) && isset($result[0])) {
+				return $result[0];
+			}
+		}
+
+		return false;
+	}
+
 	/**
 	 * @brief Check if the password is correct
 	 * @param $uid The username
@@ -238,7 +256,8 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface {
 		}
 		//check if user really still exists by reading its entry
 		if(!is_array($this->access->readAttribute($dn, ''))) {
-			\OCP\Util::writeLog('user_ldap', 'LDAP says no user '.$dn, \OCP\Util::DEBUG);
+			\OCP\Util::writeLog('user_ldap', 'LDAP says no user '.$dn.' on '.
+				$this->access->connection->ldapHost, \OCP\Util::DEBUG);
 			$this->access->connection->writeToCache('userExists'.$uid, false);
 			return false;
 		}
diff --git a/config/config.sample.php b/config/config.sample.php
index ef5fb7ea5a5f685fa2a60e857d9738e9c37ad848..0cd321d095d9035e8a962e7148451bbd804dc29f 100755
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -120,8 +120,14 @@ $CONFIG = array(
 /* Password to use for sendmail mail, depends on mail_smtpauth if this is used */
 "mail_smtppassword" => "",
 
-/* memcached hostname and port (Only used when xCache, APC and APCu are absent.) */
-"memcached_server" => array('localhost', 11211),
+/* memcached servers (Only used when xCache, APC and APCu are absent.) */
+"memcached_servers" => array(
+	// hostname, port and optional weight. Also see:
+	// http://www.php.net/manual/en/memcached.addservers.php
+	// http://www.php.net/manual/en/memcached.addserver.php
+	array('localhost', 11211),
+	//array('other.host.local', 11211),
+),
 
 /* How long should ownCloud keep deleted files in the trash bin, default value:  30 days */
 'trashbin_retention_obligation' => 30,
diff --git a/core/ajax/share.php b/core/ajax/share.php
index 8b48effb458b06508d63e79fb2b387eaa2b9bb26..c251f8e7baeb1596b6318bdc2e592ccbd93d93da 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -354,6 +354,10 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
 						break;
 					}
 				}
+				$sorter = new \OC\Share\SearchResultSorter($_GET['search'],
+														   'label',
+														   new \OC\Log());
+				usort($shareWith, array($sorter, 'sort'));
 				OC_JSON::success(array('data' => $shareWith));
 			}
 			break;
diff --git a/core/setup/controller.php b/core/setup/controller.php
index 58ed4d28dc0a33b3e091a9b8b417ae897112e95b..697408cfb576ee603f1a162a8cb24277e307e9ab 100644
--- a/core/setup/controller.php
+++ b/core/setup/controller.php
@@ -91,7 +91,7 @@ class Controller {
 			$databases['sqlite'] = 'SQLite';
 		}
 		if ($hasMySQL) {
-			$databases['mysql'] = 'MySQL';
+			$databases['mysql'] = 'MySQL/MariaDB';
 		}
 		if ($hasPostgreSQL) {
 			$databases['pgsql'] = 'PostgreSQL';
diff --git a/lib/private/files/cache/storage.php b/lib/private/files/cache/storage.php
index 5657cf06e12115a5b6b28e4e7de24dea32e055ee..5b1b30176e8592a97f26f83991abd75ff29d3a53 100644
--- a/lib/private/files/cache/storage.php
+++ b/lib/private/files/cache/storage.php
@@ -70,4 +70,23 @@ class Storage {
 			return false;
 		}
 	}
+
+	/**
+	 * remove the entry for the storage
+	 *
+	 * @param string $storageId
+	 */
+	public static function remove($storageId) {
+		$storageCache = new Storage($storageId);
+		$numericId = $storageCache->getNumericId();
+
+		if (strlen($storageId) > 64) {
+			$storageId = md5($storageId);
+		}
+		$sql = 'DELETE FROM `*PREFIX*storages` WHERE `id` = ?';
+		\OC_DB::executeAudited($sql, array($storageId));
+
+		$sql = 'DELETE FROM `*PREFIX*filecache` WHERE `storage` = ?';
+		\OC_DB::executeAudited($sql, array($numericId));
+	}
 }
diff --git a/lib/private/files/type/detection.php b/lib/private/files/type/detection.php
index d7cc9ebbf4e9a5cb905bf9b8f5e25a989d9c0986..11e439032ce3df8feeff5eaa60889942e92cc9ba 100644
--- a/lib/private/files/type/detection.php
+++ b/lib/private/files/type/detection.php
@@ -72,11 +72,12 @@ class Detection {
 			and function_exists('finfo_file') and $finfo = finfo_open(FILEINFO_MIME)
 		) {
 			$info = @strtolower(finfo_file($finfo, $path));
+			finfo_close($finfo);
 			if ($info) {
 				$mimeType = substr($info, 0, strpos($info, ';'));
 				return empty($mimeType) ? 'application/octet-stream' : $mimeType;
 			}
-			finfo_close($finfo);
+
 		}
 		$isWrapped = (strpos($path, '://') !== false) and (substr($path, 0, 7) === 'file://');
 		if (!$isWrapped and $mimeType === 'application/octet-stream' && function_exists("mime_content_type")) {
diff --git a/lib/private/l10n.php b/lib/private/l10n.php
index 98665c84c55f30c28823f8d59dbf1dd8ecf9c6cb..1aa1dc5ea28d90d03eb7edd02fbf3e60c8dbac53 100644
--- a/lib/private/l10n.php
+++ b/lib/private/l10n.php
@@ -132,10 +132,10 @@ class OC_L10N implements \OCP\IL10N {
 			$i18ndir = self::findI18nDir($app);
 			// Localization is in /l10n, Texts are in $i18ndir
 			// (Just no need to define date/time format etc. twice)
-			if((OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC_App::getAppPath($app).'/l10n/')
-				|| OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC::$SERVERROOT.'/core/l10n/')
+			if((OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC::$SERVERROOT.'/core/l10n/')
 				|| OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC::$SERVERROOT.'/lib/l10n/')
 				|| OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC::$SERVERROOT.'/settings')
+				|| OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC_App::getAppPath($app).'/l10n/')
 				)
 				&& file_exists($i18ndir.$lang.'.php')) {
 				// Include the file, save the data from $CONFIG
diff --git a/lib/private/memcache/memcached.php b/lib/private/memcache/memcached.php
index 978e6c2eff12b398beead40859e2eb87a2367e10..075828eebad2c562257a2e1cf18284ee05a5e6c7 100644
--- a/lib/private/memcache/memcached.php
+++ b/lib/private/memcache/memcached.php
@@ -18,8 +18,16 @@ class Memcached extends Cache {
 		parent::__construct($prefix);
 		if (is_null(self::$cache)) {
 			self::$cache = new \Memcached();
-			list($host, $port) = \OC_Config::getValue('memcached_server', array('localhost', 11211));
-			self::$cache->addServer($host, $port);
+			$servers = \OC_Config::getValue('memcached_servers');
+			if (!$servers) {
+				$server = \OC_Config::getValue('memcached_server');
+				if ($server) {
+					$servers = array($server);
+				} else {
+					$servers = array(array('localhost', 11211));
+				}
+			}
+			self::$cache->addServers($servers);
 		}
 	}
 
diff --git a/lib/private/ocs/result.php b/lib/private/ocs/result.php
index 84f06fa01c7d69b6269bb458b8cbdecc93814009..9f14e8da7e8d7b6499a3d138d425a835bf03973f 100644
--- a/lib/private/ocs/result.php
+++ b/lib/private/ocs/result.php
@@ -29,7 +29,13 @@ class OC_OCS_Result{
 	 * @param $data mixed the data to return
 	 */
 	public function __construct($data=null, $code=100, $message=null) {
-		$this->data = $data;
+		if ($data === null) {
+			$this->data = array();
+		} elseif (!is_array($data)) {
+			$this->data = array($this->data);
+		} else {
+			$this->data = $data;
+		}
 		$this->statusCode = $code;
 		$this->message = $message;
 	}
@@ -49,7 +55,7 @@ class OC_OCS_Result{
 	public function setItemsPerPage(int $items) {
 		$this->perPage = $items;
 	}
-	
+
 	/**
 	 * get the status code
 	 * @return int
@@ -57,7 +63,7 @@ class OC_OCS_Result{
 	public function getStatusCode() {
 		return $this->statusCode;
 	}
-	
+
 	/**
 	 * get the meta data for the result
 	 * @return array
@@ -76,15 +82,15 @@ class OC_OCS_Result{
 		return $meta;
 
 	}
-	
+
 	/**
 	 * get the result data
-	 * @return array|string|int 
+	 * @return array
 	 */
 	public function getData() {
 		return $this->data;
 	}
-	
+
 	/**
 	 * return bool if the method succedded
 	 * @return bool
diff --git a/lib/private/preview/office.php b/lib/private/preview/office.php
index 7a4826c76ecbdb535ff22bce60770aac662bef64..884b6e7dc9bac4af546bd7d7ebcfed56d577769e 100644
--- a/lib/private/preview/office.php
+++ b/lib/private/preview/office.php
@@ -6,7 +6,7 @@
  * See the COPYING-README file.
  */
 //both, libreoffice backend and php fallback, need imagick
-if (extension_loaded('imagick')) {
+if (extension_loaded('imagick') && count(\Imagick::queryFormats("PDF")) === 1) {
 	$isShellExecEnabled = \OC_Helper::is_function_enabled('shell_exec');
 
 	// LibreOffice preview is currently not supported on Windows
diff --git a/lib/private/preview/pdf.php b/lib/private/preview/pdf.php
index cc974b68818662a8ebe9e0c15c14760af9bc26fd..572b8788ac92a1a52a0633e409ace52addc1cfbf 100644
--- a/lib/private/preview/pdf.php
+++ b/lib/private/preview/pdf.php
@@ -7,7 +7,7 @@
  */
 namespace OC\Preview;
 
-if (extension_loaded('imagick')) {
+if (extension_loaded('imagick') && count(\Imagick::queryFormats("PDF")) === 1) {
 
 	class PDF extends Provider {
 
diff --git a/lib/private/preview/svg.php b/lib/private/preview/svg.php
index b49e51720fa140f304d7ddd71c38e371de2cc30c..07a37e8f8c13aded24f57d1ac746c800cd9ab777 100644
--- a/lib/private/preview/svg.php
+++ b/lib/private/preview/svg.php
@@ -7,7 +7,7 @@
  */
 namespace OC\Preview;
 
-if (extension_loaded('imagick')) {
+if (extension_loaded('imagick') && count(\Imagick::queryFormats("SVG")) === 1) {
 
 	class SVG extends Provider {
 
diff --git a/lib/private/preview/unknown.php b/lib/private/preview/unknown.php
index 4747f9e25ed0633010d08eac3ea1d4249af515a0..8145c826149211b53a8f479858d2462677987196 100644
--- a/lib/private/preview/unknown.php
+++ b/lib/private/preview/unknown.php
@@ -22,7 +22,7 @@ class Unknown extends Provider {
 
 		$svgPath = substr_replace($path, 'svg', -3);
 
-		if (extension_loaded('imagick') && file_exists($svgPath)) {
+		if (extension_loaded('imagick') && file_exists($svgPath) && count(\Imagick::queryFormats("SVG")) === 1) {
 
 			// http://www.php.net/manual/de/imagick.setresolution.php#85284
 			$svg = new \Imagick();
diff --git a/lib/private/setup/mysql.php b/lib/private/setup/mysql.php
index d97b6d2602fac048aa187ed9407d379b6786c612..b2c28173b1c61a57fb964ada4d28d7f15d5b77e7 100644
--- a/lib/private/setup/mysql.php
+++ b/lib/private/setup/mysql.php
@@ -3,13 +3,13 @@
 namespace OC\Setup;
 
 class MySQL extends AbstractDatabase {
-	public $dbprettyname = 'MySQL';
+	public $dbprettyname = 'MySQL/MariaDB';
 
 	public function setupDatabase($username) {
 		//check if the database user has admin right
 		$connection = @mysql_connect($this->dbhost, $this->dbuser, $this->dbpassword);
 		if(!$connection) {
-			throw new \DatabaseSetupException($this->trans->t('MySQL username and/or password not valid'),
+			throw new \DatabaseSetupException($this->trans->t('MySQL/MariaDB username and/or password not valid'),
 				$this->trans->t('You need to enter either an existing account or the administrator.'));
 		}
 		$oldUser=\OC_Config::getValue('dbuser', false);
@@ -82,14 +82,14 @@ class MySQL extends AbstractDatabase {
 		$query = "CREATE USER '$name'@'localhost' IDENTIFIED BY '$password'";
 		$result = mysql_query($query, $connection);
 		if (!$result) {
-			throw new \DatabaseSetupException($this->trans->t("MySQL user '%s'@'localhost' exists already.", array($name)),
-				$this->trans->t("Drop this user from MySQL", array($name)));
+			throw new \DatabaseSetupException($this->trans->t("MySQL/MariaDB user '%s'@'localhost' exists already.", array($name)),
+				$this->trans->t("Drop this user from MySQL/MariaDB", array($name)));
 		}
 		$query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'";
 		$result = mysql_query($query, $connection);
 		if (!$result) {
-			throw new \DatabaseSetupException($this->trans->t("MySQL user '%s'@'%%' already exists", array($name)),
-				$this->trans->t("Drop this user from MySQL."));
+			throw new \DatabaseSetupException($this->trans->t("MySQL/MariaDB user '%s'@'%%' already exists", array($name)),
+				$this->trans->t("Drop this user from MySQL/MariaDB."));
 		}
 	}
 }
diff --git a/lib/private/share/searchresultsorter.php b/lib/private/share/searchresultsorter.php
new file mode 100644
index 0000000000000000000000000000000000000000..fbf771790970f48d44efe734be9a159b23ec66a4
--- /dev/null
+++ b/lib/private/share/searchresultsorter.php
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Copyright (c) 2014 Arthur Schiwon <blizzz@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ *
+ */
+namespace OC\Share;
+
+class SearchResultSorter {
+	private $search;
+	private $encoding;
+	private $key;
+	private $log;
+
+	/**
+	 * @param $search the search term as was given by the user
+	 * @param $key the array key containing the value that should be compared
+	 * against
+	 * @param $encoding optional, encoding to use, defaults to UTF-8
+	 * @param $log optional, an \OC\Log instance
+	 */
+	public function __construct($search, $key, \OC\Log $log = null, $encoding = 'UTF-8') {
+		$this->encoding = $encoding;
+		$this->key = $key;
+		$this->log = $log;
+		$this->search = mb_strtolower($search, $this->encoding);
+	}
+
+	/**
+	 * User and Group names matching the search term at the beginning shall appear
+	 * on top of the share dialog. Following entries in alphabetical order.
+	 * Callback function for usort. http://php.net/usort
+	 */
+	public function sort($a, $b) {
+		if(!isset($a[$this->key]) || !isset($b[$this->key])) {
+			if(!is_null($this->log)) {
+				$this->log->error('Sharing dialogue: cannot sort due to ' .
+								  'missing array key', array('app' => 'core'));
+			}
+			return 0;
+		}
+		$nameA = mb_strtolower($a[$this->key], $this->encoding);
+		$nameB = mb_strtolower($b[$this->key], $this->encoding);
+		$i = mb_strpos($nameA, $this->search, 0, $this->encoding);
+		$j = mb_strpos($nameB, $this->search, 0, $this->encoding);
+
+		if($i === $j || $i > 0 && $j > 0) {
+			return strcmp(mb_strtolower($nameA, $this->encoding),
+						  mb_strtolower($nameB, $this->encoding));
+		} elseif ($i === 0) {
+			return -1;
+		} else {
+			return 1;
+		}
+	}
+}
+
diff --git a/lib/private/user.php b/lib/private/user.php
index 98ebebbe5c18bb0a153f8f51c4355eccd72ecb88..2519200d0f0cc153c27f09cd24c06dd354d19ed5 100644
--- a/lib/private/user.php
+++ b/lib/private/user.php
@@ -205,6 +205,9 @@ class OC_User {
 				// Delete user files in /data/
 				OC_Helper::rmdirr(\OC_User::getHome($uid));
 
+				// Delete the users entry in the storage table
+				\OC\Files\Cache\Storage::remove('home::' . $uid);
+
 				// Remove it from the Cache
 				self::getManager()->delete($uid);
 			}
diff --git a/lib/public/share.php b/lib/public/share.php
index f832d04a70f6292dc28268258983b4d2d27c9777..ae7d29e8b87f7ff6027fd96dcdca946e8fcfd561 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -1152,7 +1152,7 @@ class Share {
 						$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `*PREFIX*share`.`parent`, `uid_owner`, '
 							.'`share_type`, `share_with`, `file_source`, `path`, `file_target`, '
 							.'`permissions`, `expiration`, `storage`, `*PREFIX*filecache`.`parent` as `file_parent`, '
-							.'`name`, `mtime`, `mimetype`, `mimepart`, `size`, `encrypted`, `etag`, `mail_send`';
+							.'`name`, `mtime`, `mimetype`, `mimepart`, `size`, `unencrypted_size`, `encrypted`, `etag`, `mail_send`';
 					} else {
 						$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `item_target`,
 							`*PREFIX*share`.`parent`, `share_type`, `share_with`, `uid_owner`,
diff --git a/settings/js/personal.js b/settings/js/personal.js
index e6e1d538a194d5fba98cc9738c8d2aa638ef9848..3b8764677561523f106d7cdbdcd85464b5928a9d 100644
--- a/settings/js/personal.js
+++ b/settings/js/personal.js
@@ -158,7 +158,7 @@ $(document).ready(function(){
             if(typeof timeout !== 'undefined'){
                 clearTimeout(timeout);
             }
-            timeout = setTimeout('changeDisplayName()',1000);
+            timeout = setTimeout(changeDisplayName, 1000);
         }
     });
 
@@ -173,7 +173,7 @@ $(document).ready(function(){
             if(typeof timeout !== 'undefined'){
                 clearTimeout(timeout);
             }
-            timeout = setTimeout('changeEmailAddress()',1000);
+            timeout = setTimeout(changeEmailAddress, 1000);
         }
     });
 
diff --git a/tests/lib/share/searchresultsorter.php b/tests/lib/share/searchresultsorter.php
new file mode 100644
index 0000000000000000000000000000000000000000..eaf93400a7d9b9ff0a99b2272c0a6560a890ea77
--- /dev/null
+++ b/tests/lib/share/searchresultsorter.php
@@ -0,0 +1,47 @@
+<?php
+/**
+* ownCloud
+*
+* @author Arthur Schiwon
+* @copyright 2014 Arthur Schiwon <blizzz@owncloud.com>
+*
+* 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/>.
+*/
+
+class Test_Share_Search extends \PHPUnit_Framework_TestCase {
+	public function testSort() {
+		$search = 'lin';
+		$sorter = new \OC\Share\SearchResultSorter($search, 'foobar');
+
+		$result = array(
+			array('foobar' => 'woot'),
+			array('foobar' => 'linux'),
+			array('foobar' => 'Linus'),
+			array('foobar' => 'Bicyclerepairwoman'),
+		);
+
+		usort($result, array($sorter, 'sort'));
+		$this->assertTrue($result[0]['foobar'] === 'Linus');
+		$this->assertTrue($result[1]['foobar'] === 'linux');
+		$this->assertTrue($result[2]['foobar'] === 'Bicyclerepairwoman');
+		$this->assertTrue($result[3]['foobar'] === 'woot');
+	}
+
+	/**
+     * @expectedException PHPUnit_Framework_Error
+     */
+	public function testSortWrongLog() {
+		$sorter = new \OC\Share\SearchResultSorter('foo', 'bar', 'UTF-8', 'foobar');
+	}
+}