2.11.11.3 release
[phpmyadmin/arisferyanto.git] / libraries / display_import.lib.php
blobf62bf64573e6d7fb3be60a3357e7c18906b66818
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 */
7 if (! defined('PHPMYADMIN')) {
8 exit;
11 /**
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 $GLOBALS['show_error_header'] = TRUE;
23 PMA_showMessage($strCanNotLoadImportPlugins);
24 unset($GLOBALS['show_error_header']);
25 require './libraries/footer.inc.php';
29 <form action="import.php" method="post" enctype="multipart/form-data" name="import">
30 <?php
31 if ($import_type == 'server') {
32 echo PMA_generate_common_hidden_inputs('', '', 1);
33 } elseif ($import_type == 'database') {
34 echo PMA_generate_common_hidden_inputs($db, '', 1);
35 } else {
36 echo PMA_generate_common_hidden_inputs($db, $table, 1);
38 echo ' <input type="hidden" name="import_type" value="' . $import_type . '" />';
39 echo PMA_pluginGetJavascript($import_list);
42 <h2><?php echo $strImport; ?></h2>
44 <!-- File name, and some other common options -->
45 <fieldset class="options">
46 <legend><?php echo $strFileToImport; ?></legend>
48 <?php
49 if ($GLOBALS['is_upload']) {
51 <div class="formelementrow">
52 <label for="input_import_file"><?php echo $strLocationTextfile; ?></label>
53 <input style="margin: 5px" type="file" name="import_file" id="input_import_file" onchange="match_file(this.value);" />
54 <?php
55 echo PMA_displayMaximumUploadSize($max_upload_size) . "\n";
56 // some browsers should respect this :)
57 echo PMA_generateHiddenMaxFileSize($max_upload_size) . "\n";
58 } else {
59 echo '<div class="warning">' . "\n";
60 echo $strUploadsNotAllowed . "\n";
63 </div>
64 <?php
65 if (!empty($cfg['UploadDir'])) {
66 $extensions = '';
67 foreach ($import_list as $key => $val) {
68 if (!empty($extensions)) {
69 $extensions .= '|';
71 $extensions .= $val['extension'];
73 $matcher = '@\.(' . $extensions . ')(\.(' . PMA_supportedDecompressions() . '))?$@';
75 $files = PMA_getFileSelectOptions(PMA_userDir($cfg['UploadDir']), $matcher, (isset($timeout_passed) && $timeout_passed && isset($local_import_file)) ? $local_import_file : '');
76 echo '<div class="formelementrow">' . "\n";
77 if ($files === FALSE) {
78 echo ' <div class="warning">' . "\n";
79 echo ' <strong>' . $strError . '</strong>: ' . "\n";
80 echo ' ' . $strWebServerUploadDirectoryError . "\n";
81 echo ' </div>' . "\n";
82 } elseif (!empty($files)) {
83 echo "\n";
84 echo ' <i>' . $strOr . '</i><br/><label for="select_local_import_file">' . $strWebServerUploadDirectory . '</label>&nbsp;: ' . "\n";
85 echo ' <select style="margin: 5px" size="1" name="local_import_file" onchange="match_file(this.value)" id="select_local_import_file">' . "\n";
86 echo ' <option value="">&nbsp;</option>' . "\n";
87 echo $files;
88 echo ' </select>' . "\n";
90 echo '</div>' . "\n";
91 } // end if (web-server upload directory)
93 // charset of file
94 echo '<div class="formelementrow">' . "\n";
95 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
96 echo '<label for="charset_of_file">' . $strCharsetOfFile . '</label>' . "\n";
97 $temp_charset = reset($cfg['AvailableCharsets']);
98 echo ' <select id="charset_of_file" name="charset_of_file" size="1">' . "\n"
99 . ' <option value="' . htmlentities($temp_charset) . '"';
100 if ($temp_charset == $charset) {
101 echo ' selected="selected"';
103 echo '>' . htmlentities($temp_charset) . '</option>' . "\n";
104 while ($temp_charset = next($cfg['AvailableCharsets'])) {
105 echo ' <option value="' . htmlentities($temp_charset) . '"';
106 if ($temp_charset == $charset) {
107 echo ' selected="selected"';
109 echo '>' . htmlentities($temp_charset) . '</option>' . "\n";
111 echo ' </select><br />' . "\n" . ' ';
112 } elseif (PMA_MYSQL_INT_VERSION >= 40100) {
113 echo '<label for="charset_of_file">' . $strCharsetOfFile . '</label>' . "\n";
114 echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET, 'charset_of_file', 'charset_of_file', 'utf8', FALSE);
115 } // end if (recoding)
116 echo '</div>' . "\n";
118 // zip, gzip and bzip2 encode features
119 $compressions = $strNone;
121 if ($cfg['GZipDump'] && @function_exists('gzopen')) {
122 $compressions .= ', gzip';
124 if ($cfg['BZipDump'] && @function_exists('bzopen')) {
125 $compressions .= ', bzip2';
127 if ($cfg['ZipDump'] && @function_exists('gzinflate')) {
128 $compressions .= ', zip';
131 // We don't have show anything about compression, when no supported
132 if ($compressions != $strNone) {
133 echo '<div class="formelementrow">' . "\n";
134 printf($strCompressionWillBeDetected, $compressions);
135 echo '</div>' . "\n";
137 echo "\n";
139 </fieldset>
140 <fieldset class="options">
141 <legend><?php echo $strPartialImport; ?></legend>
143 <?php
144 if (isset($timeout_passed) && $timeout_passed) {
145 echo '<div class="formelementrow">' . "\n";
146 echo '<input type="hidden" name="skip" value="' . $offset . '" />';
147 echo sprintf($strTimeoutInfo, $offset) . '';
148 echo '</div>' . "\n";
151 <div class="formelementrow">
152 <input type="checkbox" name="allow_interrupt" value="yes"
153 id="checkbox_allow_interrupt" <?php echo PMA_pluginCheckboxCheck('Import', 'allow_interrupt'); ?>/>
154 <label for="checkbox_allow_interrupt"><?php echo $strAllowInterrupt; ?></label><br />
155 </div>
157 <?php
158 if (! (isset($timeout_passed) && $timeout_passed)) {
160 <div class="formelementrow">
161 <label for="text_skip_queries"><?php echo $strSkipQueries; ?></label>
162 <input type="text" name="skip_queries" value="<?php echo PMA_pluginGetDefault('Import', 'skip_queries');?>" id="text_skip_queries" />
163 </div>
164 <?php
165 } else {
166 // If timeout has passed,
167 // do not show the Skip dialog to avoid the risk of someone
168 // entering a value here that would interfere with "skip"
170 <input type="hidden" name="skip_queries" value="<?php echo PMA_pluginGetDefault('Import', 'skip_queries');?>" id="text_skip_queries" />
171 <?php
174 </fieldset>
176 <fieldset class="options">
177 <legend><?php echo $strImportFormat; ?></legend>
178 <?php
179 // Let's show format options now
180 echo '<div style="float: left;">';
181 echo PMA_pluginGetChoice('Import', 'format', $import_list);
182 echo '</div>';
184 echo '<div style="float: left;">';
185 echo PMA_pluginGetOptions('Import', $import_list);
186 echo '</div>';
188 <div class="clearfloat"></div>
189 </fieldset>
190 <?php
191 // Encoding setting form appended by Y.Kawada
192 if (function_exists('PMA_set_enc_form')) {
193 echo PMA_set_enc_form(' ');
195 echo "\n";
197 <fieldset class="tblFooters">
198 <input type="submit" value="<?php echo $strGo; ?>" id="buttonGo" />
199 </fieldset>
200 </form>
201 <script type="text/javascript">
202 //<![CDATA[
203 init_options();
204 //]]>
205 </script>