Merge remote branch 'origin/master'
[phpmyadmin/dkf.git] / db_export.php
bloba24ed18d7bd8e24c516386d50932b3aa7dabbd37
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * dumps a database
6 * @uses libraries/db_common.inc.php
7 * @uses libraries/db_info.inc.php
8 * @uses libraries/display_export.lib.php
9 * @uses $tables from libraries/db_info.inc.php
10 * @package phpMyAdmin
13 /**
14 * Gets some core libraries
16 require_once './libraries/common.inc.php';
18 $GLOBALS['js_include'][] = 'export.js';
20 // $sub_part is also used in db_info.inc.php to see if we are coming from
21 // db_export.php, in which case we don't obey $cfg['MaxTableList']
22 $sub_part = '_export';
23 require_once './libraries/db_common.inc.php';
24 $url_query .= '&amp;goto=db_export.php';
25 require_once './libraries/db_info.inc.php';
27 /**
28 * Displays the form
30 $export_page_title = __('View dump (schema) of database');
32 // exit if no tables in db found
33 if ($num_tables < 1) {
34 PMA_Message::error(__('No tables found in database.'))->display();
35 require './libraries/footer.inc.php';
36 exit;
37 } // end if
39 $checkall_url = 'db_export.php?'
40 . PMA_generate_common_url($db)
41 . '&amp;goto=db_export.php';
43 $multi_values = '<div>';
44 $multi_values .= '<a href="' . $checkall_url . '" onclick="setSelectOptions(\'dump\', \'table_select[]\', true); return false;">' . __('Select All') . '</a>
46 <a href="' . $checkall_url . '&amp;unselectall=1" onclick="setSelectOptions(\'dump\', \'table_select[]\', false); return false;">' . __('Unselect All') . '</a><br />';
48 $multi_values .= '<select name="table_select[]" id="table_select" size="10" multiple="multiple">';
49 $multi_values .= "\n";
51 if (!empty($selected_tbl) && empty($table_select)) {
52 $table_select = $selected_tbl;
55 // Check if the selected tables are defined in $_GET (from clicking Back button on export.php)
56 if(isset($_GET['table_select'])) {
57 $_GET['table_select'] = urldecode($_GET['table_select']);
58 $_GET['table_select'] = explode(",", $_GET['table_select']);
61 foreach ($tables as $each_table) {
62 if(isset($_GET['table_select'])) {
63 if(in_array($each_table['Name'], $_GET['table_select'])) {
64 $is_selected = ' selected="selected"';
65 } else {
66 $is_selected = '';
68 } elseif (! empty($unselectall)
69 || (! empty($table_select) && !in_array($each_table['Name'], $table_select))) {
70 $is_selected = '';
71 } else {
72 $is_selected = ' selected="selected"';
74 $table_html = htmlspecialchars($each_table['Name']);
75 $multi_values .= ' <option value="' . $table_html . '"'
76 . $is_selected . '>'
77 . str_replace(' ', '&nbsp;', $table_html) . '</option>' . "\n";
78 } // end for
80 $multi_values .= "\n";
81 $multi_values .= '</select></div>';
83 $export_type = 'database';
84 require_once './libraries/display_export.lib.php';
86 /**
87 * Displays the footer
89 require './libraries/footer.inc.php';