Changeset 840:f7157873644c for plugins/importExport/index.php
- Timestamp:
- 07/09/12 14:44:20 (13 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/importExport/index.php
r696 r840 2 2 # -- BEGIN LICENSE BLOCK --------------------------------------- 3 3 # 4 # This file is part of Dotclear2.4 # This file is part of importExport, a plugin for DotClear2. 5 5 # 6 # Copyright (c) 2003-201 1Olivier Meunier & Association Dotclear6 # Copyright (c) 2003-2012 Olivier Meunier & Association Dotclear 7 7 # Licensed under the GPL version 2.0 license. 8 8 # See LICENSE file or … … 12 12 if (!defined('DC_CONTEXT_ADMIN')) { return; } 13 13 14 require dirname(__FILE__).'/inc/class.dc.ieModule.php'; 14 function listImportExportModules($core,$modules) 15 { 16 $res = ''; 17 foreach ($modules as $id) 18 { 19 $o = new $id($core); 20 21 $res .= 22 '<dt><a href="'.$o->getURL(true).'">'.html::escapeHTML($o->name).'</a></dt>'. 23 '<dd>'.html::escapeHTML($o->description).'</dd>'; 24 25 unset($o); 26 } 27 return '<dl class="modules">'.$res.'</dl>'; 28 } 15 29 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 25 if ($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 } 30 $modules = new ArrayObject(array('import' => array(),'export' => array())); 29 31 30 32 # --BEHAVIOR-- importExportModules … … 32 34 33 35 $type = null; 34 if (!empty($_REQUEST['t ']) && ($_REQUEST['t'] == 'e' || $_REQUEST['t'] == 'i')) {35 $type = $_REQUEST['t '];36 if (!empty($_REQUEST['type']) && in_array($_REQUEST['type'],array('export','import'))) { 37 $type = $_REQUEST['type']; 36 38 } 37 39 38 $current_module = null; 39 if ($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(); 40 $module = null; 41 if ($type && !empty($_REQUEST['module'])) { 42 43 if (isset($modules[$type]) && in_array($_REQUEST['module'],$modules[$type])) { 44 45 $module = new $_REQUEST['module']($core); 46 $module->init(); 44 47 } 45 48 } 46 49 47 if ($type && $ current_module !== null && !empty($_REQUEST['do']))50 if ($type && $module !== null && !empty($_REQUEST['do'])) 48 51 { 49 52 try { 50 $ current_module->process($_REQUEST['do']);53 $module->process($_REQUEST['do']); 51 54 } catch (Exception $e) { 52 55 $core->error->add($e->getMessage()); 53 56 } 54 57 } 55 ?> 58 59 $title = __('Import/Export'); 60 61 echo ' 56 62 <html> 57 63 <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> 64 <title>'.$title.'</title> 65 <link rel="stylesheet" type="text/css" href="index.php?pf=importExport/style.css" /> 66 '.dcPage::jsLoad('index.php?pf=importExport/js/script.js').' 87 67 <script type="text/javascript"> 88 68 //<![CDATA[ 89 dotclear.msg.please_wait = '<?php echo html::escapeJS(__("Please wait...")); ?>';69 '.dcPage::jsVar('dotclear.msg.please_wait',__('Please wait...')).' 90 70 //]]> 91 71 </script> 92 72 </head> 93 <body> 73 <body>'; 94 74 95 <?php 96 if ($type && $current_module !== null) 97 { 98 echo '<h2><a href="'.$p_url.'">'.__('Import/Export').'</a>'.99 ' › <span class="page-title">'.html::escapeHTML($current_module->name).'</span></h2>';75 if ($type && $module !== null) { 76 echo 77 '<h2><a href="'.$p_url.'">'.$title.'</a>'. 78 ' › <span class="page-title">'.html::escapeHTML($module->name).'</span></h2>'. 79 '<div id="ie-gui">'; 100 80 101 echo '<div id="ie-gui">';102 $current_module->gui();81 $module->gui(); 82 103 83 echo '</div>'; 104 84 } 105 else 106 { 107 echo '<h2 class="page-title">'.__('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>'; 85 else { 86 echo 87 '<h2 class="page-title">'.$title.'</h2>'. 88 '<h3>'.__('Import').'</h3>'.listImportExportModules($core,$modules['import']). 89 '<h3>'.__('Export').'</h3>'.listImportExportModules($core,$modules['export']); 139 90 } 91 92 echo ' 93 </body> 94 </html>'; 140 95 ?> 141 142 </body>143 </html>
Note: See TracChangeset
for help on using the changeset viewer.