diff --git a/3dparty/MDB2.php b/3dparty/MDB2.php
index 19d6b8c42841ad67d77af007bc94104f9d961151..30e564f14577965b150254516b9377f7db3343e3 100644
--- a/3dparty/MDB2.php
+++ b/3dparty/MDB2.php
@@ -1500,7 +1500,7 @@ class MDB2_Driver_Common extends PEAR
             }
         }
 
-        $err = $this->raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
+        $err = PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
         if ($err->getMode() !== PEAR_ERROR_RETURN
             && isset($this->nested_transaction_counter) && !$this->has_transaction_error) {
             $this->has_transaction_error =$err;
diff --git a/3dparty/MDB2/Driver/Manager/sqlite.php b/3dparty/MDB2/Driver/Manager/sqlite.php
index 3a5d266280e7f7dcd5a32d6c6756971782ca5842..5258cff891d1131c1d11a71b271cc488347a360f 100644
--- a/3dparty/MDB2/Driver/Manager/sqlite.php
+++ b/3dparty/MDB2/Driver/Manager/sqlite.php
@@ -71,6 +71,8 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
      */
     function createDatabase($name, $options = array())
     {
+		global $SERVERROOT;
+		$datadir=OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" );
         $db =$this->getDBInstance();
         if (PEAR::isError($db)) {
             return $db;
@@ -82,7 +84,8 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
                 'database already exists', __FUNCTION__);
         }
         $php_errormsg = '';
-        $handle = @sqlite_open($database_file, $db->dsn['mode'], $php_errormsg);
+        $database_file="$datadir/$database_file.db";
+        $handle = sqlite_open($database_file, $db->dsn['mode'], $php_errormsg);
         if (!$handle) {
             return $db->raiseError(MDB2_ERROR_CANNOT_CREATE, null, null,
                 (isset($php_errormsg) ? $php_errormsg : 'could not create the database file'), __FUNCTION__);
diff --git a/3dparty/MDB2/Driver/sqlite.php b/3dparty/MDB2/Driver/sqlite.php
index 061b9c67aaa4d02d7b7e32ffd1373fff7dc9430e..48f233167c702aee3025d0600e6c2d7d2e98057a 100644
--- a/3dparty/MDB2/Driver/sqlite.php
+++ b/3dparty/MDB2/Driver/sqlite.php
@@ -205,7 +205,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
             register_shutdown_function('MDB2_closeOpenTransactions');
         }
         $query = 'BEGIN TRANSACTION '.$this->options['base_transaction_name'];
-        $result =& $this->_doQuery($query, true);
+        $result =$this->_doQuery($query, true);
         if (PEAR::isError($result)) {
             return $result;
         }
@@ -240,7 +240,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
         }
 
         $query = 'COMMIT TRANSACTION '.$this->options['base_transaction_name'];
-        $result =& $this->_doQuery($query, true);
+        $result =$this->_doQuery($query, true);
         if (PEAR::isError($result)) {
             return $result;
         }
@@ -275,7 +275,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
         }
 
         $query = 'ROLLBACK TRANSACTION '.$this->options['base_transaction_name'];
-        $result =& $this->_doQuery($query, true);
+        $result =$this->_doQuery($query, true);
         if (PEAR::isError($result)) {
             return $result;
         }
