Index: Makefile
===================================================================
--- Makefile	(revision 288)
+++ Makefile	(revision 290)
@@ -25,8 +25,4 @@
 	## Remove .svn folders
 	find ./$(DIST)/ -type d -name '.svn' | xargs rm -rf
-
-	## Remove .hg* files and folders
-	find ./$(DIST)/ -type d -name '.hg*' | xargs rm -rf
-	find ./$(DIST)/ -type f -name '.hg*' | xargs rm -rf
 	
 	## Remove config file if any
@@ -54,4 +50,8 @@
 	find ./$(DIST)/ -type d -name '.svn' -print0 | xargs -0 rm -rf
 	
+	## Remove .hg* files and folders
+	find ./$(DIST)/ -type d -name '.hg*' | xargs rm -rf
+	find ./$(DIST)/ -type f -name '.hg*' | xargs rm -rf
+
 	## "Compile" .po files
 	./build-tools/make-l10n.php ./$(DC)/
Index: admin/auth.php
===================================================================
--- admin/auth.php	(revision 270)
+++ admin/auth.php	(revision 314)
@@ -295,5 +295,5 @@
     if ($.cookie('dc_admin_test_cookie')) {
       $('#cookie_help').hide();
-      $.cookie('dc_admin_test_cookie', '', {expires: -1});
+      $.cookie('dc_admin_test_cookie', '', {'expires': -1});
     } else {
       $('#cookie_help').show();
Index: admin/js/_index.js
===================================================================
--- admin/js/_index.js	(revision 297)
+++ admin/js/_index.js	(revision 314)
@@ -65,5 +65,5 @@
 	// allow to hide quick entry div, and remember choice
 	$('#quick h3').toggleWithLegend($('#quick').children().not('h3'),{
-		cookie: 'dcx_quick_entry',
-	});
+		cookie: 'dcx_quick_entry'
+	}, positionFooter);
 });
Index: admin/js/common.js
===================================================================
--- admin/js/common.js	(revision 299)
+++ admin/js/common.js	(revision 314)
@@ -57,5 +57,5 @@
 }
 
-jQuery.fn.toggleWithLegend = function(target,s) {
+jQuery.fn.toggleWithLegend = function(target,s, callback) {
 	var defaults = {
 		img_on_src: dotclear.img_plus_src,
@@ -79,14 +79,14 @@
 	}
 
-	var toggle = function(i,speed) {
+	var toggle = function(i,speed, callback) {
 		speed = speed || 0;
 		if (p.hide) {
 			$(i).get(0).src = p.img_on_src;
 			$(i).get(0).alt = p.img_on_alt;
-			target.hide(speed, positionFooter);
+			target.hide(speed, callback);
 		} else {
 			$(i).get(0).src = p.img_off_src;
 			$(i).get(0).alt = p.img_off_alt;
-			target.show(speed, positionFooter);
+			target.show(speed, callback);
 			if (p.fn) {
 				p.fn.apply(target);
@@ -122,5 +122,5 @@
 		$(ctarget).css('cursor','pointer');
 		$(ctarget).click(function() {
-			toggle(i,p.speed, positionFooter);
+			toggle(i,p.speed, callback);
 			return false;
 		});
@@ -335,5 +335,5 @@
 			position: "static",
 			padding: ".75em 0",
-			width: "auto",
+			width: "auto"
 		});
 	}
@@ -356,14 +356,18 @@
 	}
 	$('#blog-menu h3:first').toggleWithLegend($('#blog-menu ul:first'),
-		$.extend({cookie:'dc_blog_menu'},menu_settings)
+		$.extend({cookie:'dc_blog_menu'},menu_settings),
+		positionFooter
 	);
 	$('#system-menu h3:first').toggleWithLegend($('#system-menu ul:first'),
-		$.extend({cookie:'dc_system_menu'},menu_settings)
+		$.extend({cookie:'dc_system_menu'},menu_settings),
+		positionFooter
 	);
 	$('#plugins-menu h3:first').toggleWithLegend($('#plugins-menu ul:first'),
-		$.extend({cookie:'dc_plugins_menu'},menu_settings)
+		$.extend({cookie:'dc_plugins_menu'},menu_settings),
+		positionFooter
 	);
 	$('#favorites-menu h3:first').toggleWithLegend($('#favorites-menu ul:first'),
-		$.extend({cookie:'dc_favorites_menu',hide:false,reverse_cookie:true},menu_settings)
+		$.extend({cookie:'dc_favorites_menu',hide:false,reverse_cookie:true},menu_settings),
+		positionFooter
 	);
 
Index: admin/js/jquery/jquery.pageTabs.js
===================================================================
--- admin/js/jquery/jquery.pageTabs.js	(revision 297)
+++ admin/js/jquery/jquery.pageTabs.js	(revision 0)
@@ -9,7 +9,7 @@
 		breakerClassName: 'clear'
 	};
-
+	
 	var index = start_tab ? start_tab : 0;
-
+	
 	this.params = jQuery.extend(defaults,settings);
 	this.divs = jQuery('div.'+this.params.className);
@@ -20,10 +20,10 @@
 jQuery._pageTabs.prototype = {
 	items: new Array(),
-
+	
 	createList: function() {
 		if (this.divs.length <= 0) {
 			return;
 		}
-
+		
 		this.block = document.createElement('div');
 		this.block.className = this.params.listClassName;
@@ -32,5 +32,5 @@
 		this.block.appendChild(this.list);
 		var li, a;
-
+		
 		var This = this;
 		var i=0;
@@ -57,30 +57,30 @@
 			}
 		});
