diff --git a/apps/calendar/appinfo/app.php b/apps/calendar/appinfo/app.php
index 22b91a41efea44626209e44ba511eb34cb34d07d..3c8cc76133e5976f9219dd53c0ea6993ff44f5e6 100644
--- a/apps/calendar/appinfo/app.php
+++ b/apps/calendar/appinfo/app.php
@@ -9,12 +9,17 @@ OC::$CLASSPATH['OC_Calendar_Repeat'] = 'apps/calendar/lib/repeat.php';
 OC::$CLASSPATH['OC_Calendar_Share'] = 'apps/calendar/lib/share.php';
 OC::$CLASSPATH['OC_Search_Provider_Calendar'] = 'apps/calendar/lib/search.php';
 OC::$CLASSPATH['OC_Calendar_Export'] = 'apps/calendar/lib/export.php';
+//General Hooks
 OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Calendar_Hooks', 'deleteUser');
+//Repeating Events Hooks
 OCP\Util::connectHook('OC_Calendar', 'addEvent', 'OC_Calendar_Repeat', 'generate');
 OCP\Util::connectHook('OC_Calendar', 'editEvent', 'OC_Calendar_Repeat', 'update');
 OCP\Util::connectHook('OC_Calendar', 'deleteEvent', 'OC_Calendar_Repeat', 'clean');
 OCP\Util::connectHook('OC_Calendar', 'moveEvent', 'OC_Calendar_Repeat', 'update');
 OCP\Util::connectHook('OC_Calendar', 'deleteCalendar', 'OC_Calendar_Repeat', 'cleanCalendar');
+//Sharing Hooks
+OCP\Util::connectHook('OC_Calendar', 'deleteEvent', 'OC_Calendar_Share', 'post_eventdelete');
+OCP\Util::connectHook('OC_Calendar', 'deleteCalendar', 'OC_Calendar_Share', 'post_caldelete');
 OCP\Util::addscript('calendar','loader');
 OCP\Util::addscript("3rdparty", "chosen/chosen.jquery.min");
 OCP\Util::addStyle("3rdparty", "chosen/chosen");
