Index: .hgsubstate
===================================================================
--- .hgsubstate	(revision 812)
+++ .hgsubstate	(revision 843)
@@ -1,1 +1,1 @@
-8a3e66573699ef9cf6f96d16bed8015a380dd17c inc/libs/clearbricks
+4f62679e0756104bdc0b49eacaed9aba68735aa5 inc/libs/clearbricks
Index: .hgtags
===================================================================
--- .hgtags	(revision 827)
+++ .hgtags	(revision 800)
@@ -6,3 +6,2 @@
 0000000000000000000000000000000000000000 2.4.2
 6b3942c0cf7eee71ebd906ec0827c5962823dedf 2.4.2
-36578fa779919f730e714e10041b1f896e56a8f4 2.4.3
Index: inc/prepend.php
===================================================================
--- inc/prepend.php	(revision 826)
+++ inc/prepend.php	(revision 801)
@@ -123,5 +123,5 @@
 # Constants
 define('DC_ROOT',path::real(dirname(__FILE__).'/..'));
-define('DC_VERSION','2.4.3');
+define('DC_VERSION','2.5-dev');
 define('DC_DIGESTS',dirname(__FILE__).'/digests');
 define('DC_L10N_ROOT',dirname(__FILE__).'/../locales');
Index: plugins/attachments/_define.php
===================================================================
--- plugins/attachments/_define.php	(revision 464)
+++ plugins/attachments/_define.php	(revision 843)
@@ -18,5 +18,5 @@
 	/* Version */		'1.0',
 	array(
-		'permissions' =>	'contentadmin,pages',
+		'permissions' =>	'usage,contentadmin,pages',
 		'priority' =>		999
 	)
Index: plugins/importExport/_admin.php
===================================================================
--- plugins/importExport/_admin.php	(revision 324)
+++ plugins/importExport/_admin.php	(revision 840)
@@ -2,7 +2,7 @@
 # -- BEGIN LICENSE BLOCK ---------------------------------------
 #
-# This file is part of Dotclear 2.
+# This file is part of importExport, a plugin for DotClear2.
 #
-# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear
+# Copyright (c) 2003-2012 Olivier Meunier & Association Dotclear
 # Licensed under the GPL version 2.0 license.
 # See LICENSE file or
@@ -12,12 +12,11 @@
 if (!defined('DC_CONTEXT_ADMIN')) { return; }
 
-$_menu['Plugins']->addItem(__('Import/Export'),'plugin.php?p=importExport','index.php?pf=importExport/icon.png',
-		preg_match('/plugin.php\?p=importExport(&.*)?$/',$_SERVER['REQUEST_URI']),
-		$core->auth->check('admin',$core->blog->id));
-
-# Files needed by flat files import / export
-$__autoload['backupFile'] = dirname(__FILE__).'/inc/flat/class.backupFile.php';
-$__autoload['dcImport'] = dirname(__FILE__).'/inc/flat/class.dc.import.php';
-$__autoload['dbExport'] = dirname(__FILE__).'/inc/flat/class.db.export.php';
+$_menu['Plugins']->addItem(
+	__('Import/Export'),
+	'plugin.php?p=importExport',
+	'index.php?pf=importExport/icon.png',
+	preg_match('/plugin.php\?p=importExport(&.*)?$/',$_SERVER['REQUEST_URI']),
+	$core->auth->check('admin',$core->blog->id)
+);
 
 $core->addBehavior('adminDashboardFavs','importExportDashboardFavs');
@@ -25,7 +24,12 @@
 function importExportDashboardFavs($core,$favs)
 {
-	$favs['importExport'] = new ArrayObject(array('importExport','Import/Export','plugin.php?p=importExport',
-		'index.php?pf=importExport/icon.png','index.php?pf=importExport/icon-big.png',
-		'admin',null,null));
+	$favs['importExport'] = new ArrayObject(array(
+		'importExport',
+		__('Import/Export'),
+		'plugin.php?p=importExport',
+		'index.php?pf=importExport/icon.png',
+		'index.php?pf=importExport/icon-big.png',
+		'admin',null,null
+	));
 }
 ?>
Index: plugins/importExport/_define.php
===================================================================
--- plugins/importExport/_define.php	(revision 464)
+++ plugins/importExport/_define.php	(revision 841)
@@ -2,7 +2,7 @@
 # -- BEGIN LICENSE BLOCK ---------------------------------------
 #
-# This file is part of Dotclear 2.
+# This file is part of importExport, a plugin for DotClear2.
 #
-# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear
+# Copyright (c) 2003-2012 Olivier Meunier & Association Dotclear
 # Licensed under the GPL version 2.0 license.
 # See LICENSE file or
@@ -15,10 +15,7 @@
 	/* Name */			"Import / Export",
 	/* Description*/		"Import and Export your blog",
-	/* Author */			"Olivier Meunier",
-	/* Version */			'2.4',
-	array(
-		'permissions' => 'admin',
-		'priority' => 10
-	)
+	/* Author */			"Olivier Meunier & Contributors",
+	/* Version */			'3.1',
+	/* Perm */			'admin'
 );
 ?>
Index: plugins/importExport/_prepend.php
===================================================================
--- plugins/importExport/_prepend.php	(revision 840)
+++ plugins/importExport/_prepend.php	(revision 840)
@@ -0,0 +1,42 @@
+<?php
+# -- BEGIN LICENSE BLOCK ---------------------------------------
+#
+# This file is part of importExport, a plugin for DotClear2.
+#
+# Copyright (c) 2003-2012 Olivier Meunier & Association Dotclear
+# Licensed under the GPL version 2.0 license.
+# See LICENSE file or
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+#
+# -- END LICENSE BLOCK -----------------------------------------
+if (!defined('DC_RC_PATH')) { return; }
+
+$__autoload['dcIeModule'] = 	dirname(__FILE__).'/inc/class.dc.ieModule.php';
+
+$__autoload['dcImportFlat'] = 	dirname(__FILE__).'/inc/class.dc.import.flat.php';
+$__autoload['dcImportFeed'] = 	dirname(__FILE__).'/inc/class.dc.import.feed.php';
+
+$__autoload['dcExportFlat'] = 	dirname(__FILE__).'/inc/class.dc.export.flat.php';
+
+$__autoload['dcImportDC1'] = 	dirname(__FILE__).'/inc/class.dc.import.dc1.php';
+$__autoload['dcImportWP'] = 	dirname(__FILE__).'/inc/class.dc.import.wp.php';
+
+$__autoload['flatBackup'] = 	dirname(__FILE__).'/inc/flat/class.flat.backup.php';
+$__autoload['flatImport'] = 	dirname(__FILE__).'/inc/flat/class.flat.import.php';
+$__autoload['flatExport'] = 	dirname(__FILE__).'/inc/flat/class.flat.export.php';
+
+$core->addBehavior('importExportModules','registerIeModules');
+
+function registerIeModules($modules)
+{
+	$modules['import'][] = 'dcImportFlat';
+	$modules['import'][] = 'dcImportFeed';
+	
+	$modules['export'][] = 'dcExportFlat';
+	
+	if ($GLOBALS['core']->auth->isSuperAdmin()) {
+		$modules['import'][] = 'dcImportDC1';
+		$modules['import'][] = 'dcImportWP';
+	}
+}
+?>
Index: plugins/importExport/inc/class.dc.export.flat.php
===================================================================
--- plugins/importExport/inc/class.dc.export.flat.php	(revision 557)
+++ plugins/importExport/inc/class.dc.export.flat.php	(revision 840)
@@ -2,7 +2,7 @@
 # -- BEGIN LICENSE BLOCK ---------------------------------------
 #
-# This file is part of Dotclear 2.
+# This file is part of importExport, a plugin for DotClear2.
 #
-# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear
+# Copyright (c) 2003-2012 Olivier Meunier & Association Dotclear
 # Licensed under the GPL version 2.0 license.
 # See LICENSE file or
@@ -16,5 +16,5 @@
 	public function setInfo()
 	{
-		$this->type = 'e';
+		$this->type = 'export';
 		$this->name = __('Flat file export');
 		$this->description = __('Exports a blog or a full Dotclear installation to flat file.');
@@ -31,5 +31,5 @@
 			try
 			{
-				$exp = new dbExport($this->core->con,$fullname,$this->core->prefix);
+				$exp = new flatExport($this->core->con,$fullname,$this->core->prefix);
 				fwrite($exp->fp,'///DOTCLEAR|'.DC_VERSION."|single\n");
 				
@@ -84,4 +84,5 @@
 				$_SESSION['export_file'] = $fullname;
 				$_SESSION['export_filename'] = $_POST['file_name'];
+				$_SESSION['export_filezip'] = !empty($_POST['file_zip']);
 				http::redirect($this->getURL().'&do=ok');
 			}
@@ -99,5 +100,5 @@
 			try
 			{
-				$exp = new dbExport($this->core->con,$fullname,$this->core->prefix);
+				$exp = new flatExport($this->core->con,$fullname,$this->core->prefix);
 				fwrite($exp->fp,'///DOTCLEAR|'.DC_VERSION."|full\n");
 				$exp->exportTable('blog');
@@ -123,4 +124,5 @@
 				$_SESSION['export_file'] = $fullname;
 				$_SESSION['export_filename'] = $_POST['file_name'];
+				$_SESSION['export_filezip'] = !empty($_POST['file_zip']);
 				http::redirect($this->getURL().'&do=ok');
 			}
@@ -140,11 +142,47 @@
 			
 			ob_end_clean();
-			header('Content-Disposition: attachment;filename='.$_SESSION['export_filename']);
-			header('Content-Type: text/plain; charset=UTF-8');
-			readfile($_SESSION['export_file']);
-			unlink($_SESSION['export_file']);
-			unset($_SESSION['export_file']);
-			unset($_SESSION['export_filename']);
-			exit;
+			
+			if (substr($_SESSION['export_filename'],-4) == '.zip') {
+				$_SESSION['export_filename'] = substr($_SESSION['export_filename'],0,-4);//.'.txt';
+			}
+			
+			# Flat export
+			if (empty($_SESSION['export_filezip'])) {
+			
+				header('Content-Disposition: attachment;filename='.$_SESSION['export_filename']);
+				header('Content-Type: text/plain; charset=UTF-8');
+				readfile($_SESSION['export_file']);
+				
+				unlink($_SESSION['export_file']);
+				unset($_SESSION['export_file'],$_SESSION['export_filename'],$_SESSION['export_filezip']);
+				exit;
+			}
+			# Zip export
+			else {
+				try
+				{
+					$file_zipname = $_SESSION['export_filename'].'.zip';
+					
+					$fp = fopen('php://output','wb');
+					$zip = new fileZip($fp);
+					$zip->addFile($_SESSION['export_file'],$_SESSION['export_filename']);
+					
+					header('Content-Disposition: attachment;filename='.$file_zipname);
+					header('Content-Type: application/x-zip');
+					
+					$zip->write();
+					
+					unlink($_SESSION['export_file']);
+					unset($zip,$_SESSION['export_file'],$_SESSION['export_filename'],$file_zipname);
+					exit;
+				}
+				catch (Exception $e)
+				{
+					unset($zip,$_SESSION['export_file'],$_SESSION['export_filename'],$file_zipname);
+					@unlink($_SESSION['export_file']);
+					
+					throw new Exception(__('Failed to compress export file.'));
+				}
+			}
 		}
 	}
@@ -154,15 +192,25 @@
 		echo
 		'<form action="'.$this->getURL(true).'" method="post">'.
-		'<fieldset><legend>'.__('Export a blog').'</legend>'.
-		'<p>'.sprintf(__('This will create an export of your current blog: %s'),
-		'<strong>'.html::escapeHTML($this->core->blog->name).'</strong>').'</p>'.
-		'<p><label for="file_name" class="classic">'.__('File name:').'</label>'.
-		form::field(array('file_name','file_name'),25,255,date('Y-m-d-').html::escapeHTML($this->core->blog->id.'-backup.txt')).
-		'<input type="submit" value="'.__('Export').'" />'.
+		'<fieldset><legend>'.__('Single blog').'</legend>'.
+		'<p>'.sprintf(__('This will create an export of your current blog: %s'),html::escapeHTML($this->core->blog->name)).'</p>'.
+		
+		'<p><label for="file_name">'.__('File name:').'</label>'.
+		form::field(array('file_name','file_name'),50,255,date('Y-m-d-').html::escapeHTML($this->core->blog->id.'-backup.txt')).
+		'</p>'.
+		
+		'<p><label for="file_zip" class="classic">'.
+		form::checkbox(array('file_zip','file_zip'),1).' '.
+		__('Compress file').'</label>'.
+		'</p>'.
+		
+		'<p class="zip-dl"><a href="media.php?d=&amp;zipdl=1">'.
+		__('You may also want to download your media directory as a zip file').'</a></p>'.
+		
+		'<p><input type="submit" value="'.__('Export').'" />'.
 		form::hidden(array('do'),'export_blog').
 		$this->core->formNonce().'</p>'.
-		'<p class="zip-dl"><a href="media.php?d=&amp;zipdl=1">'.
-		__('You may also want to download your media directory as a zip file').'</a></p>'.
-		'</fieldset></form>';
+		
+		'</fieldset>'.
+		'</form>';
 		
 		if ($this->core->auth->isSuperAdmin())
@@ -170,11 +218,22 @@
 			echo
 			'<form action="'.$this->getURL(true).'" method="post">'.
-			'<fieldset><legend>'.__('Export all content').'</legend>'.
-			'<p><label for="file_name2" class="classic">'.__('File name:').'</label>'.
-			form::field(array('file_name','file_name2'),25,255,date('Y-m-d-').'dotclear-backup.txt').
-			'<input type="submit" value="'.__('Export all content').'" />'.
+			'<fieldset><legend>'.__('Multiple blogs').'</legend>'.
+			'<p>'.__('This will create an export of all the content of your database.').'</p>'.
+			
+			'<p><label for="file_name2">'.__('File name:').'</label>'.
+			form::field(array('file_name','file_name2'),50,255,date('Y-m-d-').'dotclear-backup.txt').
+			'</p>'.
+			
+			'<p><label for="file_zip2" class="classic">'.
+			form::checkbox(array('file_zip','file_zip2'),1).' '.
+			__('Compress file').'</label>'.
+			'</p>'.
+			
+			'<p><input type="submit" value="'.__('Export').'" />'.
 			form::hidden(array('do'),'export_all').
 			$this->core->formNonce().'</p>'.
-			'</fieldset></form>';
+			
+			'</fieldset>'.
+			'</form>';
 		}
 	}
Index: plugins/importExport/inc/class.dc.ieModule.php
===================================================================
--- plugins/importExport/inc/class.dc.ieModule.php	(revision 270)
+++ plugins/importExport/inc/class.dc.ieModule.php	(revision 840)
@@ -2,7 +2,7 @@
 # -- BEGIN LICENSE BLOCK ---------------------------------------
 #
-# This file is part of Dotclear 2.
+# This file is part of importExport, a plugin for DotClear2.
 #
-# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear
+# Copyright (c) 2003-2012 Olivier Meunier & Association Dotclear
 # Licensed under the GPL version 2.0 license.
 # See LICENSE file or
@@ -12,5 +12,5 @@
 if (!defined('DC_RC_PATH')) { return; }
 
-class dcIeModule
+abstract class dcIeModule
 {
 	public $type;
@@ -28,14 +28,14 @@
 		$this->setInfo();
 		
-		$this->id = get_class($this);
-		if (!$this->type) {
-			throw new Exception('No type for module'.$this->id);
+		if (!in_array($this->type,array('import','export'))) {
+			throw new Exception(sprintf('Unknow type for module %s',get_class($this)));
 		}
-		
-		$this->url = 'plugin.php?p=importExport&t='.$this->type.'&f='.$this->id;
 		
 		if (!$this->name) {
 			$this->name = get_class($this);
 		}
+		
+		$this->id = get_class($this);
+		$this->url = sprintf('plugin.php?p=importExport&type=%s&module=%s',$this->type,$this->id);
 	}
 	
@@ -44,23 +44,14 @@
 	}
 	
