[ Index ]
 

Code source de phpMyAdmin 2.10.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/libraries/ -> display_export.lib.php (source)

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


Généré le : Mon Nov 26 15:18:20 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics