diff --git a/apps/files/ajax/rawlist.php b/apps/files/ajax/rawlist.php
index 1cd2944483cb337e547296224881252ebd4fc9d2..f568afad4da44f87f4d74cd301cee93202c8aa9b 100644
--- a/apps/files/ajax/rawlist.php
+++ b/apps/files/ajax/rawlist.php
@@ -15,6 +15,14 @@ $mimetype = isset($_GET['mimetype']) ? $_GET['mimetype'] : '';
 
 // make filelist
 $files = array();
+// If a type other than directory is requested first load them.
+if($mimetype && strpos($mimetype, 'httpd/unix-directory') === false) {
+	foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, 'httpd/unix-directory' ) as $i ) {
+		$i["date"] = OCP\Util::formatDate($i["mtime"] );
+		$i['mimetype_icon'] = $i['type'] == 'dir' ? \mimetype_icon('dir'): \mimetype_icon($i['mimetype']);
+		$files[] = $i;
+	}
+}
 foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, $mimetype ) as $i ) {
 	$i["date"] = OCP\Util::formatDate($i["mtime"] );
 	$i['mimetype_icon'] = $i['type'] == 'dir' ? \mimetype_icon('dir'): \mimetype_icon($i['mimetype']);
diff --git a/apps/files_external/l10n/pl.php b/apps/files_external/l10n/pl.php
index cd1b1fe84a1f4145a50bd3ba44a5b9d7c68c11f3..e03ded1e70a222268880990d6d7fc2339755e9e4 100644
--- a/apps/files_external/l10n/pl.php
+++ b/apps/files_external/l10n/pl.php
@@ -6,6 +6,7 @@
 "Error configuring Google Drive storage" => "Wystąpił błąd podczas konfigurowania zasobu Google Drive",
 "<b>Warning:</b> \"smbclient\" is not installed. Mounting of CIFS/SMB shares is not possible. Please ask your system administrator to install it." => "<b>Ostrzeżenie:</b> \"smbclient\" nie jest zainstalowany. Zamontowanie katalogów CIFS/SMB nie jest możliwe. Skontaktuj sie z administratorem w celu zainstalowania.",
 "<b>Warning:</b> The FTP support in PHP is not enabled or installed. Mounting of FTP shares is not possible. Please ask your system administrator to install it." => "<b>Ostrzeżenie:</b> Wsparcie dla FTP w PHP nie jest zainstalowane lub włączone.  Skontaktuj sie z administratorem w celu zainstalowania lub włączenia go.",
+"<b>Warning:</b> The Curl support in PHP is not enabled or installed. Mounting of ownCloud / WebDAV or GoogleDrive is not possible. Please ask your system administrator to install it." => "<b>Ostrzeżenie:</b> Wsparcie dla  Curl w PHP nie jest zainstalowane lub włączone. Montowanie WebDAV lub GoogleDrive nie będzie możliwe. Skontaktuj się z administratorem w celu zainstalowania lub włączenia tej opcji.",
 "External Storage" => "Zewnętrzna zasoby dyskowe",
 "Folder name" => "Nazwa folderu",
 "External storage" => "Zewnętrzne zasoby dyskowe",
diff --git a/core/css/styles.css b/core/css/styles.css
index 93f2cecbfe9aa6be82b76600304f0976cb6a81a9..70a840d68903ce08ece49a46dfbd9348a12c828b 100644
--- a/core/css/styles.css
+++ b/core/css/styles.css
@@ -382,13 +382,22 @@ a.bookmarklet { background-color:#ddd; border:1px solid #ccc; padding:5px;paddin
 .ui-datepicker-prev,.ui-datepicker-next{ border:1px solid #ddd; background:#fff; }
 
 /* ---- DIALOGS ---- */
-#dirup {width:4%;}
-#dirtree {width:92%;}
-#filelist {height:270px; overflow-y:auto; background-color:white; width:100%;}
-.filepicker_element_selected { background-color:lightblue;}
-.filepicker_loader {height:170px; width:100%; background-color:#333; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)"; filter:alpha(opacity=30); opacity:.3; visibility:visible; position:absolute; top:0; left:0; text-align:center; padding-top:150px;}
+#oc-dialog-filepicker-content .dirtree {width:92%; overflow:hidden; }
+#oc-dialog-filepicker-content .dirtree .home {
+	background-image:url('../img/places/home.svg');
+	background-repeat:no-repeat;
+	background-position: left center;
+}
+#oc-dialog-filepicker-content .dirtree span:not(:last-child) { cursor: pointer; }
+#oc-dialog-filepicker-content .dirtree span:last-child { font-weight: bold; }
+#oc-dialog-filepicker-content .dirtree span:not(:last-child)::after { content: '>'; padding: 3px;}
+#oc-dialog-filepicker-content .filelist {height:270px; overflow-y:auto; background-color:white; width:100%;}
+#oc-dialog-filepicker-content .filelist img { margin: 2px 1em 0 4px; }
+#oc-dialog-filepicker-content .filelist .date { float:right;margin-right:1em; }
+#oc-dialog-filepicker-content .filepicker_element_selected { background-color:lightblue;}
 .ui-dialog {position:fixed !important;}
 span.ui-icon {float: left; margin: 3px 7px 30px 0;}
+.loading { background: url('../img/loading.gif') no-repeat center; cursor: wait; }
 
 /* ---- CATEGORIES ---- */
 #categoryform .scrollarea { position:absolute; left:10px; top:10px; right:10px; bottom:50px; overflow:auto; border:1px solid #ddd; background:#f8f8f8; }
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index 990c3f8bf38b19cedb8bfed7785864174971e681..e1d3657724e14822eb2431c3667789c7b3db1c56 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -1,7 +1,7 @@
 /**
  * ownCloud
  *
- * @author Bartek Przybylski
+ * @author Bartek Przybylski, Christopher Schäpers, Thomas Tanghus
  * @copyright 2012 Bartek Przybylski bartek@alefzero.eu
  *
  * This library is free software; you can redistribute it and/or
@@ -23,6 +23,11 @@
  * this class to ease the usage of jquery dialogs
  */
 var OCdialogs = {
+	// dialog button types
+	YES_NO_BUTTONS:		70,
+	OK_BUTTONS:		71,
+	// used to name each dialog
+	dialogs_counter: 0,
 	/**
 	* displays alert dialog
 	* @param text content of dialog
@@ -31,8 +36,7 @@ var OCdialogs = {
 	* @param modal make the dialog modal
 	*/
 	alert:function(text, title, callback, modal) {
-		var content = '<p><span class="ui-icon ui-icon-alert"></span>' + escapeHTML(text) + '</p>';
-		OCdialogs.message(content, title, OCdialogs.ALERT_DIALOG, OCdialogs.OK_BUTTON, callback, modal);
+		this.message(text, title, 'alert', OCdialogs.OK_BUTTON, callback, modal);
 	},
 	/**
 	* displays info dialog
@@ -42,8 +46,7 @@ var OCdialogs = {
 	* @param modal make the dialog modal
 	*/
 	info:function(text, title, callback, modal) {
-		var content = '<p><span class="ui-icon ui-icon-info"></span>' + escapeHTML(text) + '</p>';
-		OCdialogs.message(content, title, OCdialogs.ALERT_DIALOG, OCdialogs.OK_BUTTON, callback, modal);
+		this.message(text, title, 'info', OCdialogs.OK_BUTTON, callback, modal);
 	},
 	/**
 	* displays confirmation dialog
@@ -53,82 +56,7 @@ var OCdialogs = {
 	* @param modal make the dialog modal
 	*/
 	confirm:function(text, title, callback, modal) {
-		var content = '<p><span class="ui-icon ui-icon-notice"></span>' + escapeHTML(text) + '</p>';
-		OCdialogs.message(content, title, OCdialogs.ALERT_DIALOG, OCdialogs.YES_NO_BUTTONS, callback, modal);
-	},
-	/**
-	* prompt for user input
-	* @param text content of dialog
-	* @param title dialog title
-	* @param callback which will be triggered when user presses OK (input text will be passed to callback)
-	* @param modal make the dialog modal
-	*/
-	prompt:function(text, title, default_value, callback, modal) {
-		var input = '<input type="text" id="oc-dialog-prompt-input" value="' + escapeHTML(default_value) + '" style="width:90%">';
-		var content = '<p><span class="ui-icon ui-icon-pencil"></span>' + escapeHTML(text) + ':<br/>' + input + '</p>';
-		OCdialogs.message(content, title, OCdialogs.PROMPT_DIALOG, OCdialogs.OK_BUTTON, callback, modal);
-	},
-	/**
-	* prompt user for input with custom form
-	* fields should be passed in following format: [{text:'prompt text', name:'return name', type:'input type', value: 'default value'},...]
-	* example:
-	* var fields=[{text:'Test', name:'test', type:'select', options:[{text:'hello1',value:1},{text:'hello2',value:2}] }];
-	* @param fields to display 
-	* @param title dialog title
-	* @param callback which will be triggered when user presses OK (user answers will be passed to callback in following format: [{name:'return name', value: 'user value'},...])
-	* @param modal make the dialog modal
-	*/
-	form:function(fields, title, callback, modal) {
-		var content = '<table>';
-		$.each(fields, function(index, field){
-			content += '<tr><td>' + escapeHTML(field.text) + '</td><td>';
-			var type = field.type;
-			
-			if (type === 'text' || type === 'checkbox' || type === 'password') {
-				content += '<input type="' + type + '" name="' + field.name + '"';
-				if (type === 'checkbox' && field.value === true) {
-					content += ' checked="checked"';
-				} else if (type === 'text' || type === 'password' && val.value) {
-					content += ' value="' + escapeHTML(field.value) + '"';
-				}
-				content += '>';
-			} else if (type === 'select') {
-				content += '<select name="' + escapeHTML(field.name) + '"';
-				if (field.value !== undefined) {
-					content += ' value="' + escapeHTML(field.value) + '"';
-				}
-				content += '>';
-				$.each(field.options, function(index, field_option){
-					content += '<option value="' + escapeHTML(field_option.value) + '">' + escapeHTML(field_option.text) + '</option>';
-				});
-				content += '</select>';
-			}
-			content += '</td></tr>';
-
-		});
-		content += '</table>';
-
-		var dialog_name = 'oc-dialog-' + OCdialogs.dialogs_counter + '-content';
-		var dialog_id = '#' + dialog_name;
-		var dialog_div = '<div id="' + dialog_name + '" title="' + escapeHTML(title) + '">' + content + '</div>';
-		if (modal === undefined) { modal = false };
-		$('body').append(dialog_div);
-		var buttonlist = [{
-			text: t('core', 'Ok'),
-			click: function(){ OCdialogs.form_ok_handler(callback, dialog_id); }
-		},
-		{
-			text: t('core', 'Cancel'),
-			click: function(){ $(dialog_id).dialog('close'); }
-		}];
-		var dialog_height = ( $('tr', dialog_div).length + 1 ) * 30 + 120;
-		$(dialog_id).dialog({
-			width: (4/9) * $(document).width(),
-			height: dialog_height,
-			modal: modal,
-			buttons: buttonlist
-		});
-		OCdialogs.dialogs_counter++;
+		this.message(text, title, 'notice', OCdialogs.YES_NO_BUTTONS, callback, modal);
 	},
 	/**
 	 * show a file picker to pick a file from
@@ -139,288 +67,262 @@ var OCdialogs = {
 	 * @param modal make the dialog modal
 	*/
 	filepicker:function(title, callback, multiselect, mimetype_filter, modal) {
-		var dialog_name = 'oc-dialog-' + OCdialogs.dialogs_counter + '-content';
-		var dialog_id = '#' + dialog_name;
-		var dialog_content = '<button id="dirup">↑</button><select id="dirtree"></select><div id="filelist"></div>';
-		var dialog_loader = '<div class="filepicker_loader"><img src="' + OC.filePath('gallery','img','loading.gif') + '"></div>';
-		var dialog_div = '<div id="' + dialog_name + '" title="' + escapeHTML(title) + '">' + dialog_content + dialog_loader + '</div>';
-		if (modal === undefined) { modal = false };
-		if (multiselect === undefined) { multiselect = false };
-		if (mimetype_filter === undefined) { mimetype_filter = '' };
+		var self = this;
+		$.when(this._getFilePickerTemplate()).then(function($tmpl) {
+			var dialog_name = 'oc-dialog-filepicker-content';
+			var dialog_id = '#' + dialog_name;
+			if(self.$filePicker) {
+				self.$filePicker.dialog('close');
+			}
+			self.$filePicker = $tmpl.octemplate({
+				dialog_name: dialog_name,
+				title: title
+			}).data('path', '');
 
-		$('body').append(dialog_div);
+			if (modal === undefined) { modal = false };
+			if (multiselect === undefined) { multiselect = false };
+			if (mimetype_filter === undefined) { mimetype_filter = '' };
 
-		$(dialog_id).data('path', '/');
+			$('body').append(self.$filePicker);
 
-		$(dialog_id + ' #dirtree').focus().change( {dcid: dialog_id}, OCdialogs.handleTreeListSelect );
-		$(dialog_id + ' #dirup').click( {dcid: dialog_id}, OCdialogs.filepickerDirUp );
 
-		$(dialog_id).ready(function(){
-			$.getJSON(OC.filePath('files', 'ajax', 'rawlist.php'), { mimetype: mimetype_filter } ,function(request) {
-				OCdialogs.fillFilePicker(request, dialog_id);
-			});
-			$.getJSON(OC.filePath('files', 'ajax', 'rawlist.php'), { mimetype: "httpd/unix-directory" }, function(request) {
-				OCdialogs.fillTreeList(request, dialog_id);
-			});
-		}).data('multiselect', multiselect).data('mimetype',mimetype_filter);
+			self.$filePicker.ready(function() {
+				self.$filelist = self.$filePicker.find('.filelist');
+				self.$dirTree = self.$filePicker.find('.dirtree');
+				self.$dirTree.on('click', 'span:not(:last-child)', self, self._handleTreeListSelect);
+				self.$filelist.on('click', 'li', function(event) {
+					self._handlePickerClick(event, $(this));
+				});
+				self._fillFilePicker('');
+			}).data('multiselect', multiselect).data('mimetype',mimetype_filter);
 
-		// build buttons
-		var functionToCall = function() {
-			if (callback !== undefined) {
-				var datapath;
-				if (multiselect === true) {
-					datapath = [];
-					$(dialog_id + ' .filepicker_element_selected .filename').each(function(index, element) {
-						datapath.push( $(dialog_id).data('path') + $(element).text() );
-					});
-				} else {
-					var datapath = $(dialog_id).data('path');
-					datapath += $(dialog_id+' .filepicker_element_selected .filename').text();
+			// build buttons
+			var functionToCall = function() {
+				if (callback !== undefined) {
+					var datapath;
+					if (multiselect === true) {
+						datapath = [];
+						self.$filelist.find('.filepicker_element_selected .filename').each(function(index, element) {
+							datapath.push(self.$filePicker.data('path') + '/' + $(element).text());
+						});
+					} else {
+						var datapath = self.$filePicker.data('path');
+						datapath += '/' + self.$filelist.find('.filepicker_element_selected .filename').text();
+					}
+					callback(datapath);
+					self.$filePicker.dialog('close');
 				}
-				callback(datapath);
-				$(dialog_id).dialog('close');
-			}
-		};
-		var buttonlist = [{
-			text: t('core', 'Choose'), 
-			click: functionToCall
-			},
-			{
-			text: t('core', 'Cancel'), 
-			click: function(){$(dialog_id).dialog('close'); }
-		}];
+			};
+			var buttonlist = [{
+				text: t('core', 'Choose'),
+				click: functionToCall
+				},
+				{
+				text: t('core', 'Cancel'),
+				click: function(){self.$filePicker.dialog('close'); }
+			}];
 
-		$(dialog_id).dialog({
-			width: (4/9)*$(document).width(),
-			height: 420,
-			modal: modal,
-			buttons: buttonlist
+			self.$filePicker.dialog({
+				closeOnEscape: true,
+				width: (4/9)*$(document).width(),
+				height: 420,
+				modal: modal,
+				buttons: buttonlist,
+				close: function(event, ui) {
+					self.$filePicker.dialog('destroy').remove();
+					self.$filePicker = null;
+				}
+			});
+		})
+		.fail(function() {
+			alert(t('core', 'Error loading file picker template'));
 		});
-		OCdialogs.dialogs_counter++;
 	},
 	/**
 	 * Displays raw dialog
 	 * You better use a wrapper instead ...
 	*/
 	message:function(content, title, dialog_type, buttons, callback, modal) {
-		var dialog_name = 'oc-dialog-' + OCdialogs.dialogs_counter + '-content';
-		var dialog_id = '#' + dialog_name;
-		var dialog_div = '<div id="' + dialog_name + '" title="' + escapeHTML(title) + '">' + content + '</div>';
-		if (modal === undefined) { modal = false };
-		$('body').append(dialog_div);
-		var buttonlist = [];
-		switch (buttons) {
-			case OCdialogs.YES_NO_BUTTONS:
-				buttonlist = [{
-					text: t('core', 'Yes'),
-					click: function(){
-						if (callback !== undefined) { callback(true) };
-						$(dialog_id).dialog('close');
-					}
-				},
-				{
-					text: t('core', 'No'),
-					click: function(){
-						if (callback !== undefined) { callback(false) };
-						$(dialog_id).dialog('close');
-					}
-				}];
-			break;
-			case OCdialogs.OK_BUTTON:
-				var functionToCall;
-				switch(dialog_type) {
-					case OCdialogs.ALERT_DIALOG:
-						functionToCall = function() {
+		$.when(this._getMessageTemplate()).then(function($tmpl) {
+			var dialog_name = 'oc-dialog-' + OCdialogs.dialogs_counter + '-content';
+			var dialog_id = '#' + dialog_name;
+			var $dlg = $tmpl.octemplate({
+				dialog_name: dialog_name,
+				title: title,
+				message: content,
+				type: dialog_type
+			});
+			if (modal === undefined) { modal = false };
+			$('body').append($dlg);
+			var buttonlist = [];
+			switch (buttons) {
+				case OCdialogs.YES_NO_BUTTONS:
+					buttonlist = [{
+						text: t('core', 'Yes'),
+						click: function(){
+							if (callback !== undefined) { callback(true) };
 							$(dialog_id).dialog('close');
-							if(callback !== undefined) { callback() };
-						};
-					break;
-					case OCdialogs.PROMPT_DIALOG:
-						buttonlist[1] = {
-							text: t('core', 'Cancel'),
-							click: function() { $(dialog_id).dialog('close'); }
-						};
-						functionToCall = function() { OCdialogs.prompt_ok_handler(callback, dialog_id); };
-					break;
-				}
-				buttonlist[0] = {
-					text: t('core', 'Ok'),
-					click: functionToCall
-				};
-			break;
-		};
+						}
+					},
+					{
+						text: t('core', 'No'),
+						click: function(){
+							if (callback !== undefined) { callback(false) };
+							$(dialog_id).dialog('close');
+						}
+					}];
+				break;
+				case OCdialogs.OK_BUTTON:
+					var functionToCall = function() {
+						$(dialog_id).dialog('close');
+						if(callback !== undefined) { callback() };
+					};
+					buttonlist[0] = {
+						text: t('core', 'Ok'),
+						click: functionToCall
+					};
+				break;
+			};
 
-		$(dialog_id).dialog({
-			width: (4/9) * $(document).width(),
-			height: 180,
-			modal: modal,
-			buttons: buttonlist
+			$(dialog_id).dialog({
+				closeOnEscape: true,
+				modal: modal,
+				buttons: buttonlist
+			});
+			OCdialogs.dialogs_counter++;
+		})
+		.fail(function() {
+			alert(t('core', 'Error loading file picker template'));
 		});
-		OCdialogs.dialogs_counter++;
 	},
-	// dialog button types
-	YES_NO_BUTTONS:		70,
-	OK_BUTTONS:		71,
-	// dialogs types
-	ALERT_DIALOG:	80,
-	INFO_DIALOG:	81,
-	FORM_DIALOG:	82,
-	// used to name each dialog
-	dialogs_counter: 0,
-
-	determineValue: function(element) {
-		if ( $(element).attr('type') === 'checkbox' ) {
-			return element.checked;
+	_getFilePickerTemplate: function() {
+		var defer = $.Deferred();
+		if(!this.$filePickerTemplate) {
+			var self = this;
+			$.get(OC.filePath('core', 'templates', 'filepicker.html'), function(tmpl) {
+				self.$filePickerTemplate = $(tmpl);
+				self.$listTmpl = self.$filePickerTemplate.find('.filelist li:first-child').detach();
+				defer.resolve(self.$filePickerTemplate);
+			})
+			.fail(function() {
+				defer.reject();
+			});
 		} else {
-			return $(element).val();
+			defer.resolve(this.$filePickerTemplate);
 		}
+		return defer.promise();
 	},
-
-	prompt_ok_handler: function(callback, dialog_id) {
-		$(dialog_id).dialog('close');
-		if (callback !== undefined) { callback($(dialog_id + " input#oc-dialog-prompt-input").val()) };
-	},
-
-	form_ok_handler: function(callback, dialog_id) {
-		if (callback !== undefined) {
-			var valuelist = [];
-			$(dialog_id + ' input, ' + dialog_id + ' select').each(function(index, element) {
-				valuelist[index] = { name: $(element).attr('name'), value: OCdialogs.determineValue(element) };
+	_getMessageTemplate: function() {
+		var defer = $.Deferred();
+		if(!this.$messageTemplate) {
+			var self = this;
+			$.get(OC.filePath('core', 'templates', 'message.html'), function(tmpl) {
+				self.$messageTemplate = $(tmpl);
+				defer.resolve(self.$messageTemplate);
+			})
+			.fail(function() {
+				defer.reject();
 			});
-			$(dialog_id).dialog('close');
-			callback(valuelist);
 		} else {
-			$(dialog_id).dialog('close');
+			defer.resolve(this.$messageTemplate);
+		}
+		return defer.promise();
+	},
+	_getFileList: function(dir, mimeType) {
+		return $.getJSON(
+			OC.filePath('files', 'ajax', 'rawlist.php'),
+			{dir: dir, mimetype: mimeType}
+		);
+	},
+	_determineValue: function(element) {
+		if ( $(element).attr('type') === 'checkbox' ) {
+			return element.checked;
+		} else {
+			return $(element).val();
 		}
 	},
+
 	/**
 	 * fills the filepicker with files
 	*/
-	fillFilePicker:function(request, dialog_content_id) {
-		var template_content = '<img src="*MIMETYPEICON*" style="margin: 2px 1em 0 4px;"><span class="filename">*NAME*</span><div style="float:right;margin-right:1em;">*LASTMODDATE*</div>';
-		var template = '<div data-entryname="*ENTRYNAME*" data-dcid="' + escapeHTML(dialog_content_id) + '" data="*ENTRYTYPE*">*CONTENT*</div>';
-		var files = '';
+	_fillFilePicker:function(dir) {
 		var dirs = [];
 		var others = [];
-		$.each(request.data, function(index, file) {
-			if (file.type === 'dir') {
-				dirs.push(file);
-			} else {
-				others.push(file);
-			}
-		});
-		var sorted = dirs.concat(others);
-		for (var i = 0; i < sorted.length; i++) {
-			files_content = template_content.replace('*LASTMODDATE*', OC.mtime2date(sorted[i].mtime)).replace('*NAME*', escapeHTML(sorted[i].name)).replace('*MIMETYPEICON*', sorted[i].mimetype_icon);
-			files += template.replace('*ENTRYNAME*', escapeHTML(sorted[i].name)).replace('*ENTRYTYPE*', escapeHTML(sorted[i].type)).replace('*CONTENT*', files_content);
-		}
+		var self = this;
+		this.$filelist.empty().addClass('loading');
+		this.$filePicker.data('path', dir);
+		$.when(this._getFileList(dir, this.$filePicker.data('mimetype'))).then(function(response) {
+			$.each(response.data, function(index, file) {
+				if (file.type === 'dir') {
+					dirs.push(file);
+				} else {
+					others.push(file);
+				}
+			});
 
-		$(dialog_content_id + ' #filelist').html(files);
-		$('#filelist div').click(function() {
-			OCdialogs.handlePickerClick($(this), $(this).data('entryname'), dialog_content_id);
-		});
+			self._fillSlug();
+			var sorted = dirs.concat(others);
 
-		$(dialog_content_id + ' .filepicker_loader').css('visibility', 'hidden');
-	},
-	/**
-	 * fills the tree list with directories
-	*/
-	fillTreeList: function(request, dialog_id) {
-		var template = '<option value="*COUNT*">*NAME*</option>';
-		var paths = '<option value="0">' + escapeHTML($(dialog_id).data('path')) + '</option>';
-		$.each(request.data, function(index, file) {
-			paths += template.replace('*COUNT*', index).replace('*NAME*', escapeHTML(file.name));
-		});
+			$.each(sorted, function(idx, entry) {
+				$li = self.$listTmpl.octemplate({
+					type: entry.type,
+					dir: dir,
+					filename: entry.name,
+					date: OC.mtime2date(entry.mtime)
+				});
+				$li.find('img').attr('src', entry.mimetype_icon);
+				self.$filelist.append($li);
+			});
 
-		$(dialog_id + ' #dirtree').html(paths);
+			self.$filelist.removeClass('loading');
+		});
 	},
 	/**
-	 * handle selection made in the tree list
+	 * fills the tree list with directories
 	*/
-	handleTreeListSelect:function(event) {
-		if ($("option:selected", this).html().indexOf('/') !== -1) { // if there's a slash in the selected path, don't append it
-			$(event.data.dcid).data('path', $("option:selected", this).html());
-		} else {
-			$(event.data.dcid).data('path', $(event.data.dcid).data('path') + $("option:selected", this).html() + '/');
+	_fillSlug: function() {
+		this.$dirTree.empty();
+		var self = this
+		var path = this.$filePicker.data('path');
+		var $template = $('<span data-dir="{dir}">{name}</span>');
+		if(path) {
+			var paths = path.split('/');
+			$.each(paths, function(index, dir) {
+				var dir = paths.pop();
+				if(dir === '') {
+					return false;
+				}
+				self.$dirTree.prepend($template.octemplate({
+					dir: paths.join('/') + '/' + dir,
+					name: dir
+				}));
+			});
 		}
-		$(event.data.dcid + ' .filepicker_loader').css('visibility', 'visible');
-		$.getJSON(
-			OC.filePath('files', 'ajax', 'rawlist.php'),
-			{
-				dir: $(event.data.dcid).data('path'),
-				mimetype: $(event.data.dcid).data('mimetype')
-			},
-			function(request) { OCdialogs.fillFilePicker(request, event.data.dcid) }
-		);
-		$.getJSON(
-			OC.filePath('files', 'ajax', 'rawlist.php'),
-			{
-				dir: $(event.data.dcid).data('path'),
-				mimetype: "httpd/unix-directory"
-			},
-			function(request) { OCdialogs.fillTreeList(request, event.data.dcid) }
-		);
+		$template.octemplate({
+			dir: '',
+			name: '&nbsp;&nbsp;&nbsp;&nbsp;' // Ugly but works ;)
+		}, {escapeFunction: null}).addClass('home svg').prependTo(this.$dirTree);
 	},
 	/**
-	 * go one directory up
+	 * handle selection made in the tree list
 	*/
-	filepickerDirUp:function(event) {
-		var old_path = $(event.data.dcid).data('path');
-		if ( old_path !== "/") {
-			var splitted_path = old_path.split("/");
-			var new_path = ""
-			for (var i = 0; i < splitted_path.length - 2; i++) {
-				new_path += splitted_path[i] + "/"
-			}
-			$(event.data.dcid).data('path', new_path);
-			$.getJSON(
-				OC.filePath('files', 'ajax', 'rawlist.php'),
-				{
-					dir: $(event.data.dcid).data('path'),
-					mimetype: $(event.data.dcid).data('mimetype')
-				},
-				function(request) { OCdialogs.fillFilePicker(request, event.data.dcid) }
-			);
-			$.getJSON(
-				OC.filePath('files', 'ajax', 'rawlist.php'),
-				{
-					dir: $(event.data.dcid).data('path'),
-					mimetype: "httpd/unix-directory"
-				},
-				function(request) { OCdialogs.fillTreeList(request, event.data.dcid) }
-			);
-		}
+	_handleTreeListSelect:function(event) {
+		var self = event.data;
+		var dir = $(event.target).data('dir');
+		self._fillFilePicker(dir);
 	},
 	/**
 	 * handle clicks made in the filepicker
 	*/
-	handlePickerClick:function(element, name, dialog_content_id) {
-		if ( $(element).attr('data') === 'file' ){
-			if ( $(dialog_content_id).data('multiselect') !== true) {
-				$(dialog_content_id + ' .filepicker_element_selected').removeClass('filepicker_element_selected');
+	_handlePickerClick:function(event, $element) {
+		if ($element.data('type') === 'file') {
+			if (this.$filePicker.data('multiselect') !== true || !event.ctrlKey) {
+				this.$filelist.find('.filepicker_element_selected').removeClass('filepicker_element_selected');
 			}
-			$(element).toggleClass('filepicker_element_selected');
+			$element.toggleClass('filepicker_element_selected');
 			return;
-		} else if ( $(element).attr('data') === 'dir' ) {
-			var datapath = escapeHTML( $(dialog_content_id).data('path') + name + '/' );
-			$(dialog_content_id).data('path', datapath);
-			$(dialog_content_id + ' .filepicker_loader').css('visibility', 'visible');
-			$.getJSON(
-				OC.filePath('files', 'ajax', 'rawlist.php'),
-				{
-					dir: datapath,
-					mimetype: $(dialog_content_id).data('mimetype')
-				},
-				function(request){ OCdialogs.fillFilePicker(request, dialog_content_id) }
-			);
-			$.getJSON(
-				OC.filePath('files', 'ajax', 'rawlist.php'),
-				{
-					dir: datapath,
-					mimetype: "httpd/unix-directory"
-				},
-				function(request) { OCdialogs.fillTreeList(request, dialog_content_id) }
-			);
+		} else if ( $element.data('type') === 'dir' ) {
+			this._fillFilePicker(this.$filePicker.data('path') + '/' + $element.data('entryname'))
 		}
 	}
 };
diff --git a/core/l10n/pl.php b/core/l10n/pl.php
index 5c8434984cf7f9323e9e5d1ee2f6aa132afc5111..37d01abf84992e381e2a82a1bed80464c050b9c8 100644
--- a/core/l10n/pl.php
+++ b/core/l10n/pl.php
@@ -88,6 +88,7 @@
 "The update was successful. Redirecting you to ownCloud now." => "Aktualizacji zakończyła się powodzeniem. Przekierowuję do ownCloud.",
 "ownCloud password reset" => "restart hasła ownCloud",
 "Use the following link to reset your password: {link}" => "Użyj tego odnośnika by zresetować hasło: {link}",
+"The link to reset your password has been sent to your email.<br>If you do not receive it within a reasonable amount of time, check your spam/junk folders.<br>If it is not there ask your local administrator ." => "Link do zresetowania hasła została wysłana na adres email. <br> Jeśli nie otrzymasz go w najbliższym czasie, sprawdź folder ze spamem. <br> Jeśli go tam nie ma zwrócić się do administratora tego ownCloud-a.",
 "Request failed!<br>Did you make sure your email/username was right?" => "Żądanie niepowiodło się!<br>Czy Twój email/nazwa użytkownika są poprawne?",
 "You will receive a link to reset your password via Email." => "Odnośnik służący do resetowania hasła zostanie wysłany na adres e-mail.",
 "Username" => "Nazwa użytkownika",
diff --git a/core/templates/filepicker.html b/core/templates/filepicker.html
new file mode 100644
index 0000000000000000000000000000000000000000..e761fbdb567bb89623465c146a2bb786835f3eb0
--- /dev/null
+++ b/core/templates/filepicker.html
@@ -0,0 +1,10 @@
+<div id="{dialog_name}" title="{title}">
+	<span class="dirtree"></span>
+	<ul class="filelist">
+		<li data-entryname="{filename}" data-type="{type}">
+			<img />
+			<span class="filename">{filename}</span>
+			<span class="date">{date}</span>
+		</li>
+	</ul>
+</div>
diff --git a/core/templates/message.html b/core/templates/message.html
new file mode 100644
index 0000000000000000000000000000000000000000..59048100f32031358ef32d6cc1c8e49e401ed64b
--- /dev/null
+++ b/core/templates/message.html
@@ -0,0 +1,3 @@
+<div id="{dialog_name}" title="{title}">
+	<p><span class="ui-icon ui-icon-{type}"></span>{message}</p>
+</div>
diff --git a/l10n/pl/core.po b/l10n/pl/core.po
index e023ed3428064bf0566313a69129af63bc07d04f..8317035b936b3ef977130050ea05c3f438240bb4 100644
--- a/l10n/pl/core.po
+++ b/l10n/pl/core.po
@@ -3,14 +3,15 @@
 # This file is distributed under the same license as the PACKAGE package.
 # 
 # Translators:
+# Cyryl Sochacki <cyrylsochacki@gmail.com>, 2013
 # adbrand <pkwiecin@adbrand.pl>, 2013
 msgid ""
 msgstr ""
 "Project-Id-Version: ownCloud\n"
 "Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n"
-"POT-Creation-Date: 2013-05-18 01:58+0200\n"
-"PO-Revision-Date: 2013-05-17 10:18+0000\n"
-"Last-Translator: adbrand <pkwiecin@adbrand.pl>\n"
+"POT-Creation-Date: 2013-05-22 02:17+0200\n"
+"PO-Revision-Date: 2013-05-21 07:00+0000\n"
+"Last-Translator: Cyryl Sochacki <cyrylsochacki@gmail.com>\n"
 "Language-Team: Polish (http://www.transifex.com/projects/p/owncloud/language/pl/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -402,7 +403,7 @@ msgid ""
 "The link to reset your password has been sent to your email.<br>If you do "
 "not receive it within a reasonable amount of time, check your spam/junk "
 "folders.<br>If it is not there ask your local administrator ."
-msgstr ""
+msgstr "Link do zresetowania hasła została wysłana na adres email. <br> Jeśli nie otrzymasz go w najbliższym czasie, sprawdź folder ze spamem. <br> Jeśli go tam nie ma zwrócić się do administratora tego ownCloud-a."
 
 #: lostpassword/templates/lostpassword.php:12
 msgid "Request failed!<br>Did you make sure your email/username was right?"
diff --git a/l10n/pl/files_external.po b/l10n/pl/files_external.po
index d363de4780ff58c834658b178fd6fd7a20599726..a130c038c38b6dc07b3e40ecacf543cbaa0519cc 100644
--- a/l10n/pl/files_external.po
+++ b/l10n/pl/files_external.po
@@ -3,13 +3,14 @@
 # This file is distributed under the same license as the PACKAGE package.
 # 
 # Translators:
+# Cyryl Sochacki <cyrylsochacki@gmail.com>, 2013
 msgid ""
 msgstr ""
 "Project-Id-Version: ownCloud\n"
 "Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n"
-"POT-Creation-Date: 2013-04-27 02:16+0200\n"
-"PO-Revision-Date: 2013-04-26 08:29+0000\n"
-"Last-Translator: I Robot <owncloud-bot@tmit.eu>\n"
+"POT-Creation-Date: 2013-05-22 02:17+0200\n"
+"PO-Revision-Date: 2013-05-21 07:20+0000\n"
+"Last-Translator: Cyryl Sochacki <cyrylsochacki@gmail.com>\n"
 "Language-Team: Polish (http://www.transifex.com/projects/p/owncloud/language/pl/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -55,7 +56,7 @@ msgid ""
 "<b>Warning:</b> The Curl support in PHP is not enabled or installed. "
 "Mounting of ownCloud / WebDAV or GoogleDrive is not possible. Please ask "
 "your system administrator to install it."
-msgstr ""
+msgstr "<b>Ostrzeżenie:</b> Wsparcie dla  Curl w PHP nie jest zainstalowane lub włączone. Montowanie WebDAV lub GoogleDrive nie będzie możliwe. Skontaktuj się z administratorem w celu zainstalowania lub włączenia tej opcji."
 
 #: templates/settings.php:3
 msgid "External Storage"
diff --git a/l10n/templates/core.pot b/l10n/templates/core.pot
index 78d60372e1874298abd5022a8bab99f14cbe0829..a9d313688958d26214ae00555199c65a0ce1231a 100644
--- a/l10n/templates/core.pot
+++ b/l10n/templates/core.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ownCloud Core 5.0.0\n"
 "Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2013-05-21 02:00+0200\n"
+"POT-Creation-Date: 2013-05-22 02:17+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files.pot b/l10n/templates/files.pot
index 0ab57eb950c513d55d35e0821706bc9653d1d083..c294df5ef00bd057efef4ca6cd6b4157fadf2f52 100644
--- a/l10n/templates/files.pot
+++ b/l10n/templates/files.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ownCloud Core 5.0.0\n"
 "Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2013-05-21 02:00+0200\n"
+"POT-Creation-Date: 2013-05-22 02:17+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files_encryption.pot b/l10n/templates/files_encryption.pot
index 76b4b7293ab7f74917c6e1cc5d026456bbd62538..4997ad02d2bad22bcea5b1ed0dd19debbad73cc6 100644
--- a/l10n/templates/files_encryption.pot
+++ b/l10n/templates/files_encryption.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ownCloud Core 5.0.0\n"
 "Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2013-05-21 02:00+0200\n"
+"POT-Creation-Date: 2013-05-22 02:17+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files_external.pot b/l10n/templates/files_external.pot
index 7bfc3647ddd06f98902d80f2c4903b85cc00cdce..af7820399873ee8be1c648374a79fc2aceef289e 100644
--- a/l10n/templates/files_external.pot
+++ b/l10n/templates/files_external.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ownCloud Core 5.0.0\n"
 "Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2013-05-21 02:00+0200\n"
+"POT-Creation-Date: 2013-05-22 02:17+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files_sharing.pot b/l10n/templates/files_sharing.pot
index 48923f8af3ad58f71e387aadc1f6333844705070..91ce57c6d358ce30338070aae8e6500c392e24b3 100644
--- a/l10n/templates/files_sharing.pot
+++ b/l10n/templates/files_sharing.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ownCloud Core 5.0.0\n"
 "Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2013-05-21 02:00+0200\n"
+"POT-Creation-Date: 2013-05-22 02:17+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files_trashbin.pot b/l10n/templates/files_trashbin.pot
index 3e9ecd756f1e449bd44289a2102e1b42dc73bc81..23de9ceb55c1232e9ebc847cd79d32b034b2628e 100644
--- a/l10n/templates/files_trashbin.pot
+++ b/l10n/templates/files_trashbin.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ownCloud Core 5.0.0\n"
 "Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2013-05-21 02:00+0200\n"
+"POT-Creation-Date: 2013-05-22 02:17+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files_versions.pot b/l10n/templates/files_versions.pot
index 91f8d60881e785ab44a96e2b9e6983b961d2bd85..6c897bae2e9f97c3d405c9dda49b310bc221ab9c 100644
--- a/l10n/templates/files_versions.pot
+++ b/l10n/templates/files_versions.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ownCloud Core 5.0.0\n"
 "Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2013-05-21 02:00+0200\n"
+"POT-Creation-Date: 2013-05-22 02:17+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/lib.pot b/l10n/templates/lib.pot
index 55b22c52c62aa615c4c0a2d5c7e4bf081875331a..ef7c6f40032e614cfb4dbe09ae1a7a1845cdd7ef 100644
--- a/l10n/templates/lib.pot
+++ b/l10n/templates/lib.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ownCloud Core 5.0.0\n"
 "Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2013-05-21 02:01+0200\n"
+"POT-Creation-Date: 2013-05-22 02:18+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/settings.pot b/l10n/templates/settings.pot
index fe59c434e975b774f14f9da7d363b2ffdcc6f5c8..a7651f9f1e531dd273b3c43e9c1ae9cef517bfe6 100644
--- a/l10n/templates/settings.pot
+++ b/l10n/templates/settings.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ownCloud Core 5.0.0\n"
 "Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2013-05-21 02:01+0200\n"
+"POT-Creation-Date: 2013-05-22 02:18+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/user_ldap.pot b/l10n/templates/user_ldap.pot
index e14b4cb292a2cc9c39a5f40ab561394dfe1f47ff..f18624f2773d64e70a49df002618df9743becf9c 100644
--- a/l10n/templates/user_ldap.pot
+++ b/l10n/templates/user_ldap.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ownCloud Core 5.0.0\n"
 "Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2013-05-21 02:00+0200\n"
+"POT-Creation-Date: 2013-05-22 02:17+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/user_webdavauth.pot b/l10n/templates/user_webdavauth.pot
index 018936d3d9d5916f455074f90d37ae29b0ecb6e0..c6985473c665c5072c700473b47f22e9cc0315b4 100644
--- a/l10n/templates/user_webdavauth.pot
+++ b/l10n/templates/user_webdavauth.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ownCloud Core 5.0.0\n"
 "Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2013-05-21 02:00+0200\n"
+"POT-Creation-Date: 2013-05-22 02:17+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/lib/app.php b/lib/app.php
index 55b4543ec9f874b0085a9118eb7334748c1f06c0..c6f6e92e60e255d67ece010cf26e432788f70da2 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -172,9 +172,17 @@ class OC_App{
 			return array();
 		}
 		$apps=array('files');
-		$query = OC_DB::prepare( 'SELECT `appid` FROM `*PREFIX*appconfig`'
-			.' WHERE `configkey` = \'enabled\' AND `configvalue`=\'yes\'' );
+		$sql = 'SELECT `appid` FROM `*PREFIX*appconfig`'
+			.' WHERE `configkey` = \'enabled\' AND `configvalue`=\'yes\'';
+		if (OC_Config::getValue( 'dbtype', 'sqlite' ) === 'oci') { //FIXME oracle hack
+			$sql = 'SELECT `appid` FROM `*PREFIX*appconfig`'
+			.' WHERE `configkey` = \'enabled\' AND to_char(`configvalue`)=\'yes\'';
+		}
+		$query = OC_DB::prepare( $sql );
 		$result=$query->execute();
+		if( \OC_DB::isError($result)) {
+			throw new DatabaseException($result->getMessage(), $query);
+		}
 		while($row=$result->fetchRow()) {
 			if(array_search($row['appid'], $apps)===false) {
 				$apps[]=$row['appid'];
diff --git a/lib/base.php b/lib/base.php
index 7d7e690aa6f47c412ff5f70f372748410de1f14f..724bd250a5c63fc3d518b5d19c41933d29b21c36 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -260,6 +260,7 @@ class OC {
 		OC_Util::addScript("jquery-tipsy");
 		OC_Util::addScript("compatibility");
 		OC_Util::addScript("oc-dialogs");
+		OC_Util::addScript("octemplate");
 		OC_Util::addScript("js");
 		OC_Util::addScript("eventsource");
 		OC_Util::addScript("config");
diff --git a/lib/db.php b/lib/db.php
index 8f6f50bda6e3c51738586b55e4f6512d48a164c2..618365518331c20798c805352eb92c0e4e1a9801 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -273,18 +273,13 @@ class OC_DB {
 					break;
 				case 'oci':
 					$dsn = array(
-							'phptype'  => 'oci8',
-							'username' => $user,
-							'password' => $pass,
-							'charset' => 'AL32UTF8',
+						'phptype'  => 'oci8',
+						'username' => $user,
+						'password' => $pass,
+						'service'  => $name,
+						'hostspec' => $host,
+						'charset' => 'AL32UTF8',
 					);
-					if ($host != '') {
-						$dsn['hostspec'] = $host;
-						$dsn['database'] = $name;
-					} else { // use dbname for hostspec
-						$dsn['hostspec'] = $name;
-						$dsn['database'] = $user;
-					}
 					break;
 				case 'mssql':
 					$dsn = array(
diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php
index 1a8435a46fc2206c6ece38698c0861880fecaeb7..b912b4423e7fc4eed27bf23930c22330384f63ca 100644
--- a/lib/files/cache/cache.php
+++ b/lib/files/cache/cache.php
@@ -146,8 +146,12 @@ class Cache {
 		if ($fileId > -1) {
 			$query = \OC_DB::prepare(
 				'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `unencrypted_size`, `etag`
-			 	 FROM `*PREFIX*filecache` WHERE parent = ? ORDER BY `name` ASC');
+			 	 FROM `*PREFIX*filecache` WHERE `parent` = ? ORDER BY `name` ASC');
+
 			$result = $query->execute(array($fileId));
+			if (\OC_DB::isError($result)) {
+				\OCP\Util::writeLog('cache', 'getFolderContents failed: ' . $result->getMessage(), \OCP\Util::ERROR);
+			}
 			$files = $result->fetchAll();
 			foreach ($files as &$file) {
 				$file['mimetype'] = $this->getMimetype($file['mimetype']);
@@ -202,7 +206,7 @@ class Cache {
 				. ' VALUES(' . implode(', ', $valuesPlaceholder) . ')');
 			$result = $query->execute($params);
 			if (\OC_DB::isError($result)) {
-				\OCP\Util::writeLog('cache', 'Insert to cache failed: ' . $result, \OCP\Util::ERROR);
+				\OCP\Util::writeLog('cache', 'Insert to cache failed: ' . $result->getMessage(), \OCP\Util::ERROR);
 			}
 
 			return (int)\OC_DB::insertid('*PREFIX*filecache');
@@ -373,6 +377,9 @@ class Cache {
 		$pathHash = md5($file);
 		$query = \OC_DB::prepare('SELECT `size` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path_hash` = ?');
 		$result = $query->execute(array($this->getNumericStorageId(), $pathHash));
+		if( \OC_DB::isError($result)) {
+			\OCP\Util::writeLog('cache', 'get status failed: ' . $result->getMessage(), \OCP\Util::ERROR);
+		}
 		if ($row = $result->fetchRow()) {
 			if ((int)$row['size'] === -1) {
 				return self::SHALLOW;
@@ -510,8 +517,11 @@ class Cache {
 	 */
 	public function getIncomplete() {
 		$query = \OC_DB::prepare('SELECT `path` FROM `*PREFIX*filecache`'
-			. ' WHERE `storage` = ? AND `size` = -1 ORDER BY `fileid` DESC LIMIT 1');
+			. ' WHERE `storage` = ? AND `size` = -1 ORDER BY `fileid` DESC',1);
 		$result = $query->execute(array($this->getNumericStorageId()));
+		if (\OC_DB::isError($result)) {
+			\OCP\Util::writeLog('cache', 'getIncomplete failed: ' . $result->getMessage(), \OCP\Util::ERROR);
+		}
 		if ($row = $result->fetchRow()) {
 			return $row['path'];
 		} else {
diff --git a/lib/setup.php b/lib/setup.php
index f1ac6b8b2b81c610d4135427d7cdccbfaec93d45..a63cc664dbcabebb7ed0ec3fb18e4e3956228700 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -152,8 +152,12 @@ class OC_Setup {
 					self::setupOCIDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix, $dbtablespace, $username);
 				} catch (Exception $e) {
 					$error[] = array(
-						'error' => $l->t('Oracle username and/or password not valid'),
-						'hint' => $l->t('You need to enter either an existing account or the administrator.')
+						'error' => $l->t('Oracle connection could not be established'),
+						'hint' => $e->getMessage().' Check environment: ORACLE_HOME='.getenv('ORACLE_HOME')
+							.' ORACLE_SID='.getenv('ORACLE_SID')
+							.' LD_LIBRARY_PATH='.getenv('LD_LIBRARY_PATH')
+							.' NLS_LANG='.getenv('NLS_LANG')
+							.' tnsnames.ora is '.(is_readable(getenv('ORACLE_HOME').'/network/admin/tnsnames.ora')?'':'not ').'readable'
 					);
 					return $error;
 				}
@@ -452,9 +456,13 @@ class OC_Setup {
 		} else {
 			$easy_connect_string = '//'.$e_host.'/'.$e_dbname;
 		}
+		\OC_Log::write('setup oracle', 'connect string: ' . $easy_connect_string, \OC_Log::DEBUG);
 		$connection = @oci_connect($dbuser, $dbpass, $easy_connect_string);
 		if(!$connection) {
 			$e = oci_error();
+			if (is_array ($e) && isset ($e['message'])) {
+				throw new Exception($e['message']);
+			}
 			throw new Exception($l->t('Oracle username and/or password not valid'));
 		}
 		//check for roles creation rights in oracle
diff --git a/lib/user.php b/lib/user.php
index 2bd11022e26e92e9fc1768fc41a339f8f1ef7f48..26fe73f8bfe630dd71b5a0bfa8056474555d6229 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -611,6 +611,10 @@ class OC_User {
 	public static function isEnabled($userid) {
 		$sql = 'SELECT `userid` FROM `*PREFIX*preferences`'
 			.' WHERE `userid` = ? AND `appid` = ? AND `configkey` = ? AND `configvalue` = ?';
+		if (OC_Config::getValue( 'dbtype', 'sqlite' ) === 'oci') { //FIXME oracle hack
+			$sql = 'SELECT `userid` FROM `*PREFIX*preferences`'
+				.' WHERE `userid` = ? AND `appid` = ? AND `configkey` = ? AND to_char(`configvalue`) = ?';
+		}
 		$stmt = OC_DB::prepare($sql);
 		if ( ! OC_DB::isError($stmt) ) {
 			$result = $stmt->execute(array($userid, 'core', 'enabled', 'false'));
diff --git a/lib/user/database.php b/lib/user/database.php
index 63c64ed43d393157ff2abb6635d3bdc5b2b26f03..d70b620f2abf055d9fd102fd36930bdce474f16f 100644
--- a/lib/user/database.php
+++ b/lib/user/database.php
@@ -136,7 +136,7 @@ class OC_User_Database extends OC_User_Backend {
 	 */
 	public function getDisplayName($uid) {
 		if( $this->userExists($uid) ) {
-			$query = OC_DB::prepare( 'SELECT displayname FROM `*PREFIX*users` WHERE `uid` = ?' );
+			$query = OC_DB::prepare( 'SELECT `displayname` FROM `*PREFIX*users` WHERE `uid` = ?' );
 			$result = $query->execute( array( $uid ))->fetchAll();
 			$displayName = trim($result[0]['displayname'], ' ');
 			if ( !empty($displayName) ) {
diff --git a/lib/util.php b/lib/util.php
index 48c224a3034b27c4ec84c23d64df495850a8b2f5..01e2df7bfc41539567d6608b69c83746a96b2c9d 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -173,7 +173,8 @@ class OC_Util {
 		//check for database drivers
 		if(!(is_callable('sqlite_open') or class_exists('SQLite3'))
 			and !is_callable('mysql_connect')
-			and !is_callable('pg_connect')) {
+			and !is_callable('pg_connect')
+			and !is_callable('oci_connect')) {
 			$errors[]=array('error'=>'No database drivers (sqlite, mysql, or postgresql) installed.',
 				'hint'=>'');//TODO: sane hint
 			$web_server_restart= true;