Translated using Weblate (French)
[phpmyadmin.git] / db_export.php
blob1657a87bf866f27c6bdcd1dbbfb12802f6792fd5
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';
13 require_once 'libraries/config/page_settings.class.php';
14 require_once 'libraries/export.lib.php';
16 PMA_PageSettings::showGroup('Export');
18 $response = PMA_Response::getInstance();
19 $header = $response->getHeader();
20 $scripts = $header->getScripts();
21 $scripts->addFile('export.js');
23 // $sub_part is also used in db_info.inc.php to see if we are coming from
24 // db_export.php, in which case we don't obey $cfg['MaxTableList']
25 $sub_part = '_export';
26 require_once 'libraries/db_common.inc.php';
27 $url_query .= '&amp;goto=db_export.php';
28 require_once 'libraries/db_info.inc.php';
30 /**
31 * Displays the form
33 $export_page_title = __('View dump (schema) of database');
35 // exit if no tables in db found
36 if ($num_tables < 1) {
37 PMA_Message::error(__('No tables found in database.'))->display();
38 exit;
39 } // end if
41 $multi_values = '<div class="export_table_list_container">';
42 if (isset($_GET['structure_or_data_forced'])) {
43 $force_val = htmlspecialchars($_GET['structure_or_data_forced']);
44 } else {
45 $force_val = 0;
47 $multi_values .= '<input type="hidden" name="structure_or_data_forced" value="'
48 . $force_val . '">';
49 $multi_values .= '<table class="export_table_select">'
50 . '<thead><tr><th></th>'
51 . '<th>' . __('Tables') . '</th>'
52 . '<th class="export_structure">' . __('Structure') . '</th>'
53 . '<th class="export_data">' . __('Data') . '</th>'
54 . '</tr><tr>'
55 . '<td></td>'
56 . '<td class="export_table_name all">' . __('Select all') . '</td>'
57 . '<td class="export_structure all">'
58 . '<input type="checkbox" id="table_structure_all" /></td>'
59 . '<td class="export_data all"><input type="checkbox" id="table_data_all" />'
60 . '</td>'
61 . '</tr></thead>'
62 . '<tbody>';
63 $multi_values .= "\n";
65 // when called by libraries/mult_submits.inc.php
66 if (!empty($_POST['selected_tbl']) && empty($table_select)) {
67 $table_select = $_POST['selected_tbl'];
70 // Check if the selected tables are defined in $_GET
71 // (from clicking Back button on export.php)
72 foreach (array('table_select', 'table_structure', 'table_data') as $one_key) {
73 if (isset($_GET[$one_key])) {
74 $_GET[$one_key] = urldecode($_GET[$one_key]);
75 $_GET[$one_key] = explode(",", $_GET[$one_key]);
79 foreach ($tables as $each_table) {
80 if (isset($_GET['table_select'])) {
81 $is_checked = PMA_getCheckedClause(
82 $each_table['Name'], $_GET['table_select']
84 } elseif (isset($table_select)) {
85 $is_checked = PMA_getCheckedClause(
86 $each_table['Name'], $table_select
88 } else {
89 $is_checked = ' checked="checked"';
91 if (isset($_GET['table_structure'])) {
92 $structure_checked = PMA_getCheckedClause(
93 $each_table['Name'], $_GET['table_structure']
95 } else {
96 $structure_checked = $is_checked;
98 if (isset($_GET['table_data'])) {
99 $data_checked = PMA_getCheckedClause(
100 $each_table['Name'], $_GET['table_data']
102 } else {
103 $data_checked = $is_checked;
105 $table_html = htmlspecialchars($each_table['Name']);
106 $multi_values .= '<tr>';
107 $multi_values .= '<td><input type="checkbox" name="table_select[]"'
108 . ' value="' . $table_html . '"' . $is_checked . ' /></td>';
109 $multi_values .= '<td class="export_table_name">'
110 . str_replace(' ', '&nbsp;', $table_html) . '</td>';
111 $multi_values .= '<td class="export_structure">'
112 . '<input type="checkbox" name="table_structure[]"'
113 . ' value="' . $table_html . '"' . $structure_checked . ' /></td>';
114 $multi_values .= '<td class="export_data">'
115 . '<input type="checkbox" name="table_data[]"'
116 . ' value="' . $table_html . '"' . $data_checked . ' /></td>';
117 $multi_values .= '</tr>';
118 } // end for
120 $multi_values .= "\n";
121 $multi_values .= '</tbody></table></div>';
123 $export_type = 'database';
124 require_once 'libraries/display_export.inc.php';