Translated using Weblate (Slovenian)
[phpmyadmin.git] / db_export.php
blobf33b97266db617d5f712b37942d7cd3094453177
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';
15 PMA_PageSettings::showGroup('Export');
17 $response = PMA_Response::getInstance();
18 $header = $response->getHeader();
19 $scripts = $header->getScripts();
20 $scripts->addFile('export.js');
22 // $sub_part is also used in db_info.inc.php to see if we are coming from
23 // db_export.php, in which case we don't obey $cfg['MaxTableList']
24 $sub_part = '_export';
25 require_once 'libraries/db_common.inc.php';
26 $url_query .= '&amp;goto=db_export.php';
27 require_once 'libraries/db_info.inc.php';
29 /**
30 * Displays the form
32 $export_page_title = __('View dump (schema) of database');
34 // exit if no tables in db found
35 if ($num_tables < 1) {
36 PMA_Message::error(__('No tables found in database.'))->display();
37 exit;
38 } // end if
40 $multi_values = '<div class="export_table_list_container">';
41 if (isset($_GET['structure_or_data_forced'])) {
42 $force_val = htmlspecialchars($_GET['structure_or_data_forced']);
43 } else {
44 $force_val = 0;
46 $multi_values .= '<input type="hidden" name="structure_or_data_forced" value="' . $force_val . '">';
47 $multi_values .= '<table class="export_table_select">'
48 . '<thead><tr><th></th>'
49 . '<th>' . __('Tables') . '</th>'
50 . '<th class="export_structure">' . __('Structure') . '</th>'
51 . '<th class="export_data">' . __('Data') . '</th>'
52 . '</tr><tr>'
53 . '<td></td>'
54 . '<td class="export_table_name all">' . __('Select all') . '</td>'
55 . '<td class="export_structure all"><input type="checkbox" id="table_structure_all" /></td>'
56 . '<td class="export_data all"><input type="checkbox" id="table_data_all" /></td>'
57 . '</tr></thead>'
58 . '<tbody>';
59 $multi_values .= "\n";
61 // when called by libraries/mult_submits.inc.php
62 if (!empty($_POST['selected_tbl']) && empty($table_select)) {
63 $table_select = $_POST['selected_tbl'];
66 // Check if the selected tables are defined in $_GET
67 // (from clicking Back button on export.php)
68 if (isset($_GET['table_select'])) {
69 $_GET['table_select'] = urldecode($_GET['table_select']);
70 $_GET['table_select'] = explode(",", $_GET['table_select']);
72 if (isset($_GET['table_structure'])) {
73 $_GET['table_structure'] = urldecode($_GET['table_structure']);
74 $_GET['table_structure'] = explode(",", $_GET['table_structure']);
76 if (isset($_GET['table_data'])) {
77 $_GET['table_data'] = urldecode($_GET['table_data']);
78 $_GET['table_data'] = explode(",", $_GET['table_data']);
81 foreach ($tables as $each_table) {
82 if (isset($_GET['table_select'])) {
83 if (in_array($each_table['Name'], $_GET['table_select'])) {
84 $is_checked = ' checked="checked"';
85 } else {
86 $is_checked = '';
88 } elseif (isset($table_select)) {
89 if (in_array($each_table['Name'], $table_select)) {
90 $is_checked = ' checked="checked"';
91 } else {
92 $is_checked = '';
94 } else {
95 $is_checked = ' checked="checked"';
97 if (isset($_GET['table_structure'])) {
98 if (in_array($each_table['Name'], $_GET['table_structure'])) {
99 $str_checked = ' checked="checked"';
100 } else {
101 $str_checked = '';
103 } else {
104 $str_checked = $is_checked;
106 if (isset($_GET['table_data'])) {
107 if (in_array($each_table['Name'], $_GET['table_data'])) {
108 $data_checked = ' checked="checked"';
109 } else {
110 $data_checked = '';
112 } else {
113 $data_checked = $is_checked;
115 $table_html = htmlspecialchars($each_table['Name']);
116 $multi_values .= '<tr>';
117 $multi_values .= '<td><input type="checkbox" name="table_select[]"'
118 . ' value="' . $table_html . '"' . $is_checked . ' /></td>';
119 $multi_values .= '<td class="export_table_name">' . str_replace(' ', '&nbsp;', $table_html) . '</td>';
120 $multi_values .= '<td class="export_structure"><input type="checkbox" name="table_structure[]"'
121 . ' value="' . $table_html . '"' . $str_checked . ' /></td>';
122 $multi_values .= '<td class="export_data"><input type="checkbox" name="table_data[]"'
123 . ' value="' . $table_html . '"' . $data_checked . ' /></td>';
124 $multi_values .= '</tr>';
125 } // end for
127 $multi_values .= "\n";
128 $multi_values .= '</tbody></table></div>';
130 $export_type = 'database';
131 require_once 'libraries/display_export.inc.php';