improved doc for function
[phpmyadmin/crack.git] / libraries / display_import.lib.php
bloba0c2333928ee39242609cfefecfd0f6b3e3a16f2
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 */
8 /**
11 require_once './libraries/file_listing.php';
12 require_once './libraries/plugin_interface.lib.php';
14 /* Scan for plugins */
15 $import_list = PMA_getPlugins('./libraries/import/', $import_type);
17 /* Fail if we didn't find any plugin */
18 if (empty($import_list)) {
19 PMA_Message::error('strCanNotLoadImportPlugins')->display();
20 require './libraries/footer.inc.php';
24 <form action="import.php" method="post" enctype="multipart/form-data" name="import">
25 <?php
26 if ($import_type == 'server') {
27 echo PMA_generate_common_hidden_inputs('', '', 1);
28 } elseif ($import_type == 'database') {
29 echo PMA_generate_common_hidden_inputs($db, '', 1);
30 } else {
31 echo PMA_generate_common_hidden_inputs($db, $table, 1);
33 echo ' <input type="hidden" name="import_type" value="' . $import_type . '" />';
34 echo PMA_pluginGetJavascript($import_list);
36 <fieldset class="options">
37 <legend><?php echo $strFileToImport; ?></legend>
39 <?php
40 if ($GLOBALS['is_upload']) {
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";
50 </div>
51 <?php
52 } else {
53 PMA_Message::warning('strUploadsNotAllowed')->display();
55 if (!empty($cfg['UploadDir'])) {
56 $extensions = '';
57 foreach ($import_list as $key => $val) {
58 if (!empty($extensions)) {
59 $extensions .= '|';
61 $extensions .= $val['extension'];
63 $matcher = '@\.(' . $extensions . ')(\.(' . PMA_supportedDecompressions() . '))?$@';
65 $files = PMA_getFileSelectOptions(PMA_userDir($cfg['UploadDir']), $matcher, (isset($timeout_passed) && $timeout_passed && isset($local_import_file)) ? $local_import_file : '');
66 echo '<div class="formelementrow">' . "\n";
67 if ($files === FALSE) {
68 PMA_Message::error('strWebServerUploadDirectoryError')->display();
69 } elseif (!empty($files)) {
70 echo "\n";
71 echo ' <i>' . $strOr . '</i><br/><label for="select_local_import_file">' . $strWebServerUploadDirectory . '</label>&nbsp;: ' . "\n";
72 echo ' <select style="margin: 5px" size="1" name="local_import_file" onchange="match_file(this.value)" id="select_local_import_file">' . "\n";
73 echo ' <option value="">&nbsp;</option>' . "\n";
74 echo $files;
75 echo ' </select>' . "\n";
77 echo '</div>' . "\n";
78 } // end if (web-server upload directory)
80 // charset of file
81 echo '<div class="formelementrow">' . "\n";
82 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
83 echo '<label for="charset_of_file">' . $strCharsetOfFile . '</label>' . "\n";
84 $temp_charset = reset($cfg['AvailableCharsets']);
85 echo ' <select id="charset_of_file" name="charset_of_file" size="1">' . "\n"
86 . ' <option value="' . htmlentities($temp_charset) . '"';
87 if ($temp_charset == $charset) {
88 echo ' selected="selected"';
90 echo '>' . htmlentities($temp_charset) . '</option>' . "\n";
91 while ($temp_charset = next($cfg['AvailableCharsets'])) {
92 echo ' <option value="' . htmlentities($temp_charset) . '"';
93 if ($temp_charset == $charset) {
94 echo ' selected="selected"';
96 echo '>' . htmlentities($temp_charset) . '</option>' . "\n";
98 echo ' </select><br />' . "\n" . ' ';
99 } else {
100 echo '<label for="charset_of_file">' . $strCharsetOfFile . '</label>' . "\n";
101 echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET, 'charset_of_file', 'charset_of_file', 'utf8', FALSE);
102 } // end if (recoding)
103 echo '</div>' . "\n";
105 // zip, gzip and bzip2 encode features
106 $compressions = $strNone;
108 if ($cfg['GZipDump'] && @function_exists('gzopen')) {
109 $compressions .= ', gzip';
111 if ($cfg['BZipDump'] && @function_exists('bzopen')) {
112 $compressions .= ', bzip2';
114 if ($cfg['ZipDump'] && @function_exists('gzinflate')) {
115 $compressions .= ', zip';
118 // We don't have show anything about compression, when no supported
119 if ($compressions != $strNone) {
120 echo '<div class="formelementrow">' . "\n";
121 printf($strCompressionWillBeDetected, $compressions);
122 echo '</div>' . "\n";
124 echo "\n";
126 </fieldset>
127 <fieldset class="options">
128 <legend><?php echo $strPartialImport; ?></legend>
130 <?php
131 if (isset($timeout_passed) && $timeout_passed) {
132 echo '<div class="formelementrow">' . "\n";
133 echo '<input type="hidden" name="skip" value="' . $offset . '" />';
134 echo sprintf($strTimeoutInfo, $offset) . '';
135 echo '</div>' . "\n";
138 <div class="formelementrow">
139 <input type="checkbox" name="allow_interrupt" value="yes"
140 id="checkbox_allow_interrupt" <?php echo PMA_pluginCheckboxCheck('Import', 'allow_interrupt'); ?>/>
141 <label for="checkbox_allow_interrupt"><?php echo $strAllowInterrupt; ?></label><br />
142 </div>
144 <div class="formelementrow">
145 <label for="text_skip_queries"><?php echo $strSkipQueries; ?></label>
146 <input type="text" name="skip_queries" value="<?php echo PMA_pluginGetDefault('Import', 'skip_queries');?>" id="text_skip_queries" />
147 </div>
148 </fieldset>
150 <fieldset class="options">
151 <legend><?php echo $strImportFormat; ?></legend>
152 <?php
153 // Let's show format options now
154 echo '<div style="float: left;">';
155 echo PMA_pluginGetChoice('Import', 'format', $import_list);
156 echo '</div>';
158 echo '<div style="float: left;">';
159 echo PMA_pluginGetOptions('Import', $import_list);
160 echo '</div>';
162 <div class="clearfloat"></div>
163 </fieldset>
164 <?php
165 // Encoding setting form appended by Y.Kawada
166 if (function_exists('PMA_set_enc_form')) {
167 echo PMA_set_enc_form(' ');
169 echo "\n";
171 <fieldset class="tblFooters">
172 <input type="submit" value="<?php echo $strGo; ?>" id="buttonGo" />
173 </fieldset>
174 </form>
175 <script type="text/javascript">
176 //<![CDATA[
177 init_options();
178 //]]>
179 </script>