-
+		
 		this.breaker = document.createElement('br');
 		this.breaker.className = this.params.breakerClassName;
-
+		
 		jQuery(this.divs.get(0)).before(this.block);
 		jQuery(this.block).after(this.breaker);
 	},
-
+	
 	showDiv: function(index) {
 		var This = this;
 		var i = 0;
 		var to_trigger = null;
-
+		
 		this.divs.each(function() {
 			if ((this.id != '' && this.id == index) || i == index) {
-				jQuery(this).show(0, positionFooter);
+				jQuery(this).show();
 				This.items[i].className = This.params.listClassName+'-active';
 				to_trigger = i;
 			} else {
-				jQuery(this).hide(0, positionFooter);
+				jQuery(this).hide();
 				This.items[i].className = '';
 			}
-
+			
 			i++;
 		});
-
+		
 		if (to_trigger != null) {
 			jQuery(this.divs[to_trigger]).onetabload();
Index: admin/user.php
===================================================================
--- admin/user.php	(revision 313)
+++ admin/user.php	(revision 270)
@@ -96,8 +96,4 @@
 		$cur->user_post_status = $user_post_status = $_POST['user_post_status'];
 		
-		if ($cur->user_id == $core->auth->userID() && $core->auth->isSuperAdmin()) {
-			// force super_user to true if current user
-			$cur->user_super = $user_super = true;
-		}
 		if ($core->auth->allowPassChange()) {
 			$cur->user_change_pwd = !empty($_POST['user_change_pwd']) ? 1 : 0;
@@ -259,8 +255,6 @@
 }
 
-$super_disabled = $user_super && $user_id == $core->auth->userID();
-
 echo
-'<p><label for="user_super" class="classic">'.form::checkbox('user_super','1',$user_super,'',16,$super_disabled).' '.
+'<p><label for="user_super" class="classic">'.form::checkbox('user_super','1',$user_super,'',16).' '.
 __('Super administrator').'</label></p>'.
 '</div>'.
Index: admin/users.php
===================================================================
--- admin/users.php	(revision 313)
+++ admin/users.php	(revision 270)
@@ -24,7 +24,6 @@
 			# --BEHAVIOR-- adminBeforeUserDelete
 			$core->callBehavior('adminBeforeUserDelete',$u);
-			if ($u != $core->auth->userID()) {
-				$core->delUser($u);
-			}
+			
+			$core->delUser($u);
 		}
 		catch (Exception $e)
@@ -33,4 +32,5 @@
 		}
 	}
