Translated using Weblate (Slovenian)
[phpmyadmin.git] / db_export.php
blob67871bd654b11d9389f168061e5fafb0c33b109c
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="' . $force_val . '">';
48 $multi_values .= '<table class="export_table_select">'
49 . '<thead><tr><th></th>'
50 . '<th>' . __('Tables') . '</th>'
51 . '<th class="export_structure">' . __('Structure') . '</th>'
52 . '<th class="export_data">' . __('Data') . '</th>'
53 . '</tr><tr>'
54 . '<td></td>'
55 . '<td class="export_table_name all">' . __('Select all') . '</td>'
56 . '<td class="export_structure all"><input type="checkbox" id="table_structure_all" /></td>'
57 . '<td class="export_data all"><input type="checkbox" id="table_data_all" /></td>'
58 . '</tr></thead>'
59 . '<tbody>';
60 $multi_values .= "\n";
62 // when called by libraries/mult_submits.inc.php
63 if (!empty($_POST['selected_tbl']) && empty($table_select)) {
64 $table_select = $_POST['selected_tbl'];
67 // Check if the selected tables are defined in $_GET
68 // (from clicking Back button on export.php)
69 foreach (array('table_select', 'table_structure', 'table_data') as $one_key) {
70 if (isset($_GET[$one_key])) {
71 $_GET[$one_key] = urldecode($_GET[$one_key]);
72 $_GET[$one_key] = explode(",", $_GET[$one_key]);
76 foreach ($tables as $each_table) {
77 if (isset($_GET['table_select'])) {
78 $is_checked = PMA_getCheckedClause(
79 $each_table['Name'], $_GET['table_select']
81 } elseif (isset($table_select)) {
82 $is_checked = PMA_getCheckedClause(
83 $each_table['Name'], $table_select
85 } else {
86 $is_checked = ' checked="checked"';
88 if (isset($_GET['table_structure'])) {
89 $structure_checked = PMA_getCheckedClause(
90 $each_table['Name'], $_GET['table_structure']
92 } else {
93 $structure_checked = $is_checked;
95 if (isset($_GET['table_data'])) {
96 $data_checked = PMA_getCheckedClause(
97 $each_table['Name'], $_GET['table_data']
99 } else {
100 $data_checked = $is_checked;
102 $table_html = htmlspecialchars($each_table['Name']);
103 $multi_values .= '<tr>';
104 $multi_values .= '<td><input type="checkbox" name="table_select[]"'
105 . ' value="' . $table_html . '"' . $is_checked . ' /></td>';
106 $multi_values .= '<td class="export_table_name">' . str_replace(' ', '&nbsp;', $table_html) . '</td>';
107 $multi_values .= '<td class="export_structure"><input type="checkbox" name="table_structure[]"'
108 . ' value="' . $table_html . '"' . $structure_checked . ' /></td>';
109 $multi_values .= '<td class="export_data"><input type="checkbox" name="table_data[]"'
110 . ' value="' . $table_html . '"' . $data_checked . ' /></td>';
111 $multi_values .= '</tr>';
112 } // end for
114 $multi_values .= "\n";
115 $multi_values .= '</tbody></table></div>';
117 $export_type = 'database';
118 require_once 'libraries/display_export.inc.php';