Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libraries/classes/Display/Export.php160
-rw-r--r--phpstan-baseline.neon10
-rw-r--r--templates/display/export/display.twig377
-rw-r--r--templates/display/export/options.twig378
-rw-r--r--test/classes/Display/ExportTest.php19
5 files changed, 440 insertions, 504 deletions
diff --git a/libraries/classes/Display/Export.php b/libraries/classes/Display/Export.php
index 0e5640ef90..688d54d79a 100644
--- a/libraries/classes/Display/Export.php
+++ b/libraries/classes/Display/Export.php
@@ -106,98 +106,15 @@ class Export
}
/**
- * Prints Html For Export Options
- *
- * @param string $exportType Selected Export Type
- * @param string $db Selected DB
- * @param string $table Selected Table
- * @param string $multiValues Export selection
- * @param string $numTables number of tables
- * @param ExportPlugin[] $exportList Export List
- * @param string $unlimNumRows Number of Rows
- *
- * @return string
- */
- public function getHtmlForOptions(
- $exportType,
- $db,
- $table,
- $multiValues,
- $numTables,
- $exportList,
- $unlimNumRows
- ) {
- global $cfg;
-
- $dropdown = Plugins::getChoice('Export', 'what', $exportList, 'format');
- $tableObject = new Table($table, $db);
- $rows = [];
-
- if (strlen($table) > 0 && empty($numTables) && ! $tableObject->isMerge() && $exportType !== 'raw') {
- $rows = [
- 'allrows' => $_POST['allrows'] ?? null,
- 'limit_to' => $_POST['limit_to'] ?? null,
- 'limit_from' => $_POST['limit_from'] ?? null,
- 'unlim_num_rows' => $unlimNumRows,
- 'number_of_rows' => $tableObject->countRecords(),
- ];
- }
-
- $hasAliases = isset($_SESSION['tmpval']['aliases']) && ! Core::emptyRecursive($_SESSION['tmpval']['aliases']);
- $aliases = $_SESSION['tmpval']['aliases'] ?? [];
- unset($_SESSION['tmpval']['aliases']);
- $filenameTemplate = $this->getFileNameTemplate($exportType, $_POST['filename_template'] ?? null);
- $isEncodingSupported = Encoding::isSupported();
- $selectedCompression = $_POST['compression'] ?? $cfg['Export']['compression'] ?? 'none';
-
- if (isset($cfg['Export']['as_separate_files']) && $cfg['Export']['as_separate_files']) {
- $selectedCompression = 'zip';
- }
-
- return $this->template->render('display/export/options', [
- 'export_method' => $_POST['quick_or_custom'] ?? $cfg['Export']['method'] ?? '',
- 'dropdown' => $dropdown,
- 'export_type' => $exportType,
- 'multi_values' => $multiValues,
- 'options' => Plugins::getOptions('Export', $exportList),
- 'can_convert_kanji' => Encoding::canConvertKanji(),
- 'exec_time_limit' => $cfg['ExecTimeLimit'],
- 'rows' => $rows,
- 'has_save_dir' => isset($cfg['SaveDir']) && ! empty($cfg['SaveDir']),
- 'save_dir' => Util::userDir($cfg['SaveDir'] ?? ''),
- 'export_is_checked' => $this->checkboxCheck('quick_export_onserver'),
- 'export_overwrite_is_checked' => $this->checkboxCheck('quick_export_onserver_overwrite'),
- 'has_aliases' => $hasAliases,
- 'aliases' => $aliases,
- 'is_checked_lock_tables' => $this->checkboxCheck('lock_tables'),
- 'is_checked_asfile' => $this->checkboxCheck('asfile'),
- 'is_checked_as_separate_files' => $this->checkboxCheck('as_separate_files'),
- 'is_checked_export' => $this->checkboxCheck('onserver'),
- 'is_checked_export_overwrite' => $this->checkboxCheck('onserver_overwrite'),
- 'is_checked_remember_file_template' => $this->checkboxCheck('remember_file_template'),
- 'repopulate' => isset($_POST['repopulate']),
- 'lock_tables' => isset($_POST['lock_tables']),
- 'is_encoding_supported' => $isEncodingSupported,
- 'encodings' => $isEncodingSupported ? Encoding::listEncodings() : [],
- 'export_charset' => $cfg['Export']['charset'],
- 'export_asfile' => $cfg['Export']['asfile'],
- 'has_zip' => $cfg['ZipDump'] && function_exists('gzcompress'),
- 'has_gzip' => $cfg['GZipDump'] && function_exists('gzencode'),
- 'selected_compression' => $selectedCompression,
- 'filename_template' => $filenameTemplate,
- ]);
- }
-
- /**
* Gets HTML to display export dialogs
*
- * @param string $exportType export type: server|database|table
- * @param string $db selected DB
- * @param string $table selected table
- * @param string $sqlQuery SQL query
- * @param int $numTables number of tables
- * @param int $unlimNumRows unlimited number of rows
- * @param string $multiValues selector options
+ * @param string $exportType export type: server|database|table
+ * @param string $db selected DB
+ * @param string $table selected table
+ * @param string $sqlQuery SQL query
+ * @param int|string $numTables number of tables
+ * @param int|string $unlimNumRows unlimited number of rows
+ * @param string $multiValues selector options
*
* @return string
*/
@@ -254,15 +171,30 @@ class Export
$templates = is_array($templates) ? $templates : [];
}
- $options = $this->getHtmlForOptions(
- $exportType,
- $db,
- $table,
- $multiValues,
- $numTables,
- $exportList,
- $unlimNumRows
- );
+ $dropdown = Plugins::getChoice('Export', 'what', $exportList, 'format');
+ $tableObject = new Table($table, $db);
+ $rows = [];
+
+ if (strlen($table) > 0 && empty($numTables) && ! $tableObject->isMerge() && $exportType !== 'raw') {
+ $rows = [
+ 'allrows' => $_POST['allrows'] ?? null,
+ 'limit_to' => $_POST['limit_to'] ?? null,
+ 'limit_from' => $_POST['limit_from'] ?? null,
+ 'unlim_num_rows' => $unlimNumRows,
+ 'number_of_rows' => $tableObject->countRecords(),
+ ];
+ }
+
+ $hasAliases = isset($_SESSION['tmpval']['aliases']) && ! Core::emptyRecursive($_SESSION['tmpval']['aliases']);
+ $aliases = $_SESSION['tmpval']['aliases'] ?? [];
+ unset($_SESSION['tmpval']['aliases']);
+ $filenameTemplate = $this->getFileNameTemplate($exportType, $_POST['filename_template'] ?? null);
+ $isEncodingSupported = Encoding::isSupported();
+ $selectedCompression = $_POST['compression'] ?? $cfg['Export']['compression'] ?? 'none';
+
+ if (isset($cfg['Export']['as_separate_files']) && $cfg['Export']['as_separate_files']) {
+ $selectedCompression = 'zip';
+ }
$hiddenInputs = [
'db' => $db,
@@ -291,7 +223,35 @@ class Export
],
'sql_query' => $sqlQuery,
'hidden_inputs' => $hiddenInputs,
- 'options' => $options,
+ 'export_method' => $_POST['quick_or_custom'] ?? $cfg['Export']['method'] ?? '',
+ 'dropdown' => $dropdown,
+ 'multi_values' => $multiValues,
+ 'options' => Plugins::getOptions('Export', $exportList),
+ 'can_convert_kanji' => Encoding::canConvertKanji(),
+ 'exec_time_limit' => $cfg['ExecTimeLimit'],
+ 'rows' => $rows,
+ 'has_save_dir' => isset($cfg['SaveDir']) && ! empty($cfg['SaveDir']),
+ 'save_dir' => Util::userDir($cfg['SaveDir'] ?? ''),
+ 'export_is_checked' => $this->checkboxCheck('quick_export_onserver'),
+ 'export_overwrite_is_checked' => $this->checkboxCheck('quick_export_onserver_overwrite'),
+ 'has_aliases' => $hasAliases,
+ 'aliases' => $aliases,
+ 'is_checked_lock_tables' => $this->checkboxCheck('lock_tables'),
+ 'is_checked_asfile' => $this->checkboxCheck('asfile'),
+ 'is_checked_as_separate_files' => $this->checkboxCheck('as_separate_files'),
+ 'is_checked_export' => $this->checkboxCheck('onserver'),
+ 'is_checked_export_overwrite' => $this->checkboxCheck('onserver_overwrite'),
+ 'is_checked_remember_file_template' => $this->checkboxCheck('remember_file_template'),
+ 'repopulate' => isset($_POST['repopulate']),
+ 'lock_tables' => isset($_POST['lock_tables']),
+ 'is_encoding_supported' => $isEncodingSupported,
+ 'encodings' => $isEncodingSupported ? Encoding::listEncodings() : [],
+ 'export_charset' => $cfg['Export']['charset'],
+ 'export_asfile' => $cfg['Export']['asfile'],
+ 'has_zip' => $cfg['ZipDump'] && function_exists('gzcompress'),
+ 'has_gzip' => $cfg['GZipDump'] && function_exists('gzencode'),
+ 'selected_compression' => $selectedCompression,
+ 'filename_template' => $filenameTemplate,
]);
}
diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon
index c34098a13a..da499c0faf 100644
--- a/phpstan-baseline.neon
+++ b/phpstan-baseline.neon
@@ -641,16 +641,6 @@ parameters:
path: libraries/classes/Dbal/DbiMysqli.php
-
- message: "#^Parameter \\#5 \\$numTables of method PhpMyAdmin\\\\Display\\\\Export\\:\\:getHtmlForOptions\\(\\) expects string, int given\\.$#"
- count: 1
- path: libraries/classes/Display/Export.php
-
- -
- message: "#^Parameter \\#7 \\$unlimNumRows of method PhpMyAdmin\\\\Display\\\\Export\\:\\:getHtmlForOptions\\(\\) expects string, int given\\.$#"
- count: 1
- path: libraries/classes/Display/Export.php
-
- -
message: "#^Left side of && is always true\\.$#"
count: 1
path: libraries/classes/Display/Results.php
diff --git a/templates/display/export/display.twig b/templates/display/export/display.twig
index fe8cd21c88..193f685715 100644
--- a/templates/display/export/display.twig
+++ b/templates/display/export/display.twig
@@ -68,5 +68,380 @@
<form method="post" action="{{ url('/export') }}" name="dump" class="disableAjax">
{{ get_hidden_inputs(hidden_inputs) }}
- {{ options|raw }}
+ {% if export_method != 'custom-no-form' %}
+ <div class="exportoptions" id="quick_or_custom">
+ <h3>{% trans 'Export method:' %}</h3>
+ <ul>
+ <li>
+ <input type="radio" name="quick_or_custom" value="quick" id="radio_quick_export"
+ {{- export_method == 'quick' ? ' checked' }}>
+ <label for="radio_quick_export">
+ {% trans 'Quick - display only the minimal options' %}
+ </label>
+ </li>
+
+ <li>
+ <input type="radio" name="quick_or_custom" value="custom" id="radio_custom_export"
+ {{- export_method == 'custom' ? ' checked' }}>
+ <label for="radio_custom_export">
+ {% trans 'Custom - display all possible options' %}
+ </label>
+ </li>
+ </ul>
+ </div>
+ {% endif %}
+
+ <div class="exportoptions" id="format">
+ <h3>{% trans 'Format:' %}</h3>
+ {{ dropdown|raw }}
+ </div>
+
+ <div class="exportoptions" id="databases_and_tables">
+ {% if export_type == 'server' %}
+ <h3>{% trans 'Databases:' %}</h3>
+ {% elseif export_type == 'database' %}
+ <h3>{% trans 'Tables:' %}</h3>
+ {% endif %}
+ {% if multi_values is not empty %}
+ {{ multi_values|raw }}
+ {% endif %}
+ </div>
+
+ {% if rows is not empty %}
+ <div class="exportoptions" id="rows">
+ <h3>{% trans 'Rows:' %}</h3>
+ <ul>
+ <li>
+ <input type="radio" name="allrows" value="0" id="radio_allrows_0"
+ {{- rows.allrows is not null and rows.allrows == 0 ? ' checked' }}>
+ <label for="radio_allrows_0">{% trans 'Dump some row(s)' %}</label>
+ <ul>
+ <li>
+ <label for="limit_to">{% trans 'Number of rows:' %}</label>
+ <input type="text" id="limit_to" name="limit_to" size="5" value="
+ {%- if rows.limit_to is not null -%}
+ {{- rows.limit_to -}}
+ {%- elseif rows.unlim_num_rows is not empty and rows.unlim_num_rows != 0 -%}
+ {{- rows.unlim_num_rows -}}
+ {%- else %}
+ {{- rows.number_of_rows -}}
+ {%- endif -%}" onfocus="this.select()">
+ </li>
+ <li>
+ <label for="limit_from">{% trans 'Row to begin at:' %}</label>
+ <input type="text" id="limit_from" name="limit_from" size="5" value="
+ {{- rows.limit_from is not null ? rows.limit_from : 0 }}" onfocus="this.select()">
+ </li>
+ </ul>
+ </li>
+ <li>
+ <input type="radio" name="allrows" value="1" id="radio_allrows_1"
+ {{- rows.allrows is null or rows.allrows == 1 ? ' checked' }}>
+ <label for="radio_allrows_1">{% trans 'Dump all rows' %}</label>
+ </li>
+ </ul>
+ </div>
+ {% endif %}
+
+ {% if has_save_dir %}
+ <div class="exportoptions" id="output_quick_export">
+ <h3>{% trans 'Output:' %}</h3>
+ <ul>
+ <li>
+ <input type="checkbox" name="quick_export_onserver" value="saveit" id="checkbox_quick_dump_onserver"{{ export_is_checked ? ' checked' }}>
+ <label for="checkbox_quick_dump_onserver">
+ {{ 'Save on server in the directory <strong>%s</strong>'|trans|format(save_dir|e)|raw }}
+ </label>
+ </li>
+ <li>
+ <input type="checkbox" name="quick_export_onserver_overwrite" value="saveitover" id="checkbox_quick_dump_onserver_overwrite"
+ {{- export_overwrite_is_checked ? ' checked' }}>
+ <label for="checkbox_quick_dump_onserver_overwrite">
+ {% trans 'Overwrite existing file(s)' %}
+ </label>
+ </li>
+ </ul>
+ </div>
+ {% endif %}
+
+ <div id="alias_modal" class="hide" title="{% trans 'Rename exported databases/tables/columns' %}">
+ <table id="alias_data">
+ <thead>
+ <tr>
+ <th colspan="4">
+ {% trans 'Defined aliases' %}
+ </th>
+ </tr>
+ </thead>
+
+ <tbody>
+ {% for db, db_data in aliases %}
+ {% if db_data.alias is defined and db_data.alias is not null %}
+ <tr>
+ <th>{% trans %}Database{% context %}Alias{% endtrans %}</th>
+ <td>{{ db }}</td>
+ <td>
+ <input name="aliases[{{ db }}][alias]" value="{{ db_data.alias }}" type="text">
+ </td>
+ <td>
+ <button class="alias_remove btn btn-secondary">{% trans 'Remove' %}</button>
+ </td>
+ </tr>
+ {% endif %}
+
+ {% for table, table_data in db_data.tables ?? [] %}
+ {% if table_data.alias is defined and table_data.alias is not null %}
+ <tr>
+ <th>{% trans %}Table{% context %}Alias{% endtrans %}</th>
+ <td>{{ db }}.{{ table }}</td>
+ <td>
+ <input name="aliases[{{ db }}][tables][{{ table }}][alias]" value="{{ table_data.alias }}" type="text">
+ </td>
+ <td>
+ <button class="alias_remove btn btn-secondary">{% trans 'Remove' %}</button>
+ </td>
+ </tr>
+ {% endif %}
+
+ {% for column, column_name in table_data.columns ?? [] %}
+ <tr>
+ <th>{% trans %}Column{% context %}Alias{% endtrans %}</th>
+ <td>{{ db }}.{{ table }}.{{ column }}</td>
+ <td>
+ <input name="aliases[{{ db }}][tables][{{ table }}][colums][{{ column }}]" value="{{ column_name }}" type="text">
+ </td>
+ <td>
+ <button class="alias_remove btn btn-secondary">{% trans 'Remove' %}</button>
+ </td>
+ </tr>
+ {% endfor %}
+ {% endfor %}
+ {% endfor %}
+ </tbody>
+
+ {# Empty row for javascript manipulations. #}
+ <tfoot class="hide">
+ <tr>
+ <th></th>
+ <td></td>
+ <td>
+ <input name="aliases_new" value="" type="text">
+ </td>
+ <td>
+ <button class="alias_remove btn btn-secondary">{% trans 'Remove' %}</button>
+ </td>
+ </tr>
+ </tfoot>
+ </table>
+
+ <table>
+ <thead>
+ <tr>
+ <th colspan="4">{% trans 'Define new aliases' %}</th>
+ </tr>
+ </thead>
+ <tr>
+ <td>
+ <label>{% trans 'Select database:' %}</label>
+ </td>
+ <td>
+ <select id="db_alias_select"><option value=""></option></select>
+ </td>
+ <td>
+ <input id="db_alias_name" placeholder="{% trans 'New database name' %}" disabled="1">
+ </td>
+ <td>
+ <button id="db_alias_button" class="btn btn-secondary" disabled="1">{% trans 'Add' %}</button>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label>{% trans 'Select table:' %}</label>
+ </td>
+ <td>
+ <select id="table_alias_select"><option value=""></option></select>
+ </td>
+ <td>
+ <input id="table_alias_name" placeholder="{% trans 'New table name' %}" disabled="1">
+ </td>
+ <td>
+ <button id="table_alias_button" class="btn btn-secondary" disabled="1">{% trans 'Add' %}</button>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label>{% trans 'Select column:' %}</label>
+ </td>
+ <td>
+ <select id="column_alias_select"><option value=""></option></select>
+ </td>
+ <td>
+ <input id="column_alias_name" placeholder="{% trans 'New column name' %}" disabled="1">
+ </td>
+ <td>
+ <button id="column_alias_button" class="btn btn-secondary" disabled="1">{% trans 'Add' %}</button>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ <div class="exportoptions" id="output">
+ <h3>{% trans 'Output:' %}</h3>
+ <ul id="ul_output">
+ <li>
+ <input type="checkbox" id="btn_alias_config"{{ has_aliases ? ' checked' }}>
+ <label for="btn_alias_config">
+ {% trans 'Rename exported databases/tables/columns' %}
+ </label>
+ </li>
+
+ {% if export_type != 'server' %}
+ <li>
+ <input type="checkbox" name="lock_tables" value="something" id="checkbox_lock_tables"
+ {{- (not repopulate and is_checked_lock_tables) or lock_tables ? ' checked' }}>
+ <label for="checkbox_lock_tables">
+ {{ 'Use %s statement'|trans|format('<code>LOCK TABLES</code>')|raw }}
+ </label>
+ </li>
+ {% endif %}
+
+ <li>
+ <input type="radio" name="output_format" value="sendit" id="radio_dump_asfile"
+ {{- not repopulate and is_checked_asfile ? ' checked' }}>
+ <label for="radio_dump_asfile">
+ {% trans 'Save output to a file' %}
+ </label>
+ <ul id="ul_save_asfile">
+ {% if has_save_dir %}
+ <li>
+ <input type="checkbox" name="onserver" value="saveit" id="checkbox_dump_onserver"{{ is_checked_export ? ' checked' }}>
+ <label for="checkbox_dump_onserver">
+ {{ 'Save on server in the directory <strong>%s</strong>'|trans|format(save_dir|e)|raw }}
+ </label>
+ </li>
+ <li>
+ <input type="checkbox" name="onserver_overwrite" value="saveitover" id="checkbox_dump_onserver_overwrite"
+ {{- is_checked_export_overwrite ? ' checked' }}>
+ <label for="checkbox_dump_onserver_overwrite">
+ {% trans 'Overwrite existing file(s)' %}
+ </label>
+ </li>
+ {% endif %}
+
+ <li>
+ <label for="filename_template" class="desc">
+ {% trans 'File name template:' %}
+ {% set filename_hint %}
+ {% trans 'This value is interpreted using the \'strftime\' function, so you can use time formatting strings. Additionally the following transformations will happen:' %}
+ {% if export_type == 'server' %}
+ {% trans '@SERVER@ will become the server name.' %}
+ {% elseif export_type == 'database' %}
+ {% trans '@SERVER@ will become the server name, @DATABASE@ will become the database name.' %}
+ {% elseif export_type == 'table' %}
+ {% trans '@SERVER@ will become the server name, @DATABASE@ will become the database name, @TABLE@ will become the table name.' %}
+ {% endif %}
+ {% trans 'Other text will be kept as is. See the FAQ 6.27 for details.' %}
+ {% endset %}
+ {{ show_hint(filename_hint) }}
+ </label>
+ <input type="text" name="filename_template" id="filename_template" value="{{ filename_template }}">
+ <input type="checkbox" name="remember_template" id="checkbox_remember_template"{{ is_checked_remember_file_template ? ' checked' }}>
+ <label for="checkbox_remember_template">
+ {% trans 'use this for future exports' %}
+ </label>
+ </li>
+
+ {% if is_encoding_supported %}
+ <li>
+ <label for="select_charset" class="desc">
+ {% trans 'Character set of the file:' %}
+ </label>
+ <select id="select_charset" name="charset" size="1">
+ {% for charset in encodings %}
+ <option value="{{ charset }}"
+ {{- (export_charset is empty and charset == 'utf-8') or charset == export_charset ? ' selected' }}>
+ {{- charset -}}
+ </option>
+ {% endfor %}
+ </select>
+ </li>
+ {% endif %}
+
+ {% if has_zip or has_gzip %}
+ <li>
+ <label for="compression" class="desc">
+ {% trans 'Compression:' %}
+ </label>
+ <select id="compression" name="compression">
+ <option value="none">{% trans 'None' %}</option>
+ {% if has_zip %}
+ <option value="zip"
+ {{- selected_compression == 'zip' ? ' selected' }}>
+ {% trans 'zipped' %}
+ </option>
+ {% endif %}
+ {% if has_gzip %}
+ <option value="gzip"
+ {{- selected_compression == 'gzip' ? ' selected' }}>
+ {% trans 'gzipped' %}
+ </option>
+ {% endif %}
+ </select>
+ </li>
+ {% else %}
+ <input type="hidden" name="compression" value="{{ selected_compression }}">
+ {% endif %}
+
+ {% if export_type == 'server' or export_type == 'database' %}
+ <li>
+ <input type="checkbox" id="checkbox_as_separate_files" name="as_separate_files" value="{{ export_type }}"
+ {{- is_checked_as_separate_files ? ' checked' }}>
+ <label for="checkbox_as_separate_files">
+ {% if export_type == 'server' %}
+ {% trans 'Export databases as separate files' %}
+ {% elseif export_type == 'database' %}
+ {% trans 'Export tables as separate files' %}
+ {% endif %}
+ </label>
+ </li>
+ {% endif %}
+ </ul>
+ </li>
+
+ <li>
+ <input type="radio" id="radio_view_as_text" name="output_format" value="astext"
+ {{- repopulate or export_asfile == false ? ' checked' }}>
+ <label for="radio_view_as_text">
+ {% trans 'View output as text' %}
+ </label>
+ </li>
+ </ul>
+
+ <label for="maxsize">
+ {{- 'Skip tables larger than %s MiB'|trans|format(
+ '</label><input type="text" id="maxsize" name="maxsize" size="4">'
+ )|raw }}
+ </div>
+
+ <div class="exportoptions" id="format_specific_opts">
+ <h3>{% trans 'Format-specific options:' %}</h3>
+ <p class="no_js_msg" id="scroll_to_options_msg">
+ {% trans 'Scroll down to fill in the options for the selected format and ignore the options for other formats.' %}
+ </p>
+ {{ options|raw }}
+ </div>
+
+ {% if can_convert_kanji %}
+ {# Japanese encoding setting #}
+ <div class="exportoptions" id="kanji_encoding">
+ <h3>{% trans 'Encoding Conversion:' %}</h3>
+ {% include 'encoding/kanji_encoding_form.twig' %}
+ </div>
+ {% endif %}
+
+ <div class="exportoptions justify-content-end" id="submit">
+ <input id="buttonGo" class="btn btn-primary" type="submit" value="{% trans 'Go' %}"
+ {#- If the time limit set is zero, then time out won't occur so no need to check for time out. -#}
+ {%- if exec_time_limit > 0 %} onclick="Export.checkTimeOut({{ exec_time_limit }})"{% endif %}>
+ </div>
</form>
diff --git a/templates/display/export/options.twig b/templates/display/export/options.twig
deleted file mode 100644
index 5c50d23a30..0000000000
--- a/templates/display/export/options.twig
+++ /dev/null
@@ -1,378 +0,0 @@
-{% if export_method != 'custom-no-form' %}
- <div class="exportoptions" id="quick_or_custom">
- <h3>{% trans 'Export method:' %}</h3>
- <ul>
- <li>
- <input type="radio" name="quick_or_custom" value="quick" id="radio_quick_export"
- {{- export_method == 'quick' ? ' checked' }}>
- <label for="radio_quick_export">
- {% trans 'Quick - display only the minimal options' %}
- </label>
- </li>
-
- <li>
- <input type="radio" name="quick_or_custom" value="custom" id="radio_custom_export"
- {{- export_method == 'custom' ? ' checked' }}>
- <label for="radio_custom_export">
- {% trans 'Custom - display all possible options' %}
- </label>
- </li>
- </ul>
- </div>
-{% endif %}
-
-<div class="exportoptions" id="format">
- <h3>{% trans 'Format:' %}</h3>
- {{ dropdown|raw }}
-</div>
-
-<div class="exportoptions" id="databases_and_tables">
- {% if export_type == 'server' %}
- <h3>{% trans 'Databases:' %}</h3>
- {% elseif export_type == 'database' %}
- <h3>{% trans 'Tables:' %}</h3>
- {% endif %}
- {% if multi_values is not empty %}
- {{ multi_values|raw }}
- {% endif %}
-</div>
-
-{% if rows is not empty %}
- <div class="exportoptions" id="rows">
- <h3>{% trans 'Rows:' %}</h3>
- <ul>
- <li>
- <input type="radio" name="allrows" value="0" id="radio_allrows_0"
- {{- rows.allrows is not null and rows.allrows == 0 ? ' checked' }}>
- <label for="radio_allrows_0">{% trans 'Dump some row(s)' %}</label>
- <ul>
- <li>
- <label for="limit_to">{% trans 'Number of rows:' %}</label>
- <input type="text" id="limit_to" name="limit_to" size="5" value="
- {%- if rows.limit_to is not null -%}
- {{- rows.limit_to -}}
- {%- elseif rows.unlim_num_rows is not empty and rows.unlim_num_rows != 0 -%}
- {{- rows.unlim_num_rows -}}
- {%- else %}
- {{- rows.number_of_rows -}}
- {%- endif -%}" onfocus="this.select()">
- </li>
- <li>
- <label for="limit_from">{% trans 'Row to begin at:' %}</label>
- <input type="text" id="limit_from" name="limit_from" size="5" value="
- {{- rows.limit_from is not null ? rows.limit_from : 0 }}" onfocus="this.select()">
- </li>
- </ul>
- </li>
- <li>
- <input type="radio" name="allrows" value="1" id="radio_allrows_1"
- {{- rows.allrows is null or rows.allrows == 1 ? ' checked' }}>
- <label for="radio_allrows_1">{% trans 'Dump all rows' %}</label>
- </li>
- </ul>
- </div>
-{% endif %}
-
-{% if has_save_dir %}
- <div class="exportoptions" id="output_quick_export">
- <h3>{% trans 'Output:' %}</h3>
- <ul>
- <li>
- <input type="checkbox" name="quick_export_onserver" value="saveit" id="checkbox_quick_dump_onserver"{{ export_is_checked ? ' checked' }}>
- <label for="checkbox_quick_dump_onserver">
- {{ 'Save on server in the directory <strong>%s</strong>'|trans|format(save_dir|e)|raw }}
- </label>
- </li>
- <li>
- <input type="checkbox" name="quick_export_onserver_overwrite" value="saveitover" id="checkbox_quick_dump_onserver_overwrite"
- {{- export_overwrite_is_checked ? ' checked' }}>
- <label for="checkbox_quick_dump_onserver_overwrite">
- {% trans 'Overwrite existing file(s)' %}
- </label>
- </li>
- </ul>
- </div>
-{% endif %}
-
-<div id="alias_modal" class="hide" title="{% trans 'Rename exported databases/tables/columns' %}">
- <table id="alias_data">
- <thead>
- <tr>
- <th colspan="4">
- {% trans 'Defined aliases' %}
- </th>
- </tr>
- </thead>
-
- <tbody>
- {% for db, db_data in aliases %}
- {% if db_data.alias is defined and db_data.alias is not null %}
- <tr>
- <th>{% trans %}Database{% context %}Alias{% endtrans %}</th>
- <td>{{ db }}</td>
- <td>
- <input name="aliases[{{ db }}][alias]" value="{{ db_data.alias }}" type="text">
- </td>
- <td>
- <button class="alias_remove btn btn-secondary">{% trans 'Remove' %}</button>
- </td>
- </tr>
- {% endif %}
-
- {% for table, table_data in db_data.tables ?? [] %}
- {% if table_data.alias is defined and table_data.alias is not null %}
- <tr>
- <th>{% trans %}Table{% context %}Alias{% endtrans %}</th>
- <td>{{ db }}.{{ table }}</td>
- <td>
- <input name="aliases[{{ db }}][tables][{{ table }}][alias]" value="{{ table_data.alias }}" type="text">
- </td>
- <td>
- <button class="alias_remove btn btn-secondary">{% trans 'Remove' %}</button>
- </td>
- </tr>
- {% endif %}
-
- {% for column, column_name in table_data.columns ?? [] %}
- <tr>
- <th>{% trans %}Column{% context %}Alias{% endtrans %}</th>
- <td>{{ db }}.{{ table }}.{{ column }}</td>
- <td>
- <input name="aliases[{{ db }}][tables][{{ table }}][colums][{{ column }}]" value="{{ column_name }}" type="text">
- </td>
- <td>
- <button class="alias_remove btn btn-secondary">{% trans 'Remove' %}</button>
- </td>
- </tr>
- {% endfor %}
- {% endfor %}
- {% endfor %}
- </tbody>
-
- {# Empty row for javascript manipulations. #}
- <tfoot class="hide">
- <tr>
- <th></th>
- <td></td>
- <td>
- <input name="aliases_new" value="" type="text">
- </td>
- <td>
- <button class="alias_remove btn btn-secondary">{% trans 'Remove' %}</button>
- </td>
- </tr>
- </tfoot>
- </table>
-
- <table>
- <thead>
- <tr>
- <th colspan="4">{% trans 'Define new aliases' %}</th>
- </tr>
- </thead>
- <tr>
- <td>
- <label>{% trans 'Select database:' %}</label>
- </td>
- <td>
- <select id="db_alias_select"><option value=""></option></select>
- </td>
- <td>
- <input id="db_alias_name" placeholder="{% trans 'New database name' %}" disabled="1">
- </td>
- <td>
- <button id="db_alias_button" class="btn btn-secondary" disabled="1">{% trans 'Add' %}</button>
- </td>
- </tr>
- <tr>
- <td>
- <label>{% trans 'Select table:' %}</label>
- </td>
- <td>
- <select id="table_alias_select"><option value=""></option></select>
- </td>
- <td>
- <input id="table_alias_name" placeholder="{% trans 'New table name' %}" disabled="1">
- </td>
- <td>
- <button id="table_alias_button" class="btn btn-secondary" disabled="1">{% trans 'Add' %}</button>
- </td>
- </tr>
- <tr>
- <td>
- <label>{% trans 'Select column:' %}</label>
- </td>
- <td>
- <select id="column_alias_select"><option value=""></option></select>
- </td>
- <td>
- <input id="column_alias_name" placeholder="{% trans 'New column name' %}" disabled="1">
- </td>
- <td>
- <button id="column_alias_button" class="btn btn-secondary" disabled="1">{% trans 'Add' %}</button>
- </td>
- </tr>
- </table>
-</div>
-
-<div class="exportoptions" id="output">
- <h3>{% trans 'Output:' %}</h3>
- <ul id="ul_output">
- <li>
- <input type="checkbox" id="btn_alias_config"{{ has_aliases ? ' checked' }}>
- <label for="btn_alias_config">
- {% trans 'Rename exported databases/tables/columns' %}
- </label>
- </li>
-
- {% if export_type != 'server' %}
- <li>
- <input type="checkbox" name="lock_tables" value="something" id="checkbox_lock_tables"
- {{- (not repopulate and is_checked_lock_tables) or lock_tables ? ' checked' }}>
- <label for="checkbox_lock_tables">
- {{ 'Use %s statement'|trans|format('<code>LOCK TABLES</code>')|raw }}
- </label>
- </li>
- {% endif %}
-
- <li>
- <input type="radio" name="output_format" value="sendit" id="radio_dump_asfile"
- {{- not repopulate and is_checked_asfile ? ' checked' }}>
- <label for="radio_dump_asfile">
- {% trans 'Save output to a file' %}
- </label>
- <ul id="ul_save_asfile">
- {% if has_save_dir %}
- <li>
- <input type="checkbox" name="onserver" value="saveit" id="checkbox_dump_onserver"{{ is_checked_export ? ' checked' }}>
- <label for="checkbox_dump_onserver">
- {{ 'Save on server in the directory <strong>%s</strong>'|trans|format(save_dir|e)|raw }}
- </label>
- </li>
- <li>
- <input type="checkbox" name="onserver_overwrite" value="saveitover" id="checkbox_dump_onserver_overwrite"
- {{- is_checked_export_overwrite ? ' checked' }}>
- <label for="checkbox_dump_onserver_overwrite">
- {% trans 'Overwrite existing file(s)' %}
- </label>
- </li>
- {% endif %}
-
- <li>
- <label for="filename_template" class="desc">
- {% trans 'File name template:' %}
- {% set filename_hint %}
- {% trans 'This value is interpreted using the \'strftime\' function, so you can use time formatting strings. Additionally the following transformations will happen:' %}
- {% if export_type == 'server' %}
- {% trans '@SERVER@ will become the server name.' %}
- {% elseif export_type == 'database' %}
- {% trans '@SERVER@ will become the server name, @DATABASE@ will become the database name.' %}
- {% elseif export_type == 'table' %}
- {% trans '@SERVER@ will become the server name, @DATABASE@ will become the database name, @TABLE@ will become the table name.' %}
- {% endif %}
- {% trans 'Other text will be kept as is. See the FAQ 6.27 for details.' %}
- {% endset %}
- {{ show_hint(filename_hint) }}
- </label>
- <input type="text" name="filename_template" id="filename_template" value="{{ filename_template }}">
- <input type="checkbox" name="remember_template" id="checkbox_remember_template"{{ is_checked_remember_file_template ? ' checked' }}>
- <label for="checkbox_remember_template">
- {% trans 'use this for future exports' %}
- </label>
- </li>
-
- {% if is_encoding_supported %}
- <li>
- <label for="select_charset" class="desc">
- {% trans 'Character set of the file:' %}
- </label>
- <select id="select_charset" name="charset" size="1">
- {% for charset in encodings %}
- <option value="{{ charset }}"
- {{- (export_charset is empty and charset == 'utf-8') or charset == export_charset ? ' selected' }}>
- {{- charset -}}
- </option>
- {% endfor %}
- </select>
- </li>
- {% endif %}
-
- {% if has_zip or has_gzip %}
- <li>
- <label for="compression" class="desc">
- {% trans 'Compression:' %}
- </label>
- <select id="compression" name="compression">
- <option value="none">{% trans 'None' %}</option>
- {% if has_zip %}
- <option value="zip"
- {{- selected_compression == 'zip' ? ' selected' }}>
- {% trans 'zipped' %}
- </option>
- {% endif %}
- {% if has_gzip %}
- <option value="gzip"
- {{- selected_compression == 'gzip' ? ' selected' }}>
- {% trans 'gzipped' %}
- </option>
- {% endif %}
- </select>
- </li>
- {% else %}
- <input type="hidden" name="compression" value="{{ selected_compression }}">
- {% endif %}
-
- {% if export_type == 'server' or export_type == 'database' %}
- <li>
- <input type="checkbox" id="checkbox_as_separate_files" name="as_separate_files" value="{{ export_type }}"
- {{- is_checked_as_separate_files ? ' checked' }}>
- <label for="checkbox_as_separate_files">
- {% if export_type == 'server' %}
- {% trans 'Export databases as separate files' %}
- {% elseif export_type == 'database' %}
- {% trans 'Export tables as separate files' %}
- {% endif %}
- </label>
- </li>
- {% endif %}
- </ul>
- </li>
-
- <li>
- <input type="radio" id="radio_view_as_text" name="output_format" value="astext"
- {{- repopulate or export_asfile == false ? ' checked' }}>
- <label for="radio_view_as_text">
- {% trans 'View output as text' %}
- </label>
- </li>
- </ul>
-
- <label for="maxsize">
- {{- 'Skip tables larger than %s MiB'|trans|format(
- '</label><input type="text" id="maxsize" name="maxsize" size="4">'
- )|raw }}
-</div>
-
-<div class="exportoptions" id="format_specific_opts">
- <h3>{% trans 'Format-specific options:' %}</h3>
- <p class="no_js_msg" id="scroll_to_options_msg">
- {% trans 'Scroll down to fill in the options for the selected format and ignore the options for other formats.' %}
- </p>
- {{ options|raw }}
-</div>
-
-{% if can_convert_kanji %}
- {# Japanese encoding setting #}
- <div class="exportoptions" id="kanji_encoding">
- <h3>{% trans 'Encoding Conversion:' %}</h3>
- {% include 'encoding/kanji_encoding_form.twig' %}
- </div>
-{% endif %}
-
-<div class="exportoptions justify-content-end" id="submit">
- <input id="buttonGo" class="btn btn-primary" type="submit" value="{% trans 'Go' %}"
- {#- If the time limit set is zero, then time out won't occur so no need to check for time out. -#}
- {%- if exec_time_limit > 0 %}
- onclick="Export.checkTimeOut({{ exec_time_limit }})"
- {%- endif %}>
-</div>
diff --git a/test/classes/Display/ExportTest.php b/test/classes/Display/ExportTest.php
index e4a0a68765..781a48e741 100644
--- a/test/classes/Display/ExportTest.php
+++ b/test/classes/Display/ExportTest.php
@@ -10,7 +10,6 @@ namespace PhpMyAdmin\Tests\Display;
use PhpMyAdmin\Config;
use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Display\Export;
-use PhpMyAdmin\Plugins;
use PhpMyAdmin\Tests\AbstractTestCase;
use PhpMyAdmin\Util;
use function htmlspecialchars;
@@ -90,25 +89,15 @@ class ExportTest extends AbstractTestCase
$GLOBALS['dbi'] = $dbi;
- /* Scan for plugins */
- $export_list = Plugins::getPlugins(
- 'export',
- 'libraries/classes/Plugins/Export/',
- [
- 'export_type' => $export_type,
- 'single_table' => true,// isset($single_table)
- ]
- );
-
//Call the test function
- $html = $this->export->getHtmlForOptions(
+ $html = $this->export->getDisplay(
$export_type,
$db,
$table,
- $multi_values_str,
+ '',
$num_tables_str,
- $export_list,
- $unlim_num_rows_str
+ $unlim_num_rows_str,
+ $multi_values_str
);
//validate 2: Export::getHtmlForOptionsMethod