db_export.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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); return false;">';
  34. $multi_values .= __('Select All');
  35. $multi_values .= '</a>';
  36. $multi_values .= ' / ';
  37. $multi_values .= '<a href="#"';
  38. $multi_values .= ' onclick="setSelectOptions(\'dump\', \'table_select[]\', false); return false;">';
  39. $multi_values .= __('Unselect All');
  40. $multi_values .= '</a><br />';
  41. $multi_values .= '<select name="table_select[]" id="table_select" size="10" multiple="multiple">';
  42. $multi_values .= "\n";
  43. if (!empty($selected_tbl) && empty($table_select)) {
  44. $table_select = $selected_tbl;
  45. }
  46. // Check if the selected tables are defined in $_GET
  47. // (from clicking Back button on export.php)
  48. if (isset($_GET['table_select'])) {
  49. $_GET['table_select'] = urldecode($_GET['table_select']);
  50. $_GET['table_select'] = explode(",", $_GET['table_select']);
  51. }
  52. foreach ($tables as $each_table) {
  53. if (isset($_GET['table_select'])) {
  54. if (in_array($each_table['Name'], $_GET['table_select'])) {
  55. $is_selected = ' selected="selected"';
  56. } else {
  57. $is_selected = '';
  58. }
  59. } elseif (isset($table_select)) {
  60. if (in_array($each_table['Name'], $table_select)) {
  61. $is_selected = ' selected="selected"';
  62. } else {
  63. $is_selected = '';
  64. }
  65. } else {
  66. $is_selected = ' selected="selected"';
  67. }
  68. $table_html = htmlspecialchars($each_table['Name']);
  69. $multi_values .= ' <option value="' . $table_html . '"'
  70. . $is_selected . '>'
  71. . str_replace(' ', '&nbsp;', $table_html) . '</option>' . "\n";
  72. } // end for
  73. $multi_values .= "\n";
  74. $multi_values .= '</select></div>';
  75. $export_type = 'database';
  76. require_once 'libraries/display_export.lib.php';
  77. ?>