Dotclear

source: plugins/importExport/index.php @ 0:54703be25dd6

Revision 0:54703be25dd6, 3.4 KB checked in by Dsls <dsls@…>, 14 years ago (diff)

2.3 branch (trunk) first checkin

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2010 Olivier Meunier & Association Dotclear
7# Licensed under the GPL version 2.0 license.
8# See LICENSE file or
9# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10#
11# -- END LICENSE BLOCK -----------------------------------------
12if (!defined('DC_CONTEXT_ADMIN')) { return; }
13
14require dirname(__FILE__).'/inc/class.dc.ieModule.php';
15
16$modules = new ArrayObject();
17$modules['i'] = new ArrayObject(array(
18     'dcImportFlat' => dirname(__FILE__).'/inc/class.dc.import.flat.php',
19     'dcImportFeed' => dirname(__FILE__).'/inc/class.dc.import.feed.php',
20));
21$modules['e'] = new ArrayObject(array(
22     'dcExportFlat' => dirname(__FILE__).'/inc/class.dc.export.flat.php'
23));
24
25if ($core->auth->isSuperAdmin()) {
26     $modules['i']['dcImportDC1']  = dirname(__FILE__).'/inc/class.dc.import.dc1.php';
27     $modules['i']['dcImportWP']  = dirname(__FILE__).'/inc/class.dc.import.wp.php';
28}
29
30# --BEHAVIOR-- importExportModules
31$core->callBehavior('importExportModules',$modules);
32
33$type = null;
34if (!empty($_REQUEST['t']) && ($_REQUEST['t'] == 'e' || $_REQUEST['t'] == 'i')) {
35     $type = $_REQUEST['t'];
36}
37
38$current_module = null;
39if ($type && !empty($_REQUEST['f'])) {
40     if (isset($modules[$type][$_REQUEST['f']])) {
41          require_once $modules[$type][$_REQUEST['f']];
42          $current_module = new $_REQUEST['f']($core);
43          $current_module->init();
44     }
45}
46
47if ($type && $current_module !== null && !empty($_REQUEST['do']))
48{
49     try {
50          $current_module->process($_REQUEST['do']);
51     } catch (Exception $e) {
52          $core->error->add($e->getMessage());
53     }
54}
55?>
56<html>
57<head>
58     <title><?php echo __('Import/Export'); ?></title>
59     <style type="text/css">
60     dl.modules dt {
61          font-weight: bold;
62          font-size: 1.1em;
63          margin: 1em 0 0 0;
64     }
65     dl.modules dd {
66          margin: 0 0 1.5em 0;
67     }
68     div.ie-progress {
69          background: #eee;
70          margin: 1em 0;
71     }
72     div.ie-progress div {
73          height: 10px;
74          width: 0;
75          font-size: 0.8em;
76          line-height: 1em;
77          height: 1em;
78          padding: 2px 0;
79          text-align: right;
80          background: green url(index.php?pf=importExport/progress.png) repeat-x top left;
81          color: white;
82          font-weight: bold;
83          -moz-border-radius: 2px;
84     }
85     </style>
86     <script type="text/javascript" src="index.php?pf=importExport/script.js"></script>
87     <script type="text/javascript">
88     //<![CDATA[
89     dotclear.msg.please_wait = '<?php echo html::escapeJS(__("Please wait...")); ?>';
90     //]]>
91     </script>
92</head>
93<body>
94
95<?php
96if ($type && $current_module !== null)
97{
98     echo '<h2><a href="'.$p_url.'">'.__('Import/Export').'</a>'.
99     ' &rsaquo; '.html::escapeHTML($current_module->name).'</h2>';
100     
101     echo '<div id="ie-gui">';
102     $current_module->gui();
103     echo '</div>';
104}
105else
106{
107     echo '<h2>'.__('Import/Export').'</h2>';
108     echo '<h3>'.__('Import').'</h3>';
109     
110     echo '<dl class="modules">';
111     foreach ($modules['i'] as $k => $v)
112     {
113          require_once $v;
114          $o = new $k($core);
115         
116          echo 
117          '<dt><a href="'.$o->getURL(true).'">'.html::escapeHTML($o->name).'</a></dt>'.
118          '<dd>'.html::escapeHTML($o->description).'</dd>';
119         
120          unset($o);
121     }
122     echo '</dl>';
123     
124     echo '<h3>'.__('Export').'</h3>';
125     
126     echo '<dl class="modules">';
127     foreach ($modules['e'] as $k => $v)
128     {
129          require_once $v;
130          $o = new $k($core);
131         
132          echo 
133          '<dt><a href="'.$o->getURL(true).'">'.html::escapeHTML($o->name).'</a></dt>'.
134          '<dd>'.html::escapeHTML($o->description).'</dd>';
135         
136          unset($o);
137     }
138     echo '</dl>';
139}
140?>
141
142</body>
143</html>
Note: See TracBrowser for help on using the repository browser.

Sites map