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