@@ -347,6 +347,8 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
      **/
     function connect()
     {
+		global $SERVERROOT;
+		$datadir=OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" );
         $database_file = $this->_getDatabaseFile($this->database_name);
         if (is_resource($this->connection)) {
             //if (count(array_diff($this->connected_dsn, $this->dsn)) == 0
@@ -370,6 +372,9 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
         }
 
         if ($database_file !== ':memory:') {
+			if(!strpos($database_file,'.db')){
+				$database_file="$datadir/$database_file.db";
+			}
             if (!file_exists($database_file)) {
                 if (!touch($database_file)) {
                     return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
@@ -405,7 +410,9 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
         $php_errormsg = '';
         if (version_compare('5.1.0', PHP_VERSION, '>')) {
             @ini_set('track_errors', true);
+            echo 1;
             $connection = @$connect_function($database_file);
+            echo 2;
             @ini_restore('track_errors');
         } else {
             $connection = @$connect_function($database_file, 0666, $php_errormsg);
@@ -538,7 +545,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
         $this->_lasterror = $php_errormsg;
 
         if (!$result) {
-            $err =& $this->raiseError(null, null, null,
+            $err =$this->raiseError(null, null, null,
                 'Could not execute statement', __FUNCTION__);
             return $err;
         }
@@ -753,7 +760,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
 
         $table = $this->quoteIdentifier($table, true);
         $query = "REPLACE INTO $table ($query) VALUES ($values)";
-        $result =& $this->_doQuery($query, true, $connection);
+        $result =$this->_doQuery($query, true, $connection);
         if (PEAR::isError($result)) {
             return $result;
         }
@@ -781,7 +788,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
         $query = "INSERT INTO $sequence_name ($seqcol_name) VALUES (NULL)";
         $this->pushErrorHandling(PEAR_ERROR_RETURN);
         $this->expectError(MDB2_ERROR_NOSUCHTABLE);
-        $result =& $this->_doQuery($query, true);
+        $result =$this->_doQuery($query, true);
         $this->popExpect();
         $this->popErrorHandling();
         if (PEAR::isError($result)) {
@@ -800,7 +807,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
         $value = $this->lastInsertID();
         if (is_numeric($value)) {
             $query = "DELETE FROM $sequence_name WHERE $seqcol_name < $value";
-            $result =& $this->_doQuery($query, true);
+            $result =$this->_doQuery($query, true);
             if (PEAR::isError($result)) {
                 $this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name;
             }
@@ -896,7 +903,7 @@ class MDB2_Result_sqlite extends MDB2_Result_Common
         }
         if (!$row) {
             if ($this->result === false) {
-                $err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
+                $err =$this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
                     'resultset has already been freed', __FUNCTION__);
                 return $err;
             }
diff --git a/css/styles.css b/css/styles.css
index 6b86684354103b0d395bfc1896c789d5d26c0652..b737181d01bc695cce88332782984c88d7f84f2c 100644
--- a/css/styles.css
+++ b/css/styles.css
@@ -130,3 +130,7 @@ p.actions a.delete, div.actions a.delete { background-image:url('../img/delete.p
 #logs_options input[type="submit"] { float:right; margin:0 2em 0 0; }
 #logs_options input[type="text"] { margin:0; padding:0; border:1px solid #ccc; text-align:right; }
 li.error{ list-style:none; width:640px; margin:4em auto; padding:1em 1em 1em 4em; background-color:#fee; background-image:url('../img/task-attention.png'); background-position:0.8em 0.8em; background-repeat:no-repeat; border:1px solid #ccc; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; }
+
+/* SEARCH --------------------------------------------------------------------- */
+form.searchbox{display:inline; position:fixed; top:1.5em; right:9em; margin:0; padding:0;};
+form.searchbox .prettybutton{font-size:1.5em !important};
\ No newline at end of file
diff --git a/files/css/files.css b/files/css/files.css
index 6313e6d1ca68e3fb81454c412a495261cb6ef9a7..c3f7d82aa6e8cc4e5166a27c2d8461662bb42524 100644
--- a/files/css/files.css
+++ b/files/css/files.css
@@ -19,21 +19,34 @@
     text-decoration: none;
 }
 
-#file_upload_form {
+#file_upload_form, #file_newfolder_form {
 	display: inline;
 }
 
-#fileSelector, #file_upload_cancel {
+#fileSelector, #file_upload_cancel, #file_newfolder_submit {
 	display: none;
 }
 
-#file_upload_form input[type="button"]{
-	/* this is a dirty wurgaround, Jan needs to fix it in global css*/
-	font-size: 0.9em;
+#file_upload_start, #file_newfolder_name {
+	background-repeat: no-repeat;
+	background-position: 0.5em 0;
+	padding-left: 2em;
 }
 
-#file_newfolder_form {
-	display: none;
+#file_upload_start {background-image:url(../../img/mimetypes/file.png);}
+
+#file_newfolder_name {
+	background-image:url(../../img/places/folder.png); font-weight: bold; 
+	width: 14em;
+}
+
+#file_newfolder_submit {
+	width: 3em;
+}
+
+form input[type="button"], form input[type="text"]{
+	/* this is a dirty wurgaround, Jan needs to fix it in global css*/
+	font-size: 0.9em;
 }
 
 #file_upload_target {
diff --git a/files/js/files.js b/files/js/files.js
index bfb68317b02bcebdf19027541c54ac62c2ede69e..aed2d596272cf23aad1eeceb3f51734f98a2a067 100644
--- a/files/js/files.js
+++ b/files/js/files.js
@@ -2,6 +2,8 @@ $(document).ready(function() {
 	$('#file_action_panel').attr('activeAction', false);
 	$('#file_upload_start').attr('mode', 'menu');
 	$('#file_upload_form').attr('uploading', false);
+	$('#file_newfolder_name').css('width', '14em');
+	$('#file_newfolder_submit').css('width', '3em');
 	
     // Sets browser table behaviour :
     $('.browser tr').hover(
@@ -85,11 +87,23 @@ $(document).ready(function() {
 				$('#file_upload_cancel').slideDown(250);
 				$('#file_upload_start').attr('mode', 'action');
 			});
+			$('#file_upload_start').focusin(function() {
+				if($('#fileSelector').val() == '') {
+					$('#fileSelector').hide();
+					$('#file_upload_start').unbind('focusin');
+				}
+			});
+			$('#fileSelector').focusout(function() {
+				if($('#fileSelector').val() == '') {
+					$('#fileSelector').hide();
+				}
+			});
 			$('#fileSelector').show();	//needed for Chromium compatibility
 			//rekonq does not call change-event, when click() is executed by script
 			if(navigator.userAgent.indexOf('rekonq') == -1){ 
 				$('#fileSelector').click();
 			}
+			$('#fileSelector').focus();
 		} else if($('#file_upload_start').attr('mode') == 'action') {
 			$('#file_upload_cancel').slideUp(250);
 			$('#file_upload_form').attr('uploading', true);
@@ -115,6 +129,40 @@ $(document).ready(function() {
 		});
 	});
 	
+	$('#file_newfolder_name').click(function(){
+		if($('#file_newfolder_name').val() == 'New Folder'){
+			$('#file_newfolder_name').val('');
+		}
+	});
+	
+	$('#file_newfolder_name').bind('keyup', adjustNewFolderSize);
+	
+	$('#file_newfolder_submit').bind('vanish', function() {
+		$('#file_newfolder_name').bind('keyup', adjustNewFolderSize);
+		unsplitSize($('#file_newfolder_name'),$('#file_newfolder_submit'));
+	});
+	
+	$('#file_newfolder_name').focusout(function(){
+		if($('#file_newfolder_name').val() == '') {
+			$('#file_newfolder_form')[0].reset();
+			$('#file_newfolder_submit').fadeOut(250).trigger('vanish');
+		}
+	});
+	
+	$('#file_newfolder_submit').click(function() {
+		if($('#file_newfolder_name').val() != '') {
+			$.ajax({
+				url: 'ajax/newfolder.php',
+				data: "dir="+$('#dir').val()+"&foldername="+$('#file_newfolder_name').val(),
+				complete: function(data){
+					boolOperationFinished(data, false);
+					$('#file_newfolder_form')[0].reset();
+				}
+			});
+		}
+		$('#file_newfolder_submit').fadeOut(250).trigger('vanish');
+	});
+	
 // 	$('.upload').click(function(){
 // 		if($('#file_action_panel').attr('activeAction') != 'upload') {
 // 			$('#file_action_panel').attr('activeAction', 'upload');
@@ -138,18 +186,18 @@ $(document).ready(function() {
 	
 	
 	
-	$('.new-dir').click(function(){
-		if($('#file_action_panel').attr('activeAction') != 'new-dir') {
-			$('#file_action_panel').attr('activeAction', 'new-dir');
-			$('#file_new_dir_name').val('');
-			$('#file_action_panel form').slideUp(250);
-			$('#file_newfolder_form').slideDown(250);
-		} else {
-			$('#file_newfolder_form').slideUp(250);
-			$('#file_action_panel').attr('activeAction', false);
-		}
-		return false;
-	});
+// 	$('.new-dir').click(function(){
+// 		if($('#file_action_panel').attr('activeAction') != 'new-dir') {
+// 			$('#file_action_panel').attr('activeAction', 'new-dir');
+// 			$('#file_new_dir_name').val('');
+// 			$('#file_action_panel form').slideUp(250);
+// 			$('#file_newfolder_form').slideDown(250);
+// 		} else {
+// 			$('#file_newfolder_form').slideUp(250);
+// 			$('#file_action_panel').attr('activeAction', false);
+// 		}
+// 		return false;
+// 	});
 	
 	$('.download').click(function(event) {
 		var files='';
@@ -184,6 +232,25 @@ $(document).ready(function() {
 	});
 });
 
+var adjustNewFolderSize = function() {
+	if($('#file_newfolder_name').val() != '') {
+		splitSize($('#file_newfolder_name'),$('#file_newfolder_submit'));
+		$('#file_newfolder_name').unbind('keyup', adjustNewFolderSize);
+	};
+}
+
+function splitSize(existingEl, appearingEl) {
+	nw = parseInt($(existingEl).css('width')) - parseInt($(appearingEl).css('width'));
+	$(existingEl).css('width', nw + 'px');
+	$(appearingEl).fadeIn(250);
+}
+
+function unsplitSize(stayingEl, vanishingEl) {
+	nw = parseInt($(stayingEl).css('width')) + parseInt($(vanishingEl).css('width'));
+	$(stayingEl).css('width', nw + 'px');
+	$(vanishingEl).fadeOut(250);
+}
+
 function uploadFinished() {
 	result = $('#file_upload_target').contents().text();
 	result = eval("(" + result + ");");
diff --git a/files/templates/index.php b/files/templates/index.php
index e794bad300c1763fa8fdc17ab30b84a626f4e815..4d34222b9667a34ae1b123cbf0b2386d04e6fc0d 100644
--- a/files/templates/index.php
+++ b/files/templates/index.php
@@ -3,10 +3,9 @@
 		<form id="file_upload_form" action="ajax/upload.php"
 method="post" enctype="multipart/form-data" target="file_upload_target"><input
 type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_["uploadMaxFilesize"] ?>" id="max_upload"><input
-type="hidden" class="max_human_file_size" value="(max <?php echo $_["uploadMaxHumanFilesize"]; ?>)"><input type="hidden" name="dir" value="<?php echo $_["dir"] ?>" id="dir"><input class="prettybutton" type="submit" id="file_upload_start" value="Upload (max <?php echo $_["uploadMaxHumanFilesize"];?>)" />&nbsp;<input class="prettybutton" type="button" id="file_upload_cancel" value="X" /><input type="file" name="file" id="fileSelector"><iframe id="file_upload_target" name="file_upload_target" src=""></iframe></form><a href="" title="" class="new-dir">New folder</a><a href="" title="" class="download">Download</a><a href="" title="" class="share">Share</a><a href="" title="" class="delete">Delete</a>
+type="hidden" class="max_human_file_size" value="(max <?php echo $_["uploadMaxHumanFilesize"]; ?>)"><input type="hidden" name="dir" value="<?php echo $_["dir"] ?>" id="dir"><input class="prettybutton" type="submit" id="file_upload_start" value="Upload (max <?php echo $_["uploadMaxHumanFilesize"];?>)" />&nbsp;<input class="prettybutton" type="button" id="file_upload_cancel" value="X" /><input type="file" name="file" id="fileSelector"><iframe id="file_upload_target" name="file_upload_target" src=""></iframe></form><form id="file_newfolder_form"><input type="text" class="prettybutton" name="file_newfolder_name" id="file_newfolder_name" value="New Folder" />&nbsp;<input class="prettybutton" type="button" id="file_newfolder_submit" name="file_newfolder_submit" value="OK" /></form><a href="" title="" class="download">Download</a><a href="" title="" class="share">Share</a><a href="" title="" class="delete">Delete</a>
 	</div>
 	<div id="file_action_panel">
-		<form id="file_newfolder_form"><input type="text" name="file_new_dir_name" id="file_new_dir_name" />&nbsp;<input class="prettybutton" type="button" id="file_new_dir_submit" name="file_new_dir_submit" value="OK" /></form>
 	</div>
 </div>
 
diff --git a/help/templates/index.php b/help/templates/index.php
index 262ab3d8cabfc785f65d8b84a04543b9292e4b36..a117c3d5fb40195c4dc200a1d43a82be12a15f87 100644
--- a/help/templates/index.php
+++ b/help/templates/index.php
@@ -15,7 +15,8 @@
 </table>
 <?php
 	$url=OC_HELPER::linkTo( "help", "index.php" ).'?page=';
-	OC_UTIL::showPageNavi($_['pagecount'],$_['page'],$url);
+	$pageNavi=OC_UTIL::getPageNavi($_['pagecount'],$_['page'],$url);
+	$pageNavi->printPage();
 ?>
 <a target="_blank" class="prettybutton" href="http://apps.owncloud.com/knowledgebase/editquestion.php?action=new">ASK A QUESTION</a>
 
diff --git a/lib/HTTP/WebDAV/Server/Filesystem.php b/lib/HTTP/WebDAV/Server/Filesystem.php
index 49b2397175a5b0082c77b8dd71ca9efcdacff0a7..9cebee48d7c9dbade52922ce5a1ad44aa32e56c7 100644
--- a/lib/HTTP/WebDAV/Server/Filesystem.php
+++ b/lib/HTTP/WebDAV/Server/Filesystem.php
@@ -297,12 +297,16 @@
 
         while ($filename = readdir($handle)) {
             if ($filename != "." && $filename != "..") {
-                $fullpath = $fspath."/".$filename;
+                if( substr($fspath, -1) != '/' ){
+			$fspath .= '/';
+                }
+                $fullpath = $fspath.$filename;
                 $name     = htmlspecialchars($filename);
+                $uri = $_SERVER['SCRIPT_NAME'] . $fullpath;
                 printf($format,
-                       number_format(filesize($fullpath)),
-                       strftime("%Y-%m-%d %H:%M:%S", filemtime($fullpath)),
-                       "<a href='$name'>$name</a>");
+                       number_format(OC_FILESYSTEM::filesize($fullpath)),
+                       strftime("%Y-%m-%d %H:%M:%S", OC_FILESYSTEM::filemtime($fullpath)),
+                       "<a href='$uri'>$name</a>");
             }
         }
 
@@ -745,4 +749,4 @@ VALUES (?,?,?,?,?,'timeout',?,?)");
     }
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/lib/appconfig.php b/lib/appconfig.php
index df338a412db0a70104332d992356386561e4134c..f7c49ca19cc16802efd6ba17979ecd91294fadc3 100644
--- a/lib/appconfig.php
+++ b/lib/appconfig.php
@@ -47,7 +47,7 @@ class OC_APPCONFIG{
 	 */
 	public static function getApps(){
 		// No magic in here!
-		$query = OC_DB::prepare( 'SELECT DISTINCT( `appid` ) FROM `*PREFIX*appconfig`' );
+		$query = OC_DB::prepare( 'SELECT DISTINCT( appid ) FROM `*PREFIX*appconfig`' );
 		$result = $query->execute();
 
 		$apps = array();
@@ -68,7 +68,7 @@ class OC_APPCONFIG{
 	 */
 	public static function getKeys( $app ){
 		// No magic in here as well
-		$query = OC_DB::prepare( 'SELECT `key` FROM `*PREFIX*appconfig` WHERE `appid` = ?' );
+		$query = OC_DB::prepare( 'SELECT key FROM `*PREFIX*appconfig` WHERE `appid` = ?' );
 		$result = $query->execute( array( $app ));
 
 		$keys = array();
@@ -91,7 +91,7 @@ class OC_APPCONFIG{
 	 */
 	public static function getValue( $app, $key, $default = null ){
 		// At least some magic in here :-)
-		$query = OC_DB::prepare( 'SELECT `value` FROM `*PREFIX*appconfig` WHERE `appid` = ? AND `key` = ?' );
+		$query = OC_DB::prepare( 'SELECT value FROM *PREFIX*appconfig WHERE appid = ? AND key = ?' );
 		$result = $query->execute( array( $app, $key ));
 
 		if( !$result->numRows()){
@@ -118,11 +118,11 @@ class OC_APPCONFIG{
 
 		// null: does not exist
 		if( is_null( $exists )){
-			$query = OC_DB::prepare( 'INSERT INTO `*PREFIX*appconfig` ( `appid`, `key`, `value` ) VALUES( ?, ?, ? )' );
+			$query = OC_DB::prepare( 'INSERT INTO *PREFIX*appconfig ( `appid`, `key`, `value` ) VALUES( ?, ?, ? )' );
 			$query->execute( array( $app, $key, $value ));
 		}
 		else{
-			$query = OC_DB::prepare( 'UPDATE `*PREFIX*appconfig` SET `value` = ? WHERE `appid` = ? AND `key` = ?' );
+			$query = OC_DB::prepare( 'UPDATE *PREFIX*appconfig SET value = ? WHERE appid = ? AND key = ?' );
 			$query->execute( array( $value, $app, $key ));
 		}
 	}
diff --git a/lib/base.php b/lib/base.php
index 2ed232cff2c24f4114fbdfe1b05c8dbaec80d309..4bc96ad88f67f358b40eb1beace9408a3a8f73df 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -88,6 +88,7 @@ require_once('ocsclient.php');
 require_once('connect.php');
 require_once('remotestorage.php');
 require_once('plugin.php');
+require_once('search.php');
 
 $error=(count(OC_UTIL::checkServer())>0);
 
@@ -191,7 +192,7 @@ class OC_UTIL {
 	 * @return array
 	 */
 	public static function getVersion(){
-		return array(1,2,0);
+		return array(1,60,0);
 	}
 
 	/**
@@ -204,7 +205,11 @@ class OC_UTIL {
 			$file = $application;
 			$application = "";
 		}
-		self::$scripts[] = "$application/js/$file";
+		if( !empty( $application )){
+			self::$scripts[] = "$application/js/$file";
+		}else{
+			self::$scripts[] = "js/$file";
+		}
 	}
 
 	/**
@@ -217,7 +222,11 @@ class OC_UTIL {
 			$file = $application;
 			$application = "";
 		}
-		self::$styles[] = "$application/css/$file";
+		if( !empty( $application )){
+			self::$styles[] = "$application/css/$file";
+		}else{
+			self::$styles[] = "css/$file";
+		}
 	}
 
        /**
@@ -236,9 +245,9 @@ class OC_UTIL {
 	 * @param int $pagecount
 	 * @param int $page
 	 * @param string $url
-	 * @return html-string
+	 * @return OC_TEMPLATE
 	 */
-	public static function showPageNavi($pagecount,$page,$url) {
+	public static function getPageNavi($pagecount,$page,$url) {
 
 		$pagelinkcount=8;
 		if ($pagecount>1) {
@@ -253,7 +262,7 @@ class OC_UTIL {
 			$tmpl->assign('pagestart',$pagestart);
 			$tmpl->assign('pagestop',$pagestop);
 			$tmpl->assign('url',$url);
-			$tmpl->printPage();
+			return $tmpl;
 		}
 	}
 
@@ -293,20 +302,6 @@ class OC_UTIL {
 		
 		//check for correct file permissions
 		if(!stristr(PHP_OS, 'WIN')){
-			if($CONFIG_DBTYPE=='sqlite'){
-				$file=$SERVERROOT.'/'.$CONFIG_DBNAME;
-				if(file_exists($file)){
-					$prems=substr(decoct(fileperms($file)),-3);
-					if(substr($prems,2,1)!='0'){
-						@chmod($file,0660);
-						clearstatcache();
-						$prems=substr(decoct(fileperms($file)),-3);
-						if(substr($prems,2,1)!='0'){
-							$errors[]=array('error'=>'SQLite database file ('.$file.') is readable from the web<br/>','hint'=>$permissionsHint);
-						}
-					}
-				}
-			}
 			$prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3);
 			if(substr($prems,-1)!='0'){
 				OC_HELPER::chmodr($CONFIG_DATADIRECTORY_ROOT,0770);
@@ -398,7 +393,7 @@ class OC_HOOK{
 		}
 
 		// Call all slots
-		foreach( $registered[$signalclass][$signalname] as $i ){
+		foreach( self::$registered[$signalclass][$signalname] as $i ){
 			call_user_func( array( $i["class"], $i["name"] ), $params );
 		}
 
diff --git a/lib/database.php b/lib/database.php
index 97651ccf50ad6567f3a8a093fc8cd66c29c909b5..728e73590407416e3d0586b8937c312ec319d064 100644
--- a/lib/database.php
+++ b/lib/database.php
@@ -43,8 +43,8 @@ class OC_DB {
 		$CONFIG_DBUSER = OC_CONFIG::getValue( "dbuser", "" );;
 		$CONFIG_DBPASSWORD = OC_CONFIG::getValue( "dbpassword", "" );;
 		$CONFIG_DBTYPE = OC_CONFIG::getValue( "dbtype", "sqlite" );;
-		global $DOCUMENTROOT;
 		global $SERVERROOT;
+		$datadir=OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" );
 
 		// do nothing if the connection already has been established
 		if(!self::$DBConnection){
@@ -64,7 +64,7 @@ class OC_DB {
 				// sqlite
 				$dsn = array(
 				  'phptype'  => 'sqlite',
-				  'database' => "$SERVERROOT/$CONFIG_DBNAME",
+				  'database' => "$datadir/$CONFIG_DBNAME.db",
 				  'mode' => '0644' );
 			}
 			elseif( $CONFIG_DBTYPE == 'mysql' ){
@@ -256,9 +256,9 @@ class OC_DB {
 		if( $definition instanceof MDB2_Schema_Error ){
 			die( $definition->getMessage().': '.$definition->getUserInfo());
 		}
-		if(OC_CONFIG::getValue('dbtype','sqlite')=='sqlite'){
-			$definition['overwrite']=true;//always overwrite for sqlite
-		}
+// 		if(OC_CONFIG::getValue('dbtype','sqlite')=='sqlite'){
+// 			$definition['overwrite']=true;//always overwrite for sqlite
+// 		}
 		$ret=self::$schema->createDatabase( $definition );
 
 		// Die in case something went wrong
@@ -300,7 +300,13 @@ class OC_DB {
 		// We need Database type and table prefix
 		$CONFIG_DBTYPE = OC_CONFIG::getValue( "dbtype", "sqlite" );
 		$CONFIG_DBTABLEPREFIX = OC_CONFIG::getValue( "dbtableprefix", "oc_" );
-
+		
+		// differences is getting the current timestamp
+		if( $CONFIG_DBTYPE == 'sqlite' ){
+			$query = str_replace( 'NOW()', "strftime('%s', 'now')", $query );
+			$query = str_replace( 'now()', "strftime('%s', 'now')", $query );
+		}
+		
 		// differences in escaping of table names (` for mysql)
 		// Problem: what if there is a ` in the value we want to insert?
 		if( $CONFIG_DBTYPE == 'sqlite' ){
@@ -310,7 +316,7 @@ class OC_DB {
 			$query = str_replace( '`', '"', $query );
 		}
 
-		// replace table names
+		// replace table name prefix
 		$query = str_replace( '*PREFIX*', $CONFIG_DBTABLEPREFIX, $query );
 
 		return $query;
diff --git a/lib/filestorage.php b/lib/filestorage.php
index 3d0bdf4cc0ed0653d30164dadc21c96fb2d2cedc..429961b3d693400741eb7214514e5b9d2865bf00 100644
--- a/lib/filestorage.php
+++ b/lib/filestorage.php
@@ -62,6 +62,7 @@ class OC_FILESTORAGE{
 	public function getTree($path){}
 	public function hash($type,$path,$raw){}
 	public function free_space($path){}
+	public function search($query){}
 }
 
 
@@ -468,7 +469,25 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
 	public function free_space($path){
 		return disk_free_space($this->datadir.$path);
 	}
-
+	
+	public function search($query){
+		return $this->searchInDir($query);
+	}
+	
+	private function searchInDir($query,$dir=''){
+		$files=array();
+		foreach (scandir($this->datadir.$dir) as $item) {
+			if ($item == '.' || $item == '..') continue;
+			if(strstr(strtolower($item),strtolower($query))!==false){
+				$files[]=$dir.'/'.$item;
+			}
+			if(is_dir($this->datadir.$dir.'/'.$item)){
+				$files=array_merge($files,$this->searchInDir($query,$dir.'/'.$item));
+			}
+		}
+		return $files;
+	}
+	
 	/**
 	 * @brief get the size of folder and it's content
 	 * @param string $path file path
diff --git a/lib/filesystem.php b/lib/filesystem.php
index ca4d1a2c4741fc583a9c1d246d07f89099715649..2b5c3a56b6e3e90574649e8286fef6e484fad4f5 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -194,6 +194,18 @@ class OC_FILESYSTEM{
 		}
 		return $foundMountPoint;
 	}
+	/**
+	* return the path to a local version of the file
+	* we need this because we can't know if a file is stored local or not from outside the filestorage and for some purposes a local file is needed
+	* @param string path
+	* @return string
+	*/
+	static public function getLocalFile($path){
+		$parent=substr($path,0,strrpos($path,'/'));
+		if(self::canRead($parent) and $storage=self::getStorage($path)){
+			return $storage->getLocalFile(self::getInternalPath($path));
+		}
+	}
 	
 	static public function mkdir($path){
 		$parent=substr($path,0,strrpos($path,'/'));
@@ -445,5 +457,20 @@ class OC_FILESYSTEM{
 			return $storage->free_space($path);
 		}
 	}
+	
+	static public function search($query){
+		$files=array();
+		$fakeRootLength=strlen(self::$fakeRoot);
+		foreach(self::$storages as $mountpoint=>$storage){
+			$results=$storage->search($query);
+			foreach($results as $result){
+				$file=str_replace('//','/',$mountpoint.$result);
+				$file=substr($file,$fakeRootLength);
+				$files[]=$file;
+			}
+		}
+		return $files;
+		
+	}
 }
 ?>
diff --git a/lib/helper.php b/lib/helper.php
index c4352ca33446d8280c0d3f53815b807bb6d97d8f..009e961397b9d970d6360c4aa5d4072a1a265861 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -63,7 +63,11 @@ class OC_HELPER {
 		if( file_exists( "$SERVERROOT/apps/img/$app/$image" )){
 			return "$WEBROOT/apps/img/$app/$image";
 		}
-		return "$WEBROOT/$app/img/$image";
+		if( !empty( $app )){
+			return "$WEBROOT/$app/img/$image";
+		}else{
+			return "$WEBROOT/img/$image";
+		}
 	}
 
 	/**
@@ -162,7 +166,7 @@ class OC_HELPER {
 	 *
 	 * Makes 2048 to 2 kB.
 	 */
-	function chmodr($path, $filemode) {
+	static function chmodr($path, $filemode) {
 		if (!is_dir($path))
 			return chmod($path, $filemode);
 		$dh = opendir($path);
@@ -173,7 +177,7 @@ class OC_HELPER {
 					return FALSE;
 				elseif(!is_dir($fullpath) && !chmod($fullpath, $filemode))
 						return FALSE;
-				elseif(!chmodr($fullpath, $filemode))
+				elseif(!self::chmodr($fullpath, $filemode))
 					return FALSE;
 			}
 		}
diff --git a/lib/installer.php b/lib/installer.php
index 1222a22e71c206da3852d21a59ed3a8c61163de8..0646ef8e0ea52f56f8e67f667087b5f329025f7e 100644
--- a/lib/installer.php
+++ b/lib/installer.php
@@ -136,7 +136,7 @@ class OC_INSTALLER{
 		global $SERVERROOT;
 		global $WEBROOT;
 		$content="ErrorDocument 404 /$WEBROOT/templates/404.php\n";
-		file_put_contents($SERVERROOT.'/.htaccess',$content);
+		@file_put_contents($SERVERROOT.'/.htaccess',$content); //supress errors in case we don't have permissions for it
 		
 		$content="deny from all";
 		file_put_contents(OC_CONFIG::getValue('datadirectory',$SERVERROOT.'/data').'/.htaccess',$content);
diff --git a/lib/log.php b/lib/log.php
index 231ff7997b10b9d74d0a18fa4687a8df97b82d2c..02ad8162d5105fead1ca3425151d0ac3af687811 100644
--- a/lib/log.php
+++ b/lib/log.php
@@ -50,8 +50,16 @@ class OC_LOG {
 	 *
 	 * This function adds another entry to the log database
 	 */
-	public static function add( $appid, $subject, $predicate, $object = null ){
-		// TODO: write function
+	public static function add( $appid, $subject, $predicate, $object = ' ' ){
+		$query=OC_DB::prepare("INSERT INTO *PREFIX*log(`timestamp`,appid,user,action,info) VALUES(NOW(),?,?,?,?)");
+		$result=$query->execute(array($appid,$subject,$predicate,$object));
+		// Die if we have an error
+		if( PEAR::isError($result)) {
+			$entry = 'DB Error: "'.$result->getMessage().'"<br />';
+			$entry .= 'Offending command was: '.$query.'<br />';
+			error_log( $entry );
+			die( $entry );
+		}
 		return true;
 	}
 
@@ -71,8 +79,33 @@ class OC_LOG {
 	 *   - app: only entries for this app
 	 */
 	public static function get( $filter = array()){
-		// TODO: write function
-		return array();
+		$queryString='SELECT * FROM *PREFIX*log WHERE 1=1 ';
+		$params=array();
+		if(isset($filter['from'])){
+			$queryString.='AND `timestamp`>? ';
+			array_push($params,$filter('from'));
+		}
+		if(isset($filter['until'])){
+			$queryString.='AND `timestamp`<? ';
+			array_push($params,$filter('until'));
+		}
+		if(isset($filter['user'])){
+			$queryString.='AND user=? ';
+			array_push($params,$filter('user'));
+		}
+		if(isset($filter['app'])){
+			$queryString.='AND appid=? ';
+			array_push($params,$filter('app'));
+		}
+		$query=OC_DB::prepare($queryString);
+		$result=$query->execute($params)->fetchAll();
+		if(count($result)>0 and is_numeric($result[0]['timestamp'])){
+			foreach($result as &$row){
+				$row['timestamp']=OC_UTIL::formatDate($row['timestamp']);
+			}
+		}
+		return $result;
+		
 	}
 
 	/**
@@ -83,9 +116,26 @@ class OC_LOG {
 	 * This function deletes all entries that are older than $date.
 	 */
 	public static function deleteBefore( $date ){
-		// TODO: write function
+		$query=OC_DB::prepare("DELETE FROM *PREFIX*log WHERE `timestamp`<?");
+		$query->execute(array($date));
 		return true;
 	}
+	
+	/**
+	 * @brief filter an array of log entries on action
+	 * @param array $logs the log entries to filter
+	 * @param array $actions an array of actions to filter for
+	 * @returns array
+	 */
+	public static function filterAction($logs,$actions){
+		$filteredLogs=array();
+		foreach($logs as $log){
+			if(array_search($log['action'],$actions)!==false){
+				$filteredLogs[]=$log;
+			}
+		}
+		return $filteredLogs;
+	}
 }
 
 
diff --git a/lib/search.php b/lib/search.php
new file mode 100644
index 0000000000000000000000000000000000000000..ef82e225f3d8693e04ca0bd671d44cec7bd4e0f7
--- /dev/null
+++ b/lib/search.php
@@ -0,0 +1,121 @@
+<?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/>.
+ *
+ */
+
+
+/**
+ * provides an interface to all search providers
+ */
+class OC_SEARCH{
+	static private $providers=array();
+	
+	/**
+	 * register a new search provider to be used
+	 * @param OC_SearchProvider $provider
+	 */
+	public static function registerProvider($provider){
+		self::$providers[]=$provider;
+	}
+	
+	/**
+	 * search all provider for $query
+	 * @param string query
+	 * @return array An array of OC_SearchResult's
+	 */
+	public static function search($query){
+		$results=array();
+		foreach(self::$providers as $provider){
+			$results=array_merge($results,$provider->search($query));
+		}
+		return $results;
+	}
+}
+
+/**
+ * provides search functionalty
+ */
+abstract class OC_SearchProvider{
+	public function __construct(){
+		OC_SEARCH::registerProvider($this);
+	}
+	
+	/**
+	 * search for $query
+	 * @param string $query
+	 * @return array An array of OC_SearchResult's
+	 */
+	abstract function search($query);
+}
+
+/**
+ * a result of a search
+ */
+class OC_SearchResult{
+	private $name;
+	private $text;
+	private $link;
+	private $type;
+	
+	/**
+	 * create a new search result
+	 * @param string $name short name for the result
+	 * @param string $text some more information about the result
+	 * @param string $link link for the result
+	 * @param string $type the type of result as human readable string ('File', 'Music', etc)
+	 */
+	public function __construct($name,$text,$link,$type){
+		$this->name=$name;
+		$this->text=$text;
+		$this->link=$link;
+		$this->type=$type;
+	}
+
+	public function __get($name){
+		switch($name){
+			case 'name':
+				return $this->name;
+			case 'text':
+				return $this->text;
+			case 'link':
+				return $this->link;
+			case 'type':
+				return $this->type;
+		}
+	}
+}
+
+class OC_FileSearchProvider extends OC_SearchProvider{
+	function search($query){
+		$files=OC_FILESYSTEM::search($query);
+		$results=array();
+		foreach($files as $file){
+			if(OC_FILESYSTEM::is_dir($file)){
+				$results[]=new OC_SearchResult(basename($file),$file,OC_HELPER::linkTo( 'files', 'index.php?dir='.$file ),'Files');
+			}else{
+				$results[]=new OC_SearchResult(basename($file),$file,OC_HELPER::linkTo( 'files', 'download.php?file='.$file ),'Files');
+			}
+		}
+		return $results;
+	}
+}
+
+new OC_FileSearchProvider();
+?>
\ No newline at end of file
diff --git a/lib/template.php b/lib/template.php
index dd1943ae7f57cc695821f519f334b4c03d8c8de4..0d6776aa26d22230fd6038daa6b760d226c5fe46 100644
--- a/lib/template.php
+++ b/lib/template.php
@@ -181,6 +181,7 @@ class OC_TEMPLATE{
 	{
 		// global Data we need
 		global $WEBROOT;
+		global $SERVERROOT;
 		$data = $this->_fetch();
 
 		if( $this->renderas )
@@ -189,6 +190,9 @@ class OC_TEMPLATE{
 			if( $this->renderas == "user" )
 			{
 				$page = new OC_TEMPLATE( "core", "layout.user" );
+				$search=new OC_TEMPLATE( 'core', 'part.searchbox');
+				$search->assign('searchurl',OC_HELPER::linkTo( 'search', 'index.php' ));
+				$page->assign('searchbox', $search->fetchPage());
 				// Add menu data
 
 				// Add navigation entry
@@ -197,6 +201,9 @@ class OC_TEMPLATE{
 			elseif( $this->renderas == "admin" )
 			{
 				$page = new OC_TEMPLATE( "core", "layout.admin" );
+				$search=new OC_TEMPLATE( 'core', 'part.searchbox');
+				$search->assign('searchurl',OC_HELPER::linkTo( 'search', 'index.php' ));
+				$page->assign('searchbox', $search->fetchPage());
 				// Add menu data
 				if( OC_GROUP::inGroup( $_SESSION["user_id"], "admin" )){
 					$page->assign( "settingsnavigation", OC_APP::getSettingsNavigation());
@@ -211,10 +218,18 @@ class OC_TEMPLATE{
 
 			// Add the css and js files
 			foreach(OC_UTIL::$scripts as $script){
-				$page->append( "jsfiles", "$WEBROOT/$script.js" );
+				if(is_file("$SERVERROOT/apps/$script.js" )){
+					$page->append( "jsfiles", "$WEBROOT/apps/$script.js" );
+				}else{
+					$page->append( "jsfiles", "$WEBROOT/$script.js" );
+				}
 			}
 			foreach(OC_UTIL::$styles as $style){
-				$page->append( "cssfiles", "$WEBROOT/$style.css" );
+				if(is_file("$SERVERROOT/apps/$style.css" )){
+					$page->append( "cssfiles", "$WEBROOT/apps/$style.css" );
+				}else{
+					$page->append( "cssfiles", "$WEBROOT/$style.css" );
+				}
 			}
 
 			// Add css files and js files
diff --git a/log/index.php b/log/index.php
index 646dbc0cc595429c746a89e1affefff49c1010a3..d86da6e000475e508fe922d532bc92a5c549b79e 100644
--- a/log/index.php
+++ b/log/index.php
@@ -25,21 +25,70 @@
 //require_once('../../config/config.php');
 require_once('../lib/base.php');
 require( 'template.php' );
+
 if( !OC_USER::isLoggedIn()){
-    header( "Location: ".OC_HELPER::linkTo( "index.php" ));
+    header( 'Location: '.OC_HELPER::linkTo( 'index.php' ));
     exit();
 }
 
-OC_APP::setActiveNavigationEntry( "log" );
-$logs=OC_LOG::get( $dir );
+//load the script
+OC_UTIL::addScript( "log", "log" );
+
+$allActions=array('login','logout','read','write','create','delete');
+
+//check for a submited config
+if(isset($_POST['size'])){
+	$selectedActions=array();
+	foreach($allActions as $action){
+		if(isset($_POST[$action]) and $_POST[$action]=='on'){
+			$selectedActions[]=$action;
+		}
+	}
+	OC_APPCONFIG::setValue('log','actions',implode(',',$selectedActions));
+	OC_APPCONFIG::setValue('log','pagesize',$_POST['size']);
+}
+
+OC_APP::setActiveNavigationEntry( 'log' );
+$logs=OC_LOG::get();
+
+$selectedActions=explode(',',OC_APPCONFIG::getValue('log','actions',implode(',',$allActions)));
+$logs=OC_LOG::filterAction($logs,$selectedActions);
+
+$pageSize=OC_APPCONFIG::getValue('log','pagesize',20);
+$pageCount=ceil(count($logs)/$pageSize);
+$page=isset($_GET['page'])?$_GET['page']:0;
+if($page>=$pageCount){
+	$page=$pageCount-1;
+}
+
+$logs=array_slice($logs,$page*$pageSize,$pageSize);
 
 foreach( $logs as &$i ){
-    $i["date"] = date( $CONFIG_DATEFORMAT, $i['timestamp'] );
-    $i["action"] = OC_LOG::$TYPE[$i['type']];
+    $i['date'] =$i['timestamp'];
+}
+
+$url=OC_HELPER::linkTo( 'log', 'index.php' ).'?page=';
+$pager=OC_UTIL::getPageNavi($pageCount,$page,$url);
+if($pager){
+	$pagerHTML=$pager->fetchPage();
+}else{
+	$pagerHTML='';
+}
+
+$showActions=array();
+foreach($allActions as $action){
+	if(array_search($action,$selectedActions)!==false){
+		$showActions[$action]='checked="checked"';
+	}else{
+		$showActions[$action]='';
+	}
 }
 
-$tmpl = new OC_TEMPLATE( "log", "index", "admin" );
-$tmpl->assign( "logs", $logs );
+$tmpl = new OC_TEMPLATE( 'log', 'index', 'admin' );
+$tmpl->assign( 'logs', $logs );
+$tmpl->assign( 'pager', $pagerHTML );
+$tmpl->assign( 'size', $pageSize );
+$tmpl->assign( 'showActions', $showActions );
 $tmpl->printPage();
 
 ?>
diff --git a/log/js/log.js b/log/js/log.js
new file mode 100644
index 0000000000000000000000000000000000000000..47c20b3e8603d7f2f648a8521a76847cb727bb51
--- /dev/null
+++ b/log/js/log.js
@@ -0,0 +1,21 @@
+$(document).ready(function() {
+	// Sets the select_all checkbox behaviour :
+	$('#all').click(function() {
+		if($(this).attr('checked')){
+			// Check all
+			$('input.action:checkbox').attr('checked', true);
+		}else{
+			// Uncheck all
+			$('input.action:checkbox').attr('checked', false);
+		}
+	});
+	$('input.action:checkbox').click(function() {
+		if(!$(this).attr('checked')){
+			$('#all').attr('checked',false);
+		}else{
+			if($('input.action:checkbox:checked').length==$('input.action:checkbox').length){
+				$('#all').attr('checked',true);
+			}
+		}
+	});
+});
\ No newline at end of file
diff --git a/log/templates/index.php b/log/templates/index.php
index 18630e49d065b6b0583a3c0e2eb152936b8cfdde..1e294091e3fa11803d99bc7f30c4beb16c915ed5 100644
--- a/log/templates/index.php
+++ b/log/templates/index.php
@@ -1,20 +1,19 @@
 <div class="controls">
-	<form id="logs_options">
+	<form id="logs_options" method='post'>
 		<p>
 			<span>Filter :</span>
 
-			<input type="checkbox" checked="checked" name="all" id="all" /> <label for="all">All</label>
-			<input type="checkbox" checked="checked" name="logins" id="logins" /> <label for="logins">Logins</label>
-			<input type="checkbox" checked="checked" name="logouts" id="logouts" /> <label for="logouts">Logouts</label>
-			<input type="checkbox" checked="checked" name="downloads" id="downloads" /> <label for="downloads">Downloads</label>
-			<input type="checkbox" checked="checked" name="uploads" id="uploads" /> <label for="uploads">Uploads</label>
-
-			<input type="checkbox" checked="checked" name="creations" id="creations" /> <label for="creations">Creations</label>
-			<input type="checkbox" checked="checked" name="deletions" id="deletions" /> <label for="deletions">Deletions</label>
+			<input type="checkbox" checked="" name="all" id="all" /> <label for="all">All</label>
+			<input type="checkbox" class='action' <?php echo $_['showActions']['login']?> name="login" id="logins" /> <label for="logins">Logins</label>
+			<input type="checkbox" class='action' <?php echo $_['showActions']['logout']?> name="logout" id="logouts" /> <label for="logouts">Logouts</label>
+			<input type="checkbox" class='action' <?php echo $_['showActions']['read']?> name="read" id="downloads" /> <label for="downloads">Downloads</label>
+			<input type="checkbox" class='action' <?php echo $_['showActions']['write']?> name="write" id="uploads" /> <label for="uploads">Uploads</label>
+			<input type="checkbox" class='action' <?php echo $_['showActions']['create']?> name="create" id="creations" /> <label for="creations">Creations</label>
+			<input type="checkbox" class='action' <?php echo $_['showActions']['delete']?> name="delete" id="deletions" /> <label for="deletions">Deletions</label>
 		</p>
 		<p>
 			<span>Show :</span>
-			<input type="text" maxlength="3" size="3" value="10" />&nbsp;entries per page.
+			<input type="text" maxlength="3" size="3" value="<?php echo $_['size']?>" name='size'/>&nbsp;entries per page.
 			<input class="prettybutton" type="submit" value="Save" />
 
 		</p>
@@ -31,13 +30,11 @@
 	<tbody>
 		<?php foreach($_["logs"] as $entry): ?>
 			<tr>
-				<td class="login"><em><?php echo $entry["user"]; ?></em> <?php echo $entry["message"]; ?></td>
+				<td class="<?php echo $entry["action"]; ?>"><em><?php echo $entry["action"]; ?> <?php echo $entry["user"]; ?></em> <?php echo $entry["info"]; ?></td>
 				<td class="date"><?php echo $entry["date"]; ?></td>
 			</tr>
 		<?php endforeach; ?>
 	</tbody>
 </table>
 
-<div class="controls">
-    <p class="center"><a href="" title="Previous page">&larr;</a>&nbsp;3/5&nbsp;<a href="" title="Next page">&rarr;</a></p>
-</div>
+<?php echo $_['pager'];?>
diff --git a/search/appinfo/app.php b/search/appinfo/app.php
new file mode 100644
index 0000000000000000000000000000000000000000..44834498fec14999f915fdd8a4b8fb6f23465a1a
--- /dev/null
+++ b/search/appinfo/app.php
@@ -0,0 +1,5 @@
+<?php
+
+OC_APP::register( array( 'order' => 2, "id" => 'search', 'name' => 'Search' ));
+
+?>
diff --git a/search/css/search.css b/search/css/search.css
new file mode 100644
index 0000000000000000000000000000000000000000..df0712be03fdfd799f804c226363fef210d7eca1
--- /dev/null
+++ b/search/css/search.css
@@ -0,0 +1,17 @@
+#searchresults{
+	margin: 2em;
+	list-style:none;
+	border: solid 1px #CCC;
+}
+
+#searchresults li.resultHeader{
+	font-size:1.2em;
+	font-weight:bold;
+	border-bottom: solid 1px #CCC;
+	padding:0.2em;
+	background-color:#eee;
+}
+
+#searchresults li.result{
+	margin-left:2em;
+}
\ No newline at end of file
diff --git a/search/index.php b/search/index.php
new file mode 100644
index 0000000000000000000000000000000000000000..e6f41528ea31eedec6f546ddf324dc0ab9e2fb27
--- /dev/null
+++ b/search/index.php
@@ -0,0 +1,55 @@
+<?php
+
+/**
+* ownCloud - ajax frontend
+*
+* @author Robin Appelman
+* @copyright 2010 Robin Appelman icewind1991@gmail.com
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+* License as published by the Free Software Foundation; either
+* version 3 of the License, or any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+*
+* You should have received a copy of the GNU Affero General Public
+* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+// Init owncloud
+require_once('../lib/base.php');
+require( 'template.php' );
+
+// Check if we are a user
+if( !OC_USER::isLoggedIn()){
+	header( "Location: ".OC_HELPER::linkTo( '', 'index.php' ));
+	exit();
+}
+
+// Load the files we need
+OC_UTIL::addStyle( 'search', 'search' );
+
+$query=(isset($_POST['query']))?$_POST['query']:'';
+if($query){
+	$results=OC_SEARCH::search($query);
+}
+
+$resultTypes=array();
+foreach($results as $result){
+	if(!isset($resultTypes[$result->type])){
+		$resultTypes[$result->type]=array();
+	}
+	$resultTypes[$result->type][]=$result;
+}
+
+$tmpl = new OC_TEMPLATE( 'search', 'index', 'user' );
+$tmpl->assign('resultTypes',$resultTypes);
+$tmpl->printPage();
+
+?>
diff --git a/search/templates/index.php b/search/templates/index.php
new file mode 100644
index 0000000000000000000000000000000000000000..7241553e7fc085e166fcdce4eb01a88fbb5463b5
--- /dev/null
+++ b/search/templates/index.php
@@ -0,0 +1,17 @@
+<ul id='searchresults'>
+	<?php foreach($_['resultTypes'] as $resultType):?>
+		<li class='resultHeader'>
+			<p><?php echo $resultType[0]->type?></p>
+		</li>
+		<?php foreach($resultType as $result):?>
+			<li class='result'>
+				<p>
+					<a href='<?php echo $result->link?>' title='<?php echo $result->name?>'><?php echo $result->name?></a>
+				</p>
+				<p>
+					<?php echo $result->text?>
+				</p>
+			</li>
+		<?php endforeach;?>
+	<?php endforeach;?>
+</ul>
diff --git a/templates/layout.admin.php b/templates/layout.admin.php
index 0212419a9522e7ee1dc5e72fcbb7746c2c16ac01..efd9a8b6fdb5d2ef71ae7899b158ae0bd405a073 100644
--- a/templates/layout.admin.php
+++ b/templates/layout.admin.php
@@ -15,7 +15,7 @@
 	<body id="body-settings">
 		<div id="header">
 			<a href="<?php echo link_to('', 'index.php'); ?>" title="" id="owncloud"><img src="<?php echo image_path('', 'owncloud-logo-small-white.png'); ?>" alt="ownCloud" /></a>
-
+			<?php echo $_['searchbox']?>
 			<ul id="metanav">
 				<li><a href="<?php echo link_to('', 'index.php'); ?>" title="Back to files"><img src="<?php echo image_path('', 'layout/back.png'); ?>"></a></li>
 				<li><a href="<?php echo link_to('', 'index.php?logout=true'); ?>" title="Log out"><img src="<?php echo image_path('', 'layout/logout.png'); ?>"></a></li>
diff --git a/templates/layout.user.php b/templates/layout.user.php
index 4e9190d91ff44a0a0a14c1cd1f8505db59147fe5..23210b6880875153a23bf4428f482def5fc6ba99 100644
--- a/templates/layout.user.php
+++ b/templates/layout.user.php
@@ -15,7 +15,7 @@
 	<body id="body-user">
 		<div id="header">
 			<a href="<?php echo link_to('', 'index.php'); ?>" title="" id="owncloud"><img src="<?php echo image_path('', 'owncloud-logo-small-white.png'); ?>" alt="ownCloud" /></a>
-
+			<?php echo $_['searchbox']?>
 			<ul id="metanav">
 				<li><a href="<?php echo link_to('settings', 'index.php'); ?>" title="Settings"><img src="<?php echo image_path('', 'layout/settings.png'); ?>"></a></li>
 				<li><a href="<?php echo link_to('', 'index.php'); ?>?logout=true" title="Log out"><img src="<?php echo image_path('', 'layout/logout.png'); ?>"></a></li>
diff --git a/templates/part.searchbox.php b/templates/part.searchbox.php
new file mode 100644
index 0000000000000000000000000000000000000000..910af81ebb20001ba0ba30018d450482523ad663
--- /dev/null
+++ b/templates/part.searchbox.php
@@ -0,0 +1,4 @@
+<form class='searchbox' action='<?php echo $_['searchurl']?>' method='post'>
+	<input name='query' value='<?php if(isset($_POST['query'])){echo $_POST['query'];};?>'/>
+	<input type='submit' value='Search' class='prettybutton'/>
+</form>
\ No newline at end of file