+	
 	if (!$core->error->flag()) {
 		http::redirect('users.php?del=1');
Index: inc/core/class.dc.auth.php
===================================================================
--- inc/core/class.dc.auth.php	(revision 312)
+++ inc/core/class.dc.auth.php	(revision 270)
@@ -4,5 +4,5 @@
 # This file is part of Dotclear 2.
 #
-# Copyright (c) 2003-2010 Olivier Meunier & Association Dotclear
+# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear
 # Licensed under the GPL version 2.0 license.
 # See LICENSE file or
@@ -77,8 +77,7 @@
 	@param	pwd		<b>string</b>		User password
 	@param	user_key	<b>string</b>		User key check
-	@param	check_blog	<b>boolean</b>		checks if user is associated to a blog or not.
 	@return	<b>boolean</b>
 	*/
-	public function checkUser($user_id, $pwd=null, $user_key=null, $check_blog=true)
+	public function checkUser($user_id, $pwd=null, $user_key=null)
 	{
 		# Check user and password
@@ -142,5 +141,5 @@
 		
 		# Get permissions on blogs
-		if ($check_blog && ($this->findUserBlog() === false)) {
+		if ($this->findUserBlog() === false) {
 			return false;
 		}
Index: inc/core/class.dc.blog.php
===================================================================
--- inc/core/class.dc.blog.php	(revision 302)
+++ inc/core/class.dc.blog.php	(revision 270)
@@ -391,5 +391,5 @@
 		
 		if (!empty($params['post_type'])) {
-			$strReq .= 'AND P.post_type '.$this->con->in($params['post_type']);
+			$strReq .= "AND post_type = '".$this->con->escape($params['post_type'])."' ";
 		}
 		
Index: inc/core/class.dc.settings.php
===================================================================
--- inc/core/class.dc.settings.php	(revision 301)
+++ inc/core/class.dc.settings.php	(revision 270)
@@ -308,77 +308,4 @@
 	}
 
-	/**
-	Returns a list of settings matching given criteria, for any blog.
-	<b>$params</b> is an array taking the following
-	optionnal parameters:
-	
-	- ns : retrieve setting from given namespace
-	- id : retrieve only settings corresponding to the given id
-	
-	@param	params		<b>array</b>		Parameters
-	@return	<b>record</b>	A record 
-	*/
-	public function getGlobalSettings($params=array())
-	{
-		$strReq = "SELECT * from ".$this->table." ";
-		$where = array();
-		if (!empty($params['ns'])) {
-			$where[] = "setting_ns = '".$this->con->escape($params['ns'])."'";
-		}
-		if (!empty($params['id'])) {
-			$where[] = "setting_id = '".$this->con->escape($params['id'])."'";
-		}
-		if (isset($params['blog_id'])) {
-			if (!empty($params['blog_id'])) {
-				$where[] = "blog_id = '".$this->con->escape($params['blog_id'])."'";
-			} else {
-				$where[] = "blog_id IS NULL";
-			}
-		}
-		if (count($where) != 0) {
-			$strReq .= " WHERE ".join(" AND ", $where);
-		}
-		$strReq .= " ORDER by blog_id";
-		return $this->con->select($strReq);
-	}
-
-	/**
-	Updates a setting from a given record
-	
-	@param	rs		<b>record</b>		the setting to update
-	*/
-	public function updateSetting($rs) 
-	{
-		$cur = $this->con->openCursor($this->table);
-		$cur->setting_id = $rs->setting_id;
-		$cur->setting_value = $rs->setting_value;
-		$cur->setting_type = $rs->setting_type;
-		$cur->setting_label = $rs->setting_label;
-		$cur->blog_id = $rs->blog_id;
-		$cur->setting_ns = $rs->setting_ns;
-		if ($cur->blog_id == null) {
-				$where = 'WHERE blog_id IS NULL ';
-		} else {
-			$where = "WHERE blog_id = '".$this->con->escape($cur->blog_id)."' ";
-		}
-		$cur->update($where."AND setting_id = '".$this->con->escape($cur->setting_id)."' AND setting_ns = '".$this->con->escape($cur->setting_ns)."' ");
-	}
-	
-	/**
-	Drops a setting from a given record
-	
-	@param	rs		<b>record</b>		the setting to drop
-	@return	int		number of deleted records (0 if setting does not exist)
-	*/
-	public function dropSetting($rs) {
-		$strReq = "DELETE FROM ".$this->table.' ';
-		if ($rs->blog_id == null) {
-			$strReq .= 'WHERE blog_id IS NULL ';
-		} else {
-			$strReq .= "WHERE blog_id = '".$this->con->escape($rs->blog_id)."' ";
-		}
-		$strReq .= "AND setting_id = '".$this->con->escape($rs->setting_id)."' AND setting_ns = '".$this->con->escape($rs->setting_ns)."' ";
-		return $this->con->execute($strReq);
-	}
 }
 ?>
Index: inc/dbschema/upgrade.php
===================================================================
--- inc/dbschema/upgrade.php	(revision 270)
+++ inc/dbschema/upgrade.php	(revision 291)
@@ -290,4 +290,11 @@
 			}
 			
