Index: plugins/importExport/index.php
===================================================================
--- plugins/importExport/index.php	(revision 3993)
+++ plugins/importExport/index.php	(revision 0)
@@ -1,104 +1,143 @@
 <?php
-/**
- * @brief importExport, a plugin for Dotclear 2
- *
- * @package Dotclear
- * @subpackage Plugins
- *
- * @copyright Olivier Meunier & Association Dotclear
- * @copyright GPL-2.0-only
- */
+# -- BEGIN LICENSE BLOCK ---------------------------------------
+#
+# This file is part of Dotclear 2.
+#
+# Copyright (c) 2003-2010 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_CONTEXT_ADMIN')) { return; }
 
-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);
+$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'
+));
 
-        $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>';
+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(['import' => [], 'export' => []]);
-
 # --BEHAVIOR-- importExportModules
-$core->callBehavior('importExportModules', $modules, $core);
+$core->callBehavior('importExportModules',$modules);
 
 $type = null;
-if (!empty($_REQUEST['type']) && in_array($_REQUEST['type'], ['export', 'import'])) {
-    $type = $_REQUEST['type'];
+if (!empty($_REQUEST['t']) && ($_REQUEST['t'] == 'e' || $_REQUEST['t'] == 'i')) {
+	$type = $_REQUEST['t'];
 }
 
-$module = null;
-if ($type && !empty($_REQUEST['module'])) {
-
-    if (isset($modules[$type]) && in_array($_REQUEST['module'], $modules[$type])) {
-
-        $module = new $_REQUEST['module']($core);
-        $module->init();
-    }
+$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();
+	}
 }
 
-if ($type && $module !== null && !empty($_REQUEST['do'])) {
-    try {
-        $module->process($_REQUEST['do']);
-    } catch (Exception $e) {
-        $core->error->add($e->getMessage());
-    }
+if ($type && $current_module !== null && !empty($_REQUEST['do']))
+{
+	try {
+		$current_module->process($_REQUEST['do']);
+	} catch (Exception $e) {
+		$core->error->add($e->getMessage());
+	}
 }
-
-$title = __('Import/Export');
-
-echo '
+?>
 <html>
 <head>
-    <title>' . $title . '</title>' .
-dcPage::cssLoad(dcPage::getPF('importExport/style.css')) .
-dcPage::jsJson('ie_msg', ['please_wait' => __('Please wait...')]) .
-dcPage::jsLoad(dcPage::getPF('importExport/js/script.js')) .
-'</head>
-<body>';
+	<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>
+	<script type="text/javascript">
+	//<![CDATA[
+	dotclear.msg.please_wait = '<?php echo html::escapeJS(__("Please wait...")); ?>';
+	//]]>
+	</script>
+</head>
+<body>
 
-if ($type && $module !== null) {
-    echo dcPage::breadcrumb(
-        [
-            __('Plugins')                   => '',
-            $title                          => $p_url,
-            html::escapeHTML($module->name) => ''
-        ]) .
-    dcPage::notices();
+<?php
+if ($type && $current_module !== null)
+{
+	echo '<h2><a href="'.$p_url.'">'.__('Import/Export').'</a>'.
+	' &rsaquo; '.html::escapeHTML($current_module->name).'</h2>';
+	
+	echo '<div id="ie-gui">';
+	$current_module->gui();
+	echo '</div>';
+}
+else
+{
+	echo '<h2>'.__('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>';
+}
+?>
 
-    echo
-        '<div id="ie-gui">';
-
-    $module->gui();
-
-    echo '</div>';
-} else {
-    echo dcPage::breadcrumb(
-        [
-            __('Plugins') => '',
-            $title        => ''
-        ]) .
-    dcPage::notices();
-
-    echo '<h3>' . __('Import') . '</h3>' . listImportExportModules($core, $modules['import']);
-
-    echo
-    '<h3>' . __('Export') . '</h3>' .
-    '<p class="info">' . sprintf(
-        __('Export functions are in the page %s.'),
-        '<a href="' . $core->adminurl->get('admin.plugin.maintenance', ['tab' => 'backup']) . '#backup">' . __('Maintenance') . '</a>'
-    ) . '</p>';
-}
-
-dcPage::helpBlock('import');
-
-echo '</body></html>';
+</body>
+</html>
