2 /* vim: set expandtab sw=4 ts=4 sts=4: */
8 use PhpMyAdmin\Config\PageSettings
;
9 use PhpMyAdmin\Display\Export
;
10 use PhpMyAdmin\Relation
;
11 use PhpMyAdmin\Response
;
16 require_once 'libraries/common.inc.php';
18 PageSettings
::showGroup('Export');
20 $response = Response
::getInstance();
21 $header = $response->getHeader();
22 $scripts = $header->getScripts();
23 $scripts->addFile('export.js');
25 // Get the relation settings
26 $relation = new Relation();
27 $cfgRelation = $relation->getRelationsParam();
29 $displayExport = new Export();
31 // handling export template actions
32 if (isset($_POST['templateAction']) && $cfgRelation['exporttemplateswork']) {
33 $displayExport->handleTemplateActions($cfgRelation);
38 * Gets tables information and displays top links
40 require_once 'libraries/tbl_common.inc.php';
41 $url_query .= '&goto=tbl_export.php&back=tbl_export.php';
45 $export_page_title = __('View dump (schema) of table');
47 // When we have some query, we need to remove LIMIT from that and possibly
48 // generate WHERE clause (if we are asked to export specific rows)
50 if (! empty($sql_query)) {
51 $parser = new PhpMyAdmin\SqlParser\
Parser($sql_query);
53 if ((!empty($parser->statements
[0]))
54 && ($parser->statements
[0] instanceof PhpMyAdmin\SqlParser\Statements\SelectStatement
)
56 // Checking if the WHERE clause has to be replaced.
57 if ((!empty($where_clause)) && (is_array($where_clause))) {
59 'WHERE', 'WHERE (' . implode(') OR (', $where_clause) . ')'
63 // Preparing to remove the LIMIT clause.
64 $replaces[] = array('LIMIT', '');
66 // Replacing the clauses.
67 $sql_query = PhpMyAdmin\SqlParser\Utils\Query
::replaceClauses(
68 $parser->statements
[0],
74 echo PhpMyAdmin\Util
::getMessage(PhpMyAdmin\Message
::success());
77 if (! isset($sql_query)) {
80 if (! isset($num_tables)) {
83 if (! isset($unlim_num_rows)) {
86 if (! isset($multi_values)) {
89 $response = Response
::getInstance();
91 $displayExport->getDisplay(
92 'table', $db, $table, $sql_query, $num_tables,
93 $unlim_num_rows, $multi_values