+			if (version_compare($version,'2.3.1','<'))
+			{
+				# Remove unecessary file
+				@unlink(DC_ROOT.'/'.'inc/libs/clearbricks/.hgignore');
+			}
+			
+			
 			$core->setVersion('core',DC_VERSION);
 			$core->blogDefaults();
Index: inc/prepend.php
===================================================================
--- inc/prepend.php	(revision 289)
+++ inc/prepend.php	(revision 287)
@@ -118,5 +118,5 @@
 # Constants
 define('DC_ROOT',path::real(dirname(__FILE__).'/..'));
-define('DC_VERSION','2.4.0-dev');
+define('DC_VERSION','2.3.1');
 define('DC_DIGESTS',dirname(__FILE__).'/digests');
 define('DC_L10N_ROOT',dirname(__FILE__).'/../locales');
Index: inc/public/lib.urlhandlers.php
===================================================================
--- inc/public/lib.urlhandlers.php	(revision 306)
+++ inc/public/lib.urlhandlers.php	(revision 270)
@@ -204,9 +204,6 @@
 		
 		$n = self::getPageNumber($args);
-		$params = new ArrayObject(array(
-			'lang' => $args));
-		
-		$core->callBehavior('publicLangBeforeGetLangs',$params,$args);
-		
+		
+		$params['lang'] = $args;
 		$_ctx->langs = $core->blog->getLangs($params);
 		
