Translated using Weblate (Indonesian)
[phpmyadmin.git] / db_export.php
blob61a01a1189b6212cdd813a4b2851024d6baf7de7
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * dumps a database
6 * @package PhpMyAdmin
7 */
8 use PhpMyAdmin\Config\PageSettings;
9 use PhpMyAdmin\Response;
11 /**
12 * Gets some core libraries
14 require_once 'libraries/common.inc.php';
15 require_once 'libraries/config/user_preferences.forms.php';
16 require_once 'libraries/config/page_settings.forms.php';
17 require_once 'libraries/export.lib.php';
19 PageSettings::showGroup('Export');
21 $response = Response::getInstance();
22 $header = $response->getHeader();
23 $scripts = $header->getScripts();
24 $scripts->addFile('export.js');
26 // $sub_part is used in PhpMyAdmin\Util::getDbInfo() to see if we are coming from
27 // db_export.php, in which case we don't obey $cfg['MaxTableList']
28 $sub_part = '_export';
29 require_once 'libraries/db_common.inc.php';
30 $url_query .= '&amp;goto=db_export.php';
32 list(
33 $tables,
34 $num_tables,
35 $total_num_tables,
36 $sub_part,
37 $is_show_stats,
38 $db_is_system_schema,
39 $tooltip_truename,
40 $tooltip_aliasname,
41 $pos
42 ) = PhpMyAdmin\Util::getDbInfo($db, isset($sub_part) ? $sub_part : '');
44 /**
45 * Displays the form
47 $export_page_title = __('View dump (schema) of database');
49 // exit if no tables in db found
50 if ($num_tables < 1) {
51 $response->addHTML(
52 PhpMyAdmin\Message::error(__('No tables found in database.'))->getDisplay()
54 exit;
55 } // end if
57 $multi_values = '<div class="export_table_list_container">';
58 if (isset($_GET['structure_or_data_forced'])) {
59 $force_val = htmlspecialchars($_GET['structure_or_data_forced']);
60 } else {
61 $force_val = 0;
63 $multi_values .= '<input type="hidden" name="structure_or_data_forced" value="'
64 . $force_val . '">';
65 $multi_values .= '<table class="export_table_select">'
66 . '<thead><tr><th></th>'
67 . '<th>' . __('Tables') . '</th>'
68 . '<th class="export_structure">' . __('Structure') . '</th>'
69 . '<th class="export_data">' . __('Data') . '</th>'
70 . '</tr><tr>'
71 . '<td></td>'
72 . '<td class="export_table_name all">' . __('Select all') . '</td>'
73 . '<td class="export_structure all">'
74 . '<input type="checkbox" id="table_structure_all" /></td>'
75 . '<td class="export_data all"><input type="checkbox" id="table_data_all" />'
76 . '</td>'
77 . '</tr></thead>'
78 . '<tbody>';
79 $multi_values .= "\n";
81 // when called by libraries/mult_submits.inc.php
82 if (!empty($_POST['selected_tbl']) && empty($table_select)) {
83 $table_select = $_POST['selected_tbl'];
86 // Check if the selected tables are defined in $_GET
87 // (from clicking Back button on export.php)
88 foreach (array('table_select', 'table_structure', 'table_data') as $one_key) {
89 if (isset($_GET[$one_key])) {
90 $_GET[$one_key] = urldecode($_GET[$one_key]);
91 $_GET[$one_key] = explode(",", $_GET[$one_key]);
95 foreach ($tables as $each_table) {
96 if (isset($_GET['table_select']) && is_array($_GET['table_select'])) {
97 $is_checked = PMA_getCheckedClause(
98 $each_table['Name'], $_GET['table_select']
100 } elseif (isset($table_select)) {
101 $is_checked = PMA_getCheckedClause(
102 $each_table['Name'], $table_select
104 } else {
105 $is_checked = ' checked="checked"';
107 if (isset($_GET['table_structure']) && is_array($_GET['table_structure'])) {
108 $structure_checked = PMA_getCheckedClause(
109 $each_table['Name'], $_GET['table_structure']
111 } else {
112 $structure_checked = $is_checked;
114 if (isset($_GET['table_data']) && is_array($_GET['table_data'])) {
115 $data_checked = PMA_getCheckedClause(
116 $each_table['Name'], $_GET['table_data']
118 } else {
119 $data_checked = $is_checked;
121 $table_html = htmlspecialchars($each_table['Name']);
122 $multi_values .= '<tr class="marked">';
123 $multi_values .= '<td><input type="checkbox" name="table_select[]"'
124 . ' value="' . $table_html . '"' . $is_checked . ' class="checkall"/></td>';
125 $multi_values .= '<td class="export_table_name">'
126 . str_replace(' ', '&nbsp;', $table_html) . '</td>';
127 $multi_values .= '<td class="export_structure">'
128 . '<input type="checkbox" name="table_structure[]"'
129 . ' value="' . $table_html . '"' . $structure_checked . ' /></td>';
130 $multi_values .= '<td class="export_data">'
131 . '<input type="checkbox" name="table_data[]"'
132 . ' value="' . $table_html . '"' . $data_checked . ' /></td>';
133 $multi_values .= '</tr>';
134 } // end for
136 $multi_values .= "\n";
137 $multi_values .= '</tbody></table></div>';
139 require_once 'libraries/display_export.lib.php';
140 if (! isset($sql_query)) {
141 $sql_query = '';
143 if (! isset($num_tables)) {
144 $num_tables = 0;
146 if (! isset($unlim_num_rows)) {
147 $unlim_num_rows = 0;
149 if (! isset($multi_values)) {
150 $multi_values = '';
152 $response = Response::getInstance();
153 $response->addHTML(
154 PMA_getExportDisplay(
155 'database', $db, $table, $sql_query, $num_tables,
156 $unlim_num_rows, $multi_values