2 /* vim: set expandtab sw=4 ts=4 sts=4: */
7 if (! defined('PHPMYADMIN')) {
14 require_once './libraries/file_listing.php';
15 require_once './libraries/plugin_interface.lib.php';
17 /* Scan for plugins */
18 $import_list = PMA_getPlugins('./libraries/import/', $import_type);
20 /* Fail if we didn't find any plugin */
21 if (empty($import_list)) {
22 PMA_Message
::error('strCanNotLoadImportPlugins')->display();
23 require './libraries/footer.inc.php';
27 <form action
="import.php" method
="post" enctype
="multipart/form-data" name
="import">
29 if ($import_type == 'server') {
30 echo PMA_generate_common_hidden_inputs('', '', 1);
31 } elseif ($import_type == 'database') {
32 echo PMA_generate_common_hidden_inputs($db, '', 1);
34 echo PMA_generate_common_hidden_inputs($db, $table, 1);
36 echo ' <input type="hidden" name="import_type" value="' . $import_type . '" />';
37 echo PMA_pluginGetJavascript($import_list);
39 <fieldset
class="options">
40 <legend
><?php
echo $strFileToImport; ?
></legend
>
43 if ($GLOBALS['is_upload']) {
45 <div
class="formelementrow">
46 <label
for="input_import_file"><?php
echo $strLocationTextfile; ?
></label
>
47 <input style
="margin: 5px" type
="file" name
="import_file" id
="input_import_file" onchange
="match_file(this.value);" />
49 echo PMA_displayMaximumUploadSize($max_upload_size) . "\n";
50 // some browsers should respect this :)
51 echo PMA_generateHiddenMaxFileSize($max_upload_size) . "\n";
56 PMA_Message
::warning('strUploadsNotAllowed')->display();
58 if (!empty($cfg['UploadDir'])) {
60 foreach ($import_list as $key => $val) {
61 if (!empty($extensions)) {
64 $extensions .= $val['extension'];
66 $matcher = '@\.(' . $extensions . ')(\.(' . PMA_supportedDecompressions() . '))?$@';
68 $files = PMA_getFileSelectOptions(PMA_userDir($cfg['UploadDir']), $matcher, (isset($timeout_passed) && $timeout_passed && isset($local_import_file)) ?
$local_import_file : '');
69 echo '<div class="formelementrow">' . "\n";
70 if ($files === FALSE) {
71 PMA_Message
::error('strWebServerUploadDirectoryError')->display();
72 } elseif (!empty($files)) {
74 echo ' <i>' . $strOr . '</i><br/><label for="select_local_import_file">' . $strWebServerUploadDirectory . '</label> : ' . "\n";
75 echo ' <select style="margin: 5px" size="1" name="local_import_file" onchange="match_file(this.value)" id="select_local_import_file">' . "\n";
76 echo ' <option value=""> </option>' . "\n";
78 echo ' </select>' . "\n";
81 } // end if (web-server upload directory)
84 echo '<div class="formelementrow">' . "\n";
85 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
86 echo '<label for="charset_of_file">' . $strCharsetOfFile . '</label>' . "\n";
87 $temp_charset = reset($cfg['AvailableCharsets']);
88 echo ' <select id="charset_of_file" name="charset_of_file" size="1">' . "\n"
89 . ' <option value="' . htmlentities($temp_charset) . '"';
90 if ($temp_charset == $charset) {
91 echo ' selected="selected"';
93 echo '>' . htmlentities($temp_charset) . '</option>' . "\n";
94 while ($temp_charset = next($cfg['AvailableCharsets'])) {
95 echo ' <option value="' . htmlentities($temp_charset) . '"';
96 if ($temp_charset == $charset) {
97 echo ' selected="selected"';
99 echo '>' . htmlentities($temp_charset) . '</option>' . "\n";
101 echo ' </select><br />' . "\n" . ' ';
103 echo '<label for="charset_of_file">' . $strCharsetOfFile . '</label>' . "\n";
104 echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET
, 'charset_of_file', 'charset_of_file', 'utf8', FALSE);
105 } // end if (recoding)
106 echo '</div>' . "\n";
108 // zip, gzip and bzip2 encode features
109 $compressions = $strNone;
111 if ($cfg['GZipDump'] && @function_exists
('gzopen')) {
112 $compressions .= ', gzip';
114 if ($cfg['BZipDump'] && @function_exists
('bzopen')) {
115 $compressions .= ', bzip2';
117 if ($cfg['ZipDump'] && @function_exists
('zip_open')) {
118 $compressions .= ', zip';
121 // We don't have show anything about compression, when no supported
122 if ($compressions != $strNone) {
123 echo '<div class="formelementrow">' . "\n";
124 printf($strCompressionWillBeDetected, $compressions);
125 echo '</div>' . "\n";
130 <fieldset
class="options">
131 <legend
><?php
echo $strPartialImport; ?
></legend
>
134 if (isset($timeout_passed) && $timeout_passed) {
135 echo '<div class="formelementrow">' . "\n";
136 echo '<input type="hidden" name="skip" value="' . $offset . '" />';
137 echo sprintf($strTimeoutInfo, $offset) . '';
138 echo '</div>' . "\n";
141 <div
class="formelementrow">
142 <input type
="checkbox" name
="allow_interrupt" value
="yes"
143 id
="checkbox_allow_interrupt" <?php
echo PMA_pluginCheckboxCheck('Import', 'allow_interrupt'); ?
>/>
144 <label
for="checkbox_allow_interrupt"><?php
echo $strAllowInterrupt; ?
></label
><br
/>
148 if (! (isset($timeout_passed) && $timeout_passed)) {
150 <div
class="formelementrow">
151 <label
for="text_skip_queries"><?php
echo $strSkipQueries; ?
></label
>
152 <input type
="text" name
="skip_queries" value
="<?php echo PMA_pluginGetDefault('Import', 'skip_queries');?>" id
="text_skip_queries" />
156 // If timeout has passed,
157 // do not show the Skip dialog to avoid the risk of someone
158 // entering a value here that would interfere with "skip"
160 <input type
="hidden" name
="skip_queries" value
="<?php echo PMA_pluginGetDefault('Import', 'skip_queries');?>" id
="text_skip_queries" />
166 <fieldset
class="options">
167 <legend
><?php
echo $strImportFormat; ?
></legend
>
169 // Let's show format options now
170 echo '<div style="float: left;">';
171 echo PMA_pluginGetChoice('Import', 'format', $import_list);
174 echo '<div style="float: left;">';
175 echo PMA_pluginGetOptions('Import', $import_list);
178 <div
class="clearfloat"></div
>
181 // Encoding setting form appended by Y.Kawada
182 if (function_exists('PMA_set_enc_form')) {
183 echo PMA_set_enc_form(' ');
187 <fieldset
class="tblFooters">
188 <input type
="submit" value
="<?php echo $strGo; ?>" id
="buttonGo" />
191 <script type
="text/javascript">