@@ -238,9 +235,6 @@
 		else
 		{
-			$params = new ArrayObject(array(
-				'cat_url' => $args,
-				'post_type' => 'post'));
-			
-			$core->callBehavior('publicCategoryBeforeGetCategories',$params,$args);
+			$params['cat_url'] = $args;
+			$params['post_type'] = 'post';
 			
 			$_ctx->categories = $core->blog->getCategories($params);
@@ -273,11 +267,7 @@
 		elseif (preg_match('|^/([0-9]{4})/([0-9]{2})$|',$args,$m))
 		{
-			$params = new ArrayObject(array(
-				'year' => $m[1],
-				'month' => $m[2],
-				'type' => 'month'));
-			
-			$core->callBehavior('publicArchiveBeforeGetDates',$params,$args);
-			
+			$params['year'] = $m[1];
+			$params['month'] = $m[2];
+			$params['type'] = 'month';
 			$_ctx->archives = $core->blog->getDates($params);
 			
@@ -310,9 +300,7 @@
 			$core->blog->withoutPassword(false);
 			
-			$params = new ArrayObject(array(
-				'post_url' => $args));
-			
-			$core->callBehavior('publicPostBeforeGetPosts',$params,$args);
-
+			$params = new ArrayObject();
+			$params['post_url'] = $args;
+			
 			$_ctx->posts = $core->blog->getPosts($params);
 			
@@ -422,5 +410,5 @@
 						
 						$redir = $_ctx->posts->getURL();
-						$redir .= $core->blog->settings->system->url_scan == 'query_string' ? '&' : '?';
+						$redir .= strpos($redir,'?') !== false ? '&' : '?';
 						
 						try
@@ -493,4 +481,5 @@
 		$cat_url = false;
 		$post_id = null;
+		$params = array();
 		$subtitle = '';
 		
@@ -501,9 +490,6 @@
 		
 		if (preg_match('!^([a-z]{2}(-[a-z]{2})?)/(.*)$!',$args,$m)) {
-			$params = new ArrayObject(array('lang' => $m[1]));
-			
+			$params['lang'] = $m[1];
 			$args = $m[3];
-			
-			$core->callBehavior('publicFeedBeforeGetLangs',$params,$args);
 			
 			$_ctx->langs = $core->blog->getLangs($params);
@@ -549,10 +535,6 @@
 		if ($cat_url)
 		{
-			$params = new ArrayObject(array(
-				'cat_url' => $cat_url,
-				'post_type' => 'post'));
-			
-			$core->callBehavior('publicFeedBeforeGetCategories',$params,$args);
-			
+			$params['cat_url'] = $cat_url;
+			$params['post_type'] = 'post';
 			$_ctx->categories = $core->blog->getCategories($params);
 			
@@ -567,10 +549,6 @@
 		elseif ($post_id)
 		{
-			$params = new ArrayObject(array(
-				'post_id' => $post_id,
-				'post_type' => ''));
-				
-			$core->callBehavior('publicFeedBeforeGetPosts',$params,$args);
-			
+			$params['post_id'] = $post_id;
+			$params['post_type'] = '';
 			$_ctx->posts = $core->blog->getPosts($params);
 			
Index: plugins/importExport/inc/flat/class.dc.import.php
===================================================================
--- plugins/importExport/inc/flat/class.dc.import.php	(revision 270)
+++ plugins/importExport/inc/flat/class.dc.import.php	(revision 298)
@@ -371,4 +371,8 @@
 	private function insertPref($pref)
 	{
+		if ($this->prefExists($pref->pref_ws,$pref->pref_id,$pref->user_id)) {
+			return;
+		}
+		
 		$this->cur_pref->clean();
 		
@@ -751,4 +755,21 @@
 		$this->stack['users'][$user_id] = !$rs->isEmpty();
 		return $this->stack['users'][$user_id];
+	}
+	
+	private function prefExists($pref_ws,$pref_id,$user_id)
+	{
+		$strReq = 'SELECT pref_id,pref_ws,user_id '.
+				'FROM '.$this->prefix.'pref '.
+				"WHERE pref_id = '".$this->con->escape($pref_id)."' ".
+				"AND pref_ws = '".$this->con->escape($pref_ws)."' ";
+		if (!$user_id) {
+			$strReq .= "AND user_id IS NULL ";
+		} else {
+			$strReq .= "AND user_id = '".$this->con->escape($user_id)."' ";
+		}
+		
+		$rs = $this->con->select($strReq);
+		
+		return !$rs->isEmpty();
 	}
 	
Index: plugins/pages/_public.php
===================================================================
--- plugins/pages/_public.php	(revision 306)
+++ plugins/pages/_public.php	(revision 270)
@@ -33,9 +33,7 @@
 			$core->blog->withoutPassword(false);
 			
-			$params = new ArrayObject(array(
-				'post_type' => 'page',
-				'post_url' => $args));
-			
-			$core->callBehavior('publicPagesBeforeGetPosts',$params,$args);
+			$params = new ArrayObject();
+			$params['post_type'] = 'page';
+			$params['post_url'] = $args;
 			
 			$_ctx->posts = $core->blog->getPosts($params);
