db_export.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * dumps a database
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. /**
  9. * Gets some core libraries
  10. */
  11. require_once 'libraries/common.inc.php';
  12. $response = PMA_Response::getInstance();
  13. $header = $response->getHeader();
  14. $scripts = $header->getScripts();
  15. $scripts->addFile('export.js');
  16. // $sub_part is also used in db_info.inc.php to see if we are coming from
  17. // db_export.php, in which case we don't obey $cfg['MaxTableList']
  18. $sub_part = '_export';
  19. require_once 'libraries/db_common.inc.php';
  20. $url_query .= '&amp;goto=db_export.php';
  21. require_once 'libraries/db_info.inc.php';
  22. /**
  23. * Displays the form
  24. */
  25. $export_page_title = __('View dump (schema) of database');
  26. // exit if no tables in db found
  27. if ($num_tables < 1) {
  28. PMA_Message::error(__('No tables found in database.'))->display();
  29. exit;
  30. } // end if
  31. $multi_values = '<div>';
  32. $multi_values .= '<a href="#"';
  33. $multi_values .= ' onclick="setSelectOptions(\'dump\', \'table_select[]\', true);'
  34. . ' return false;">';
  35. $multi_values .= __('Select All');
  36. $multi_values .= '</a>';
  37. $multi_values .= ' / ';
  38. $multi_values .= '<a href="#"';
  39. $multi_values .= ' onclick="setSelectOptions(\'dump\', \'table_select[]\', false);'
  40. . ' return false;">';
  41. $multi_values .= __('Unselect All');
  42. $multi_values .= '</a><br />';
  43. $multi_values .= '<select name="table_select[]" id="table_select" size="10"'
  44. . ' multiple="multiple">';
  45. $multi_values .= "\n";
  46. // when called by libraries/mult_submits.inc.php
  47. if (!empty($_POST['selected_tbl']) && empty($table_select)) {
  48. $table_select = $_POST['selected_tbl'];
  49. }
  50. // Check if the selected tables are defined in $_GET
  51. // (from clicking Back button on export.php)
  52. if (isset($_GET['table_select'])) {
  53. $_GET['table_select'] = urldecode($_GET['table_select']);
  54. $_GET['table_select'] = explode(",", $_GET['table_select']);
  55. }
  56. foreach ($tables as $each_table) {
  57. if (isset($_GET['table_select'])) {
  58. if (in_array($each_table['Name'], $_GET['table_select'])) {
  59. $is_selected = ' selected="selected"';
  60. } else {
  61. $is_selected = '';
  62. }
  63. } elseif (isset($table_select)) {
  64. if (in_array($each_table['Name'], $table_select)) {
  65. $is_selected = ' selected="selected"';
  66. } else {
  67. $is_selected = '';
  68. }
  69. } else {
  70. $is_selected = ' selected="selected"';
  71. }
  72. $table_html = htmlspecialchars($each_table['Name']);
  73. $multi_values .= ' <option value="' . $table_html . '"'
  74. . $is_selected . '>'
  75. . str_replace(' ', '&nbsp;', $table_html) . '</option>' . "\n";
  76. } // end for
  77. $multi_values .= "\n";
  78. $multi_values .= '</select></div>';
  79. $export_type = 'database';
  80. require_once 'libraries/display_export.inc.php';
  81. ?>