diff --git a/.gitignore b/.gitignore
index a84615cf138517cbbbbda6b854a40dc87568240f..68c48822e9d1a05e148af8643e88a13976dd0c30 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,3 +43,4 @@ nbproject
 
 # WebFinger
 .well-known
+/.buildpath
diff --git a/apps/external/ajax/seturls.php b/apps/external/ajax/seturls.php
index c8e977545443e26532c267d53a0de463b1511c23..e994385a1994f8596e2a59cb4f047dba6a470fa2 100644
--- a/apps/external/ajax/seturls.php
+++ b/apps/external/ajax/seturls.php
@@ -8,16 +8,16 @@
 require_once('../../../lib/base.php');
 OC_Util::checkAdminUser();
 
-if(isset($_POST['s1name'])) OC_Config::setValue( 'external-site1name', $_POST['s1name'] );
-if(isset($_POST['s1url'])) OC_Config::setValue( 'external-site1url', $_POST['s1url'] );
-if(isset($_POST['s2name'])) OC_Config::setValue( 'external-site2name', $_POST['s2name'] );
-if(isset($_POST['s2url'])) OC_Config::setValue( 'external-site2url', $_POST['s2url'] );
-if(isset($_POST['s3name'])) OC_Config::setValue( 'external-site3name', $_POST['s3name'] );
-if(isset($_POST['s3url'])) OC_Config::setValue( 'external-site3url', $_POST['s3url'] );
-if(isset($_POST['s4name'])) OC_Config::setValue( 'external-site4name', $_POST['s4name'] );
-if(isset($_POST['s4url'])) OC_Config::setValue( 'external-site4url', $_POST['s4url'] );
-if(isset($_POST['s5name'])) OC_Config::setValue( 'external-site5name', $_POST['s5name'] );
-if(isset($_POST['s5url'])) OC_Config::setValue( 'external-site5url', $_POST['s5url'] );
+if(isset($_POST['s1name'])) OC_Appconfig::setValue( 'external','site1name', $_POST['s1name'] );
+if(isset($_POST['s1url'])) OC_Appconfig::setValue( 'external','site1url', $_POST['s1url'] );
+if(isset($_POST['s2name'])) OC_Appconfig::setValue( 'external','site2name', $_POST['s2name'] );
+if(isset($_POST['s2url'])) OC_Appconfig::setValue( 'external','site2url', $_POST['s2url'] );
+if(isset($_POST['s3name'])) OC_Appconfig::setValue( 'external','site3name', $_POST['s3name'] );
+if(isset($_POST['s3url'])) OC_Appconfig::setValue( 'external','site3url', $_POST['s3url'] );
+if(isset($_POST['s4name'])) OC_Appconfig::setValue( 'external','site4name', $_POST['s4name'] );
+if(isset($_POST['s4url'])) OC_Appconfig::setValue( 'external','site4url', $_POST['s4url'] );
+if(isset($_POST['s5name'])) OC_Appconfig::setValue( 'external','site5name', $_POST['s5name'] );
+if(isset($_POST['s5url'])) OC_Appconfig::setValue( 'external','site5url', $_POST['s5url'] );
 
 echo 'true';
 
diff --git a/apps/external/appinfo/app.php b/apps/external/appinfo/app.php
index df14954d86f6ea52242fdfb8669d6c91b8a0f2b9..0f536cbf4183d5c6ce0419c2a3584e534fa17da7 100644
--- a/apps/external/appinfo/app.php
+++ b/apps/external/appinfo/app.php
@@ -25,13 +25,13 @@ OC_APP::registerAdmin('external','settings');
 
 OC_App::register( array( 'order' => 70, 'id' => 'external', 'name' => 'External' ));
 
-if(OC_Config::getValue( "external-site1name", '' )<>'')  OC_App::addNavigationEntry( array( 'id' => 'external_index1', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=1', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Config::getValue( "external-site1name", '' )));
+if(OC_Appconfig::getValue( "external","site1name", '' )<>'')  OC_App::addNavigationEntry( array( 'id' => 'external_index1', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=1', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Appconfig::getValue( "external","site1name", '' )));
 
-if(OC_Config::getValue( "external-site2name", '' )<>'')  OC_App::addNavigationEntry( array( 'id' => 'external_index2', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=2', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Config::getValue( "external-site2name", '' )));
+if(OC_Appconfig::getValue( "external","site2name", '' )<>'')  OC_App::addNavigationEntry( array( 'id' => 'external_index2', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=2', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Appconfig::getValue( "external","site2name", '' )));
 
-if(OC_Config::getValue( "external-site3name", '' )<>'')  OC_App::addNavigationEntry( array( 'id' => 'external_index3', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=3', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Config::getValue( "external-site3name", '' )));
+if(OC_Appconfig::getValue( "external","site3name", '' )<>'')  OC_App::addNavigationEntry( array( 'id' => 'external_index3', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=3', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Appconfig::getValue( "external","site3name", '' )));
 
-if(OC_Config::getValue( "external-site4name", '' )<>'')  OC_App::addNavigationEntry( array( 'id' => 'external_index4', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=4', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Config::getValue( "external-site4name", '' )));
+if(OC_Appconfig::getValue( "external","site4name", '' )<>'')  OC_App::addNavigationEntry( array( 'id' => 'external_index4', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=4', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Appconfig::getValue( "external","site4name", '' )));
 
-if(OC_Config::getValue( "external-site5name", '' )<>'')  OC_App::addNavigationEntry( array( 'id' => 'external_index5', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=5', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Config::getValue( "external-site5name", '' )));
+if(OC_Appconfig::getValue( "external","site5name", '' )<>'')  OC_App::addNavigationEntry( array( 'id' => 'external_index5', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=5', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Appconfig::getValue( "external","site5name", '' )));
 
diff --git a/apps/external/index.php b/apps/external/index.php
index 116e16d909642bd236164936a7d0e23432c8d2f4..86b19abc10ef64eb4b552d55030785d9c12e9497 100644
--- a/apps/external/index.php
+++ b/apps/external/index.php
@@ -35,7 +35,7 @@ if(isset($_GET['id'])){
 	$id=$_GET['id'];
 	$id = (int) $id;
 
-	$url=OC_Config::getValue( "external-site".$id."url", '' );
+	$url=OC_Appconfig::getValue( "external","site".$id."url", '' );
 	OC_App::setActiveNavigationEntry( 'external_index'.$id );
 
 	$tmpl = new OC_Template( 'external', 'frame', 'user' );
diff --git a/apps/external/settings.php b/apps/external/settings.php
index ad33c16e1bf7c5545454ba4cafe1b8fb28e6375c..3e0c34251281e6da9ed9009c74bf7de6e54900e8 100644
--- a/apps/external/settings.php
+++ b/apps/external/settings.php
@@ -6,17 +6,17 @@ OC_Util::addScript( "external", "admin" );
 
 $tmpl = new OC_Template( 'external', 'settings');
 
-	$tmpl->assign('s1name',OC_Config::getValue( "external-site1name", '' ));
-	$tmpl->assign('s2name',OC_Config::getValue( "external-site2name", '' ));
-	$tmpl->assign('s3name',OC_Config::getValue( "external-site3name", '' ));
-	$tmpl->assign('s4name',OC_Config::getValue( "external-site4name", '' ));
-	$tmpl->assign('s5name',OC_Config::getValue( "external-site5name", '' ));
+	$tmpl->assign('s1name',OC_Appconfig::getValue( "external","site1name", '' ));
+	$tmpl->assign('s2name',OC_Appconfig::getValue( "external","site2name", '' ));
+	$tmpl->assign('s3name',OC_Appconfig::getValue( "external","site3name", '' ));
+	$tmpl->assign('s4name',OC_Appconfig::getValue( "external","site4name", '' ));
+	$tmpl->assign('s5name',OC_Appconfig::getValue( "external","site5name", '' ));
 
-	$tmpl->assign('s1url',OC_Config::getValue( "external-site1url", '' ));
-	$tmpl->assign('s2url',OC_Config::getValue( "external-site2url", '' ));
-	$tmpl->assign('s3url',OC_Config::getValue( "external-site3url", '' ));
-	$tmpl->assign('s4url',OC_Config::getValue( "external-site4url", '' ));
-	$tmpl->assign('s5url',OC_Config::getValue( "external-site5url", '' ));
+	$tmpl->assign('s1url',OC_Appconfig::getValue( "external","site1url", '' ));
+	$tmpl->assign('s2url',OC_Appconfig::getValue( "external","site2url", '' ));
+	$tmpl->assign('s3url',OC_Appconfig::getValue( "external","site3url", '' ));
+	$tmpl->assign('s4url',OC_Appconfig::getValue( "external","site4url", '' ));
+	$tmpl->assign('s5url',OC_Appconfig::getValue( "external","site5url", '' ));
 
 return $tmpl->fetchPage();
 ?>
diff --git a/apps/files_sharing/ajax/getitem.php b/apps/files_sharing/ajax/getitem.php
index 075ec043eace6879e71683c4e6cdd6bfe4f0cb61..d9df4abe984656f12ffb0117e33d3c246fb469da 100644
--- a/apps/files_sharing/ajax/getitem.php
+++ b/apps/files_sharing/ajax/getitem.php
@@ -1,5 +1,5 @@
 <?php
-$RUNTIME_NOAPPS = true;
+//$RUNTIME_NOAPPS = true;
 
 require_once('../../../lib/base.php');
 OC_JSON::checkAppEnabled('files_sharing');
diff --git a/apps/files_sharing/ajax/setpermissions.php b/apps/files_sharing/ajax/setpermissions.php
index 7ee8f0e57bd21e9a308060f44ececfa8894c0c46..200202c704c0da0b95cb5a466240fc2bf5e82bbf 100644
--- a/apps/files_sharing/ajax/setpermissions.php
+++ b/apps/files_sharing/ajax/setpermissions.php
@@ -1,5 +1,5 @@
 <?php
-$RUNTIME_NOAPPS = true;
+//$RUNTIME_NOAPPS = true;
 
 require_once('../../../lib/base.php');
 OC_JSON::checkAppEnabled('files_sharing');
diff --git a/apps/files_sharing/ajax/share.php b/apps/files_sharing/ajax/share.php
index d1f509943179e252facc3d4455857131295dc2fc..9b10260da5a0e10945f300b6d69559d3182c7064 100644
--- a/apps/files_sharing/ajax/share.php
+++ b/apps/files_sharing/ajax/share.php
@@ -1,5 +1,5 @@
 <?php
-$RUNTIME_NOAPPS = true;
+//$RUNTIME_NOAPPS = true;
 
 require_once('../../../lib/base.php');
 OC_JSON::checkAppEnabled('files_sharing');
diff --git a/apps/files_sharing/ajax/unshare.php b/apps/files_sharing/ajax/unshare.php
index a19a85cfda3639b20a917abbbb7237116d1c3826..d8a72a00efe4317dd41dffa672f550cefe122378 100644
--- a/apps/files_sharing/ajax/unshare.php
+++ b/apps/files_sharing/ajax/unshare.php
@@ -1,5 +1,5 @@
 <?php
-$RUNTIME_NOAPPS = true;
+//$RUNTIME_NOAPPS = true;
 
 require_once('../../../lib/base.php');
 OC_JSON::checkAppEnabled('files_sharing');
diff --git a/apps/files_sharing/ajax/userautocomplete.php b/apps/files_sharing/ajax/userautocomplete.php
index 21516c3d091a4bedd1f2c74186f4de6fb519f08c..9d971fb62af7546c685c9c3352dce0754d12d05c 100644
--- a/apps/files_sharing/ajax/userautocomplete.php
+++ b/apps/files_sharing/ajax/userautocomplete.php
@@ -1,5 +1,5 @@
 <?php
-$RUNTIME_NOAPPS = true;
+//$RUNTIME_NOAPPS = true;
 
 require_once('../../../lib/base.php');
 
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index 4056d693bfa99dcd2d0fe975b519654efb0308cf..4457dddbe15a8b5e461cf6d1f37b5fa4faee67b9 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -224,7 +224,7 @@ function addUser(uid_shared_with, permissions, parentFolder) {
 		var user = '<li data-uid_shared_with="'+uid_shared_with+'">';
 		user += '<a href="" class="unshare" style="display:none;"><img class="svg" alt="Unshare" src="'+OC.imagePath('core','actions/delete')+'"/></a>';
 		user += uid_shared_with;
-		user += '<input type="checkbox" name="permissions" id="'+uid_shared_with+'" class="permissions" "+checked+" />';
+		user += '<input type="checkbox" name="permissions" id="'+uid_shared_with+'" class="permissions" '+checked+' />';
 		user += '<label for="'+uid_shared_with+'" '+style+'>can edit</label>';
 		user += '</li>';
 	}
diff --git a/apps/media/lib_ampache.php b/apps/media/lib_ampache.php
index 0ad84d668097d74c58ce983ba58a94882386018a..bb468d55955a3f8f0ab199239014d722c2d93c00 100644
--- a/apps/media/lib_ampache.php
+++ b/apps/media/lib_ampache.php
@@ -128,7 +128,7 @@ class OC_MEDIA_AMPACHE{
 		$albums=count(OC_MEDIA_COLLECTION::getAlbums($artist['artist_id']));
 		$songs=count(OC_MEDIA_COLLECTION::getSongs($artist['artist_id']));
 		$id=$artist['artist_id'];
-		$name=utf8_decode(htmlentities($artist['artist_name']));
+		$name=htmlentities($artist['artist_name'], ENT_COMPAT | ENT_HTML401, 'UTF-8');
 		echo("\t<artist id='$id'>\n");
 		echo("\t\t<name>$name</name>\n");
 		echo("\t\t<albums>$albums</albums>\n");
@@ -142,10 +142,10 @@ class OC_MEDIA_AMPACHE{
 		if(!$artistName){
 			$artistName=OC_MEDIA_COLLECTION::getArtistName($album['album_artist']);
 		}
-		$artistName=utf8_decode(htmlentities($artistName));
+		$artistName=htmlentities($artistName, ENT_COMPAT | ENT_HTML401, 'UTF-8');
 		$songs=count(OC_MEDIA_COLLECTION::getSongs($album['album_artist'],$album['album_id']));
 		$id=$album['album_id'];
-		$name=utf8_decode(htmlentities($album['album_name']));
+		$name=htmlentities($album['album_name'], ENT_COMPAT | ENT_HTML401, 'UTF-8');
 		$artist=$album['album_artist'];
 		echo("\t<album id='$id'>\n");
 		echo("\t\t<name>$name</name>\n");
@@ -163,10 +163,10 @@ class OC_MEDIA_AMPACHE{
 		if(!$albumName){
 			$albumName=OC_MEDIA_COLLECTION::getAlbumName($song['song_album']);
 		}
-		$artistName=utf8_decode(htmlentities($artistName));
-		$albumName=utf8_decode(htmlentities($albumName));
+		$artistName=htmlentities($artistName, ENT_COMPAT | ENT_HTML401, 'UTF-8');
+		$albumName=htmlentities($albumName, ENT_COMPAT | ENT_HTML401, 'UTF-8');
 		$id=$song['song_id'];
-		$name=utf8_decode(htmlentities($song['song_name']));
+		$name=htmlentities($song['song_name'], ENT_COMPAT | ENT_HTML401, 'UTF-8');
 		$artist=$song['song_artist'];
 		$album=$song['song_album'];
 		echo("\t<song id='$id'>\n");
diff --git a/apps/media/lib_scanner.php b/apps/media/lib_scanner.php
index ef63cea45dfe19fee69a5989d3ae3c448c485399..c2bea2d836d95f5e0b85fe205be4611473ccf23d 100644
--- a/apps/media/lib_scanner.php
+++ b/apps/media/lib_scanner.php
@@ -93,6 +93,7 @@ class OC_MEDIA_SCANNER{
 			}
 			if(!self::$getID3){
 				self::$getID3=@new getID3();
+				self::$getID3->encoding='UTF-8';
 			}
 			$data=@self::$getID3->analyze($file);
 			getid3_lib::CopyTagsToComments($data);
@@ -105,21 +106,18 @@ class OC_MEDIA_SCANNER{
 				$artist='unknown';
 			}else{
 				$artist=stripslashes($data['comments']['artist'][0]);
-				$artist=utf8_encode($artist);
 			}
 			if(!isset($data['comments']['album'])){
 				OC_Log::write('media',"error reading album tag in '$file'",OC_Log::WARN);
 				$album='unknown';
 			}else{
 				$album=stripslashes($data['comments']['album'][0]);
-				$album=utf8_encode($album);
 			}
 			if(!isset($data['comments']['title'])){
 				OC_Log::write('media',"error reading title tag in '$file'",OC_Log::WARN);
 				$title='unknown';
 			}else{
 				$title=stripslashes($data['comments']['title'][0]);
-				$title=utf8_encode($title);
 			}
 			$size=$data['filesize'];
 			$track=(isset($data['comments']['track']))?$data['comments']['track'][0]:0;
@@ -150,4 +148,4 @@ class OC_MEDIA_SCANNER{
 		$ext=substr($filename,strrpos($filename,'.')+1);
 		return $ext=='mp3' || $ext=='flac' || $ext=='m4a' || $ext=='ogg' || $ext=='oga';
 	}
-}
\ No newline at end of file
+}
diff --git a/apps/user_ldap/appinfo/app.php b/apps/user_ldap/appinfo/app.php
index 7906241f79b819d9222937be58ee1aa0c15fe119..3261708f590404563c5184104951fa55f32aea86 100644
--- a/apps/user_ldap/appinfo/app.php
+++ b/apps/user_ldap/appinfo/app.php
@@ -26,7 +26,10 @@ require_once('apps/user_ldap/user_ldap.php');
 OC_APP::registerAdmin('user_ldap','settings');
 
 // define LDAP_DEFAULT_PORT
-define("OC_USER_BACKEND_LDAP_DEFAULT_PORT", 389);
+define('OC_USER_BACKEND_LDAP_DEFAULT_PORT', 389);
+
+// define OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME
+define('OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME', 'uid');
 
 // register user backend
 OC_User::useBackend( "LDAP" );
diff --git a/apps/user_ldap/settings.php b/apps/user_ldap/settings.php
index 8dbd3c0462b7959a40ca60e8ce5987d05d6a2ddb..e61d82bf8beacd64cd1d72e904283e5ed9968402 100644
--- a/apps/user_ldap/settings.php
+++ b/apps/user_ldap/settings.php
@@ -20,12 +20,16 @@
  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
-$params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_password', 'ldap_base', 'ldap_filter');
+$params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_password', 'ldap_base', 'ldap_filter', 'ldap_display_name', 'ldap_tls');
 
 foreach($params as $param){
 	if(isset($_POST[$param])){
 		OC_Appconfig::setValue('user_ldap', $param, $_POST[$param]);
 	}
+	elseif('ldap_tls' == $param) {
+		// unchecked checkboxes are not included in the post paramters
+		OC_Appconfig::setValue('user_ldap', $param, 0);
+	}
 }
 
 // fill template
@@ -38,4 +42,7 @@ foreach($params as $param){
 // ldap_port has a default value
 $tmpl->assign( 'ldap_port', OC_Appconfig::getValue('user_ldap', 'ldap_port', OC_USER_BACKEND_LDAP_DEFAULT_PORT));
 
+// ldap_display_name has a default value
+$tmpl->assign( 'ldap_display_name', OC_Appconfig::getValue('user_ldap', 'ldap_display_name', OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME));
+
 return $tmpl->fetchPage();
diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php
index 32e1b29dafb219d6c006ad73aa1eb552dc903067..5f25570e229d6dc87b499b542234a5a0376598af 100644
--- a/apps/user_ldap/templates/settings.php
+++ b/apps/user_ldap/templates/settings.php
@@ -1,12 +1,16 @@
 <form id="ldap" action="#" method="post">
 	<fieldset class="personalblock">
 		<legend><strong>LDAP</strong></legend>
-		<p><label for="ldap_host">Host<input type="text" id="ldap_host" name="ldap_host" value="<?php echo $_['ldap_host']; ?>"></label>
-		<label for="ldap_port">Port</label><input type="text" id="ldap_port" name="ldap_port" value="<?php echo $_['ldap_port']; ?>" /></p>
-		<p><label for="ldap_dn">Name</label><input type="text" id="ldap_dn" name="ldap_dn" value="<?php echo $_['ldap_dn']; ?>" />
-		<label for="ldap_password">Password</label><input type="password" id="ldap_password" name="ldap_password" value="<?php echo $_['ldap_password']; ?>" /></p>
-		<p><label for="ldap_base">Base</label><input type="text" id="ldap_base" name="ldap_base" value="<?php echo $_['ldap_base']; ?>" />
-		<label for="ldap_filter">Filter (use %uid placeholder)</label><input type="text" id="ldap_filter" name="ldap_filter" value="<?php echo $_['ldap_filter']; ?>" /></p>
+		<p><label for="ldap_host"><?php echo $l->t('Host');?><input type="text" id="ldap_host" name="ldap_host" value="<?php echo $_['ldap_host']; ?>"></label>
+		<label for="ldap_port"><?php echo $l->t('Port');?></label><input type="text" id="ldap_port" name="ldap_port" value="<?php echo $_['ldap_port']; ?>" /></p>
+		<p><label for="ldap_dn"><?php echo $l->t('Name');?></label><input type="text" id="ldap_dn" name="ldap_dn" value="<?php echo $_['ldap_dn']; ?>" />
+		<label for="ldap_password"><?php echo $l->t('Password');?></label><input type="password" id="ldap_password" name="ldap_password" value="<?php echo $_['ldap_password']; ?>" />
+		<small><?php echo $l->t('Leave both empty for anonymous bind for search, then bind with users credentials.');?></small></p>
+		<p><label for="ldap_base"><?php echo $l->t('Base');?></label><input type="text" id="ldap_base" name="ldap_base" value="<?php echo $_['ldap_base']; ?>" />
+		<label for="ldap_filter"><?php echo $l->t('Filter (use %%uid placeholder)');?></label><input type="text" id="ldap_filter" name="ldap_filter" value="<?php echo $_['ldap_filter']; ?>" /></p>
+		<p><label for="ldap_display_name"><?php echo $l->t('Display Name Field');?></label><input type="text" id="ldap_display_name" name="ldap_display_name" value="<?php echo $_['ldap_display_name']; ?>" />
+		<small><?php echo $l->t('Currently the display name field needs to be the same you matched %%uid against in the filter above, because ownCloud doesn\'t distinguish between user id and user name.');?></small></p>
+		<p><input type="checkbox" id="ldap_tls" name="ldap_tls" value="1"<?php if ($_['ldap_tls']) echo ' checked'; ?>><label for="ldap_tls"><?php echo $l->t('Use TLS');?></label></p>
 		<input type="submit" value="Save" />
 	</fieldset>
 </form>
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php
index 1154efc17b194e0810109fd22502e79c56e13295..249def7a1c8c90c99de5172154f19bbb6582cf3d 100644
--- a/apps/user_ldap/user_ldap.php
+++ b/apps/user_ldap/user_ldap.php
@@ -33,6 +33,8 @@ class OC_USER_LDAP extends OC_User_Backend {
 	protected $ldap_password;
 	protected $ldap_base;
 	protected $ldap_filter;
+	protected $ldap_tls;
+	protected $ldap_display_name;
 
 	function __construct() {
 		$this->ldap_host = OC_Appconfig::getValue('user_ldap', 'ldap_host','');
@@ -41,13 +43,15 @@ class OC_USER_LDAP extends OC_User_Backend {
 		$this->ldap_password = OC_Appconfig::getValue('user_ldap', 'ldap_password','');
 		$this->ldap_base = OC_Appconfig::getValue('user_ldap', 'ldap_base','');
 		$this->ldap_filter = OC_Appconfig::getValue('user_ldap', 'ldap_filter','');
+		$this->ldap_tls = OC_Appconfig::getValue('user_ldap', 'ldap_tls', 0);
+		$this->ldap_display_name = OC_Appconfig::getValue('user_ldap', 'ldap_display_name', OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME);
 
 		if( !empty($this->ldap_host)
 			&& !empty($this->ldap_port)
-			&& !empty($this->ldap_dn)
-			&& !empty($this->ldap_password)
+			&& ((!empty($this->ldap_dn) && !empty($this->ldap_password)) || (empty($this->ldap_dn) && empty($this->ldap_password)))
 			&& !empty($this->ldap_base)
 			&& !empty($this->ldap_filter)
+			&& !empty($this->ldap_display_name)
 		)
 		{
 			$this->configured = true;
@@ -63,9 +67,10 @@ class OC_USER_LDAP extends OC_User_Backend {
 	private function getDs() {
 		if(!$this->ds) {
 			$this->ds = ldap_connect( $this->ldap_host, $this->ldap_port );
-			   if(ldap_set_option($this->ds, LDAP_OPT_PROTOCOL_VERSION, 3))
-				 if(ldap_set_option($this->ds, LDAP_OPT_REFERRALS, 0))
-					  ldap_start_tls($this->ds);
+				if(ldap_set_option($this->ds, LDAP_OPT_PROTOCOL_VERSION, 3))
+					if(ldap_set_option($this->ds, LDAP_OPT_REFERRALS, 0))
+						if($this->ldap_tls)
+							ldap_start_tls($this->ds);
 		}
 
 		// login
@@ -88,15 +93,16 @@ class OC_USER_LDAP extends OC_User_Backend {
 			return false;
 
 		// get dn
-		$filter = str_replace("%uid", $uid, $this->ldap_filter);
+		$filter = str_replace('%uid', $uid, $this->ldap_filter);
 		$sr = ldap_search( $this->getDs(), $this->ldap_base, $filter );
 		$entries = ldap_get_entries( $this->getDs(), $sr );
 
-		if( $entries["count"] == 0 )
+		if( $entries['count'] == 0 )
 			return false;
 
-		return $entries[0]["dn"];
+		return $entries[0]['dn'];
 	}
+
 	public function checkPassword( $uid, $password ) {
 		if(!$this->configured){
 			return false;
@@ -117,6 +123,37 @@ class OC_USER_LDAP extends OC_User_Backend {
 		$dn = $this->getDn($uid);
 		return !empty($dn);
 	}
+	
+	public function getUsers()
+	{
+		if(!$this->configured)
+		return false;
+	
+		// connect to server
+		$ds = $this->getDs();
+		if( !$ds )
+			return false;
+	
+		// get users
+		$filter = 'objectClass=person';
+		$sr = ldap_search( $this->getDs(), $this->ldap_base, $filter );
+		$entries = ldap_get_entries( $this->getDs(), $sr );
+		if( $entries['count'] == 0 )
+			return false;
+		else {
+			$users = array();
+			foreach($entries as $row) {
+				// TODO ldap_get_entries() seems to lower all keys => needs review
+				$ldap_display_name  = strtolower($this->ldap_display_name);
+				if(isset($row[$ldap_display_name])) {
+					$users[] = $row[$ldap_display_name][0];
+				}
+			}
+			// TODO language specific sorting of user names
+			sort($users);
+			return $users;
+		}
+	}
 
 }
 
diff --git a/lib/config.php b/lib/config.php
index 2c82036257f95e4206c901e1d2f8e0ec27e7e07d..8d03271b3eaacfc573e38e0f3c662da3d72be432 100644
--- a/lib/config.php
+++ b/lib/config.php
@@ -94,7 +94,6 @@ class OC_Config{
 
 		// Write changes
 		self::writeData();
-
 		return true;
 	}
 
diff --git a/lib/setup.php b/lib/setup.php
index e2d56ddaf4ad2f78824c0750ce96caf2aaad170f..8afe0070e9bdc7ed0f9bcd68a113ab94695dd5a1 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -77,6 +77,8 @@ class OC_Setup {
 			OC_Config::setValue('datadirectory', $datadir);
  			OC_Config::setValue('dbtype', $dbtype);
  			OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
+ 			OC_Config::setValue('installedat',microtime(true));
+ 			OC_Config::setValue('lastupdatedat',microtime(true));
 			if($dbtype == 'mysql') {
 				$dbuser = $options['dbuser'];
 				$dbpass = $options['dbpass'];
diff --git a/lib/updater.php b/lib/updater.php
new file mode 100644
index 0000000000000000000000000000000000000000..e4db719a62c913cb276da5c85e989316d08da545
--- /dev/null
+++ b/lib/updater.php
@@ -0,0 +1,91 @@
+<?php
+/**
+ * ownCloud
+ *
+ * @author Frank Karlitschek
+ * @copyright 2010 Frank Karlitschek karlitschek@kde.org
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/**
+ * Class that handels autoupdating of ownCloud
+ */
+class OC_Updater{
+
+	/**
+	 * Check if a new version is available
+	 */
+	public static function check(){
+		OC_Config::setValue('lastupdatedat',microtime(true));
+
+		$updaterurl='http://apps.owncloud.com/updater.php';
+		$version=OC_Util::getVersion();
+		$version['installed']=OC_Config::getValue( "installedat");
+		$version['updated']=OC_Config::getValue( "lastupdatedat");
+		$version['updatechannel']='stable';
+		$versionstring=implode('x',$version);
+
+		//fetch xml data from updater
+		$url=$updaterurl.'?version='.$versionstring;
+                $xml=@file_get_contents($url);
+                if($xml==FALSE){
+                        return array();
+                }
+                $data=@simplexml_load_string($xml);
+
+		$tmp=array();
+                $tmp['version'] = $data->version;
+                $tmp['versionstring'] = $data->versionstring;
+                $tmp['url'] = $data->url;
+                $tmp['web'] = $data->web;
+
+
+                return $tmp;
+
+	}
+
+
+
+	public static function ShowUpdatingHint(){
+		$data=OC_Updater::check();
+		if(isset($data['version']) and $data['version']<>'') {
+			$txt='<span style="color:#AA0000; font-weight:bold;">'.$data['versionstring'].' is available. Please click <a href="'.$data['web'].'">here</a> for more information</span>';
+		}else{
+			$txt='Your ownCloud is up to date';
+		}
+		return($txt);
+
+	}
+
+
+	/**
+	 * do ownCloud update
+	 */
+	public static function doUpdate(){
+
+		//update ownCloud core
+
+		//update all apps
+
+		//update version in config
+
+	}
+
+}
+
+
+
+?>
diff --git a/settings/templates/personal.php b/settings/templates/personal.php
index 54487165f3c2098c02dd2b1f92afb53463f9a9a8..8c5de5ccf2a1c1d127916dca91ff9d72acecbf3a 100644
--- a/settings/templates/personal.php
+++ b/settings/templates/personal.php
@@ -50,7 +50,9 @@
 };?>
 
 <p class="personalblock">
-	<strong>ownCloud</strong> <?php echo(OC_Util::getVersionString()); ?>, <a href="http://gitorious.org/owncloud" target="_blank">source code</a> licensed freely under <a href="http://www.gnu.org/licenses/agpl-3.0.html" target="_blank">AGPL</a>
+	<strong>ownCloud</strong> <?php echo(OC_Util::getVersionString()); ?><br />
+	<?php echo(OC_Updater::ShowUpdatingHint());     ?><br />
+	<a href="http://gitorious.org/owncloud" target="_blank">source code</a> licensed freely under <a href="http://www.gnu.org/licenses/agpl-3.0.html" target="_blank">AGPL</a>
 </p>