Translated using Weblate (Arabic)
[phpmyadmin.git] / tbl_export.php
bloba56554577cd9a289c60df80967249de87f5eb97f
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Table export
6 * @package PhpMyAdmin
7 */
8 use PhpMyAdmin\Config\PageSettings;
9 use PhpMyAdmin\Display\Export;
10 use PhpMyAdmin\Relation;
11 use PhpMyAdmin\Response;
13 /**
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);
34 exit;
37 /**
38 * Gets tables information and displays top links
40 require_once 'libraries/tbl_common.inc.php';
41 $url_query .= '&amp;goto=tbl_export.php&amp;back=tbl_export.php';
43 // Dump of a table
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)
55 ) {
56 // Checking if the WHERE clause has to be replaced.
57 if ((!empty($where_clause)) && (is_array($where_clause))) {
58 $replaces[] = array(
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],
69 $parser->list,
70 $replaces
74 echo PhpMyAdmin\Util::getMessage(PhpMyAdmin\Message::success());
77 if (! isset($sql_query)) {
78 $sql_query = '';
80 if (! isset($num_tables)) {
81 $num_tables = 0;
83 if (! isset($unlim_num_rows)) {
84 $unlim_num_rows = 0;
86 if (! isset($multi_values)) {
87 $multi_values = '';
89 $response = Response::getInstance();
90 $response->addHTML(
91 $displayExport->getDisplay(
92 'table', $db, $table, $sql_query, $num_tables,
93 $unlim_num_rows, $multi_values