-	protected function setInfo()
-	{
-	}
+	abstract protected function setInfo();
 	
 	final public function getURL($escape=false)
 	{
-		if ($escape) {
-			return html::escapeHTML($this->url);
-		}
-		return $this->url;
+		return $escape ? html::escapeHTML($this->url) : $this->url;
 	}
 	
-	public function process($do)
-	{
-	}
+	abstract public function process($do);
 	
-	public function gui()
-	{
-	}
+	abstract public function gui();
 	
 	protected function progressBar($percent)
Index: plugins/importExport/inc/class.dc.import.dc1.php
===================================================================
--- plugins/importExport/inc/class.dc.import.dc1.php	(revision 270)
+++ plugins/importExport/inc/class.dc.import.dc1.php	(revision 840)
@@ -2,7 +2,7 @@
 # -- BEGIN LICENSE BLOCK ---------------------------------------
 #
-# This file is part of Dotclear 2.
+# This file is part of importExport, a plugin for DotClear2.
 #
-# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear
+# Copyright (c) 2003-2012 Olivier Meunier & Association Dotclear
 # Licensed under the GPL version 2.0 license.
 # See LICENSE file or
@@ -40,5 +40,5 @@
 	protected function setInfo()
 	{
-		$this->type = 'i';
+		$this->type = 'import';
 		$this->name = __('Dotclear 1.2 import');
 		$this->description = __('Import a Dotclear 1.2 installation into your current blog.');
Index: plugins/importExport/inc/class.dc.import.feed.php
===================================================================
--- plugins/importExport/inc/class.dc.import.feed.php	(revision 557)
+++ plugins/importExport/inc/class.dc.import.feed.php	(revision 840)
@@ -2,7 +2,7 @@
 # -- BEGIN LICENSE BLOCK ---------------------------------------
 #
-# This file is part of Dotclear 2.
+# This file is part of importExport, a plugin for DotClear2.
 #
-# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear
+# Copyright (c) 2003-2012 Olivier Meunier & Association Dotclear
 # Licensed under the GPL version 2.0 license.
 # See LICENSE file or
@@ -19,5 +19,5 @@
 	public function setInfo()
 	{
-		$this->type = 'i';
+		$this->type = 'import';
 		$this->name = __('Feed import');
 		$this->description = __('Imports a feed as new entries.');
@@ -81,16 +81,17 @@
 		
 		echo
-		'<h3>'.__('Import from a feed').'</h3>'.
-		'<p>'.sprintf(__('This will import a feed (RSS or Atom) a as new content in the current blog: %s.'),
-		'<strong>'.html::escapeHTML($this->core->blog->name).'</strong>').'</p>'.
 		'<form action="'.$this->getURL(true).'" method="post">'.
+		'<fieldset><legend>'.__('Single blog').'</legend>'.
+		'<p>'.sprintf(__('This will import a feed (RSS or Atom) a as new content in the current blog: %s.'),html::escapeHTML($this->core->blog->name)).'</p>'.
 		
-		'<div class="fieldset">'.
+		'<p><label for="feed_url">'.__('Feed URL:').'</label>'.
+		form::field('feed_url',50,300,html::escapeHTML($this->feed_url)).'</p>'.
+		
+		'<p>'.
 		$this->core->formNonce().
 		form::hidden(array('do'),1).
-		'<p><label for="feed_url">'.__('Feed URL:').'</label>'.
-		form::field('feed_url',40,300,html::escapeHTML($this->feed_url)).'</p>'.
-		'<p><input type="submit" value="'.__('Import').'" /></p>'.
-		'</div>'.
+		'<input type="submit" value="'.__('Import').'" /></p>'.
+		
+		'</fieldset>'.
 		'</form>';
 	}
Index: plugins/importExport/inc/class.dc.import.flat.php
===================================================================
--- plugins/importExport/inc/class.dc.import.flat.php	(revision 557)
+++ plugins/importExport/inc/class.dc.import.flat.php	(revision 840)
@@ -2,7 +2,7 @@
 # -- BEGIN LICENSE BLOCK ---------------------------------------
 #
-# This file is part of Dotclear 2.
+# This file is part of importExport, a plugin for DotClear2.
 #
-# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear
+# Copyright (c) 2003-2012 Olivier Meunier & Association Dotclear
 # Licensed under the GPL version 2.0 license.
 # See LICENSE file or
@@ -18,5 +18,5 @@
 	public function setInfo()
 	{
-		$this->type = 'i';
+		$this->type = 'import';
 		$this->name = __('Flat file import');
 		$this->description = __('Imports a blog or a full Dotclear installation from flat file.');
@@ -55,7 +55,17 @@
 			
 			try {
-				$bk = new dcImport($this->core,$file);
+				# Try to unzip file
+				$unzip_file = $this->unzip($file);
+				if (false !== $unzip_file) {
+					$bk = new flatImport($this->core,$unzip_file);
+				}
+				# Else this is a normal file
+				else {
+					$bk = new flatImport($this->core,$file);
+				}
+				
 				$bk->importSingle();
 			} catch (Exception $e) {
+				@unlink($unzip_file);
 				if ($to_unlink) {
 					@unlink($file);
@@ -63,4 +73,5 @@
 				throw $e;
 			}
+			@unlink($unzip_file);
 			if ($to_unlink) {
 				@unlink($file);
@@ -95,7 +106,17 @@
 			
 			try {
-				$bk = new dcImport($this->core,$file);
+				# Try to unzip file
+				$unzip_file = $this->unzip($file);
+				if (false !== $unzip_file) {
+					$bk = new flatImport($this->core,$unzip_file);
+				}
+				# Else this is a normal file
+				else {
+					$bk = new flatImport($this->core,$file);
+				}
+				
 				$bk->importFull();
 			} catch (Exception $e) {
+				@unlink($unzip_file);
 				if ($to_unlink) {
 					@unlink($file);
@@ -103,4 +124,5 @@
 				throw $e;
 			}
+			@unlink($unzip_file);
 			if ($to_unlink) {
 				@unlink($file);
@@ -128,4 +150,7 @@
 			return;
 		}
+		
+		$public_files = array_merge(array('-' => ''),$this->getPublicFiles());
+		$has_files = (boolean) (count($public_files) - 1);
 		
 		echo
@@ -155,29 +180,27 @@
 		
 		echo
-		'<h3>'.__('Import a single blog').'</h3>'.
-		'<p>'.sprintf(__('This will import a single blog backup as new content in the current blog: %s.'),
-		'<strong>'.html::escapeHTML($this->core->blog->name).'</strong>').'</p>'.
 		'<form action="'.$this->getURL(true).'" method="post" enctype="multipart/form-data">'.
-		
-		'<div class="fieldset">'.
+		'<fieldset><legend>'.__('Single blog').'</legend>'.
+		'<p>'.sprintf(__('This will import a single blog backup as new content in the current blog: %s.'),html::escapeHTML($this->core->blog->name)).'</p>'.
+		
+		'<p><label for="up_single_file">'.__('Upload a backup file').'</label>'.
+		'<input type="file" id="up_single_file" name="up_single_file" size="20" />'.
+		'</p>';
+		
+		if ($has_files) {
+			echo 
+			'<p><label for="public_single_file">'.__('or pick up a local file in your public directory').' '.
+			form::combo('public_single_file',$public_files).
+			'</label></p>';
+		}
+		
+		echo 
+		'<p>'.
 		$this->core->formNonce().
 		form::hidden(array('do'),1).
 		form::hidden(array('MAX_FILE_SIZE'),DC_MAX_UPLOAD_SIZE).
-		'<p><label for="up_single_file">'.__('Upload a backup file').'</label>'.
-		'<input type="file" id="up_single_file" name="up_single_file" size="20" />'.
-		'</p>';
-		
-		$public_files = $this->getPublicFiles();
-		
-		$empty = empty($public_files);
-		$public_files = array_merge(array('-' => ''),$public_files);
-		echo
-		'<p><label for="public_single_file">'.__('or pick up a local file in your public directory').' '.
-		form::combo('public_single_file',$public_files, '', '', '', $empty).
-		'</label></p>';
-		
-		echo
-		'<p><input type="submit" value="'.__('Import').'" /></p>'.
-		'</div>'.
+		'<input type="submit" value="'.__('Import').'" /></p>'.
+		
+		'</fieldset>'.
 		'</form>';
 		
@@ -185,29 +208,30 @@
 		{
 			echo
-			'<h3>'.__('Import a full backup file').'</h3>'.
 			'<form action="'.$this->getURL(true).'" method="post" enctype="multipart/form-data" id="formfull">'.
-			'<div>'.form::hidden(array('MAX_FILE_SIZE'),DC_MAX_UPLOAD_SIZE).'</div>'.
-			
-			'<div class="fieldset">'.
+			'<fieldset><legend>'.__('Multiple blogs').'</legend>'.
+			'<p>'.__('This will reset all the content of your database, except users.').'</p>'.
+			
+			'<p><label for="up_full_file">'.__('Upload a backup file').'</label>'.
+			'<input type="file" id="up_full_file" name="up_full_file" size="20" />'.
+			'</p>';
+			
+			if ($has_files) {
+				echo 
+				'<p><label for="public_full_file">'.__('or pick up a local file in your public directory').'</label>'.
+				form::combo('public_full_file',$public_files).
+				'</p>';
+			}
+			
+			echo
+			'<p><label for="your_pwd" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Your password:').'</label>'.
+			form::password('your_pwd',20,255).'</p>'.
+			
+			'<p>'.
 			$this->core->formNonce().
 			form::hidden(array('do'),1).
 			form::hidden(array('MAX_FILE_SIZE'),DC_MAX_UPLOAD_SIZE).
-			'<p><label for="up_full_file">'.__('Upload a backup file').'</label>'.
-			'<input type="file" id="up_full_file" name="up_full_file" size="20" />'.
-			'</p>';
-			
-			echo
-			'<p><label for="public_full_file">'.__('or pick up a local file in your public directory').'</label>'.
-			form::combo('public_full_file',$public_files, '', '', '', $empty).
-			'</p>';
-			
-			echo
-			'<p class="form-note warning"><strong>'.__('Warning: This will reset all the content of your database, except users.').'</strong></p>'.
-			
-			'<p><label for="your_pwd" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Your password:').'</label>'.
-			form::password('your_pwd',20,255).'</p>'.
-			
-			'<p><input type="submit" value="'.__('Import').'" /></p>'.
-			'</div>'.
+			'<input type="submit" value="'.__('Import').'" /></p>'.
+			
+			'</fieldset>'.
 			'</form>';
 		}
@@ -225,13 +249,76 @@
 				if (is_file($entry_path) && is_readable($entry_path))
 				{
-					$fp = fopen($entry_path,'rb');
-					if (strpos(fgets($fp),'///DOTCLEAR|') === 0) {
+					# Do not test each zip file content here, its too long
+					if (substr($entry_path,-4) == '.zip') {
+							$public_files[$entry] = $entry_path;
+					}
+					elseif (self::checkFileContent($entry_path)) {
 						$public_files[$entry] = $entry_path;
 					}
-					fclose($fp);
 				}
 			}
 		}
 		return $public_files;
+	}
+	
+	protected static function checkFileContent($entry_path)
+	{
+		$ret = false;
+		
+		$fp = fopen($entry_path,'rb');
+		$ret = strpos(fgets($fp),'///DOTCLEAR|') === 0;
+		fclose($fp);
+		
+		return $ret;
+	}
+	
+	private function unzip($file)
+	{
+		$zip = new fileUnzip($file);
+		
+		if ($zip->isEmpty()) {
+			$zip->close();
+			return false;//throw new Exception(__('File is empty or not a compressed file.'));
+		}
+		
+		foreach($zip->getFilesList() as $zip_file)
+		{
+			# Check zipped file name
+			if (substr($zip_file,-4) != '.txt') {
+				continue;
+			}
+			
+			# Check zipped file contents
+			$content = $zip->unzip($zip_file);
+			if (strpos($content,'///DOTCLEAR|') !== 0) {
+				unset($content);
+				continue;
+			}
+			
+			$target = path::fullFromRoot($zip_file,dirname($file));
+			
+			# Check existing files with same name
+			if (file_exists($target)) {
+				$zip->close();
+				unset($content);
+				throw new Exception(__('Another file with same name exists.'));
+			}
+			
+			# Extract backup content
+			if (file_put_contents($target,$content) === false) {
+				$zip->close();
+				unset($content);
+				throw new Exception(__('Failed to extract backup file.'));
+			}
+			
+			$zip->close();
+			unset($content);
+			
+			# Return extracted file name
+			return $target;
+		}
+		
+		$zip->close();
+		throw new Exception(__('No backup in compressed file.'));
 	}
 }
Index: plugins/importExport/inc/class.dc.import.wp.php
===================================================================
--- plugins/importExport/inc/class.dc.import.wp.php	(revision 807)
+++ plugins/importExport/inc/class.dc.import.wp.php	(revision 840)
@@ -2,7 +2,7 @@
 # -- BEGIN LICENSE BLOCK ---------------------------------------
 #
-# This file is part of Dotclear 2.
+# This file is part of importExport, a plugin for DotClear2.
 #
-# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear
+# Copyright (c) 2003-2012 Olivier Meunier & Association Dotclear
 # Licensed under the GPL version 2.0 license.
 # See LICENSE file or
@@ -61,5 +61,5 @@
 	protected function setInfo()
 	{
-		$this->type = 'i';
+		$this->type = 'import';
 		$this->name = __('WordPress import');
 		$this->description = __('Import a WordPress installation into your current blog.');
Index: lugins/importExport/inc/flat/class.backupFile.php
===================================================================
--- plugins/importExport/inc/flat/class.backupFile.php	(revision 270)
+++ 	(revision )
@@ -1,133 +1,0 @@
-<?php
-# -- BEGIN LICENSE BLOCK ---------------------------------------
-#
-# This file is part of Dotclear 2.
-#
-# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear
-# Licensed under the GPL version 2.0 license.
-# See LICENSE file or
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-#
-# -- END LICENSE BLOCK -----------------------------------------
-if (!defined('DC_RC_PATH')) { return; }
-
-class backupFile
-{
-	protected $fp;
-	private $line_cols = array();
-	private $line_name;
-	
-	private $replacement = array(
-		'/(?<!\\\\)(?>(\\\\\\\\)*+)(\\\\n)/u' => "\$1\n",
-		'/(?<!\\\\)(?>(\\\\\\\\)*+)(\\\\r)/u' => "\$1\r",
-		'/(?<!\\\\)(?>(\\\\\\\\)*+)(\\\\")/u' => '$1"',
-		'/(\\\\\\\\)/' => '\\'
-	);
-	
-	public function __construct($file)
-	{
-		if (file_exists($file) && is_readable($file)) {
-			$this->fp = fopen($file,'rb');
-		} else {
-			throw new Exception(__('No file to read.'));
-		}
-	}
-	
-	public function __destruct()
-	{
-		if ($this->fp) {
-			fclose($this->fp);
-		}
-	}
-	
-	public function getLine()
-	{
-		if (feof($this->fp)) {
-			return false;
-		}
-		
-		$line = trim(fgets($this->fp));
-		
-		if (substr($line,0,1) == '[')
-		{
-			$this->line_name = substr($line,1,strpos($line,' ')-1);
-			
-			$line = substr($line,strpos($line,' ')+1,-1);
-			$this->line_cols = explode(',',$line);
-			
-			return $this->getLine();
-		}
-		elseif (substr($line,0,1) == '"')
-		{
-			$line = preg_replace('/^"|"$/','',$line);
-			$line = preg_split('/(^"|","|"$)/m',$line);
-			
-			if (count($this->line_cols) != count($line)) {
-				throw new Exception('Invalid row count');
-			}
-			
-			$res = array();
-			
-			for ($i=0; $i<count($line); $i++) {
-				$res[$this->line_cols[$i]] =
-				preg_replace(array_keys($this->replacement),array_values($this->replacement),$line[$i]);
-			}
-			
-			return new backupFileItem($this->line_name,$res);
-		}
-		else
-		{
-			return $this->getLine();
-		}
-	}
-}
-
-class backupFileItem
-{
-	public $__name;
-	private $__data = array();
-	
-	public function __construct($name,$data)
-	{
-		$this->__name = $name;
-		$this->__data = $data;
-	}
-	
-	public function f($name)
-	{
-		return iconv('UTF-8','UTF-8//IGNORE',$this->__data[$name]);
-	}
-	
-	public function __get($name)
-	{
-		return $this->f($name);
-	}
-	
-	public function __set($n,$v)
-	{
-		$this->__data[$n] = $v;
-	}
-	
-	public function exists($n)
-	{
-		return isset($this->__data[$n]);
-	}
-	
-	public function drop()
-	{
-		foreach (func_get_args() as $n) {
-			if (isset($this->__data[$n])) {
-				unset($this->__data[$n]);
-			}
-		}
-	}
-	
-	public function substitute($old,$new)
-	{
-		if (isset($this->__data[$old])) {
-			$this->__data[$new] = $this->__data[$old];
-			unset($this->__data[$old]);
-		}
-	}
-}
-?>
Index: lugins/importExport/inc/flat/class.db.export.php
===================================================================
--- plugins/importExport/inc/flat/class.db.export.php	(revision 270)
+++ 	(revision )
@@ -1,106 +1,0 @@
-<?php
-# -- BEGIN LICENSE BLOCK ---------------------------------------
-#
-# This file is part of Dotclear 2.
-#
-# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear
-# Licensed under the GPL version 2.0 license.
-# See LICENSE file or
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-#
-# -- END LICENSE BLOCK -----------------------------------------
-if (!defined('DC_RC_PATH')) { return; }
-
-class dbExport
-{
-	private $con;
-	private $prefix;
-	
-	private $line_reg = array('/\\\\/u',  '/\n/u','/\r/u','/"/u');
-	private $line_rep = array('\\\\\\\\', '\n'   ,'\r'   ,'\"');
-	
-	public $fp;
-	
-	function __construct($con,$out='php://output',$prefix=null)
-	{
-		$this->con =& $con;
-		$this->prefix = $prefix;
-		
-		if (($this->fp = fopen($out,'w')) === false) {
-			return false;
-		}
-		@set_time_limit(300);
-	}
-	
-	function __destruct()
-	{
-		if (is_resource($this->fp)) {
-			fclose($this->fp);
-		}
-	}
-	
-	function export($name,$sql)
-	{
-		$rs = $this->con->select($sql);
-		
-		if (!$rs->isEmpty())
-		{
-			fwrite($this->fp,"\n[".$name.' '.implode(',',$rs->columns())."]\n");
-			while ($rs->fetch()) {
-				fwrite($this->fp,$this->getLine($rs));
-			}
-			fflush($this->fp);
-		}
-	}
-	
-	function exportAll()
-	{
-		$tables = $this->getTables();
-		
-		foreach ($tables as $table)
-		{
-			$this->exportTable($table);
-		}
-	}
-	
-	function exportTable($table)
-	{
-		$req = 'SELECT * FROM '.$this->con->escapeSystem($this->prefix.$table);
-		
-		$this->export($table,$req);
-	}
-	
-	function getTables()
-	{
-		$schema = dbSchema::init($this->con);
-		$db_tables = $schema->getTables();
-		
-		$tables = array();
-		foreach ($db_tables as $t)
-		{
-			if ($this->prefix) {
-				if (strpos($t,$this->prefix) === 0) {
-					$tables[] = $t;
-				}
-			} else {
-				$tables[] = $t;
-			}
-		}
-		
-		return $tables;
-	}
-	
-	function getLine($rs)
-	{
-		$l = array();
-		$cols = $rs->columns();
-		foreach ($cols as $i => &$c) {
-			$s = $rs->f($c);
-			$s = preg_replace($this->line_reg,$this->line_rep,$s);
-			$s = '"'.$s.'"';
-			$l[$i] = $s;
-		}
-		return implode(',',$l)."\n";
-	}
-}
-?>
Index: lugins/importExport/inc/flat/class.dc.import.php
===================================================================
--- plugins/importExport/inc/flat/class.dc.import.php	(revision 298)
+++ 	(revision )
@@ -1,857 +1,0 @@
-<?php
-# -- BEGIN LICENSE BLOCK ---------------------------------------
-#
-# This file is part of Dotclear 2.
-#
-# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear
-# Licensed under the GPL version 2.0 license.
-# See LICENSE file or
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-#
-# -- END LICENSE BLOCK -----------------------------------------
-if (!defined('DC_RC_PATH')) { return; }
-
-class dcImport extends backupFile
-{
-	private $core;
-	private $con;
-	private $prefix;
-	
-	private $dc_version;
-	private $dc_major;
-	private $mode;
-	
-	private $blog_url;
-	private $blog_name;
-	private $blog_desc;
-	
-	private $users = array();
-	
-	public $old_ids = array(
-		'category' => array(),
-		'post' => array(),
-		'media' => array()
-	);
-	
-	public $stack = array(
-		'categories'=>null,
-		'cat_id'=>1,
-		'cat_lft'=>array(),
-		'post_id'=>1,
-		'media_id'=>1,
-		'comment_id'=>1,
-		'link_id'=>1
-	);
-	
-	public $has_categories = false;
-	
-	public function __construct($core,$file)
-	{
-		parent::__construct($file);
-		
-		$first_line = fgets($this->fp);
-		if (strpos($first_line,'///DOTCLEAR|') !== 0) {
-			throw new Exception(__('File is not a DotClear backup.'));
-		}
-		
-		@set_time_limit(300);
-		
-		$l = explode('|',$first_line);
-		
-		if (isset($l[1])) {
-			$this->dc_version = $l[1];
-		}
-		
-		$this->mode = isset($l[2]) ? strtolower(trim($l[2])) : 'single';
-		if ($this->mode != 'full' && $this->mode != 'single') {
-			$this->mode = 'single';
-		}
-		
-		if (version_compare('1.2',$this->dc_version,'<=') &&
-		version_compare('1.3',$this->dc_version,'>')) {
-			$this->dc_major_version = '1.2';
-		} else {
-			$this->dc_major_version = '2.0';
-		}
-		
-		$this->core =& $core;
-		$this->con =& $core->con;
-		$this->prefix = $core->prefix;
-		
-		$this->cur_blog        = $this->con->openCursor($this->prefix.'blog');
-		$this->cur_category    = $this->con->openCursor($this->prefix.'category');
-		$this->cur_link        = $this->con->openCursor($this->prefix.'link');
-		$this->cur_setting     = $this->con->openCursor($this->prefix.'setting');
-		$this->cur_user        = $this->con->openCursor($this->prefix.'user');
-		$this->cur_pref        = $this->con->openCursor($this->prefix.'pref');
-		$this->cur_permissions = $this->con->openCursor($this->prefix.'permissions');
-		$this->cur_post        = $this->con->openCursor($this->prefix.'post');
-		$this->cur_meta        = $this->con->openCursor($this->prefix.'meta');
-		$this->cur_media       = $this->con->openCursor($this->prefix.'media');
-		$this->cur_post_media  = $this->con->openCursor($this->prefix.'post_media');
-		$this->cur_log         = $this->con->openCursor($this->prefix.'log');
-		$this->cur_ping        = $this->con->openCursor($this->prefix.'ping');
-		$this->cur_comment     = $this->con->openCursor($this->prefix.'comment');
-		$this->cur_spamrule    = $this->con->openCursor($this->prefix.'spamrule');
-		$this->cur_version     = $this->con->openCursor($this->prefix.'version');
-		
-		# --BEHAVIOR-- importInit
-		$this->core->callBehavior('importInit',$this,$this->core);
-	}
-	
-	public function importSingle()
-	{
-		if ($this->mode != 'single') {
-			throw new Exception(__('File is not a single blog export.'));
-		}
-		
-		if (!$this->core->auth->check('admin',$this->core->blog->id)) {
-			throw new Exception(__('Permission denied.'));
-		}
-		
-		$this->blog_id = $this->core->blog->id;
-		
-		$this->stack['categories'] = $this->con->select(
-			'SELECT cat_id, cat_title, cat_url '.
-			'FROM '.$this->prefix.'category '.
-			"WHERE blog_id = '".$this->con->escape($this->blog_id)."' "
-		);
-		
-		$rs = $this->con->select('SELECT MAX(cat_id) FROM '.$this->prefix.'category');
-		$this->stack['cat_id'] = ((integer) $rs->f(0))+1;
-		
-		$rs = $this->con->select('SELECT MAX(link_id) FROM '.$this->prefix.'link');
-		$this->stack['link_id'] = ((integer) $rs->f(0))+1;
-		
-		$rs = $this->con->select('SELECT MAX(post_id) FROM '.$this->prefix.'post');
-		$this->stack['post_id'] = ((integer) $rs->f(0))+1;
-		
-		$rs = $this->con->select('SELECT MAX(media_id) FROM '.$this->prefix.'media');
-		$this->stack['media_id'] = ((integer) $rs->f(0))+1;
-		
-		$rs = $this->con->select('SELECT MAX(comment_id) FROM '.$this->prefix.'comment');
-		$this->stack['comment_id'] = ((integer) $rs->f(0))+1;
-		
-		$rs = $this->con->select(
-			'SELECT MAX(cat_rgt) AS cat_rgt FROM '.$this->prefix.'category '.
-			"WHERE blog_id = '".$this->con->escape($this->core->blog->id)."'"
-		);
-		
-		if ((integer) $rs->cat_rgt > 0) {
-			$this->has_categories = true;
-			$this->stack['cat_lft'][$this->core->blog->id] = (integer) $rs->cat_rgt + 1;
-		}
-		
-		$this->con->begin();
-		
-		try
-		{
-			$last_line_name = '';
-			$constrained = array('post', 'meta', 'post_media', 'ping', 'comment');
-			
-			while (($line = $this->getLine()) !== false)
-			{
-				# import DC 1.2.x, we fix lines before insert
-				if ($this->dc_major_version == '1.2') {
-					$this->prepareDC12line($line);
-				}
-				
-				if ($last_line_name != $line->__name) {
-					if (in_array($last_line_name,$constrained)) {
-						# UNDEFER
-						if ($this->con->driver() == 'mysql') $this->con->execute('SET foreign_key_checks = 1');
-						if ($this->con->driver() == 'pgsql') $this->con->execute('SET CONSTRAINTS ALL DEFERRED');
-					}
-					
-					if (in_array($line->__name,$constrained)) {
-						# DEFER
-						if ($this->con->driver() == 'mysql') $this->con->execute('SET foreign_key_checks = 0');
-						if ($this->con->driver() == 'pgsql') $this->con->execute('SET CONSTRAINTS ALL IMMEDIATE');
-					}
-					
-					$last_line_name = $line->__name;
-				}
-				
-				switch ($line->__name)
-				{
-					case 'category':
-						$this->insertCategorySingle($line);
-						break;
-					case 'link':
-						$this->insertLinkSingle($line);
-						break;
-					case 'post':
-						$this->insertPostSingle($line);
-						break;
-					case 'meta':
-						$this->insertMetaSingle($line);
-						break;
-					case 'media':
-						$this->insertMediaSingle($line);
-						break;
-					case 'post_media':
-						$this->insertPostMediaSingle($line);
-						break;
-					case 'ping':
-						$this->insertPingSingle($line);
-						break;
-					case 'comment':
-						$this->insertCommentSingle($line);
-						break;
-				}
-				
-				# --BEHAVIOR-- importSingle
-				$this->core->callBehavior('importSingle',$line,$this,$this->core);
-			}
-			
-			if ($this->con->driver() == 'mysql') $this->con->execute('SET foreign_key_checks = 1');
-			if ($this->con->driver() == 'pgsql') $this->con->execute('SET CONSTRAINTS ALL DEFERRED');
-		}
-		catch (Exception $e)
-		{
-			$this->con->rollback();
-			throw $e;
-		}
-		
-		$this->con->commit();
-	}
-	
-	public function importFull()
-	{
-		if ($this->mode != 'full') {
-			throw new Exception(__('File is not a full export.'));
-		}
-		
-		if (!$this->core->auth->isSuperAdmin()) {
-			throw new Exception(__('Permission denied.'));
-		}
-		
-		$this->con->begin();
-		$this->con->execute('DELETE FROM '.$this->prefix.'blog');
-		$this->con->execute('DELETE FROM '.$this->prefix.'media');
-		$this->con->execute('DELETE FROM '.$this->prefix.'spamrule');
-		$this->con->execute('DELETE FROM '.$this->prefix.'setting');
-		
-		try
-		{
-			while (($line = $this->getLine()) !== false)
-			{
-				switch ($line->__name)
-				{
-					case 'blog':
-						$this->insertBlog($line);
-						break;
-					case 'category':
-						$this->insertCategory($line);
-						break;
-					case 'link':
-						$this->insertLink($line);
-						break;
-					case 'setting':
-						$this->insertSetting($line);
-						break;
-					case 'user':
-						$this->insertUser($line);
-						break;
-					case 'pref':
-						$this->insertPref($line);
-						break;
-					case 'permissions':
-						$this->insertPermissions($line);
-						break;
-					case 'post':
-						$this->insertPost($line);
-						break;
-					case 'meta':
-						$this->insertMeta($line);
-						break;
-					case 'media':
-						$this->insertMedia($line);
-						break;
-					case 'post_media':
-						$this->insertPostMedia($line);
-						break;
-					case 'log';
-						$this->insertLog($line);
-						break;
-					case 'ping':
-						$this->insertPing($line);
-						break;
-					case 'comment':
-						$this->insertComment($line);
-						break;
-					case 'spamrule':
-						$this->insertSpamRule($line);
-						break;
-				}
-				# --BEHAVIOR-- importFull
-				$this->core->callBehavior('importFull',$line,$this,$this->core);
-			}
-		}
-		catch (Exception $e)
-		{
-			$this->con->rollback();
-			throw $e;
-		}
-		
-		$this->con->commit();
-	}
-	
-	private function insertBlog($blog)
-	{
-		$this->cur_blog->clean();
-		
-		$this->cur_blog->blog_id     = (string) $blog->blog_id;
-		$this->cur_blog->blog_uid    = (string) $blog->blog_uid;
-		$this->cur_blog->blog_creadt = (string) $blog->blog_creadt;
-		$this->cur_blog->blog_upddt  = (string) $blog->blog_upddt;
-		$this->cur_blog->blog_url    = (string) $blog->blog_url;
-		$this->cur_blog->blog_name   = (string) $blog->blog_name;
-		$this->cur_blog->blog_desc   = (string) $blog->blog_desc;
-		
-		$this->cur_blog->blog_status = $blog->exists('blog_status') ? (integer) $blog->blog_status : 1;
-		
-		$this->cur_blog->insert();
-	}
-	
-	private function insertCategory($category)
-	{
-		$this->cur_category->clean();
-		
-		$this->cur_category->cat_id       = (string) $category->cat_id;
-		$this->cur_category->blog_id      = (string) $category->blog_id;
-		$this->cur_category->cat_title    = (string) $category->cat_title;
-		$this->cur_category->cat_url      = (string) $category->cat_url;
-		$this->cur_category->cat_desc     = (string) $category->cat_desc;
-		
-		if (!$this->has_categories && $category->exists('cat_lft') && $category->exists('cat_rgt')) {
-			$this->cur_category->cat_lft = (integer) $category->cat_lft;
-			$this->cur_category->cat_rgt = (integer) $category->cat_rgt;
-		} else {
-			if (!isset($this->stack['cat_lft'][$category->blog_id])) {
-				$this->stack['cat_lft'][$category->blog_id] = 2;
-			}
-			$this->cur_category->cat_lft = $this->stack['cat_lft'][$category->blog_id]++;
-			$this->cur_category->cat_rgt = $this->stack['cat_lft'][$category->blog_id]++;
-		}
-		
-		$this->cur_category->insert();
-	}
-	
-	private function insertLink($link)
-	{
-		$this->cur_link->clean();
-		
-		$this->cur_link->link_id       = (integer) $link->link_id;
-		$this->cur_link->blog_id       = (string) $link->blog_id;
-		$this->cur_link->link_href     = (string) $link->link_href;
-		$this->cur_link->link_title    = (string) $link->link_title;
-		$this->cur_link->link_desc     = (string) $link->link_desc;
-		$this->cur_link->link_lang     = (string) $link->link_lang;
-		$this->cur_link->link_xfn      = (string) $link->link_xfn;
-		$this->cur_link->link_position = (integer) $link->link_position;
-		
-		$this->cur_link->insert();
-	}
-	
-	private function insertSetting($setting)
-	{
-		$this->cur_setting->clean();
-		
-		$this->cur_setting->setting_id    = (string) $setting->setting_id;
-		$this->cur_setting->blog_id       = !$setting->blog_id ? null : (string) $setting->blog_id;
-		$this->cur_setting->setting_ns    = (string) $setting->setting_ns;
-		$this->cur_setting->setting_value = (string) $setting->setting_value;
-		$this->cur_setting->setting_type  = (string) $setting->setting_type;
-		$this->cur_setting->setting_label = (string) $setting->setting_label;
-		
-		$this->cur_setting->insert();
-	}
-	
-	private function insertPref($pref)
-	{
-		if ($this->prefExists($pref->pref_ws,$pref->pref_id,$pref->user_id)) {
-			return;
-		}
-		
-		$this->cur_pref->clean();
-		
-		$this->cur_pref->pref_id    = (string) $pref->pref_id;
-		$this->cur_pref->user_id    = !$pref->user_id ? null : (string) $pref->user_id;
-		$this->cur_pref->pref_ws    = (string) $pref->pref_ws;
-		$this->cur_pref->pref_value = (string) $pref->pref_value;
-		$this->cur_pref->pref_type  = (string) $pref->pref_type;
-		$this->cur_pref->pref_label = (string) $pref->pref_label;
-		
-		$this->cur_pref->insert();
-	}
-	
-	private function insertUser($user)
-	{
-		if ($this->userExists($user->user_id)) {
-			return;
-		}
-		
-		$this->cur_user->clean();
-		
-		$this->cur_user->user_id           = (string) $user->user_id;
-		$this->cur_user->user_super        = (integer) $user->user_super;
-		$this->cur_user->user_pwd          = (string) $user->user_pwd;
-		$this->cur_user->user_recover_key  = (string) $user->user_recover_key;
-		$this->cur_user->user_name         = (string) $user->user_name;
-		$this->cur_user->user_firstname    = (string) $user->user_firstname;
-		$this->cur_user->user_displayname  = (string) $user->user_displayname;
-		$this->cur_user->user_email        = (string) $user->user_email;
-		$this->cur_user->user_url          = (string) $user->user_url;
-		$this->cur_user->user_default_blog = !$user->user_default_blog ? null : (string) $user->user_default_blog;
-		$this->cur_user->user_lang         = (string) $user->user_lang;
-		$this->cur_user->user_tz           = (string) $user->user_tz;
-		$this->cur_user->user_post_status  = (integer) $user->user_post_status;
-		$this->cur_user->user_creadt       = (string) $user->user_creadt;
-		$this->cur_user->user_upddt        = (string) $user->user_upddt;
-		
-		$this->cur_user->user_desc = $user->exists('user_desc') ? (string) $user->user_desc : null;
-		$this->cur_user->user_options = $user->exists('user_options') ? (string) $user->user_options : null;
-		$this->cur_user->user_status = $user->exists('user_status') ? (integer) $user->user_status : 1;
-		
-		$this->cur_user->insert();
-		
-		$this->stack['users'][$user->user_id] = true;
-	}
-	
-	private function insertPermissions($permissions)
-	{
-		$this->cur_permissions->clean();
-		
-		$this->cur_permissions->user_id     = (string) $permissions->user_id;
-		$this->cur_permissions->blog_id     = (string) $permissions->blog_id;
-		$this->cur_permissions->permissions = (string) $permissions->permissions;
-		
-		$this->cur_permissions->insert();
-	}
-	
-	private function insertPost($post)
-	{
-		$this->cur_post->clean();
-		
-		$cat_id = (integer) $post->cat_id;
-		if (!$cat_id) {
-			$cat_id = null;
-		}
-		
-		$post_password = $post->post_password ? (string) $post->post_password : null;
-		
-		$this->cur_post->post_id            = (integer) $post->post_id;
-		$this->cur_post->blog_id            = (string) $post->blog_id;
-		$this->cur_post->user_id            = (string) $this->getUserId($post->user_id);
-		$this->cur_post->cat_id             = $cat_id;
-		$this->cur_post->post_dt            = (string) $post->post_dt;
-		$this->cur_post->post_creadt        = (string) $post->post_creadt;
-		$this->cur_post->post_upddt         = (string) $post->post_upddt;
-		$this->cur_post->post_password      = $post_password;
-		$this->cur_post->post_type          = (string) $post->post_type;
-		$this->cur_post->post_format        = (string) $post->post_format;
-		$this->cur_post->post_url           = (string) $post->post_url;
-		$this->cur_post->post_lang          = (string) $post->post_lang;
-		$this->cur_post->post_title         = (string) $post->post_title;
-		$this->cur_post->post_excerpt       = (string) $post->post_excerpt;
-		$this->cur_post->post_excerpt_xhtml = (string) $post->post_excerpt_xhtml;
-		$this->cur_post->post_content       = (string) $post->post_content;
-		$this->cur_post->post_content_xhtml = (string) $post->post_content_xhtml;
-		$this->cur_post->post_notes         = (string) $post->post_notes;
-		$this->cur_post->post_words         = (string) $post->post_words;
-		$this->cur_post->post_meta          = (string) $post->post_meta;
-		$this->cur_post->post_status        = (integer) $post->post_status;
-		$this->cur_post->post_selected      = (integer) $post->post_selected;
-		$this->cur_post->post_open_comment  = (integer) $post->post_open_comment;
-		$this->cur_post->post_open_tb       = (integer) $post->post_open_tb;
-		$this->cur_post->nb_comment         = (integer) $post->nb_comment;
-		$this->cur_post->nb_trackback       = (integer) $post->nb_trackback;
-		
-		$this->cur_post->post_tz = $post->exists('post_tz') ? (string) $post->post_tz : 'UTC';
-		
-		$this->cur_post->insert();
-	}
-	
-	private function insertMeta($meta)
-	{
-		$this->cur_meta->clean();
-		
-		$this->cur_meta->meta_id   = (string) $meta->meta_id;
-		$this->cur_meta->meta_type = (string) $meta->meta_type;
-		$this->cur_meta->post_id   = (integer) $meta->post_id;
-		
-		$this->cur_meta->insert();
-	}
-	
-	private function insertMedia($media)
-	{
-		$this->cur_media->clean();
-		
-		$this->cur_media->media_id      = (integer) $media->media_id;
-		$this->cur_media->user_id       = (string) $media->user_id;
-		$this->cur_media->media_path    = (string) $media->media_path;
-		$this->cur_media->media_title   = (string) $media->media_title;
-		$this->cur_media->media_file    = (string) $media->media_file;
-		$this->cur_media->media_meta    = (string) $media->media_meta;
-		$this->cur_media->media_dt      = (string) $media->media_dt;
-		$this->cur_media->media_creadt  = (string) $media->media_creadt;
-		$this->cur_media->media_upddt   = (string) $media->media_upddt;
-		$this->cur_media->media_private = (integer) $media->media_private;
-		
-		$this->cur_media->media_dir = $media->exists('media_dir') ? (string) $media->media_dir : dirname($media->media_file);
-		
-		if (!$this->mediaExists()) {
-			$this->cur_media->insert();
-		}
-	}
-	
-	private function insertPostMedia($post_media)
-	{
-		$this->cur_post_media->clean();
-		
-		$this->cur_post_media->media_id = (integer) $post_media->media_id;
-		$this->cur_post_media->post_id  = (integer) $post_media->post_id;
-		
-		$this->cur_post_media->insert();
-	}
-	
-	private function insertLog($log)
-	{
-		$this->cur_log->clean();
-		
-		$this->cur_log->log_id    = (integer) $log->log_id;
-		$this->cur_log->user_id   = (string) $log->user_id;
-		$this->cur_log->log_table = (string) $log->log_table;
-		$this->cur_log->log_dt    = (string) $log->log_dt;
-		$this->cur_log->log_ip    = (string) $log->log_ip;
-		$this->cur_log->log_msg   = (string) $log->log_msg;
-		
-		$this->cur_log->insert();
-	}
-	
-	private function insertPing($ping)
-	{
-		$this->cur_ping->clean();
-		
-		$this->cur_ping->post_id  = (integer) $ping->post_id;
-		$this->cur_ping->ping_url = (string) $ping->ping_url;
-		$this->cur_ping->ping_dt  = (string) $ping->ping_dt;
-		
-		$this->cur_ping->insert();
-	}
-	
-	private function insertComment($comment)
-	{
-		$this->cur_comment->clean();
-		
-		$this->cur_comment->comment_id          = (integer) $comment->comment_id;
-		$this->cur_comment->post_id             = (integer) $comment->post_id;
-		$this->cur_comment->comment_dt          = (string) $comment->comment_dt;
-		$this->cur_comment->comment_upddt       = (string) $comment->comment_upddt;
-		$this->cur_comment->comment_author      = (string) $comment->comment_author;
-		$this->cur_comment->comment_email       = (string) $comment->comment_email;
-		$this->cur_comment->comment_site        = (string) $comment->comment_site;
-		$this->cur_comment->comment_content     = (string) $comment->comment_content;
-		$this->cur_comment->comment_words       = (string) $comment->comment_words;
-		$this->cur_comment->comment_ip          = (string) $comment->comment_ip;
-		$this->cur_comment->comment_status      = (integer) $comment->comment_status;
-		$this->cur_comment->comment_spam_status = (integer) $comment->comment_spam_status;
-		$this->cur_comment->comment_trackback   = (integer) $comment->comment_trackback;
-		
-		$this->cur_comment->comment_tz = $comment->exists('comment_tz') ? (string) $comment->comment_tz : 'UTC';
-		$this->cur_comment->comment_spam_filter = $comment->exists('comment_spam_filter') ? (integer) $comment->comment_spam_filter : null;
-		
-		$this->cur_comment->insert();
-	}
-	
-	private function insertSpamRule($spamrule)
-	{
-		$this->cur_spamrule->clean();
-		
-		$this->cur_spamrule->rule_id      = (integer) $spamrule->rule_id;
-		$this->cur_spamrule->blog_id      = !$spamrule->blog_id ? null : (string) $spamrule->blog_id;
-		$this->cur_spamrule->rule_type    = (string) $spamrule->rule_type;
-		$this->cur_spamrule->rule_content = (string) $spamrule->rule_content;
-		
-		$this->cur_spamrule->insert();
-	}
-	
-	private function insertCategorySingle($category)
-	{
-		$this->cur_category->clean();
-		
-		$m = $this->searchCategory($this->stack['categories'],$category->cat_url);
-		
-		$old_id = $category->cat_id;
-		if ($m !== false)
-		{
-			$cat_id = $m;
-		}
-		else
-		{
-			$cat_id = $this->stack['cat_id'];
-			$category->cat_id = $cat_id;
-			$category->blog_id = $this->blog_id;
-			
-			$this->insertCategory($category);
-			$this->stack['cat_id']++;
-		}
-		
-		$this->old_ids['category'][(integer) $old_id] = $cat_id;
-	}
-	
-	private function insertLinkSingle($link)
-	{
-		$link->blog_id = $this->blog_id;
-		$link->link_id = $this->stack['link_id'];
-		
-		$this->insertLink($link);
-		$this->stack['link_id']++;
-	}
-	
-	private function insertPostSingle($post)
-	{
-		if (!$post->cat_id || isset($this->old_ids['category'][(integer) $post->cat_id])) {
-			$post_id = $this->stack['post_id'];
-			$this->old_ids['post'][(integer) $post->post_id] = $post_id;
-			
-			$cat_id = $post->cat_id ? $this->old_ids['category'][(integer) $post->cat_id] : null;
-			
-			$post->post_id = $post_id;
-			$post->cat_id = $cat_id;
-			$post->blog_id = $this->blog_id;
-			
-			$post->post_url = $this->core->blog->getPostURL(
-				$post->post_url,$post->post_dt,$post->post_title,$post->post_id
-			);
-			
-			$this->insertPost($post);
-			$this->stack['post_id']++;
-		} else {
-			throw new Exception(__('The backup file does not appear to be well formed.'));
-		}
-	}
-	
-	private function insertMetaSingle($meta)
-	{
-		if (isset($this->old_ids['post'][(integer) $meta->post_id])) {
-			$meta->post_id = $this->old_ids['post'][(integer) $meta->post_id];
-			$this->insertMeta($meta);
-		} else {
-			throw new Exception(__('The backup file does not appear to be well formed.'));
-		}
-	}
-	
-	private function insertMediaSingle($media)
-	{
-		$media_id = $this->stack['media_id'];
-		$old_id = $media->media_id;
-		
-		$media->media_id = $media_id;
-		$media->media_path = $this->core->blog->settings->system->public_path;
-		$media->user_id = $this->getUserId($media->user_id);
-		
-		$this->insertMedia($media);
-		$this->stack['media_id']++;
-		$this->old_ids['media'][(integer) $old_id] = $media_id;
-	}
-	
-	private function insertPostMediaSingle($post_media)
-	{
-		if (isset($this->old_ids['media'][(integer) $post_media->media_id]) &&
-			isset($this->old_ids['post'][(integer) $post_media->post_id])) {
-			$post_media->media_id = $this->old_ids['media'][(integer) $post_media->media_id];
-			$post_media->post_id = $this->old_ids['post'][(integer) $post_media->post_id];
-			
-			$this->insertPostMedia($post_media);
-		} else {
-			throw new Exception(__('The backup file does not appear to be well formed.'));
-		}
-	}
-	
-	private function insertPingSingle($ping)
-	{
-		if (isset($this->old_ids['post'][(integer) $ping->post_id])) {
-			$ping->post_id = $this->old_ids['post'][(integer) $ping->post_id];
-			
-			$this->insertPing($ping);
-		} else {
-			throw new Exception(__('The backup file does not appear to be well formed.'));
-		}
-	}
-	
-	private function insertCommentSingle($comment)
-	{
-		if (isset($this->old_ids['post'][(integer) $comment->post_id])) {
-			$comment_id = $this->stack['comment_id'];
-			
-			$comment->comment_id = $comment_id;
-			$comment->post_id = $this->old_ids['post'][(integer) $comment->post_id];
-			
-			$this->insertComment($comment);
-			$this->stack['comment_id']++;
-		} else {
-			throw new Exception(__('The backup file does not appear to be well formed.'));
-		}
-	}
-	
-	public function searchCategory($rs,$url)
-	{
-		while ($rs->fetch())
-		{
-			if ($rs->cat_url == $url) {
-				return $rs->cat_id;
-			}
-		}
-		
-		return false;
-	}
-	
-	public function getUserId($user_id)
-	{
-		if (!$this->userExists($user_id))
-		{
-			if ($this->core->auth->isSuperAdmin())
-			{
-				# Sanitizes user_id and create a lambda user
-				$user_id = preg_replace('/[^A-Za-z0-9]$/','',$user_id);
-				$user_id .= strlen($user_id) < 2 ? '-a' : '';
-				
-				# We change user_id, we need to check again
-				if (!$this->userExists($user_id))
-				{
-					$this->cur_user->clean();
-					$this->cur_user->user_id = (string) $user_id;
-					$this->cur_user->user_pwd = md5(uniqid());
-					
-					$this->core->addUser($this->cur_user);
-					
-					$this->stack['users'][$user_id] = true;
-				}
-			}
-			else
-			{
-				# Returns current user id
-				$user_id = $this->core->auth->userID();
-			}
-		}
-		
-		return $user_id;
-	}
-	
-	private function userExists($user_id)
-	{
-		if (isset($this->stack['users'][$user_id])) {
-			return $this->stack['users'][$user_id];
-		}
-		
-		$strReq = 'SELECT user_id '.
-				'FROM '.$this->prefix.'user '.
-				"WHERE user_id = '".$this->con->escape($user_id)."' ";
-		
-		$rs = $this->con->select($strReq);
-		
-		$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();
-	}
-	
-	private function mediaExists()
-	{
-		$strReq = 'SELECT media_id '.
-				'FROM '.$this->prefix.'media '.
-				"WHERE media_path = '".$this->cur_media->media_path."' ".
-				"AND media_file = '".$this->cur_media->media_file."' ";
-		
-		$rs = $this->con->select($strReq);
-		
-		return !$rs->isEmpty();
-	}
-	
-	private function prepareDC12line(&$line)
-	{
-		$settings = array('dc_theme','dc_nb_post_per_page','dc_allow_comments',
-		'dc_allow_trackbacks','dc_comment_pub','dc_comments_ttl',
-		'dc_wiki_comments','dc_use_smilies','dc_date_format','dc_time_format',
-		'dc_url_scan');
-		
-		switch ($line->__name)
-		{
-			case 'categorie':
-				$line->substitute('cat_libelle','cat_title');
-				$line->substitute('cat_libelle_url','cat_url');
-				$line->__name = 'category';
-				$line->blog_id = 'default';
-				break;
-			case 'link':
-				$line->substitute('href','link_href');
-				$line->substitute('label','link_title');
-				$line->substitute('title','link_desc');
-				$line->substitute('lang','link_lang');
-				$line->substitute('rel','link_xfn');
-				$line->substitute('position','link_position');
-				$line->blog_id = 'default';
-				break;
-			case 'post':
-				$line->substitute('post_titre','post_title');
-				$line->post_title = html::decodeEntities($line->post_title);
-				$line->post_url = date('Y/m/d/',strtotime($line->post_dt)).$line->post_id.'-'.$line->post_titre_url;
-				$line->post_url = substr($line->post_url,0,255);
-				$line->post_format = $line->post_content_wiki == '' ? 'xhtml' : 'wiki';
-				$line->post_content_xhtml = $line->post_content;
-				$line->post_excerpt_xhtml = $line->post_chapo;
-				
-				if ($line->post_format == 'wiki') {
-					$line->post_content = $line->post_content_wiki;
-					$line->post_excerpt = $line->post_chapo_wiki;
-				} else {
-					$line->post_content = $line->post_content;
-					$line->post_excerpt = $line->post_chapo;
-				}
-				
-				$line->post_status = (integer) $line->post_pub;
-				$line->post_type = 'post';
-				$line->blog_id = 'default';
-				
-				$line->drop('post_titre_url','post_content_wiki','post_chapo','post_chapo_wiki','post_pub');
-				
-				break;
-			case 'post_meta':
-				$line->drop('meta_id');
-				$line->substitute('meta_key','meta_type');
-				$line->substitute('meta_value','meta_id');
-				$line->__name = 'meta';
-				$line->blog_id = 'default';
-				break;
-			case 'comment':
-				$line->substitute('comment_auteur','comment_author');
-				if ($line->comment_site != '' && !preg_match('!^http://.*$!', $line->comment_site,$m)) {
-					$line->comment_site = 'http://'.$line->comment_site;
-				}
-				$line->comment_status = (integer) $line->comment_pub;
-				$line->drop('comment_pub');
-				break;
-		}
-		
-		# --BEHAVIOR-- importPrepareDC12
-		$this->core->callBehavior('importPrepareDC12',$line,$this,$this->core);
-	}
-}
-?>
Index: plugins/importExport/inc/flat/class.flat.backup.php
===================================================================
--- plugins/importExport/inc/flat/class.flat.backup.php	(revision 841)
+++ plugins/importExport/inc/flat/class.flat.backup.php	(revision 841)
@@ -0,0 +1,148 @@
+<?php
+# -- BEGIN LICENSE BLOCK ---------------------------------------
+#
+# This file is part of importExport, a plugin for DotClear2.
+#
+# Copyright (c) 2003-2012 Olivier Meunier & Association Dotclear
+# Licensed under the GPL version 2.0 license.
+# See LICENSE file or
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+#
+# -- END LICENSE BLOCK -----------------------------------------
+if (!defined('DC_RC_PATH')) { return; }
+
+class flatBackup
+{
+	protected $fp;
+	private $line_cols = array();
+	private $line_name;
+	private $line_num;
+	
+	private $replacement = array(
+		'/(?<!\\\\)(?>(\\\\\\\\)*+)(\\\\n)/u' => "\$1\n",
+		'/(?<!\\\\)(?>(\\\\\\\\)*+)(\\\\r)/u' => "\$1\r",
+		'/(?<!\\\\)(?>(\\\\\\\\)*+)(\\\\")/u' => '$1"',
+		'/(\\\\\\\\)/' => '\\'
+	);
+	
+	public function __construct($file)
+	{
+		if (file_exists($file) && is_readable($file)) {
+			$this->fp = fopen($file,'rb');
+			$this->line_num = 1;
+		} else {
+			throw new Exception(__('No file to read.'));
+		}
+	}
+	
+	public function __destruct()
+	{
+		if ($this->fp) {
+			fclose($this->fp);
+		}
+	}
+	
+	public function getLine()
+	{
+		if (($line = $this->nextLine()) === false) {
+			return false;
+		}
+		
+		if (substr($line,0,1) == '[')
+		{
+			$this->line_name = substr($line,1,strpos($line,' ')-1);
+			
+			$line = substr($line,strpos($line,' ')+1,-1);
+			$this->line_cols = explode(',',$line);
+			
+			return $this->getLine();
+		}
+		elseif (substr($line,0,1) == '"')
+		{
+			$line = preg_replace('/^"|"$/','',$line);
+			$line = preg_split('/(^"|","|"$)/m',$line);
+			
+			if (count($this->line_cols) != count($line)) {
+				throw new Exception(sprintf('Invalid row count at line %s',$this->line_num));
+			}
+			
+			$res = array();
+			
+			for ($i=0; $i<count($line); $i++) {
+				$res[$this->line_cols[$i]] =
+				preg_replace(array_keys($this->replacement),array_values($this->replacement),$line[$i]);
+			}
+			
+			return new flatBackupItem($this->line_name,$res,$this->line_num);
+		}
+		else
+		{
+			return $this->getLine();
+		}
+	}
+	
+	private function nextLine()
+	{
+		if (feof($this->fp)) {
+			return false;
+		}
+		$this->line_num++;
+		
+		$line = fgets($this->fp);
+		$line = trim($line);
+		
+		return empty($line) ? $this->nextLine() : $line;
+	}
+}
+
+class flatBackupItem
+{
+	public $__name;
+	public $__line;
+	private $__data = array();
+	
+	public function __construct($name,$data,$line)
+	{
+		$this->__name = $name;
+		$this->__data = $data;
+		$this->__line = $line;
+	}
+	
+	public function f($name)
+	{
+		return iconv('UTF-8','UTF-8//IGNORE',$this->__data[$name]);
+	}
+	
+	public function __get($name)
+	{
+		return $this->f($name);
+	}
+	
+	public function __set($n,$v)
+	{
+		$this->__data[$n] = $v;
+	}
+	
+	public function exists($n)
+	{
+		return isset($this->__data[$n]);
+	}
+	
+	public function drop()
+	{
+		foreach (func_get_args() as $n) {
+			if (isset($this->__data[$n])) {
+				unset($this->__data[$n]);
+			}
+		}
+	}
+	
+	public function substitute($old,$new)
+	{
+		if (isset($this->__data[$old])) {
+			$this->__data[$new] = $this->__data[$old];
+			unset($this->__data[$old]);
+		}
+	}
+}
+?>
Index: plugins/importExport/inc/flat/class.flat.export.php
===================================================================
--- plugins/importExport/inc/flat/class.flat.export.php	(revision 840)
+++ plugins/importExport/inc/flat/class.flat.export.php	(revision 840)
@@ -0,0 +1,106 @@
+<?php
+# -- BEGIN LICENSE BLOCK ---------------------------------------
+#
+# This file is part of importExport, a plugin for DotClear2.
+#
+# Copyright (c) 2003-2012 Olivier Meunier & Association Dotclear
+# Licensed under the GPL version 2.0 license.
+# See LICENSE file or
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+#
+# -- END LICENSE BLOCK -----------------------------------------
+if (!defined('DC_RC_PATH')) { return; }
+
+class flatExport
+{
+	private $con;
+	private $prefix;
+	
+	private $line_reg = array('/\\\\/u',  '/\n/u','/\r/u','/"/u');
+	private $line_rep = array('\\\\\\\\', '\n'   ,'\r'   ,'\"');
+	
+	public $fp;
+	
+	function __construct($con,$out='php://output',$prefix=null)
+	{
+		$this->con =& $con;
+		$this->prefix = $prefix;
+		
+		if (($this->fp = fopen($out,'w')) === false) {
+			return false;
+		}
+		@set_time_limit(300);
+	}
+	
+	function __destruct()
+	{
+		if (is_resource($this->fp)) {
+			fclose($this->fp);
+		}
+	}
+	
+	function export($name,$sql)
+	{
+		$rs = $this->con->select($sql);
+		
+		if (!$rs->isEmpty())
+		{
+			fwrite($this->fp,"\n[".$name.' '.implode(',',$rs->columns())."]\n");
+			while ($rs->fetch()) {
+				fwrite($this->fp,$this->getLine($rs));
+			}
+			fflush($this->fp);
+		}
+	}
+	
+	function exportAll()
+	{
+		$tables = $this->getTables();
+		
+		foreach ($tables as $table)
+		{
+			$this->exportTable($table);
+		}
+	}
+	
+	function exportTable($table)
+	{
+		$req = 'SELECT * FROM '.$this->con->escapeSystem($this->prefix.$table);
+		
+		$this->export($table,$req);
+	}
+	
+	function getTables()
+	{
+		$schema = dbSchema::init($this->con);
+		$db_tables = $schema->getTables();
+		
+		$tables = array();
+		foreach ($db_tables as $t)
+		{
+			if ($this->prefix) {
+				if (strpos($t,$this->prefix) === 0) {
+					$tables[] = $t;
+				}
+			} else {
+				$tables[] = $t;
+			}
+		}
+		
+		return $tables;
+	}
+	
+	function getLine($rs)
+	{
+		$l = array();
+		$cols = $rs->columns();
+		foreach ($cols as $i => &$c) {
+			$s = $rs->f($c);
+			$s = preg_replace($this->line_reg,$this->line_rep,$s);
+			$s = '"'.$s.'"';
+			$l[$i] = $s;
+		}
+		return implode(',',$l)."\n";
+	}
+}
+?>
Index: plugins/importExport/inc/flat/class.flat.import.php
===================================================================
--- plugins/importExport/inc/flat/class.flat.import.php	(revision 841)
+++ plugins/importExport/inc/flat/class.flat.import.php	(revision 841)
@@ -0,0 +1,869 @@
+<?php
+# -- BEGIN LICENSE BLOCK ---------------------------------------
+#
+# This file is part of importExport, a plugin for DotClear2.
+#
+# Copyright (c) 2003-2012 Olivier Meunier & Association Dotclear
+# Licensed under the GPL version 2.0 license.
+# See LICENSE file or
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+#
+# -- END LICENSE BLOCK -----------------------------------------
+if (!defined('DC_RC_PATH')) { return; }
+
+class flatImport extends flatBackup
+{
+	private $core;
+	private $con;
+	private $prefix;
+	
+	private $dc_version;
+	private $dc_major;
+	private $mode;
+	
+	private $blog_url;
+	private $blog_name;
+	private $blog_desc;
+	
+	private $users = array();
+	
+	public $old_ids = array(
+		'category' => array(),
+		'post' => array(),
+		'media' => array()
+	);
+	
+	public $stack = array(
+		'categories'=>null,
+		'cat_id'=>1,
+		'cat_lft'=>array(),
+		'post_id'=>1,
+		'media_id'=>1,
+		'comment_id'=>1,
+		'link_id'=>1
+	);
+	
+	public $has_categories = false;
+	
+	public function __construct($core,$file)
+	{
+		parent::__construct($file);
+		
+		$first_line = fgets($this->fp);
+		if (strpos($first_line,'///DOTCLEAR|') !== 0) {
+			throw new Exception(__('File is not a DotClear backup.'));
+		}
+		
+		@set_time_limit(300);
+		
+		$l = explode('|',$first_line);
+		
+		if (isset($l[1])) {
+			$this->dc_version = $l[1];
+		}
+		
+		$this->mode = isset($l[2]) ? strtolower(trim($l[2])) : 'single';
+		if ($this->mode != 'full' && $this->mode != 'single') {
+			$this->mode = 'single';
+		}
+		
+		if (version_compare('1.2',$this->dc_version,'<=') &&
+		version_compare('1.3',$this->dc_version,'>')) {
+			$this->dc_major_version = '1.2';
+		} else {
+			$this->dc_major_version = '2.0';
+		}
+		
+		$this->core =& $core;
+		$this->con =& $core->con;
+		$this->prefix = $core->prefix;
+		
+		$this->cur_blog        = $this->con->openCursor($this->prefix.'blog');
+		$this->cur_category    = $this->con->openCursor($this->prefix.'category');
+		$this->cur_link        = $this->con->openCursor($this->prefix.'link');
+		$this->cur_setting     = $this->con->openCursor($this->prefix.'setting');
+		$this->cur_user        = $this->con->openCursor($this->prefix.'user');
+		$this->cur_pref        = $this->con->openCursor($this->prefix.'pref');
+		$this->cur_permissions = $this->con->openCursor($this->prefix.'permissions');
+		$this->cur_post        = $this->con->openCursor($this->prefix.'post');
+		$this->cur_meta        = $this->con->openCursor($this->prefix.'meta');
+		$this->cur_media       = $this->con->openCursor($this->prefix.'media');
+		$this->cur_post_media  = $this->con->openCursor($this->prefix.'post_media');
+		$this->cur_log         = $this->con->openCursor($this->prefix.'log');
+		$this->cur_ping        = $this->con->openCursor($this->prefix.'ping');
+		$this->cur_comment     = $this->con->openCursor($this->prefix.'comment');
+		$this->cur_spamrule    = $this->con->openCursor($this->prefix.'spamrule');
+		$this->cur_version     = $this->con->openCursor($this->prefix.'version');
+		
+		# --BEHAVIOR-- importInit
+		$this->core->callBehavior('importInit',$this,$this->core);
+	}
+	
+	public function importSingle()
+	{
+		if ($this->mode != 'single') {
+			throw new Exception(__('File is not a single blog export.'));
+		}
+		
+		if (!$this->core->auth->check('admin',$this->core->blog->id)) {
+			throw new Exception(__('Permission denied.'));
+		}
+		
+		$this->blog_id = $this->core->blog->id;
+		
+		$this->stack['categories'] = $this->con->select(
+			'SELECT cat_id, cat_title, cat_url '.
+			'FROM '.$this->prefix.'category '.
+			"WHERE blog_id = '".$this->con->escape($this->blog_id)."' "
+		);
+		
+		$rs = $this->con->select('SELECT MAX(cat_id) FROM '.$this->prefix.'category');
+		$this->stack['cat_id'] = ((integer) $rs->f(0))+1;
+		
+		$rs = $this->con->select('SELECT MAX(link_id) FROM '.$this->prefix.'link');
+		$this->stack['link_id'] = ((integer) $rs->f(0))+1;
+		
+		$rs = $this->con->select('SELECT MAX(post_id) FROM '.$this->prefix.'post');
+		$this->stack['post_id'] = ((integer) $rs->f(0))+1;
+		
+		$rs = $this->con->select('SELECT MAX(media_id) FROM '.$this->prefix.'media');
+		$this->stack['media_id'] = ((integer) $rs->f(0))+1;
+		
+		$rs = $this->con->select('SELECT MAX(comment_id) FROM '.$this->prefix.'comment');
+		$this->stack['comment_id'] = ((integer) $rs->f(0))+1;
+		
+		$rs = $this->con->select(
+			'SELECT MAX(cat_rgt) AS cat_rgt FROM '.$this->prefix.'category '.
+			"WHERE blog_id = '".$this->con->escape($this->core->blog->id)."'"
+		);
+		
+		if ((integer) $rs->cat_rgt > 0) {
+			$this->has_categories = true;
+			$this->stack['cat_lft'][$this->core->blog->id] = (integer) $rs->cat_rgt + 1;
+		}
+		
+		$this->con->begin();
+		
+		try
+		{
+			$last_line_name = '';
+			$constrained = array('post', 'meta', 'post_media', 'ping', 'comment');
+			
+			while (($line = $this->getLine()) !== false)
+			{
+				# import DC 1.2.x, we fix lines before insert
+				if ($this->dc_major_version == '1.2') {
+					$this->prepareDC12line($line);
+				}
+				
+				if ($last_line_name != $line->__name) {
+					if (in_array($last_line_name,$constrained)) {
+						# UNDEFER
+						if ($this->con->driver() == 'mysql') $this->con->execute('SET foreign_key_checks = 1');
+						if ($this->con->driver() == 'pgsql') $this->con->execute('SET CONSTRAINTS ALL DEFERRED');
+					}
+					
+					if (in_array($line->__name,$constrained)) {
+						# DEFER
+						if ($this->con->driver() == 'mysql') $this->con->execute('SET foreign_key_checks = 0');
+						if ($this->con->driver() == 'pgsql') $this->con->execute('SET CONSTRAINTS ALL IMMEDIATE');
+					}
+					
+					$last_line_name = $line->__name;
+				}
+				
+				switch ($line->__name)
+				{
+					case 'category':
+						$this->insertCategorySingle($line);
+						break;
+					case 'link':
+						$this->insertLinkSingle($line);
+						break;
+					case 'post':
+						$this->insertPostSingle($line);
+						break;
+					case 'meta':
+						$this->insertMetaSingle($line);
+						break;
+					case 'media':
+						$this->insertMediaSingle($line);
+						break;
+					case 'post_media':
+						$this->insertPostMediaSingle($line);
+						break;
+					case 'ping':
+						$this->insertPingSingle($line);
+						break;
+					case 'comment':
+						$this->insertCommentSingle($line);
+						break;
+				}
+				
+				# --BEHAVIOR-- importSingle
+				$this->core->callBehavior('importSingle',$line,$this,$this->core);
+			}
+			
+			if ($this->con->driver() == 'mysql') $this->con->execute('SET foreign_key_checks = 1');
+			if ($this->con->driver() == 'pgsql') $this->con->execute('SET CONSTRAINTS ALL DEFERRED');
+		}
+		catch (Exception $e)
+		{
+			$this->con->rollback();
+			throw $e;
+		}
+		
+		$this->con->commit();
+	}
+	
+	public function importFull()
+	{
+		if ($this->mode != 'full') {
+			throw new Exception(__('File is not a full export.'));
+		}
+		
+		if (!$this->core->auth->isSuperAdmin()) {
+			throw new Exception(__('Permission denied.'));
+		}
+		
+		$this->con->begin();
+		$this->con->execute('DELETE FROM '.$this->prefix.'blog');
+		$this->con->execute('DELETE FROM '.$this->prefix.'media');
+		$this->con->execute('DELETE FROM '.$this->prefix.'spamrule');
+		$this->con->execute('DELETE FROM '.$this->prefix.'setting');
+		
+		try
+		{
+			while (($line = $this->getLine()) !== false)
+			{
+				switch ($line->__name)
+				{
+					case 'blog':
+						$this->insertBlog($line);
+						break;
+					case 'category':
+						$this->insertCategory($line);
+						break;
+					case 'link':
+						$this->insertLink($line);
+						break;
+					case 'setting':
+						$this->insertSetting($line);
+						break;
+					case 'user':
+						$this->insertUser($line);
+						break;
+					case 'pref':
+						$this->insertPref($line);
+						break;
+					case 'permissions':
+						$this->insertPermissions($line);
+						break;
+					case 'post':
+						$this->insertPost($line);
+						break;
+					case 'meta':
+						$this->insertMeta($line);
+						break;
+					case 'media':
+						$this->insertMedia($line);
+						break;
+					case 'post_media':
+						$this->insertPostMedia($line);
+						break;
+					case 'log';
+						$this->insertLog($line);
+						break;
+					case 'ping':
+						$this->insertPing($line);
+						break;
+					case 'comment':
+						$this->insertComment($line);
+						break;
+					case 'spamrule':
+						$this->insertSpamRule($line);
+						break;
+				}
+				# --BEHAVIOR-- importFull
+				$this->core->callBehavior('importFull',$line,$this,$this->core);
+			}
+		}
+		catch (Exception $e)
+		{
+			$this->con->rollback();
+			throw $e;
+		}
+		
+		$this->con->commit();
+	}
+	
+	private function insertBlog($blog)
+	{
+		$this->cur_blog->clean();
+		
+		$this->cur_blog->blog_id     = (string) $blog->blog_id;
+		$this->cur_blog->blog_uid    = (string) $blog->blog_uid;
+		$this->cur_blog->blog_creadt = (string) $blog->blog_creadt;
+		$this->cur_blog->blog_upddt  = (string) $blog->blog_upddt;
+		$this->cur_blog->blog_url    = (string) $blog->blog_url;
+		$this->cur_blog->blog_name   = (string) $blog->blog_name;
+		$this->cur_blog->blog_desc   = (string) $blog->blog_desc;
+		
+		$this->cur_blog->blog_status = $blog->exists('blog_status') ? (integer) $blog->blog_status : 1;
+		
+		$this->cur_blog->insert();
+	}
+	
+	private function insertCategory($category)
+	{
+		$this->cur_category->clean();
+		
+		$this->cur_category->cat_id       = (string) $category->cat_id;
+		$this->cur_category->blog_id      = (string) $category->blog_id;
+		$this->cur_category->cat_title    = (string) $category->cat_title;
+		$this->cur_category->cat_url      = (string) $category->cat_url;
+		$this->cur_category->cat_desc     = (string) $category->cat_desc;
+		
+		if (!$this->has_categories && $category->exists('cat_lft') && $category->exists('cat_rgt')) {
+			$this->cur_category->cat_lft = (integer) $category->cat_lft;
+			$this->cur_category->cat_rgt = (integer) $category->cat_rgt;
+		} else {
+			if (!isset($this->stack['cat_lft'][$category->blog_id])) {
+				$this->stack['cat_lft'][$category->blog_id] = 2;
+			}
+			$this->cur_category->cat_lft = $this->stack['cat_lft'][$category->blog_id]++;
+			$this->cur_category->cat_rgt = $this->stack['cat_lft'][$category->blog_id]++;
+		}
+		
+		$this->cur_category->insert();
+	}
+	
+	private function insertLink($link)
+	{
+		$this->cur_link->clean();
+		
+		$this->cur_link->link_id       = (integer) $link->link_id;
+		$this->cur_link->blog_id       = (string) $link->blog_id;
+		$this->cur_link->link_href     = (string) $link->link_href;
+		$this->cur_link->link_title    = (string) $link->link_title;
+		$this->cur_link->link_desc     = (string) $link->link_desc;
+		$this->cur_link->link_lang     = (string) $link->link_lang;
+		$this->cur_link->link_xfn      = (string) $link->link_xfn;
+		$this->cur_link->link_position = (integer) $link->link_position;
+		
+		$this->cur_link->insert();
+	}
+	
+	private function insertSetting($setting)
+	{
+		$this->cur_setting->clean();
+		
+		$this->cur_setting->setting_id    = (string) $setting->setting_id;
+		$this->cur_setting->blog_id       = !$setting->blog_id ? null : (string) $setting->blog_id;
+		$this->cur_setting->setting_ns    = (string) $setting->setting_ns;
+		$this->cur_setting->setting_value = (string) $setting->setting_value;
+		$this->cur_setting->setting_type  = (string) $setting->setting_type;
+		$this->cur_setting->setting_label = (string) $setting->setting_label;
+		
+		$this->cur_setting->insert();
+	}
+	
+	private function insertPref($pref)
+	{
+		if ($this->prefExists($pref->pref_ws,$pref->pref_id,$pref->user_id)) {
+			return;
+		}
+		
+		$this->cur_pref->clean();
+		
+		$this->cur_pref->pref_id    = (string) $pref->pref_id;
+		$this->cur_pref->user_id    = !$pref->user_id ? null : (string) $pref->user_id;
+		$this->cur_pref->pref_ws    = (string) $pref->pref_ws;
+		$this->cur_pref->pref_value = (string) $pref->pref_value;
+		$this->cur_pref->pref_type  = (string) $pref->pref_type;
+		$this->cur_pref->pref_label = (string) $pref->pref_label;
+		
+		$this->cur_pref->insert();
+	}
+	
+	private function insertUser($user)
+	{
+		if ($this->userExists($user->user_id)) {
+			return;
+		}
+		
+		$this->cur_user->clean();
+		
+		$this->cur_user->user_id           = (string) $user->user_id;
+		$this->cur_user->user_super        = (integer) $user->user_super;
+		$this->cur_user->user_pwd          = (string) $user->user_pwd;
+		$this->cur_user->user_recover_key  = (string) $user->user_recover_key;
+		$this->cur_user->user_name         = (string) $user->user_name;
+		$this->cur_user->user_firstname    = (string) $user->user_firstname;
+		$this->cur_user->user_displayname  = (string) $user->user_displayname;
+		$this->cur_user->user_email        = (string) $user->user_email;
+		$this->cur_user->user_url          = (string) $user->user_url;
+		$this->cur_user->user_default_blog = !$user->user_default_blog ? null : (string) $user->user_default_blog;
+		$this->cur_user->user_lang         = (string) $user->user_lang;
+		$this->cur_user->user_tz           = (string) $user->user_tz;
+		$this->cur_user->user_post_status  = (integer) $user->user_post_status;
+		$this->cur_user->user_creadt       = (string) $user->user_creadt;
+		$this->cur_user->user_upddt        = (string) $user->user_upddt;
+		
+		$this->cur_user->user_desc = $user->exists('user_desc') ? (string) $user->user_desc : null;
+		$this->cur_user->user_options = $user->exists('user_options') ? (string) $user->user_options : null;
+		$this->cur_user->user_status = $user->exists('user_status') ? (integer) $user->user_status : 1;
+		
+		$this->cur_user->insert();
+		
+		$this->stack['users'][$user->user_id] = true;
+	}
+	
+	private function insertPermissions($permissions)
+	{
+		$this->cur_permissions->clean();
+		
+		$this->cur_permissions->user_id     = (string) $permissions->user_id;
+		$this->cur_permissions->blog_id     = (string) $permissions->blog_id;
+		$this->cur_permissions->permissions = (string) $permissions->permissions;
+		
+		$this->cur_permissions->insert();
+	}
+	
+	private function insertPost($post)
+	{
+		$this->cur_post->clean();
+		
+		$cat_id = (integer) $post->cat_id;
+		if (!$cat_id) {
+			$cat_id = null;
+		}
+		
+		$post_password = $post->post_password ? (string) $post->post_password : null;
+		
+		$this->cur_post->post_id            = (integer) $post->post_id;
+		$this->cur_post->blog_id            = (string) $post->blog_id;
+		$this->cur_post->user_id            = (string) $this->getUserId($post->user_id);
+		$this->cur_post->cat_id             = $cat_id;
+		$this->cur_post->post_dt            = (string) $post->post_dt;
+		$this->cur_post->post_creadt        = (string) $post->post_creadt;
+		$this->cur_post->post_upddt         = (string) $post->post_upddt;
+		$this->cur_post->post_password      = $post_password;
+		$this->cur_post->post_type          = (string) $post->post_type;
+		$this->cur_post->post_format        = (string) $post->post_format;
+		$this->cur_post->post_url           = (string) $post->post_url;
+		$this->cur_post->post_lang          = (string) $post->post_lang;
+		$this->cur_post->post_title         = (string) $post->post_title;
+		$this->cur_post->post_excerpt       = (string) $post->post_excerpt;
+		$this->cur_post->post_excerpt_xhtml = (string) $post->post_excerpt_xhtml;
+		$this->cur_post->post_content       = (string) $post->post_content;
+		$this->cur_post->post_content_xhtml = (string) $post->post_content_xhtml;
+		$this->cur_post->post_notes         = (string) $post->post_notes;
+		$this->cur_post->post_words         = (string) $post->post_words;
+		$this->cur_post->post_meta          = (string) $post->post_meta;
+		$this->cur_post->post_status        = (integer) $post->post_status;
+		$this->cur_post->post_selected      = (integer) $post->post_selected;
+		$this->cur_post->post_open_comment  = (integer) $post->post_open_comment;
+		$this->cur_post->post_open_tb       = (integer) $post->post_open_tb;
+		$this->cur_post->nb_comment         = (integer) $post->nb_comment;
+		$this->cur_post->nb_trackback       = (integer) $post->nb_trackback;
+		
+		$this->cur_post->post_tz = $post->exists('post_tz') ? (string) $post->post_tz : 'UTC';
+		
+		$this->cur_post->insert();
+	}
+	
+	private function insertMeta($meta)
+	{
+		$this->cur_meta->clean();
+		
+		$this->cur_meta->meta_id   = (string) $meta->meta_id;
+		$this->cur_meta->meta_type = (string) $meta->meta_type;
+		$this->cur_meta->post_id   = (integer) $meta->post_id;
+		
+		$this->cur_meta->insert();
+	}
+	
+	private function insertMedia($media)
+	{
+		$this->cur_media->clean();
+		
+		$this->cur_media->media_id      = (integer) $media->media_id;
+		$this->cur_media->user_id       = (string) $media->user_id;
+		$this->cur_media->media_path    = (string) $media->media_path;
+		$this->cur_media->media_title   = (string) $media->media_title;
+		$this->cur_media->media_file    = (string) $media->media_file;
+		$this->cur_media->media_meta    = (string) $media->media_meta;
+		$this->cur_media->media_dt      = (string) $media->media_dt;
+		$this->cur_media->media_creadt  = (string) $media->media_creadt;
+		$this->cur_media->media_upddt   = (string) $media->media_upddt;
+		$this->cur_media->media_private = (integer) $media->media_private;
+		
+		$this->cur_media->media_dir = $media->exists('media_dir') ? (string) $media->media_dir : dirname($media->media_file);
+		
+		if (!$this->mediaExists()) {
+			$this->cur_media->insert();
+		}
+	}
+	
+	private function insertPostMedia($post_media)
+	{
+		$this->cur_post_media->clean();
+		
+		$this->cur_post_media->media_id = (integer) $post_media->media_id;
+		$this->cur_post_media->post_id  = (integer) $post_media->post_id;
+		
+		$this->cur_post_media->insert();
+	}
+	
+	private function insertLog($log)
+	{
+		$this->cur_log->clean();
+		
+		$this->cur_log->log_id    = (integer) $log->log_id;
+		$this->cur_log->user_id   = (string) $log->user_id;
+		$this->cur_log->log_table = (string) $log->log_table;
+		$this->cur_log->log_dt    = (string) $log->log_dt;
+		$this->cur_log->log_ip    = (string) $log->log_ip;
+		$this->cur_log->log_msg   = (string) $log->log_msg;
+		
+		$this->cur_log->insert();
+	}
+	
+	private function insertPing($ping)
+	{
+		$this->cur_ping->clean();
+		
+		$this->cur_ping->post_id  = (integer) $ping->post_id;
+		$this->cur_ping->ping_url = (string) $ping->ping_url;
+		$this->cur_ping->ping_dt  = (string) $ping->ping_dt;
+		
+		$this->cur_ping->insert();
+	}
+	
+	private function insertComment($comment)
+	{
+		$this->cur_comment->clean();
+		
+		$this->cur_comment->comment_id          = (integer) $comment->comment_id;
+		$this->cur_comment->post_id             = (integer) $comment->post_id;
+		$this->cur_comment->comment_dt          = (string) $comment->comment_dt;
+		$this->cur_comment->comment_upddt       = (string) $comment->comment_upddt;
+		$this->cur_comment->comment_author      = (string) $comment->comment_author;
+		$this->cur_comment->comment_email       = (string) $comment->comment_email;
+		$this->cur_comment->comment_site        = (string) $comment->comment_site;
+		$this->cur_comment->comment_content     = (string) $comment->comment_content;
+		$this->cur_comment->comment_words       = (string) $comment->comment_words;
+		$this->cur_comment->comment_ip          = (string) $comment->comment_ip;
+		$this->cur_comment->comment_status      = (integer) $comment->comment_status;
+		$this->cur_comment->comment_spam_status = (integer) $comment->comment_spam_status;
+		$this->cur_comment->comment_trackback   = (integer) $comment->comment_trackback;
+		
+		$this->cur_comment->comment_tz = $comment->exists('comment_tz') ? (string) $comment->comment_tz : 'UTC';
+		$this->cur_comment->comment_spam_filter = $comment->exists('comment_spam_filter') ? (integer) $comment->comment_spam_filter : null;
+		
+		$this->cur_comment->insert();
+	}
+	
+	private function insertSpamRule($spamrule)
+	{
+		$this->cur_spamrule->clean();
+		
+		$this->cur_spamrule->rule_id      = (integer) $spamrule->rule_id;
+		$this->cur_spamrule->blog_id      = !$spamrule->blog_id ? null : (string) $spamrule->blog_id;
+		$this->cur_spamrule->rule_type    = (string) $spamrule->rule_type;
+		$this->cur_spamrule->rule_content = (string) $spamrule->rule_content;
+		
+		$this->cur_spamrule->insert();
+	}
+	
+	private function insertCategorySingle($category)
+	{
+		$this->cur_category->clean();
+		
+		$m = $this->searchCategory($this->stack['categories'],$category->cat_url);
+		
+		$old_id = $category->cat_id;
+		if ($m !== false)
+		{
+			$cat_id = $m;
+		}
+		else
+		{
+			$cat_id = $this->stack['cat_id'];
+			$category->cat_id = $cat_id;
+			$category->blog_id = $this->blog_id;
+			
+			$this->insertCategory($category);
+			$this->stack['cat_id']++;
+		}
+		
+		$this->old_ids['category'][(integer) $old_id] = $cat_id;
+	}
+	
+	private function insertLinkSingle($link)
+	{
+		$link->blog_id = $this->blog_id;
+		$link->link_id = $this->stack['link_id'];
+		
+		$this->insertLink($link);
+		$this->stack['link_id']++;
+	}
+	
+	private function insertPostSingle($post)
+	{
+		if (!$post->cat_id || isset($this->old_ids['category'][(integer) $post->cat_id])) {
+			$post_id = $this->stack['post_id'];
+			$this->old_ids['post'][(integer) $post->post_id] = $post_id;
+			
+			$cat_id = $post->cat_id ? $this->old_ids['category'][(integer) $post->cat_id] : null;
+			
+			$post->post_id = $post_id;
+			$post->cat_id = $cat_id;
+			$post->blog_id = $this->blog_id;
+			
+			$post->post_url = $this->core->blog->getPostURL(
+				$post->post_url,$post->post_dt,$post->post_title,$post->post_id
+			);
+			
+			$this->insertPost($post);
+			$this->stack['post_id']++;
+		} else {
+			self::throwIdError($post->__name,$post->__line,'category');
+		}
+	}
+	
+	private function insertMetaSingle($meta)
+	{
+		if (isset($this->old_ids['post'][(integer) $meta->post_id])) {
+			$meta->post_id = $this->old_ids['post'][(integer) $meta->post_id];
+			$this->insertMeta($meta);
+		} else {
+			self::throwIdError($meta->__name,$meta->__line,'post');
+		}
+	}
+	
+	private function insertMediaSingle($media)
+	{
+		$media_id = $this->stack['media_id'];
+		$old_id = $media->media_id;
+		
+		$media->media_id = $media_id;
+		$media->media_path = $this->core->blog->settings->system->public_path;
+		$media->user_id = $this->getUserId($media->user_id);
+		
+		$this->insertMedia($media);
+		$this->stack['media_id']++;
+		$this->old_ids['media'][(integer) $old_id] = $media_id;
+	}
+	
+	private function insertPostMediaSingle($post_media)
+	{
+		if (isset($this->old_ids['media'][(integer) $post_media->media_id]) &&
+			isset($this->old_ids['post'][(integer) $post_media->post_id])) {
+			$post_media->media_id = $this->old_ids['media'][(integer) $post_media->media_id];
+			$post_media->post_id = $this->old_ids['post'][(integer) $post_media->post_id];
+			
+			$this->insertPostMedia($post_media);
+		} elseif (!isset($this->old_ids['media'][(integer) $post_media->media_id])) {
+			self::throwIdError($post_media->__name,$post_media->__line,'media');
+		}else {
+			self::throwIdError($post_media->__name,$post_media->__line,'post');
+		}
+	}
+	
+	private function insertPingSingle($ping)
+	{
+		if (isset($this->old_ids['post'][(integer) $ping->post_id])) {
+			$ping->post_id = $this->old_ids['post'][(integer) $ping->post_id];
+			
+			$this->insertPing($ping);
+		} else {
+			self::throwIdError($ping->__name,$ping->__line,'post');
+		}
+	}
+	
+	private function insertCommentSingle($comment)
+	{
+		if (isset($this->old_ids['post'][(integer) $comment->post_id])) {
+			$comment_id = $this->stack['comment_id'];
+			
+			$comment->comment_id = $comment_id;
+			$comment->post_id = $this->old_ids['post'][(integer) $comment->post_id];
+			
+			$this->insertComment($comment);
+			$this->stack['comment_id']++;
+		} else {
+			self::throwIdError($comment->__name,$comment->__line,'post');
+		}
+	}
+	
+	private static function throwIdError($name,$line,$related)
+	{
+		throw new Exception(sprintf(
+			__('ID of "%3$s" does not match on record "%1$s" at line %2$s of backup file.'),
+			html::escapeHTML($name),
+			html::escapeHTML($line),
+			html::escapeHTML($related)
+		));
+	}
+	
+	public function searchCategory($rs,$url)
+	{
+		while ($rs->fetch())
+		{
+			if ($rs->cat_url == $url) {
+				return $rs->cat_id;
+			}
+		}
+		
+		return false;
+	}
+	
+	public function getUserId($user_id)
+	{
+		if (!$this->userExists($user_id))
+		{
+			if ($this->core->auth->isSuperAdmin())
+			{
+				# Sanitizes user_id and create a lambda user
+				$user_id = preg_replace('/[^A-Za-z0-9]$/','',$user_id);
+				$user_id .= strlen($user_id) < 2 ? '-a' : '';
+				
+				# We change user_id, we need to check again
+				if (!$this->userExists($user_id))
+				{
+					$this->cur_user->clean();
+					$this->cur_user->user_id = (string) $user_id;
+					$this->cur_user->user_pwd = md5(uniqid());
+					
+					$this->core->addUser($this->cur_user);
+					
+					$this->stack['users'][$user_id] = true;
+				}
+			}
+			else
+			{
+				# Returns current user id
+				$user_id = $this->core->auth->userID();
+			}
+		}
+		
+		return $user_id;
+	}
+	
+	private function userExists($user_id)
+	{
+		if (isset($this->stack['users'][$user_id])) {
+			return $this->stack['users'][$user_id];
+		}
+		
+		$strReq = 'SELECT user_id '.
+				'FROM '.$this->prefix.'user '.
+				"WHERE user_id = '".$this->con->escape($user_id)."' ";
+		
+		$rs = $this->con->select($strReq);
+		
+		$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();
+	}
+	
+	private function mediaExists()
+	{
+		$strReq = 'SELECT media_id '.
+				'FROM '.$this->prefix.'media '.
+				"WHERE media_path = '".$this->cur_media->media_path."' ".
+				"AND media_file = '".$this->cur_media->media_file."' ";
+		
+		$rs = $this->con->select($strReq);
+		
+		return !$rs->isEmpty();
+	}
+	
+	private function prepareDC12line(&$line)
+	{
+		$settings = array('dc_theme','dc_nb_post_per_page','dc_allow_comments',
+		'dc_allow_trackbacks','dc_comment_pub','dc_comments_ttl',
+		'dc_wiki_comments','dc_use_smilies','dc_date_format','dc_time_format',
+		'dc_url_scan');
+		
+		switch ($line->__name)
+		{
+			case 'categorie':
+				$line->substitute('cat_libelle','cat_title');
+				$line->substitute('cat_libelle_url','cat_url');
+				$line->__name = 'category';
+				$line->blog_id = 'default';
+				break;
+			case 'link':
+				$line->substitute('href','link_href');
+				$line->substitute('label','link_title');
+				$line->substitute('title','link_desc');
+				$line->substitute('lang','link_lang');
+				$line->substitute('rel','link_xfn');
+				$line->substitute('position','link_position');
+				$line->blog_id = 'default';
+				break;
+			case 'post':
+				$line->substitute('post_titre','post_title');
+				$line->post_title = html::decodeEntities($line->post_title);
+				$line->post_url = date('Y/m/d/',strtotime($line->post_dt)).$line->post_id.'-'.$line->post_titre_url;
+				$line->post_url = substr($line->post_url,0,255);
+				$line->post_format = $line->post_content_wiki == '' ? 'xhtml' : 'wiki';
+				$line->post_content_xhtml = $line->post_content;
+				$line->post_excerpt_xhtml = $line->post_chapo;
+				
+				if ($line->post_format == 'wiki') {
+					$line->post_content = $line->post_content_wiki;
+					$line->post_excerpt = $line->post_chapo_wiki;
+				} else {
+					$line->post_content = $line->post_content;
+					$line->post_excerpt = $line->post_chapo;
+				}
+				
+				$line->post_status = (integer) $line->post_pub;
+				$line->post_type = 'post';
+				$line->blog_id = 'default';
+				
+				$line->drop('post_titre_url','post_content_wiki','post_chapo','post_chapo_wiki','post_pub');
+				
+				break;
+			case 'post_meta':
+				$line->drop('meta_id');
+				$line->substitute('meta_key','meta_type');
+				$line->substitute('meta_value','meta_id');
+				$line->__name = 'meta';
+				$line->blog_id = 'default';
+				break;
+			case 'comment':
+				$line->substitute('comment_auteur','comment_author');
+				if ($line->comment_site != '' && !preg_match('!^http://.*$!', $line->comment_site,$m)) {
+					$line->comment_site = 'http://'.$line->comment_site;
+				}
+				$line->comment_status = (integer) $line->comment_pub;
+				$line->drop('comment_pub');
+				break;
+		}
+		
+		# --BEHAVIOR-- importPrepareDC12
+		$this->core->callBehavior('importPrepareDC12',$line,$this,$this->core);
+	}
+}
+?>
Index: plugins/importExport/index.php
===================================================================
--- plugins/importExport/index.php	(revision 696)
+++ plugins/importExport/index.php	(revision 840)
@@ -2,7 +2,7 @@
 # -- BEGIN LICENSE BLOCK ---------------------------------------
 #
-# This file is part of Dotclear 2.
+# This file is part of importExport, a plugin for DotClear2.
 #
-# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear
+# Copyright (c) 2003-2012 Olivier Meunier & Association Dotclear
 # Licensed under the GPL version 2.0 license.
 # See LICENSE file or
@@ -12,19 +12,21 @@
 if (!defined('DC_CONTEXT_ADMIN')) { return; }
 
-require dirname(__FILE__).'/inc/class.dc.ieModule.php';
+function listImportExportModules($core,$modules)
+{
+	$res = '';
+	foreach ($modules as $id)
+	{
+		$o = new $id($core);
+		
+		$res .= 
+		'<dt><a href="'.$o->getURL(true).'">'.html::escapeHTML($o->name).'</a></dt>'.
+		'<dd>'.html::escapeHTML($o->description).'</dd>';
+		
+		unset($o);
+	}
+	return '<dl class="modules">'.$res.'</dl>';
+}
 
-$modules = new ArrayObject();
-$modules['i'] = new ArrayObject(array(
-	'dcImportFlat' => dirname(__FILE__).'/inc/class.dc.import.flat.php',
-	'dcImportFeed' => dirname(__FILE__).'/inc/class.dc.import.feed.php'
-));
-$modules['e'] = new ArrayObject(array(
-	'dcExportFlat' => dirname(__FILE__).'/inc/class.dc.export.flat.php'
-));
-
-if ($core->auth->isSuperAdmin()) {
-	$modules['i']['dcImportDC1']  = dirname(__FILE__).'/inc/class.dc.import.dc1.php';
-	$modules['i']['dcImportWP']  = dirname(__FILE__).'/inc/class.dc.import.wp.php';
-}
+$modules = new ArrayObject(array('import' => array(),'export' => array()));
 
 # --BEHAVIOR-- importExportModules
@@ -32,112 +34,62 @@
 
 $type = null;
-if (!empty($_REQUEST['t']) && ($_REQUEST['t'] == 'e' || $_REQUEST['t'] == 'i')) {
-	$type = $_REQUEST['t'];
+if (!empty($_REQUEST['type'])  && in_array($_REQUEST['type'],array('export','import'))) {
+	$type = $_REQUEST['type'];
 }
 
-$current_module = null;
-if ($type && !empty($_REQUEST['f'])) {
-	if (isset($modules[$type][$_REQUEST['f']])) {
-		require_once $modules[$type][$_REQUEST['f']];
-		$current_module = new $_REQUEST['f']($core);
-		$current_module->init();
+$module = null;
+if ($type && !empty($_REQUEST['module'])) {
+
+	if (isset($modules[$type]) && in_array($_REQUEST['module'],$modules[$type])) {
+	
+		$module = new $_REQUEST['module']($core);
+		$module->init();
 	}
 }
 
-if ($type && $current_module !== null && !empty($_REQUEST['do']))
+if ($type && $module !== null && !empty($_REQUEST['do']))
 {
 	try {
-		$current_module->process($_REQUEST['do']);
+		$module->process($_REQUEST['do']);
 	} catch (Exception $e) {
 		$core->error->add($e->getMessage());
 	}
 }
-?>
+
+$title = __('Import/Export');
+
+echo '
 <html>
 <head>
-	<title><?php echo __('Import/Export'); ?></title>
-	<style type="text/css">
-	dl.modules dt {
-		font-weight: bold;
-		font-size: 1.1em;
-		margin: 1em 0 0 0;
-	}
-	dl.modules dd {
-		margin: 0 0 1.5em 0;
-	}
-	div.ie-progress {
-		background: #eee;
-		margin: 1em 0;
-	}
-	div.ie-progress div {
-		height: 10px;
-		width: 0;
-		font-size: 0.8em;
-		line-height: 1em;
-		height: 1em;
-		padding: 2px 0;
-		text-align: right;
-		background: green url(index.php?pf=importExport/progress.png) repeat-x top left;
-		color: white;
-		font-weight: bold;
-		-moz-border-radius: 2px;
-	}
-	</style>
-	<script type="text/javascript" src="index.php?pf=importExport/script.js"></script>
+	<title>'.$title.'</title>
+	<link rel="stylesheet" type="text/css" href="index.php?pf=importExport/style.css" />
+	'.dcPage::jsLoad('index.php?pf=importExport/js/script.js').'
 	<script type="text/javascript">
 	//<![CDATA[
-	dotclear.msg.please_wait = '<?php echo html::escapeJS(__("Please wait...")); ?>';
+	'.dcPage::jsVar('dotclear.msg.please_wait',__('Please wait...')).'
 	//]]>
 	</script>
 </head>
-<body>
+<body>';
 
-<?php
-if ($type && $current_module !== null)
-{
-	echo '<h2><a href="'.$p_url.'">'.__('Import/Export').'</a>'.
-	' &rsaquo; <span class="page-title">'.html::escapeHTML($current_module->name).'</span></h2>';
+if ($type && $module !== null) {
+	echo
+	'<h2><a href="'.$p_url.'">'.$title.'</a>'.
+	' &rsaquo; <span class="page-title">'.html::escapeHTML($module->name).'</span></h2>'.
+	'<div id="ie-gui">';
 	
-	echo '<div id="ie-gui">';
-	$current_module->gui();
+	$module->gui();
+	
 	echo '</div>';
 }
-else
-{
-	echo '<h2 class="page-title">'.__('Import/Export').'</h2>';
-	echo '<h3>'.__('Import').'</h3>';
-	
-	echo '<dl class="modules">';
-	foreach ($modules['i'] as $k => $v)
-	{
-		require_once $v;
-		$o = new $k($core);
-		
-		echo 
-		'<dt><a href="'.$o->getURL(true).'">'.html::escapeHTML($o->name).'</a></dt>'.
-		'<dd>'.html::escapeHTML($o->description).'</dd>';
-		
-		unset($o);
-	}
-	echo '</dl>';
-	
-	echo '<h3>'.__('Export').'</h3>';
-	
-	echo '<dl class="modules">';
-	foreach ($modules['e'] as $k => $v)
-	{
-		require_once $v;
-		$o = new $k($core);
-		
-		echo 
-		'<dt><a href="'.$o->getURL(true).'">'.html::escapeHTML($o->name).'</a></dt>'.
-		'<dd>'.html::escapeHTML($o->description).'</dd>';
-		
-		unset($o);
-	}
-	echo '</dl>';
+else {
+	echo
+	'<h2 class="page-title">'.$title.'</h2>'.
+	'<h3>'.__('Import').'</h3>'.listImportExportModules($core,$modules['import']).
+	'<h3>'.__('Export').'</h3>'.listImportExportModules($core,$modules['export']);
 }
+
+echo '
+</body>
+</html>';
 ?>
-
-</body>
-</html>
Index: plugins/importExport/js/script.js
===================================================================
--- plugins/importExport/js/script.js	(revision 840)
+++ plugins/importExport/js/script.js	(revision 840)
@@ -0,0 +1,3 @@
+
+$(function(){if($('*.error').length>0){return;}
+$('#ie-gui form[method=post]:has(input[type=hidden][name=autosubmit])').each(function(){$('input[type=submit]',this).remove();$(this).after('<p style="font-size:2em;text-align:center">'+dotclear.msg.please_wait+'</p>');$(this).submit();});});
Index: plugins/importExport/locales/fr/main.po
===================================================================
--- plugins/importExport/locales/fr/main.po	(revision 841)
+++ plugins/importExport/locales/fr/main.po	(revision 841)
@@ -0,0 +1,333 @@
+# Language: Français
+# Module: importExport - 3.1
+# Date: 2012-07-09 14:37:32
+# Translated with translater 1.5
+
+msgid ""
+msgstr ""
+"Content-Type: text/plain; charset=UTF-8\n"
+"Project-Id-Version: importExport 3.1\n"
+"POT-Creation-Date: \n"
+"PO-Revision-Date: 2012-07-09T14:37:32+00:00\n"
+"Last-Translator: Jean-Christian Denis\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: _admin.php:15
+#: _admin.php:28
+#: index.php:59
+msgid "Import/Export"
+msgstr "Import/Export"
+
+#: inc/class.dc.export.flat.php:19
+msgid "Flat file export"
+msgstr "Exporter un fichier texte"
+
+#: inc/class.dc.export.flat.php:20
+msgid "Exports a blog or a full Dotclear installation to flat file."
+msgstr "Exporte un blog ou toutes les données de Dotclear dans un fichier texte."
+
+#: inc/class.dc.export.flat.php:140
+msgid "Export file not found."
+msgstr "Fichier d'export non trouvé."
+
+#: inc/class.dc.export.flat.php:184
+msgid "Failed to compress export file."
+msgstr "Impossible de compresser le fichier d'export."
+
+#: inc/class.dc.export.flat.php:194
+#: inc/class.dc.import.feed.php:84
+#: inc/class.dc.import.flat.php:183
+msgid "Single blog"
+msgstr "Un seul blog"
+
+#: inc/class.dc.export.flat.php:195
+msgid "This will create an export of your current blog: %s"
+msgstr "Ceci va exporter le contenu du blog en cours : %s."
+
+#: inc/class.dc.export.flat.php:197
+#: inc/class.dc.export.flat.php:223
+msgid "File name:"
+msgstr "Nom du fichier :"
+
+#: inc/class.dc.export.flat.php:203
+#: inc/class.dc.export.flat.php:229
+msgid "Compress file"
+msgstr "Compresser le fichier"
+
+#: inc/class.dc.export.flat.php:207
+msgid "You may also want to download your media directory as a zip file"
+msgstr "Vous pouvez également télécharger votre répertoire de médias au format zip."
+
+#: inc/class.dc.export.flat.php:209
+#: inc/class.dc.export.flat.php:232
+#: index.php:89
+msgid "Export"
+msgstr "Exporter"
+
+#: inc/class.dc.export.flat.php:220
+#: inc/class.dc.import.flat.php:211
+msgid "Multiple blogs"
+msgstr "Tous les blogs"
+
+#: inc/class.dc.export.flat.php:221
+msgid "This will create an export of all the content of your database."
+msgstr "Ceci va exporter le contenu complet de votre base de données."
+
+#: inc/class.dc.ieModule.php:74
+msgid "Congratulation!"
+msgstr "Félicitations !"
+
+#: inc/class.dc.ieModule.php:75
+msgid "Your blog has been successfully imported. Welcome on Dotclear 2!"
+msgstr "Votre blog a été importé avec succès. Bienvenue sur Dotclear 2 !"
+
+#: inc/class.dc.ieModule.php:76
+msgid "Why don't you blog this now?"
+msgstr "Pourquoi ne pas le bloguer maintenant ?"
+
+#: inc/class.dc.ieModule.php:77
+msgid "or"
+msgstr "ou"
+
+#: inc/class.dc.ieModule.php:77
+msgid "visit your dashboard"
+msgstr "vous rendre sur votre tableau de bord"
+
+#: inc/class.dc.import.dc1.php:43
+msgid "Dotclear 1.2 import"
+msgstr "Importer depuis Dotclear 1.2"
+
+#: inc/class.dc.import.dc1.php:44
+msgid "Import a Dotclear 1.2 installation into your current blog."
+msgstr "Importe un blog Dotclear 1.2 dans votre blog en cours."
+
+#: inc/class.dc.import.dc1.php:145
+msgid "This will import your Dotclear 1.2 content as new content in the current blog: %s."
+msgstr "Ceci va importer votre blog Dotclear 1.2 comme un nouveau contenu dans le blog en cours : %s."
+
+#: inc/class.dc.import.dc1.php:149
+#: inc/class.dc.import.wp.php:180
+msgid "Depending on the size of your blog, it could take a few minutes."
+msgstr "Selon la taille de votre blog, ceci peut prendre quelques minutes."
+
+#: inc/class.dc.import.dc1.php:151
+#: inc/class.dc.import.wp.php:182
+msgid "General information"
+msgstr "Informations générales"
+
+#: inc/class.dc.import.dc1.php:151
+#: inc/class.dc.import.wp.php:182
+msgid "Import my blog now"
+msgstr "Importer mon blog"
+
+#: inc/class.dc.import.dc1.php:152
+msgid "We first need some information about your old Dotclear 1.2 installation."
+msgstr "Nous avons d'abord besoin de renseignements à propos de votre ancienne installation Dotclear 1.2."
+
+#: inc/class.dc.import.dc1.php:163
+#: inc/class.dc.import.wp.php:194
+msgid "Entries import options"
+msgstr "Options d'importation des billets"
+
+#: inc/class.dc.import.dc1.php:164
+#: inc/class.dc.import.wp.php:212
+msgid "Number of entries to import at once:"
+msgstr "Nombre de billets à importer à chaque étape :"
+
+#: inc/class.dc.import.dc1.php:169
+#: inc/class.dc.import.wp.php:222
+msgid "Importing users"
+msgstr "Importe les utilisateurs"
+
+#: inc/class.dc.import.dc1.php:174
+#: inc/class.dc.import.wp.php:227
+msgid "Importing categories"
+msgstr "Importe les catégories"
+
+#: inc/class.dc.import.dc1.php:179
+#: inc/class.dc.import.wp.php:232
+msgid "Importing blogroll"
+msgstr "Importe les liens"
+
+#: inc/class.dc.import.dc1.php:184
+#: inc/class.dc.import.wp.php:237
+msgid "Importing entries from %d to %d / %d"
+msgstr "Importation des billets %d à %d"
+
+#: inc/class.dc.import.dc1.php:193
+msgid "Please read carefully"
+msgstr "Merci de lire attentivement"
+
+#: inc/class.dc.import.dc1.php:214
+#: inc/class.dc.import.wp.php:258
+msgid "next step"
+msgstr "étape suivante"
+
+#: inc/class.dc.import.dc1.php:242
+msgid "Dotclear tables not found"
+msgstr "Tables Dotclear non trouvées"
+
+#: inc/class.dc.import.feed.php:22
+msgid "Feed import"
+msgstr "Importer depuis un flux"
+
+#: inc/class.dc.import.feed.php:23
+msgid "Imports a feed as new entries."
+msgstr "Importe un flux comme nouveaux billets."
+
+#: inc/class.dc.import.feed.php:41
+msgid "Cannot retrieve feed URL."
+msgstr "Impossible d'atteindre l'URL du fil."
+
+#: inc/class.dc.import.feed.php:44
+msgid "No items in feed."
+msgstr "Aucun élément dans le fil."
+
+#: inc/class.dc.import.feed.php:79
+#: inc/class.dc.import.flat.php:149
+msgid "Content successfully imported."
+msgstr "Contenu importé avec succès."
+
+#: inc/class.dc.import.feed.php:85
+msgid "This will import a feed (RSS or Atom) a as new content in the current blog: %s."
+msgstr "Ceci va importer un fil (RSS ou Atom) comme un nouveau contenu dans le blog en cours : %s."
+
+#: inc/class.dc.import.feed.php:87
+msgid "Feed URL:"
+msgstr "URL du fil :"
+
+#: inc/class.dc.import.feed.php:93
+#: inc/class.dc.import.flat.php:202
+#: inc/class.dc.import.flat.php:233
+#: index.php:88
+msgid "Import"
+msgstr "Importer"
+
+#: inc/class.dc.import.flat.php:21
+msgid "Flat file import"
+msgstr "Importer depuis un fichier texte"
+
+#: inc/class.dc.import.flat.php:22
+msgid "Imports a blog or a full Dotclear installation from flat file."
+msgstr "Importe un blog ou toutes les données depuis un fichier texte."
+
+#: inc/class.dc.import.flat.php:144
+msgid "Single blog successfully imported."
+msgstr "Blog importé avec succès."
+
+#: inc/class.dc.import.flat.php:160
+msgid "Are you sure you want to import a full backup file?"
+msgstr "Êtes-vous certain de vouloir charger un fichier de sauvegarde complet ?"
+
+#: inc/class.dc.import.flat.php:184
+msgid "This will import a single blog backup as new content in the current blog: %s."
+msgstr "Ceci va charger une sauvegarde de blog comme un nouveau contenu dans le blog en cours : %s."
+
+#: inc/class.dc.import.flat.php:186
+#: inc/class.dc.import.flat.php:214
+msgid "Upload a backup file"
+msgstr "Charger un fichier de sauvegarde"
+
+#: inc/class.dc.import.flat.php:192
+#: inc/class.dc.import.flat.php:220
+msgid "or pick up a local file in your public directory"
+msgstr "ou choisissez un fichier local dans votre répertoire public"
+
+#: inc/class.dc.import.flat.php:212
+msgid "This will reset all the content of your database, except users."
+msgstr "Ceci va remettre à zéro tout le contenu, sauf les utilisateurs."
+
+#: inc/class.dc.import.flat.php:281
+msgid "File is empty or not a compressed file."
+msgstr "Le Fichier est vide ou n'est pas un fichier compressé."
+
+#: inc/class.dc.import.flat.php:304
+msgid "Another file with same name exists."
+msgstr "Un autre fichier du même nom existe déjà."
+
+#: inc/class.dc.import.flat.php:311
+msgid "Failed to extract backup file."
+msgstr "Impossible d'extraire le fichier de sauvegarde."
+
+#: inc/class.dc.import.flat.php:322
+msgid "No backup in compressed file."
+msgstr "Pas de sauvegarde dans le fichier compressé."
+
+#: inc/class.dc.import.wp.php:64
+msgid "WordPress import"
+msgstr "Importer depuis WordPress"
+
+#: inc/class.dc.import.wp.php:65
+msgid "Import a WordPress installation into your current blog."
+msgstr "Importe un blog WordPress dans votre blog en cours."
+
+#: inc/class.dc.import.wp.php:176
+msgid "This will import your WordPress content as new content in the current blog: %s."
+msgstr "Ceci va importer votre blog WordPress comme un nouveau contenu dans le blog en cours : %s."
+
+#: inc/class.dc.import.wp.php:183
+msgid "We first need some information about your old WordPress installation."
+msgstr "Nous avons d'abord besoin de renseignements à propos de votre ancienne installation WordPress."
+
+#: inc/class.dc.import.wp.php:205
+msgid "Ignore the first category:"
+msgstr "Ignorer la première catégorie :"
+
+#: inc/class.dc.import.wp.php:207
+msgid "Import lowest numbered category on posts:"
+msgstr "Importer la catégorie la plus ancienne sur les articles :"
+
+#: inc/class.dc.import.wp.php:209
+msgid "Import all categories as tags:"
+msgstr "Importer les catégories comme des mots-clés :"
+
+#: inc/class.dc.import.wp.php:210
+msgid "Prefix such tags with:"
+msgstr "Préfixer ces mots-clés avec :"
+
+#: inc/class.dc.import.wp.php:215
+msgid "Content filters"
+msgstr "Filtres de contenu"
+
+#: inc/class.dc.import.wp.php:216
+msgid "You may want to process your post and/or comment content with the following filters."
+msgstr "Vous pouvez utiliser les filtres suivants sur vos articles et/ou commentaires."
+
+#: inc/class.dc.import.wp.php:217
+msgid "Post content formatter:"
+msgstr "Formatage des articles :"
+
+#: inc/class.dc.import.wp.php:218
+msgid "Comment content formatter:"
+msgstr "Formatage des commentaires :"
+
+#: inc/class.dc.import.wp.php:286
+msgid "WordPress tables not found"
+msgstr "Tables WordPress non trouvées"
+
+#: inc/flat/class.flat.backup.php:34
+msgid "No file to read."
+msgstr "Aucun fichier lisible."
+
+#: inc/flat/class.flat.import.php:54
+msgid "File is not a DotClear backup."
+msgstr "Le fichier n'est pas une sauvegarde DotClear."
+
+#: inc/flat/class.flat.import.php:105
+msgid "File is not a single blog export."
+msgstr "Le fichier n'est pas un fichier d'export simple."
+
+#: inc/flat/class.flat.import.php:222
+msgid "File is not a full export."
+msgstr "Le fichier n'est pas un fichier d'export complet."
+
+#: inc/flat/class.flat.import.php:704
+msgid "ID of \"%3$s\" does not match on record \"%1$s\" at line %2$s of backup file."
+msgstr "L'ID de \"%3$s\" ne correspond pas dans l'enregistrement de \"%1$s\" à la ligne %2$s du fichier de sauvegarde."
+
+#: index.php:69
+msgid "Please wait..."
+msgstr "Veuillez patienter..."
+
Index: lugins/importExport/script.js
===================================================================
--- plugins/importExport/script.js	(revision 0)
+++ 	(revision )
@@ -1,11 +1,0 @@
-$(function() {
-	if ($('*.error').length > 0) {
-		return;
-	}
-	
-	$('#ie-gui form[method=post]:has(input[type=hidden][name=autosubmit])').each(function() {
-		$('input[type=submit]',this).remove();
-		$(this).after('<p style="font-size:2em;text-align:center">' + dotclear.msg.please_wait + '</p>');
-		$(this).submit();
-	});
-});
Index: plugins/importExport/style.css
===================================================================
--- plugins/importExport/style.css	(revision 840)
+++ plugins/importExport/style.css	(revision 840)
@@ -0,0 +1,25 @@
+dl.modules dt {
+	font-weight: bold;
+	font-size: 1.1em;
+	margin: 1em 0 0 0;
+}
+dl.modules dd {
+	margin: 0 0 1.5em 0;
+}
+div.ie-progress {
+	background: #eee;
+	margin: 1em 0;
+}
+div.ie-progress div {
+	height: 10px;
+	width: 0;
+	font-size: 0.8em;
+	line-height: 1em;
+	height: 1em;
+	padding: 2px 0;
+	text-align: right;
+	background: green url(index.php?pf=importExport/progress.png) repeat-x top left;
+	color: white;
+	font-weight: bold;
+	-moz-border-radius: 2px;
+}
