home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / phpMyAdmin / libraries / display_import.lib.php < prev    next >
Encoding:
PHP Script  |  2008-06-23  |  6.7 KB  |  193 lines

  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4.  *
  5.  * @version $Id: display_import.lib.php 11326 2008-06-17 21:32:48Z lem9 $
  6.  */
  7. if (! defined('PHPMYADMIN')) {
  8.     exit;
  9. }
  10.  
  11. /**
  12.  *
  13.  */
  14. require_once './libraries/file_listing.php';
  15. require_once './libraries/plugin_interface.lib.php';
  16.  
  17. /* Scan for plugins */
  18. $import_list = PMA_getPlugins('./libraries/import/', $import_type);
  19.  
  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';
  26. }
  27. ?>
  28.  
  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);
  37. }
  38. echo '    <input type="hidden" name="import_type" value="' . $import_type . '" />';
  39. echo PMA_pluginGetJavascript($import_list);
  40. ?>
  41.  
  42.     <h2><?php echo $strImport; ?></h2>
  43.  
  44.     <!-- File name, and some other common options -->
  45.     <fieldset class="options">
  46.         <legend><?php echo $strFileToImport; ?></legend>
  47.  
  48.         <?php
  49.         if ($GLOBALS['is_upload']) {
  50.         ?>
  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";
  61.         }
  62.         ?>
  63.         </div>
  64. <?php
  65. if (!empty($cfg['UploadDir'])) {
  66.     $extensions = '';
  67.     foreach ($import_list as $key => $val) {
  68.         if (!empty($extensions)) {
  69.             $extensions .= '|';
  70.         }
  71.         $extensions .= $val['extension'];
  72.     }
  73.     $matcher = '@\.(' . $extensions . ')(\.(' . PMA_supportedDecompressions() . '))?$@';
  74.  
  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> : ' . "\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=""> </option>' . "\n";
  87.         echo $files;
  88.         echo '    </select>' . "\n";
  89.     }
  90.     echo '</div>' . "\n";
  91. } // end if (web-server upload directory)
  92.  
  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"';
  102.     }
  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"';
  108.         }
  109.         echo '>' . htmlentities($temp_charset) . '</option>' . "\n";
  110.     }
  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";
  117.  
  118. // zip, gzip and bzip2 encode features
  119. $compressions = $strNone;
  120.  
  121. if ($cfg['GZipDump'] && @function_exists('gzopen')) {
  122.     $compressions .= ', gzip';
  123. }
  124. if ($cfg['BZipDump'] && @function_exists('bzopen')) {
  125.     $compressions .= ', bzip2';
  126. }
  127. if ($cfg['ZipDump'] && @function_exists('gzinflate')) {
  128.     $compressions .= ', zip';
  129. }
  130.  
  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";
  136. }
  137. echo "\n";
  138. ?>
  139.     </fieldset>
  140.     <fieldset class="options">
  141.         <legend><?php echo $strPartialImport; ?></legend>
  142.  
  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";
  149.         }
  150.         ?>
  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>
  156.  
  157.         <div class="formelementrow">
  158.         <label for="text_skip_queries"><?php echo $strSkipQueries; ?></label>
  159.         <input type="text" name="skip_queries" value="<?php echo PMA_pluginGetDefault('Import', 'skip_queries');?>" id="text_skip_queries" />
  160.         </div>
  161.     </fieldset>
  162.  
  163.     <fieldset class="options">
  164.         <legend><?php echo $strImportFormat; ?></legend>
  165. <?php
  166. // Let's show format options now
  167. echo '<div style="float: left;">';
  168. echo PMA_pluginGetChoice('Import', 'format', $import_list);
  169. echo '</div>';
  170.  
  171. echo '<div style="float: left;">';
  172. echo PMA_pluginGetOptions('Import', $import_list);
  173. echo '</div>';
  174. ?>
  175.         <div class="clearfloat"></div>
  176.     </fieldset>
  177. <?php
  178. // Encoding setting form appended by Y.Kawada
  179. if (function_exists('PMA_set_enc_form')) {
  180.     echo PMA_set_enc_form('            ');
  181. }
  182. echo "\n";
  183. ?>
  184.     <fieldset class="tblFooters">
  185.         <input type="submit" value="<?php echo $strGo; ?>" id="buttonGo" />
  186.     </fieldset>
  187. </form>
  188. <script type="text/javascript">
  189. //<![CDATA[
  190.     init_options();
  191. //]]>
  192. </script>
  193.