1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
<?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_CONTEXT_ADMIN')) { return; }
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(array('import' => array(),'export' => array()));
# --BEHAVIOR-- importExportModules
$core->callBehavior('importExportModules', $modules, $core);
$type = null;
if (!empty($_REQUEST['type']) && in_array($_REQUEST['type'],array('export','import'))) {
$type = $_REQUEST['type'];
}
$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 && $module !== null && !empty($_REQUEST['do']))
{
try {
$module->process($_REQUEST['do']);
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
}
$title = __('Import/Export');
echo '
<html>
<head>
<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[
'.dcPage::jsVar('dotclear.msg.please_wait',__('Please wait...')).'
//]]>
</script>
</head>
<body>';
if ($type && $module !== null) {
echo dcPage::breadcrumb(
array(
__('Plugins') => '',
$title => $p_url,
html::escapeHTML($module->name) => ''
)).
dcPage::notices();
echo
'<div id="ie-gui">';
$module->gui();
echo '</div>';
}
else {
echo dcPage::breadcrumb(
array(
__('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="plugin.php?p=maintenance&tab=backup#backup">'.__('Maintenance').'</a>'
).'</p>';
}
dcPage::helpBlock('import');
echo '</body></html>';
|