1 | <?php
|
---|
2 | /* $Id: display_import.lib.php 9193 2006-07-22 21:13:24Z lem9 $ */
|
---|
3 | // vim: expandtab sw=4 ts=4 sts=4:
|
---|
4 |
|
---|
5 | require_once('./libraries/file_listing.php');
|
---|
6 | require_once('./libraries/plugin_interface.lib.php');
|
---|
7 |
|
---|
8 | /* Scan for plugins */
|
---|
9 | $import_list = PMA_getPlugins('./libraries/import/', $import_type);
|
---|
10 |
|
---|
11 | /* Fail if we didn't find any plugin */
|
---|
12 | if (empty($import_list)) {
|
---|
13 | $GLOBALS['show_error_header'] = TRUE;
|
---|
14 | PMA_showMessage($strCanNotLoadImportPlugins);
|
---|
15 | unset($GLOBALS['show_error_header']);
|
---|
16 | require('./libraries/footer.inc.php');
|
---|
17 | }
|
---|
18 | ?>
|
---|
19 |
|
---|
20 | <form action="import.php" method="post" enctype="multipart/form-data" name="import">
|
---|
21 | <?php
|
---|
22 | if ($import_type == 'server') {
|
---|
23 | echo PMA_generate_common_hidden_inputs('', '', 1);
|
---|
24 | } elseif ($import_type == 'database') {
|
---|
25 | echo PMA_generate_common_hidden_inputs($db, '', 1);
|
---|
26 | } else {
|
---|
27 | echo PMA_generate_common_hidden_inputs($db, $table, 1);
|
---|
28 | }
|
---|
29 | echo ' <input type="hidden" name="import_type" value="' . $import_type . '" />';
|
---|
30 | echo PMA_pluginGetJavascript($import_list);
|
---|
31 | ?>
|
---|
32 |
|
---|
33 | <h2><?php echo $strImport; ?></h2>
|
---|
34 |
|
---|
35 | <!-- File name, and some other common options -->
|
---|
36 | <fieldset class="options">
|
---|
37 | <legend><?php echo $strFileToImport; ?></legend>
|
---|
38 |
|
---|
39 | <?php
|
---|
40 | if ($GLOBALS['is_upload']) {
|
---|
41 | ?>
|
---|
42 | <div class="formelementrow">
|
---|
43 | <label for="input_import_file"><?php echo $strLocationTextfile; ?></label>
|
---|
44 | <input style="margin: 5px" type="file" name="import_file" id="input_import_file" onchange="match_file(this.value);" />
|
---|
45 | <?php
|
---|
46 | echo PMA_displayMaximumUploadSize($max_upload_size) . "\n";
|
---|
47 | // some browsers should respect this :)
|
---|
48 | echo PMA_generateHiddenMaxFileSize($max_upload_size) . "\n";
|
---|
49 | } else {
|
---|
50 | echo '<div class="warning">' . "\n";
|
---|
51 | echo $strUploadsNotAllowed . "\n";
|
---|
52 | }
|
---|
53 | ?>
|
---|
54 | </div>
|
---|
55 | <?php
|
---|
56 | if (!empty($cfg['UploadDir'])) {
|
---|
57 | $extensions = '';
|
---|
58 | foreach ($import_list as $key => $val) {
|
---|
59 | if (!empty($extensions)) {
|
---|
60 | $extensions .= '|';
|
---|
61 | }
|
---|
62 | $extensions .= $val['extension'];
|
---|
63 | }
|
---|
64 | $matcher = '@\.(' . $extensions . ')(\.(' . PMA_supportedDecompressions() . '))?$@';
|
---|
65 |
|
---|
66 | $files = PMA_getFileSelectOptions(PMA_userDir($cfg['UploadDir']), $matcher, (isset($timeout_passed) && $timeout_passed && isset($local_import_file)) ? $local_import_file : '');
|
---|
67 | echo '<div class="formelementrow">' . "\n";
|
---|
68 | if ($files === FALSE) {
|
---|
69 | echo ' <div class="warning">' . "\n";
|
---|
70 | echo ' <strong>' . $strError . '</strong>: ' . "\n";
|
---|
71 | echo ' ' . $strWebServerUploadDirectoryError . "\n";
|
---|
72 | echo ' </div>' . "\n";
|
---|
73 | } elseif (!empty($files)) {
|
---|
74 | echo "\n";
|
---|
75 | echo ' <i>' . $strOr . '</i><br/><label for="select_local_import_file">' . $strWebServerUploadDirectory . '</label> : ' . "\n";
|
---|
76 | echo ' <select style="margin: 5px" size="1" name="local_import_file" onchange="match_file(this.value)" id="select_local_import_file">' . "\n";
|
---|
77 | echo ' <option value=""></option>' . "\n";
|
---|
78 | echo $files;
|
---|
79 | echo ' </select>' . "\n";
|
---|
80 | }
|
---|
81 | echo '</div>' . "\n";
|
---|
82 | } // end if (web-server upload directory)
|
---|
83 |
|
---|
84 | // charset of file
|
---|
85 | echo '<div class="formelementrow">' . "\n";
|
---|
86 | if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
|
---|
87 | echo '<label for="charset_of_file">' . $strCharsetOfFile . '</label>' . "\n";
|
---|
88 | $temp_charset = reset($cfg['AvailableCharsets']);
|
---|
89 | echo ' <select id="charset_of_file" name="charset_of_file" size="1">' . "\n"
|
---|
90 | . ' <option value="' . htmlentities( $temp_charset ) . '"';
|
---|
91 | if ($temp_charset == $charset) {
|
---|
92 | echo ' selected="selected"';
|
---|
93 | }
|
---|
94 | echo '>' . htmlentities( $temp_charset ) . '</option>' . "\n";
|
---|
95 | while ($temp_charset = next($cfg['AvailableCharsets'])) {
|
---|
96 | echo ' <option value="' . htmlentities( $temp_charset ) . '"';
|
---|
97 | if ($temp_charset == $charset) {
|
---|
98 | echo ' selected="selected"';
|
---|
99 | }
|
---|
100 | echo '>' . htmlentities( $temp_charset ) . '</option>' . "\n";
|
---|
101 | }
|
---|
102 | echo ' </select><br />' . "\n" . ' ';
|
---|
103 | } elseif (PMA_MYSQL_INT_VERSION >= 40100) {
|
---|
104 | echo '<label for="charset_of_file">' . $strCharsetOfFile . '</label>' . "\n";
|
---|
105 | echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET, 'charset_of_file', 'charset_of_file', 'utf8', FALSE);
|
---|
106 | } // end if (recoding)
|
---|
107 | echo '</div>' . "\n";
|
---|
108 |
|
---|
109 | // zip, gzip and bzip2 encode features
|
---|
110 | $compressions = $strNone;
|
---|
111 |
|
---|
112 | if ($cfg['GZipDump'] && @function_exists('gzopen')) {
|
---|
113 | $compressions .= ', gzip';
|
---|
114 | }
|
---|
115 | if ($cfg['BZipDump'] && @function_exists('bzopen')) {
|
---|
116 | $compressions .= ', bzip2';
|
---|
117 | }
|
---|
118 | if ($cfg['ZipDump'] && @function_exists('gzinflate')) {
|
---|
119 | $compressions .= ', zip';
|
---|
120 | }
|
---|
121 |
|
---|
122 | // We don't have show anything about compression, when no supported
|
---|
123 | if ($compressions != $strNone) {
|
---|
124 | echo '<div class="formelementrow">' . "\n";
|
---|
125 | printf( $strCompressionWillBeDetected, $compressions);
|
---|
126 | echo '</div>' . "\n";
|
---|
127 | }
|
---|
128 | echo "\n";
|
---|
129 | ?>
|
---|
130 | </fieldset>
|
---|
131 | <fieldset class="options">
|
---|
132 | <legend><?php echo $strPartialImport; ?></legend>
|
---|
133 |
|
---|
134 | <?php
|
---|
135 | if (isset($timeout_passed) && $timeout_passed) {
|
---|
136 | echo '<div class="formelementrow">' . "\n";
|
---|
137 | echo '<input type="hidden" name="skip" value="' . $offset . '" />';
|
---|
138 | echo sprintf($strTimeoutInfo, $offset) . '';
|
---|
139 | echo '</div>' . "\n";
|
---|
140 | }
|
---|
141 | ?>
|
---|
142 | <div class="formelementrow">
|
---|
143 | <input type="checkbox" name="allow_interrupt" value="yes"
|
---|
144 | id="checkbox_allow_interrupt" <?php echo PMA_pluginCheckboxCheck('Import', 'allow_interrupt'); ?>/>
|
---|
145 | <label for="checkbox_allow_interrupt"><?php echo $strAllowInterrupt; ?></label><br />
|
---|
146 | </div>
|
---|
147 |
|
---|
148 | <div class="formelementrow">
|
---|
149 | <label for="text_skip_queries"><?php echo $strSkipQueries; ?></label>
|
---|
150 | <input type="text" name="skip_queries" value="<?php echo PMA_pluginGetDefault('Import', 'skip_queries');?>" id="text_skip_queries" />
|
---|
151 | </div>
|
---|
152 | </fieldset>
|
---|
153 |
|
---|
154 | <fieldset class="options">
|
---|
155 | <legend><?php echo $strImportFormat; ?></legend>
|
---|
156 | <?php
|
---|
157 | // Let's show format options now
|
---|
158 | echo '<div style="float: left;">';
|
---|
159 | echo PMA_pluginGetChoice('Import', 'format', $import_list);
|
---|
160 | echo '</div>';
|
---|
161 |
|
---|
162 | echo '<div style="float: left;">';
|
---|
163 | echo PMA_pluginGetOptions('Import', $import_list);
|
---|
164 | echo '</div>';
|
---|
165 | ?>
|
---|
166 | <div class="clearfloat"></div>
|
---|
167 | </fieldset>
|
---|
168 | <?php
|
---|
169 | // Encoding setting form appended by Y.Kawada
|
---|
170 | if (function_exists('PMA_set_enc_form')) {
|
---|
171 | echo PMA_set_enc_form(' ');
|
---|
172 | }
|
---|
173 | echo "\n";
|
---|
174 | ?>
|
---|
175 | <fieldset class="tblFooters">
|
---|
176 | <input type="submit" value="<?php echo $strGo; ?>" id="buttonGo" />
|
---|
177 | </fieldset>
|
---|
178 | </form>
|
---|
179 | <script type="text/javascript" language="javascript">
|
---|
180 | //<![CDATA[
|
---|
181 | init_options();
|
---|
182 | //]]>
|
---|
183 | </script>
|
---|