diff --git a/apps/calendar/js/loader.js b/apps/calendar/js/loader.js
index 0fc5018e89c55b7b6b9833bb6aa4c8658fefae77..cef95afc3aa46d7aaf1c9e85e09a05f61eb06934 100644
--- a/apps/calendar/js/loader.js
+++ b/apps/calendar/js/loader.js
@@ -44,7 +44,7 @@ Calendar_Import={
 			$('#newcalendar').attr('readonly', 'readonly');
 			$('#calendar').attr('disabled', 'disabled');
 			var progresskey = $('#progresskey').val();
-			$.post(OC.filePath('calendar', 'ajax/import', 'import.php') + '?progresskey='+progresskey, {method: String (method), calname: String (calname), path: String (path), file: String (filename), id: String (calid)}, function(data){
+			$.post(OC.filePath('calendar', 'ajax/import', 'import.php'), {progresskey: progresskey, method: String (method), calname: String (calname), path: String (path), file: String (filename), id: String (calid)}, function(data){
 				if(data.status == 'success'){
 					$('#progressbar').progressbar('option', 'value', 100);
 					$('#import_done').css('display', 'block');
diff --git a/apps/calendar/lib/app.php b/apps/calendar/lib/app.php
index 344c89f36b0d6fa6853918b84237f2120b4a5f49..ca897a36dc02e9b914afe8117459c52593cc0081 100644
--- a/apps/calendar/lib/app.php
+++ b/apps/calendar/lib/app.php
@@ -368,12 +368,14 @@ class OC_Calendar_App{
 	 * @return (array) $output - readable output
 	 */
 	public static function generateEventOutput($event, $start, $end){
-		if(isset($event['calendardata'])){
-			$object = OC_VObject::parse($event['calendardata']);
-			$vevent = $object->VEVENT;
-		}else{
-			$vevent = $event['vevent'];
+		if(!isset($event['calendardata']) && !isset($event['vevent'])){
+			return false;
 		}
+		if(!isset($event['calendardata']) && isset($event['vevent'])){
+			$event['calendardata'] = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud's Internal iCal System\n" . $event['vevent']->serialize() .  "END:VCALENDAR";
+		}
+		$object = OC_VObject::parse($event['calendardata']);
+		$vevent = $object->VEVENT;
 		$return = array();
 		$id = $event['id'];
 		$allday = ($vevent->DTSTART->getDateType() == Sabre_VObject_Element_DateTime::DATE)?true:false;
@@ -404,7 +406,7 @@ class OC_Calendar_App{
 				$return[] = array_merge($staticoutput, $dynamicoutput);
 			}
 		}else{
-			if(OC_Calendar_Object::isrepeating($id)){
+			if(OC_Calendar_Object::isrepeating($id) || $event['repeating'] == 1){
 				$object->expand($start, $end);
 			}
 			foreach($object->getComponents() as $singleevent){
@@ -412,7 +414,7 @@ class OC_Calendar_App{
 					continue;
 				}
 				$dynamicoutput = OC_Calendar_Object::generateStartEndDate($singleevent->DTSTART, OC_Calendar_Object::getDTEndFromVEvent($singleevent), $allday, self::$tz);
-				$return[] = array_merge($staticoutput, $dynamicoutput);
+				$return[] = array_merge($staticoutput, $dynamicoutput);			
 			}
 		}
 		return $return;
diff --git a/apps/calendar/lib/share.php b/apps/calendar/lib/share.php
index 54c531892f05b3c095b83022a6619fbab2fc91fb..01502f1c6b069062f79d9bad1cc4a3a1c69a326e 100644
--- a/apps/calendar/lib/share.php
+++ b/apps/calendar/lib/share.php
@@ -258,7 +258,7 @@ class OC_Calendar_Share{
 		}
 
 		/*
-		 * @brief delete all shared calendars / events after a user was deleted
+		 * @brief deletes all shared calendars / events after a user was deleted
 		 * @param (string) $userid
 		 * @return (bool)
 		 */
@@ -273,4 +273,26 @@ class OC_Calendar_Share{
 			$stmt->execute(array($userid));
 			return true;
 		}
+		
+		/*
+		 * @brief deletes all shared events of a calendar
+		 * @param integer $calid
+		 * @return boolean
+		 */
+		public static function post_caldelete($calid){
+			$stmt = OCP\DB::prepare('DELETE FROM *PREFIX*calendar_share_calendar WHERE calendarid = ?');
+			$stmt->execute(array($calid));
+			return true;
+		}
+		
+		/*
+		 * @brief deletes all shares of an event
+		 * @param integer $eventid
+		 * @return boolean
+		 */
+		public static function post_eventdelete($eventid){
+			$stmt = OCP\DB::prepare('DELETE FROM *PREFIX*calendar_share_event WHERE eventid = ?');
+			$stmt->execute(array($eventid));
+			return true;
+		}
 }
\ No newline at end of file
diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js
index 9d41b70a314e8a155e186427f5e30ca6808795bf..5be1fa61292b860677c4a009a12cda2e0f3bcc24 100644
--- a/apps/contacts/js/contacts.js
+++ b/apps/contacts/js/contacts.js
@@ -1621,19 +1621,21 @@ Contacts={
 							var contactlist = $('#contacts ul[data-id="'+b+'"]');
 							for(var c in book.contacts) {
 								if(book.contacts[c].id == undefined) { continue; }
-								var contact = Contacts.UI.Card.createEntry(book.contacts[c]);
-								if(c == self.batchnum-5) {
-									contact.bind('inview', function(event, isInView, visiblePartX, visiblePartY) {
-										$(this).unbind(event);
-										var bookid = $(this).data('bookid');
-										var numsiblings = $('.contacts li[data-bookid="'+bookid+'"]').length;
-										if (isInView && numsiblings >= self.batchnum) {
-											console.log('This would be a good time to load more contacts.');
-											Contacts.UI.Contacts.update(id, bookid, $('#contacts li[data-bookid="'+bookid+'"]').length);
-										}
-									});
+								if($('#contacts li[data-id="'+book.contacts[c]['id']+'"][data-id="'+book.contacts[c]['bookid']+'"]').length == 0) {
+									var contact = Contacts.UI.Card.createEntry(book.contacts[c]);
+									if(c == self.batchnum-5) {
+										contact.bind('inview', function(event, isInView, visiblePartX, visiblePartY) {
+											$(this).unbind(event);
+											var bookid = $(this).data('bookid');
+											var numsiblings = $('.contacts li[data-bookid="'+bookid+'"]').length;
+											if (isInView && numsiblings >= self.batchnum) {
+												console.log('This would be a good time to load more contacts.');
+												Contacts.UI.Contacts.update(id, bookid, $('#contacts li[data-bookid="'+bookid+'"]').length);
+											}
+										});
+									}
+									contactlist.append(contact);
 								}
-								contactlist.append(contact);
 							}
 						});
 						if($('#contacts h3').length > 1) {
diff --git a/apps/contacts/lib/hooks.php b/apps/contacts/lib/hooks.php
index 9794a9c9b94a299814ee928db6a12a0a994b72d5..d91d3c565b52fcc20aa47dda028df6911b483b66 100644
--- a/apps/contacts/lib/hooks.php
+++ b/apps/contacts/lib/hooks.php
@@ -90,9 +90,10 @@ class OC_Contacts_Hooks{
 			if ($birthday) {
 				$date = new DateTime($birthday);
 				$vevent = new OC_VObject('VEVENT');
-				$vevent->setDateTime('LAST-MODIFIED', new DateTime($vcard->REV));
+				//$vevent->setDateTime('LAST-MODIFIED', new DateTime($vcard->REV));
 				$vevent->setDateTime('DTSTART', $date, Sabre_VObject_Element_DateTime::DATE);
 				$vevent->setString('DURATION', 'P1D');
+				$vevent->setString('UID', substr(md5(rand().time()),0,10));
 				// DESCRIPTION?
 				$vevent->setString('RRULE', 'FREQ=YEARLY');
 				$title = str_replace('{name}', $vcard->getAsString('FN'), OC_Contacts_App::$l10n->t('{name}\'s Birthday'));
@@ -101,6 +102,7 @@ class OC_Contacts_Hooks{
 					'vevent' => $vevent,
 					'repeating' => true,
 					'summary' => $title,
+					'calendardata' => "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud Contacts " . OCP\App::getAppVersion('contacts') . "\n" . $vevent->serialize() .  "END:VCALENDAR"
 					);
 			}
 		}
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 3ba473e023d6f8b60d3f4f2b6940ec4663df5a2a..86c5185bf728b6752b2f924375531259bdc61a7e 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -451,7 +451,7 @@ $(document).ready(function() {
 		$(this).append(input);
 		input.focus();
 		input.change(function(){
-			var name=$(this).val();
+			var name=getUniqueName($(this).val());
 			if(type != 'web' && name.indexOf('/')!=-1){
 				$('#notification').text(t('files','Invalid name, \'/\' is not allowed.'));
 				$('#notification').fadeIn();
@@ -496,6 +496,7 @@ $(document).ready(function() {
 					}else{//or the domain
 						localName=(localName.match(/:\/\/(.[^/]+)/)[1]).replace('www.','');
 					}
+					localName = getUniqueName(localName);
 					$.post(
 						OC.filePath('files','ajax','newfile.php'),
 						{dir:$('#dir').val(),source:name,filename:localName},
@@ -737,7 +738,10 @@ getMimeIcon.cache={};
 function getUniqueName(name){
 	if($('tr').filterAttr('data-file',name).length>0){
 		var parts=name.split('.');
-		var extension=parts.pop();
+		var extension = "";
+		if (parts.length > 1) {
+			extension=parts.pop();
+		}
 		var base=parts.join('.');
 		numMatch=base.match(/\((\d+)\)/);
 		var num=2;
@@ -747,7 +751,10 @@ function getUniqueName(name){
 			base.pop();
 			base=base.join('(').trim();
 		}
-		name=base+' ('+num+').'+extension;
+		name=base+' ('+num+')';
+		if (extension) {
+			name = name+'.'+extension;
+		}
 		return getUniqueName(name);
 	}
 	return name;
diff --git a/apps/files_encryption/tests/proxy.php b/apps/files_encryption/tests/proxy.php
index fcfc4cfb9f0bcd43bb76e5705c09cff82d005eb7..5463836a209da9bffe2aec5b15478ced6c065b79 100644
--- a/apps/files_encryption/tests/proxy.php
+++ b/apps/files_encryption/tests/proxy.php
@@ -11,6 +11,8 @@ class Test_CryptProxy extends UnitTestCase {
 	private $oldKey;
 	
 	public function setUp(){
+		$user=OC_User::getUser();
+
 		$this->oldConfig=OCP\Config::getAppValue('files_encryption','enable_encryption','true');
 		OCP\Config::setAppValue('files_encryption','enable_encryption','true');
 		$this->oldKey=isset($_SESSION['enckey'])?$_SESSION['enckey']:null;
@@ -30,10 +32,12 @@ class Test_CryptProxy extends UnitTestCase {
 		OC_Filesystem::clearMounts();
 		OC_Filesystem::mount('OC_Filestorage_Temporary',array(),'/');
 
+		OC_Filesystem::init('/'.$user.'/files');
+
 		//set up the users home folder in the temp storage
 		$rootView=new OC_FilesystemView('');
-		$rootView->mkdir('/'.OC_User::getUser());
-		$rootView->mkdir('/'.OC_User::getUser().'/files');
+		$rootView->mkdir('/'.$user);
+		$rootView->mkdir('/'.$user.'/files');
 	}
 
 	public function tearDown(){
diff --git a/apps/files_external/js/dropbox.js b/apps/files_external/js/dropbox.js
index 67f3c46a6ed3f2b9534fb307b1dfa8426bdb9fc6..08796cbbdc9c23215bb6ea6b8448c5f744ffffcd 100644
--- a/apps/files_external/js/dropbox.js
+++ b/apps/files_external/js/dropbox.js
@@ -23,7 +23,6 @@ $(document).ready(function() {
 					});
 				}
 			}
-			return false;
 		}
 	});
 
diff --git a/apps/files_external/js/google.js b/apps/files_external/js/google.js
index 84c74c57421a221255ab201d176b83da388ffb79..55042194c7db5c9be799f7182e13dfe20f7cbbea 100644
--- a/apps/files_external/js/google.js
+++ b/apps/files_external/js/google.js
@@ -24,7 +24,6 @@ $(document).ready(function() {
 					});
 				}
 			}
-			return false;
 		}
 	});
 	
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js
index 57188a6a266e4bbcb8163fc7fe5ba4959c3e7e55..1c366a79c7a63e0d6d19d7897a4f461c44ba0072 100644
--- a/apps/files_external/js/settings.js
+++ b/apps/files_external/js/settings.js
@@ -27,7 +27,7 @@ OC.MountConfig={
 			}
 		});
 		if (addMountPoint) {
-			if ($('#externalStorage').data('admin')) {
+			if ($('#externalStorage').data('admin') === true) {
 				var isPersonal = false;
 				var multiselect = $(tr).find('.chzn-select').val();
 				var oldGroups = $(tr).find('.applicable').data('applicable-groups');
@@ -73,7 +73,8 @@ $(document).ready(function() {
 	
 	$('#selectBackend').live('change', function() {
 		var tr = $(this).parent().parent();
-		$('#externalStorage tbody').last().append($(tr).clone());
+		$('#externalStorage tbody').append($(tr).clone());
+		$('#externalStorage tbody tr').last().find('.mountPoint input').val('');
 		var selected = $(this).find('option:selected').text();
 		var backendClass = $(this).val();
 		$(this).parent().text(selected);
@@ -103,6 +104,7 @@ $(document).ready(function() {
 		});
 		$('.chz-select').chosen();
 		$(tr).find('td').last().attr('class', 'remove');
+		$(tr).find('td').last().removeAttr('style');
 		$(tr).removeAttr('id');
 		$(this).remove();
 	});
@@ -117,7 +119,7 @@ $(document).ready(function() {
 		if (mountPoint == '') {
 			return false;
 		}
-		if ($('#externalStorage').data('admin')) {
+		if ($('#externalStorage').data('admin') === true) {
 			var isPersonal = false;
 			var multiselect = $(tr).find('.chzn-select').val();
 			$.each(multiselect, function(index, value) {
diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php
index d136f04f3eb5e7f90ea5bd7c2ffbbc761b0ee256..d0fe2aca8541537b81a32cfa52beecf1b9474639 100644
--- a/apps/files_external/lib/webdav.php
+++ b/apps/files_external/lib/webdav.php
@@ -20,10 +20,14 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
 	private static $tempFiles=array();
 	
 	public function __construct($params){
-		$this->host=$params['host'];
+		$host = $params['host'];
+		//remove leading http[s], will be generated in createBaseUri()
+		if (substr($host,0,8) == "https://") $host = substr($host, 8);
+		else if (substr($host,0,7) == "http://") $host = substr($host, 7);
+		$this->host=$host;
 		$this->user=$params['user'];
 		$this->password=$params['password'];
-		$this->secure=isset($params['secure'])?(bool)$params['secure']:false;
+		$this->secure=(isset($params['secure']) && $params['secure'] == 'true')?true:false;
 		$this->root=isset($params['root'])?$params['root']:'/';
 		if(!$this->root || $this->root[0]!='/'){
 			$this->root='/'.$this->root;
@@ -46,7 +50,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
 	private function createBaseUri(){
 		$baseUri='http';
 		if($this->secure){
-			$baseUri.'s';
+			$baseUri.='s';
 		}
 		$baseUri.='://'.$this->host.$this->root;
 		return $baseUri;
@@ -69,13 +73,15 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
 			$stripLength=strlen($this->root)+strlen($path);
 			$id=md5('webdav'.$this->root.$path);
 			OC_FakeDirStream::$dirs[$id]=array();
+			$skip = true;
 			foreach($response as $file=>$data){
-				//strip root and path
-				$file=trim(substr($file,$stripLength));
-				$file=trim($file,'/');
-				if($file){
-					OC_FakeDirStream::$dirs[$id][]=$file;
+				// Skip the first file, because it is the current directory
+				if ($skip) {
+					$skip = false;
+					continue;
 				}
+				$file = urldecode(basename($file));
+				OC_FakeDirStream::$dirs[$id][]=$file;
 			}
 			return opendir('fakedir://'.$id);
 		}catch(Exception $e){
@@ -240,15 +246,11 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
 		$path=$this->cleanPath($path);
 		try{
 			$response=$this->client->propfind($path, array('{DAV:}getlastmodified','{DAV:}getcontentlength'));
-			if(isset($response['{DAV:}getlastmodified']) and isset($response['{DAV:}getcontentlength'])){
-				return array(
-					'mtime'=>strtotime($response['{DAV:}getlastmodified']),
-					'size'=>(int)$response['{DAV:}getcontentlength'],
-					'ctime'=>-1,
-				);
-			}else{
-				return array();
-			}
+			return array(
+				'mtime'=>strtotime($response['{DAV:}getlastmodified']),
+				'size'=>(int)isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0,
+				'ctime'=>-1,
+			);
 		}catch(Exception $e){
 			return array();
 		}
diff --git a/apps/files_external/personal.php b/apps/files_external/personal.php
index 32e087424429720a1b0d88029b928e4087a5868f..b758e7e7eb089cfb9179f3cca4fa7d0affffe4f2 100755
--- a/apps/files_external/personal.php
+++ b/apps/files_external/personal.php
@@ -26,7 +26,7 @@ $backends = OC_Mount_Config::getBackends();
 // Remove local storage
 unset($backends['OC_Filestorage_Local']);
 $tmpl = new OCP\Template('files_external', 'settings');
-$tmpl->assign('isAdminPage', false);
+$tmpl->assign('isAdminPage', false, false);
 $tmpl->assign('mounts', OC_Mount_Config::getPersonalMountPoints());
 $tmpl->assign('backends', $backends);
 return $tmpl->fetchPage();
diff --git a/apps/files_external/settings.php b/apps/files_external/settings.php
index 983855ecdcc3fbfac13824f725d80a56e0d9a3da..acc9036b299822f894cc40f713b93afa8fa4a658 100644
--- a/apps/files_external/settings.php
+++ b/apps/files_external/settings.php
@@ -23,7 +23,7 @@
 OCP\Util::addScript('files_external', 'settings');
 OCP\Util::addStyle('files_external', 'settings');
 $tmpl = new OCP\Template('files_external', 'settings');
-$tmpl->assign('isAdminPage', true);
+$tmpl->assign('isAdminPage', true, false);
 $tmpl->assign('mounts', OC_Mount_Config::getSystemMountPoints());
 $tmpl->assign('backends', OC_Mount_Config::getBackends());
 $tmpl->assign('groups', OC_Group::getGroups());
diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php
index 6c37df8001eb93004d57c5234168cee8aa9d2d06..e651c4574d70729ca96e4d8d6d1d21e542527126 100644
--- a/apps/files_external/templates/settings.php
+++ b/apps/files_external/templates/settings.php
@@ -1,7 +1,7 @@
 <form id="files_external">
 	<fieldset class="personalblock">
 	<legend><strong><?php echo $l->t('External Storage'); ?></strong></legend>
-		<table id="externalStorage" data-admin="<?php echo json_encode($_['isAdminPage']); ?>">
+		<table id="externalStorage" data-admin='<?php echo json_encode($_['isAdminPage']); ?>'>
 			<thead>
 				<tr>
 					<th><?php echo $l->t('Mount point'); ?></th>
@@ -39,7 +39,7 @@
 									<?php elseif(strpos($placeholder, '!') !== false): ?>
 										<label><input type="checkbox" data-parameter="<?php echo $parameter; ?>" <?php if ($value == 'true') echo ' checked="checked"'; ?>  /><?php echo substr($placeholder, 1); ?></label>
 									<?php elseif (strpos($placeholder, '&') !== false): ?>
-										<input type="text" class="optional" data-parameter="<?php echo $parameter; ?>" value="<?php echo $value; ?>" placeholder="<?php echo substr($placeholder, 1); ?>" />
+										<input type="text" class="optional" data-parameter="<?php echo $parameter; ?>" value="<?php echo $value; ?>" placeholder="<?php echo substr($placeholder, 5); ?>" />
 									<?php elseif (strpos($placeholder, '#') !== false): ?>
 										<input type="hidden" data-parameter="<?php echo $parameter; ?>" value="<?php echo $value; ?>" />
 									<?php else: ?>
@@ -74,7 +74,7 @@
 							</select>
 						</td>
 					<?php endif; ?>
-					<td <?php if ($mountPoint != '') echo 'class="remove"'; ?>><img alt="<?php echo $l->t('Delete'); ?>" title="<?php echo $l->t('Delete'); ?>" class="svg action" src="<?php echo image_path('core', 'actions/delete.svg'); ?>" /></td>
+					<td <?php echo ($mountPoint != '') ? 'class="remove"' : 'style="visibility:hidden;"'; ?>><img alt="<?php echo $l->t('Delete'); ?>" title="<?php echo $l->t('Delete'); ?>" class="svg action" src="<?php echo image_path('core', 'actions/delete.svg'); ?>" /></td>
 				</tr>
 			<?php endforeach; ?>
 			</tbody>
diff --git a/apps/gallery/lib/managers.php b/apps/gallery/lib/managers.php
index fcce3f40e23d673b7db22adef3e62880a141dace..17eb741a660e0accfe2dcd2cd199ee17b589d197 100644
--- a/apps/gallery/lib/managers.php
+++ b/apps/gallery/lib/managers.php
@@ -4,6 +4,7 @@ namespace OC\Pictures;
 
 class DatabaseManager {
 	private static $instance = null;
+	protected $cache = array();
 	const TAG = 'DatabaseManager';
 	
 	public static function getInstance() {
@@ -12,13 +13,27 @@ class DatabaseManager {
 		return self::$instance;
 	}
 	
+	protected function getPathData($path) {
+		$stmt = \OCP\DB::prepare('SELECT * FROM *PREFIX*pictures_images_cache
+			WHERE uid_owner LIKE ? AND path like ? AND path not like ?');
+		$path_match = $path.'/%';
+		$path_notmatch = $path.'/%/%';
+		$result = $stmt->execute(array(\OCP\USER::getUser(), $path_match, $path_notmatch));
+		$this->cache[$path] = array();
+		while (($row = $result->fetchRow()) != false) {
+			$this->cache[$path][$row['path']] = $row;
+		}
+	}
+
 	public function getFileData($path) {
 		$gallery_path = \OCP\Config::getSystemValue( 'datadirectory' ).'/'.\OC_User::getUser().'/gallery';
 		$path = $gallery_path.$path;
-		$stmt = \OCP\DB::prepare('SELECT * FROM *PREFIX*pictures_images_cache WHERE uid_owner LIKE ? AND path = ?');
-		$result = $stmt->execute(array(\OCP\USER::getUser(), $path));
-		if (($row = $result->fetchRow()) != false) {
-			return $row;
+		$dir = dirname($path);
+		if (!isset($this->cache[$dir])) {
+			$this->getPathData($dir);
+		}
+		if (isset($this->cache[$dir][$path])) {
+			return $this->cache[$dir][$path];
 		}
 		$image = new \OC_Image();
 		if (!$image->loadFromFile($path)) {
@@ -28,6 +43,7 @@ class DatabaseManager {
 		$stmt->execute(array(\OCP\USER::getUser(), $path, $image->width(), $image->height()));
 		$ret = array('path' => $path, 'width' => $image->width(), 'height' => $image->height());
 		unset($image);
+		$this->cache[$dir][$path] = $ret;
 		return $ret;
 	}
 	
diff --git a/apps/user_openid/appinfo/app.php b/apps/user_openid/appinfo/app.php
index c683254101fde20a054ed98b8bd66e49746b1571..fe57b189fac3a97205274ba06222f15f345b230a 100644
--- a/apps/user_openid/appinfo/app.php
+++ b/apps/user_openid/appinfo/app.php
@@ -27,7 +27,7 @@ OC_User::useBackend('openid');
 //check for results from openid requests
 if(isset($_GET['openid_mode']) and $_GET['openid_mode'] == 'id_res'){
 	OCP\Util::writeLog('user_openid','openid retured',OCP\Util::DEBUG);
-	$openid = new SimpleOpenID;
+	$openid = new SimpleOpenID();
 	$openid->SetIdentity($_GET['openid_identity']);
 	$openid_validation_result = $openid->ValidateWithServer();
 	if ($openid_validation_result == true){         // OK HERE KEY IS VALID
@@ -50,5 +50,3 @@ if(isset($_GET['openid_mode']) and $_GET['openid_mode'] == 'id_res'){
 	OCP\Util::writeLog('user_openid','USER CANCELED REQUEST',OCP\Util::DEBUG);
 	return false;
 }
-
-?>
diff --git a/apps/user_openid/appinfo/version b/apps/user_openid/appinfo/version
index 6da28dde76d6550e3d398a70a9a8231256774669..d917d3e26adc9854b4569871e20111c38de2606f 100644
--- a/apps/user_openid/appinfo/version
+++ b/apps/user_openid/appinfo/version
@@ -1 +1 @@
-0.1.1
\ No newline at end of file
+0.1.2
diff --git a/apps/user_openid/class.openid.v3.php b/apps/user_openid/class.openid.v3.php
index 8afb9e5b8175be25c28ed43aea6f8690250cd1cd..eeb319866598c8312faff2a3242d7d8cbd22495f 100644
--- a/apps/user_openid/class.openid.v3.php
+++ b/apps/user_openid/class.openid.v3.php
@@ -324,5 +324,3 @@ class SimpleOpenID{
 		}
 	}
 }
-
-?>
\ No newline at end of file
diff --git a/apps/user_openid/user_openid.php b/apps/user_openid/user_openid.php
index e228de95e9e570e14a919083f3e4189ceb573b18..70b193a30b13cf8b61b174f3501ad021d46fab65 100644
--- a/apps/user_openid/user_openid.php
+++ b/apps/user_openid/user_openid.php
@@ -37,7 +37,7 @@ class OC_USER_OPENID extends OC_User_Backend {
 	 */
 	public function checkPassword( $uid, $password ){
 		// Get identity from user and redirect browser to OpenID Server
-		$openid = new SimpleOpenID;
+		$openid = new SimpleOpenID();
 		$openid->SetIdentity($uid);
 		$openid->SetTrustRoot('http://' . OCP\Util::getServerHost());
 		if ($openid->GetOpenIDServer()){
@@ -63,7 +63,3 @@ class OC_USER_OPENID extends OC_User_Backend {
 		}
 	}
 }
-
-
-
-?>
diff --git a/core/js/multiselect.js b/core/js/multiselect.js
index db5afa637c94de4a50318b9b9de5d6064a70ae15..c4fd74b0475e746844b554f23d9b94f487de8b45 100644
--- a/core/js/multiselect.js
+++ b/core/js/multiselect.js
@@ -35,6 +35,7 @@
 		}
 
 		button.click(function(event){
+			
 			var button=$(this);
 			if(button.parent().children('ul').length>0){
 				button.parent().children('ul').slideUp(400,function(){
@@ -128,19 +129,30 @@
 						if(event.keyCode == 13) {
 							event.preventDefault();
 							event.stopPropagation();
+							var value = $(this).val();
+							var exists = false;
+							$.each(options,function(index, item) {
+								if ($(item).val() == value) {
+									exists = true;
+									return false;
+								}
+							});
+							if (exists) {
+								return false;
+							}
 							var li=$(this).parent();
 							$(this).remove();
 							li.text('+ '+settings.createText);
 							li.before(createItem(this));
 							var select=button.parent().next();
 							var option=$('<option selected="selected"/>');
-							option.attr('value',$(this).val());
+							option.attr('value',value);
 							option.text($(this).val());
-							select.append(options);
+							select.append(option);
 							li.prev().children('input').trigger('click');
 							button.parent().data('preventHide',false);
 							if(settings.createCallback){
-								settings.createCallback();
+								settings.createCallback($(this).val());
 							}
 						}
 					});
diff --git a/lib/app.php b/lib/app.php
index 61566ed7522c46d4b3325e50d164873b15adc590..4c2c43ec26be72c97b1061d7b444e402e6396d0d 100755
--- a/lib/app.php
+++ b/lib/app.php
@@ -350,9 +350,13 @@ class OC_App{
 
 
 	protected static function findAppInDirectories($appid) {
+		static $app_dir = array();
+		if (isset($app_dir[$appid])) {
+			return $app_dir[$appid];
+		}
 		foreach(OC::$APPSROOTS as $dir) {
 			if(file_exists($dir['path'].'/'.$appid)) {
-				return $dir;
+				return $app_dir[$appid]=$dir;
 			}
 		}
 	}
@@ -569,7 +573,7 @@ class OC_App{
 	}
 
 	/**
-	 * get the installed version of all papps
+	 * get the installed version of all apps
 	 */
 	public static function getAppVersions(){
 		static $versions;
diff --git a/lib/files.php b/lib/files.php
index 469c3a15b8eb9ea69f8befc6b53f711303d74d6c..d5bebb7e549af13a2f59a7fba3bc0603aaff3ae8 100644
--- a/lib/files.php
+++ b/lib/files.php
@@ -167,10 +167,12 @@ class OC_Files {
 	* @param file $target
 	*/
 	public static function move($sourceDir,$source,$targetDir,$target){
-		if(OC_User::isLoggedIn() && ($sourceDir != '' || $source != 'Shared')){
+		if(OC_User::isLoggedIn() && ($sourceDir != '' || $source != 'Shared') && !OC_Filesystem::file_exists($targetDir.'/'.$target)){
 			$targetFile=self::normalizePath($targetDir.'/'.$target);
 			$sourceFile=self::normalizePath($sourceDir.'/'.$source);
 			return OC_Filesystem::rename($sourceFile,$targetFile);
+		} else {
+			return false;
 		}
 	}
 
diff --git a/lib/helper.php b/lib/helper.php
index 6ab55f27618154006faf1ca4d54cd7fa5cc77166..64378da356e717c7e68929e19870a50416405d89 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -38,13 +38,10 @@ class OC_Helper {
 	 */
 	public static function linkTo( $app, $file ){
 		if( $app != '' ){
-			$app .= '/';
+			$app_path = OC_App::getAppPath($app);
 			// Check if the app is in the app folder
-			if( file_exists( OC_App::getAppPath($app).'/'.$file )){
+			if( $app_path && file_exists( $app_path.'/'.$file )){
 				if(substr($file, -3) == 'php' || substr($file, -3) == 'css'){	
-					if(substr($app, -1, 1) == '/'){
-						$app = substr($app, 0, strlen($app) - 1);
-					}
 					$urlLinkTo =  OC::$WEBROOT . '/?app=' . $app;
 					$urlLinkTo .= ($file!='index.php')?'&getfile=' . urlencode($file):'';
 				}else{
@@ -52,7 +49,7 @@ class OC_Helper {
 				}
 			}
 			else{
-				$urlLinkTo =  OC::$WEBROOT . '/' . $app . $file;
+				$urlLinkTo =  OC::$WEBROOT . '/' . $app . '/' . $file;
 			}
 		}
 		else{
diff --git a/lib/setup.php b/lib/setup.php
index 59c3aefbf13aec36f6dfea364f67569e6c1e4355..5387a0ef493e8ea0003c53e7623a1b2cb9e7261c 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -285,13 +285,23 @@ class OC_Setup {
 		//we cant use OC_BD functions here because we need to connect as the administrative user.
 		$e_name = pg_escape_string($name);
 		$e_user = pg_escape_string($user);
-		$query = "CREATE DATABASE \"$e_name\" OWNER \"$e_user\"";
+		$query = "select datname from pg_database where datname = '$e_name'";
 		$result = pg_query($connection, $query);
 		if(!$result) {
 			$entry='DB Error: "'.pg_last_error($connection).'"<br />';
 			$entry.='Offending command was: '.$query.'<br />';
 			echo($entry);
 		}
+		if(! pg_fetch_row($result)) {
+			//The database does not exists... let's create it
+			$query = "CREATE DATABASE \"$e_name\" OWNER \"$e_user\"";
+			$result = pg_query($connection, $query);
+			if(!$result) {
+				$entry='DB Error: "'.pg_last_error($connection).'"<br />';
+				$entry.='Offending command was: '.$query.'<br />';
+				echo($entry);
+			}
+		}
 		$query = "REVOKE ALL PRIVILEGES ON DATABASE \"$e_name\" FROM PUBLIC";
 		$result = pg_query($connection, $query);		
 	}
@@ -299,13 +309,33 @@ class OC_Setup {
 	private static function pg_createDBUser($name,$password,$connection) {
 		$e_name = pg_escape_string($name);
 		$e_password = pg_escape_string($password);
-		$query = "CREATE USER \"$e_name\" CREATEDB PASSWORD '$e_password';";
+		$query = "select * from pg_roles where rolname='$e_name';";
 		$result = pg_query($connection, $query);
 		if(!$result) {
 			$entry='DB Error: "'.pg_last_error($connection).'"<br />';
 			$entry.='Offending command was: '.$query.'<br />';
 			echo($entry);
 		}
+
+		if(! pg_fetch_row($result)) {
+			//user does not exists let's create it :)
+			$query = "CREATE USER \"$e_name\" CREATEDB PASSWORD '$e_password';";
+			$result = pg_query($connection, $query);
+			if(!$result) {
+				$entry='DB Error: "'.pg_last_error($connection).'"<br />';
+				$entry.='Offending command was: '.$query.'<br />';
+				echo($entry);
+			}
+		}
+		else { // change password of the existing role
+			$query = "ALTER ROLE \"$e_name\" WITH PASSWORD '$e_password';";
+			$result = pg_query($connection, $query);
+			if(!$result) {
+				$entry='DB Error: "'.pg_last_error($connection).'"<br />';
+				$entry.='Offending command was: '.$query.'<br />';
+				echo($entry);
+			}
+		}
 	}
 
 	/**
diff --git a/settings/js/users.js b/settings/js/users.js
index 0de0d1df3bc9ae543326d48f18a406a96ee07483..90569bcc56b6f9d058265de34a9a5943a5e57750 100644
--- a/settings/js/users.js
+++ b/settings/js/users.js
@@ -40,7 +40,15 @@ $(document).ready(function(){
 		}else{
 			checkHandeler=false;
 		}
+		var addGroup = function(group) {
+			$('select[multiple]').each(function(index, element) {
+				if ($(element).find('option[value="'+group +'"]').length == 0) {
+					$(element).append('<option value="'+group+'">'+group+'</option>');
+				}
+			})
+		};
 		element.multiSelect({
+			createCallback:addGroup,
 			createText:'add group',
 			checked:checked,
 			oncheck:checkHandeler,
diff --git a/settings/templates/admin.php b/settings/templates/admin.php
index a9f727d6764b4b8f1aacced60ce6c995d5646bbc..033cd1a1642e146b061eb05f83ee789ae66b524f 100755
--- a/settings/templates/admin.php
+++ b/settings/templates/admin.php
@@ -54,3 +54,10 @@ if(!$_['htaccessworking']) {
 </table>
 <input id='moreLog' type='button' value='<?php echo $l->t('More');?>...'></input>
 </fieldset>
+
+
+<p class="personalblock">
+	<strong>ownCloud</strong> <?php echo(OC_Util::getVersionString()); ?> <?php echo(OC_Util::getEditionString()); ?> (<?php echo(OC_Updater::ShowUpdatingHint()); ?>)<br />
+	Developed by the <a href="http://ownCloud.org/contact" target="_blank">ownCloud community</a>, the <a href="http://gitorious.org/owncloud" target="_blank">source code</a> is licensed under the <a href="http://www.gnu.org/licenses/agpl-3.0.html" target="_blank"><abbr title="Affero General Public License">AGPL</abbr></a>.
+</p>
+
diff --git a/settings/templates/personal.php b/settings/templates/personal.php
index 014996a5b2071c5fd278fabe64c7c08a90449479..ee40120d724b21a9da8dd31370097040c9917fed 100644
--- a/settings/templates/personal.php
+++ b/settings/templates/personal.php
@@ -55,10 +55,5 @@
 	echo $form;
 };?>
 
-<p class="personalblock">
-	<strong>ownCloud</strong> <?php echo(OC_Util::getVersionString()); ?> <?php echo(OC_Util::getEditionString()); ?> (<?php echo(OC_Updater::ShowUpdatingHint()); ?>)<br />
-	Developed by the <a href="http://ownCloud.org/contact" target="_blank">ownCloud community</a>, the <a href="http://gitorious.org/owncloud" target="_blank">source code</a> is freely licensed under the <a href="http://www.gnu.org/licenses/agpl-3.0.html" target="_blank"><abbr title="Affero General Public License">AGPL</abbr></a>.
-</p>
-
 
 
diff --git a/tests/lib/cache/file.php b/tests/lib/cache/file.php
index 226e5068c4148fb91dd708db77fed4dafb4dafa3..54e60e6569ddf623500d748d697bd2d2ac0a3fbe 100644
--- a/tests/lib/cache/file.php
+++ b/tests/lib/cache/file.php
@@ -21,7 +21,26 @@
 */
 
 class Test_Cache_File extends Test_Cache {
+	function skip() {
+		$this->skipUnless(OC_User::isLoggedIn());
+	}
+	
 	public function setUp(){
+		//clear all proxies and hooks so we can do clean testing
+		OC_FileProxy::clearProxies();
+		OC_Hook::clear('OC_Filesystem');
+		
+		//enable only the encryption hook
+		OC_FileProxy::register(new OC_FileProxy_Encryption());
+		
+		//set up temporary storage
+		OC_Filesystem::clearMounts();
+		OC_Filesystem::mount('OC_Filestorage_Temporary',array(),'/');
+
+		//set up the users dir
+		$rootView=new OC_FilesystemView('');
+		$rootView->mkdir('/'.OC_User::getUser());
+		
 		$this->instance=new OC_Cache_File();
 	}
 }
diff --git a/tests/lib/cache/xcache.php b/tests/lib/cache/xcache.php
index a5e954f827c278d8e4ea5f4d5314df19401322bc..cc2077076cee446f13a1d6d9879a9ea9e546671a 100644
--- a/tests/lib/cache/xcache.php
+++ b/tests/lib/cache/xcache.php
@@ -28,4 +28,8 @@ class Test_Cache_XCache extends Test_Cache {
 	public function setUp(){
 		$this->instance=new OC_Cache_XCache();
 	}
+
+	function testTTL(){
+		// ttl doesn't work correctly in the same request
+	}
 }