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_export.lib.php < prev    next >
Encoding:
PHP Script  |  2008-06-23  |  9.5 KB  |  273 lines

  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4.  *
  5.  * @version $Id: display_export.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/Table.class.php';
  15.  
  16. // Get relations & co. status
  17. require_once './libraries/relation.lib.php';
  18. $cfgRelation = PMA_getRelationsParam();
  19.  
  20.  
  21. require_once './libraries/file_listing.php';
  22. require_once './libraries/plugin_interface.lib.php';
  23.  
  24. function PMA_exportCheckboxCheck($str) {
  25.     if (isset($GLOBALS['cfg']['Export'][$str]) && $GLOBALS['cfg']['Export'][$str]) {
  26.         echo ' checked="checked"';
  27.     }
  28. }
  29.  
  30. function PMA_exportIsActive($what, $val) {
  31.     if (isset($GLOBALS['cfg']['Export'][$what]) &&  $GLOBALS['cfg']['Export'][$what] == $val) {
  32.         echo ' checked="checked"';
  33.     }
  34. }
  35.  
  36. /* Scan for plugins */
  37. $export_list = PMA_getPlugins('./libraries/export/', array('export_type' => $export_type, 'single_table' => isset($single_table)));
  38.  
  39. /* Fail if we didn't find any plugin */
  40. if (empty($export_list)) {
  41.     $GLOBALS['show_error_header'] = TRUE;
  42.     PMA_showMessage($strCanNotLoadExportPlugins);
  43.     unset($GLOBALS['show_error_header']);
  44.     require './libraries/footer.inc.php';
  45. }
  46. ?>
  47.  
  48. <form method="post" action="export.php" name="dump">
  49.  
  50. <?php
  51. if ($export_type == 'server') {
  52.     echo PMA_generate_common_hidden_inputs('', '', 1);
  53. } elseif ($export_type == 'database') {
  54.     echo PMA_generate_common_hidden_inputs($db, '', 1);
  55. } else {
  56.     echo PMA_generate_common_hidden_inputs($db, $table, 1);
  57. }
  58.  
  59. // just to keep this value for possible next display of this form after saving on server
  60. if (isset($single_table)) {
  61.     echo '<input type="hidden" name="single_table" value="TRUE" />' . "\n";
  62. }
  63.  
  64. echo '<input type="hidden" name="export_type" value="' . $export_type . '" />' . "\n";
  65.  
  66. if (! empty($sql_query)) {
  67.     echo '<input type="hidden" name="sql_query" value="' . htmlspecialchars($sql_query) . '" />' . "\n";
  68. }
  69. echo PMA_pluginGetJavascript($export_list);
  70. ?>
  71. <fieldset id="fieldsetexport">
  72. <legend><?php echo $export_page_title; ?></legend>
  73.  
  74. <?php
  75. /*
  76.  * this table is needed to fix rendering in Opera <= 9 and Safari <= 2
  77.  * normaly just the two fieldset would have float: left
  78.  */
  79. ?>
  80. <table><tr><td>
  81.  
  82. <div id="div_container_exportoptions">
  83. <fieldset id="exportoptions">
  84. <legend><?php echo $strExport; ?></legend>
  85.  
  86.     <?php if (! empty($multi_values)) { ?>
  87.     <div class="formelementrow">
  88.         <?php echo $multi_values; ?>
  89.     </div>
  90.     <?php } ?>
  91. <?php echo PMA_pluginGetChoice('Export', 'what', $export_list, 'format'); ?>
  92. </fieldset>
  93. </div>
  94.  
  95. </td><td>
  96.  
  97. <div id="div_container_sub_exportoptions">
  98. <?php echo PMA_pluginGetOptions('Export', $export_list); ?>
  99. </div>
  100. </td></tr></table>
  101.  
  102. <script type="text/javascript">
  103. //<![CDATA[
  104.     init_options();
  105. //]]>
  106. </script>
  107.  
  108. <?php if (strlen($table) && ! isset($num_tables)) { ?>
  109.     <div class="formelementrow">
  110.         <?php
  111.         echo sprintf($strDumpXRows,
  112.             '<input type="text" name="limit_to" size="5" value="'
  113.             . (isset($unlim_num_rows) ? $unlim_num_rows : PMA_Table::countRecords($db, $table, TRUE))
  114.             . '" onfocus="this.select()" />',
  115.             '<input type="text" name="limit_from" value="0" size="5"'
  116.             .' onfocus="this.select()" /> ');
  117.         ?>
  118.     </div>
  119. <?php } ?>
  120. </fieldset>
  121.  
  122. <fieldset>
  123.     <legend>
  124.         <input type="checkbox" name="asfile" value="sendit"
  125.             id="checkbox_dump_asfile" <?php PMA_exportCheckboxCheck('asfile'); ?> />
  126.         <label for="checkbox_dump_asfile"><?php echo $strSend; ?></label>
  127.     </legend>
  128.  
  129.     <?php if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) { ?>
  130.     <input type="checkbox" name="onserver" value="saveit"
  131.         id="checkbox_dump_onserver"
  132.         onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
  133.         <?php PMA_exportCheckboxCheck('onserver'); ?> />
  134.     <label for="checkbox_dump_onserver">
  135.         <?php echo sprintf($strSaveOnServer, htmlspecialchars(PMA_userDir($cfg['SaveDir']))); ?>
  136.     </label>,<br />
  137.     <input type="checkbox" name="onserverover" value="saveitover"
  138.         id="checkbox_dump_onserverover"
  139.         onclick="document.getElementById('checkbox_dump_onserver').checked = true;
  140.             document.getElementById('checkbox_dump_asfile').checked = true;"
  141.         <?php PMA_exportCheckboxCheck('onserver_overwrite'); ?> />
  142.     <label for="checkbox_dump_onserverover">
  143.         <?php echo $strOverwriteExisting; ?></label>
  144.     <br />
  145.     <?php } ?>
  146.  
  147.     <label for="filename_template">
  148.         <?php echo $strFileNameTemplate; ?>
  149.         <sup>(1)</sup></label>:
  150.     <input type="text" name="filename_template" id="filename_template"
  151.     <?php
  152.         echo ' value="';
  153.         if ($export_type == 'database') {
  154.             if (isset($_COOKIE) && !empty($_COOKIE['pma_db_filename_template'])) {
  155.                 echo $_COOKIE['pma_db_filename_template'];
  156.             } else {
  157.                 echo $GLOBALS['cfg']['Export']['file_template_database'];
  158.             }
  159.         } elseif ($export_type == 'table') {
  160.             if (isset($_COOKIE) && !empty($_COOKIE['pma_table_filename_template'])) {
  161.                 echo $_COOKIE['pma_table_filename_template'];
  162.             } else {
  163.                 echo $GLOBALS['cfg']['Export']['file_template_table'];
  164.             }
  165.         } else {
  166.             if (isset($_COOKIE) && !empty($_COOKIE['pma_server_filename_template'])) {
  167.                 echo $_COOKIE['pma_server_filename_template'];
  168.             } else {
  169.                 echo $GLOBALS['cfg']['Export']['file_template_server'];
  170.             }
  171.         }
  172.         echo '" />';
  173.     ?>
  174.  
  175.     (
  176.     <input type="checkbox" name="remember_template"
  177.         id="checkbox_remember_template"
  178.         <?php PMA_exportCheckboxCheck('remember_file_template'); ?> />
  179.     <label for="checkbox_remember_template">
  180.         <?php echo $strFileNameTemplateRemember; ?></label>
  181.     )
  182.  
  183.     <div class="formelementrow">
  184.     <?php
  185.     // charset of file
  186.     if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
  187.         echo '        <label for="select_charset_of_file">'
  188.             . $strCharsetOfFile . '</label>' . "\n";
  189.  
  190.         $temp_charset = reset($cfg['AvailableCharsets']);
  191.         echo '        <select id="select_charset_of_file" name="charset_of_file" size="1">' . "\n";
  192.         foreach ($cfg['AvailableCharsets'] as $key => $temp_charset) {
  193.             echo '            <option value="' . $temp_charset . '"';
  194.             if ((empty($cfg['Export']['charset']) && $temp_charset == $charset)
  195.               || $temp_charset == $cfg['Export']['charset']) {
  196.                 echo ' selected="selected"';
  197.             }
  198.             echo '>' . $temp_charset . '</option>' . "\n";
  199.         } // end foreach
  200.         echo '        </select>';
  201.     } // end if
  202.     ?>
  203.     </div>
  204.  
  205. <?php
  206. // zip, gzip and bzip2 encode features
  207. $is_zip  = ($cfg['ZipDump']  && @function_exists('gzcompress'));
  208. $is_gzip = ($cfg['GZipDump'] && @function_exists('gzencode'));
  209. $is_bzip = ($cfg['BZipDump'] && @function_exists('bzcompress'));
  210.  
  211. if ($is_zip || $is_gzip || $is_bzip) { ?>
  212.     <div class="formelementrow">
  213.         <?php echo $strCompression; ?>:
  214.         <input type="radio" name="compression" value="none"
  215.             id="radio_compression_none"
  216.             onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
  217.             <?php PMA_exportIsActive('compression', 'none'); ?> />
  218.         <label for="radio_compression_none"><?php echo $strNone; ?></label>
  219.     <?php
  220.     if ($is_zip) { ?>
  221.         <input type="radio" name="compression" value="zip"
  222.             id="radio_compression_zip"
  223.             onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
  224.             <?php PMA_exportIsActive('compression', 'zip'); ?> />
  225.         <label for="radio_compression_zip"><?php echo $strZip; ?></label>
  226.     <?php } if ($is_gzip) { ?>
  227.         <input type="radio" name="compression" value="gzip"
  228.             id="radio_compression_gzip"
  229.             onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
  230.             <?php PMA_exportIsActive('compression', 'gzip'); ?> />
  231.         <label for="radio_compression_gzip"><?php echo $strGzip; ?></label>
  232.     <?php } if ($is_bzip) { ?>
  233.         <input type="radio" name="compression" value="bzip"
  234.             id="radio_compression_bzip"
  235.             onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
  236.             <?php PMA_exportIsActive('compression', 'bzip2'); ?> />
  237.         <label for="radio_compression_bzip"><?php echo $strBzip; ?></label>
  238.     <?php } ?>
  239.     </div>
  240. <?php } else { ?>
  241.     <input type="hidden" name="compression" value="none" />
  242. <?php } ?>
  243. </fieldset>
  244.  
  245. <?php if (function_exists('PMA_set_enc_form')) { ?>
  246. <!-- Encoding setting form appended by Y.Kawada -->
  247. <!-- Japanese encoding setting -->
  248. <fieldset>
  249. <?php echo PMA_set_enc_form('            '); ?>
  250. </fieldset>
  251. <?php } ?>
  252.  
  253. <fieldset class="tblFooters">
  254. <?php PMA_externalBug($GLOBALS['strSQLCompatibility'], 'mysql', '50027', '14515'); ?>
  255.     <input type="submit" value="<?php echo $strGo; ?>" id="buttonGo" />
  256. </fieldset>
  257. </form>
  258.  
  259. <div class="notice">
  260.     <sup id="FileNameTemplateHelp">(1)</sup>
  261.     <?php
  262.     $trans = '__SERVER__/' . $strFileNameTemplateDescriptionServer;
  263.     if ($export_type == 'database' || $export_type == 'table') {
  264.         $trans .= ', __DB__/' . $strFileNameTemplateDescriptionDatabase;
  265.     }
  266.     if ($export_type == 'table') {
  267.         $trans .= ', __TABLE__/' . $strFileNameTemplateDescriptionTable;
  268.     }
  269.     echo sprintf($strFileNameTemplateDescription,
  270.         '<a href="http://www.php.net/strftime" target="documentation" title="'
  271.         . $strDocu . '">', '</a>', $trans); ?>
  272. </div>
  273.