Refactor to remove display_export.inc.php
Signed-off-by: Marc Delisle <marc@infomarc.info>
This commit is contained in:
parent
a0927dcc47
commit
27e54fb194
@ -131,5 +131,26 @@ foreach ($tables as $each_table) {
|
||||
$multi_values .= "\n";
|
||||
$multi_values .= '</tbody></table></div>';
|
||||
|
||||
$export_type = 'database';
|
||||
require_once 'libraries/display_export.inc.php';
|
||||
require_once 'libraries/display_export.lib.php';
|
||||
if (! isset($sql_query)) {
|
||||
$sql_query = '';
|
||||
}
|
||||
if (! isset($num_tables)) {
|
||||
$num_tables = 0;
|
||||
}
|
||||
if (! isset($num_tables)) {
|
||||
$num_tables = 0;
|
||||
}
|
||||
if (! isset($unlim_num_rows)) {
|
||||
$unlim_num_rows = 0;
|
||||
}
|
||||
if (! isset($multi_values)) {
|
||||
$multi_values = '';
|
||||
}
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addHTML(
|
||||
PMA_getExportDisplay(
|
||||
'database', $db, $table, $sql_query, $num_tables,
|
||||
$unlim_num_rows, $multi_values
|
||||
)
|
||||
);
|
||||
|
||||
@ -5050,7 +5050,7 @@ class PMA_DisplayResults
|
||||
|
||||
// Export link
|
||||
// (the url_query has extra parameters that won't be used to export)
|
||||
// (the single_table parameter is used in display_export.inc.php
|
||||
// (the single_table parameter is used in PMA_getExportDisplay()
|
||||
// to hide the SQL and the structure export dialogs)
|
||||
// If the parser found a PROCEDURE clause
|
||||
// (most probably PROCEDURE ANALYSE()) it makes no sense to
|
||||
|
||||
@ -1,80 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Displays export tab.
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get relations & co. status
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
if (isset($_REQUEST['single_table'])) {
|
||||
$GLOBALS['single_table'] = $_REQUEST['single_table'];
|
||||
}
|
||||
|
||||
require_once './libraries/file_listing.lib.php';
|
||||
require_once './libraries/plugin_interface.lib.php';
|
||||
require_once './libraries/display_export.lib.php';
|
||||
|
||||
/* Scan for plugins */
|
||||
/* @var $export_list ExportPlugin[] */
|
||||
$export_list = PMA_getPlugins(
|
||||
"export",
|
||||
'libraries/plugins/export/',
|
||||
array(
|
||||
'export_type' => $export_type,
|
||||
'single_table' => isset($single_table)
|
||||
)
|
||||
);
|
||||
|
||||
/* Fail if we didn't find any plugin */
|
||||
if (empty($export_list)) {
|
||||
PMA_Message::error(
|
||||
__('Could not load export plugins, please check your installation!')
|
||||
)->display();
|
||||
exit;
|
||||
}
|
||||
|
||||
$html = PMA_getHtmlForExportOptionHeader($export_type, $db, $table);
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
if ($cfgRelation['exporttemplateswork']) {
|
||||
$html .= PMA_getHtmlForExportTemplateLoading($export_type);
|
||||
}
|
||||
|
||||
$html .= '<form method="post" action="export.php" '
|
||||
. ' name="dump" class="disableAjax">';
|
||||
|
||||
//output Hidden Inputs
|
||||
$single_table_str = isset($single_table)? $single_table : '';
|
||||
$sql_query_str = isset($sql_query)? $sql_query : '';
|
||||
$html .= PMA_getHtmlForHiddenInput(
|
||||
$export_type,
|
||||
$db,
|
||||
$table,
|
||||
$single_table_str,
|
||||
$sql_query_str
|
||||
);
|
||||
|
||||
//output Export Options
|
||||
$num_tables_str = isset($num_tables)? $num_tables : '';
|
||||
$unlim_num_rows_str = isset($unlim_num_rows)? $unlim_num_rows : '';
|
||||
$multi_values_str = isset($multi_values)? $multi_values : '';
|
||||
$html .= PMA_getHtmlForExportOptions(
|
||||
$export_type,
|
||||
$db,
|
||||
$table,
|
||||
$multi_values_str,
|
||||
$num_tables_str,
|
||||
$export_list,
|
||||
$unlim_num_rows_str
|
||||
);
|
||||
|
||||
$html .= '</form>';
|
||||
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addHTML($html);
|
||||
@ -4,8 +4,6 @@
|
||||
/**
|
||||
* functions for displaying server, database and table export
|
||||
*
|
||||
* @usedby display_export.inc.php
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
@ -1021,3 +1019,83 @@ function PMA_getHtmlForAliasModalDialog($db = '', $table = '')
|
||||
$html .= '</div>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets HTML to display export dialogs
|
||||
*
|
||||
* @param String $export_type export type: server|database|table
|
||||
* @param String $db selected DB
|
||||
* @param String $table selected table
|
||||
* @param String $sql_query SQL query
|
||||
* @param Int $num_tables number of tables
|
||||
* @param Int $unlim_num_rows unlimited number of rows
|
||||
* @param String $multi_values selector options
|
||||
*
|
||||
* @return string $html
|
||||
*/
|
||||
function PMA_getExportDisplay(
|
||||
$export_type, $db, $table, $sql_query = '', $num_tables,
|
||||
$unlim_num_rows, $multi_values
|
||||
) {
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
if (isset($_REQUEST['single_table'])) {
|
||||
$GLOBALS['single_table'] = $_REQUEST['single_table'];
|
||||
}
|
||||
|
||||
require_once './libraries/file_listing.lib.php';
|
||||
require_once './libraries/plugin_interface.lib.php';
|
||||
require_once './libraries/display_export.lib.php';
|
||||
|
||||
/* Scan for plugins */
|
||||
/* @var $export_list ExportPlugin[] */
|
||||
$export_list = PMA_getPlugins(
|
||||
"export",
|
||||
'libraries/plugins/export/',
|
||||
array(
|
||||
'export_type' => $export_type,
|
||||
'single_table' => isset($GLOBALS['single_table'])
|
||||
)
|
||||
);
|
||||
|
||||
/* Fail if we didn't find any plugin */
|
||||
if (empty($export_list)) {
|
||||
PMA_Message::error(
|
||||
__('Could not load export plugins, please check your installation!')
|
||||
)->display();
|
||||
exit;
|
||||
}
|
||||
|
||||
$html = PMA_getHtmlForExportOptionHeader($export_type, $db, $table);
|
||||
|
||||
if ($cfgRelation['exporttemplateswork']) {
|
||||
$html .= PMA_getHtmlForExportTemplateLoading($export_type);
|
||||
}
|
||||
|
||||
$html .= '<form method="post" action="export.php" '
|
||||
. ' name="dump" class="disableAjax">';
|
||||
|
||||
//output Hidden Inputs
|
||||
$single_table_str = isset($GLOBALS['single_table'])? $GLOBALS['single_table'] : '';
|
||||
$html .= PMA_getHtmlForHiddenInput(
|
||||
$export_type,
|
||||
$db,
|
||||
$table,
|
||||
$single_table_str,
|
||||
$sql_query
|
||||
);
|
||||
|
||||
//output Export Options
|
||||
$html .= PMA_getHtmlForExportOptions(
|
||||
$export_type,
|
||||
$db,
|
||||
$table,
|
||||
$multi_values,
|
||||
$num_tables,
|
||||
$export_list,
|
||||
$unlim_num_rows
|
||||
);
|
||||
|
||||
$html .= '</form>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
@ -26,5 +26,24 @@ $export_page_title = __('View dump (schema) of databases') . "\n";
|
||||
$select_item = isset($tmp_select)? $tmp_select : '';
|
||||
$multi_values = PMA_getHtmlForExportSelectOptions($select_item);
|
||||
|
||||
$export_type = 'server';
|
||||
require_once 'libraries/display_export.inc.php';
|
||||
require_once 'libraries/display_export.lib.php';
|
||||
|
||||
if (! isset($sql_query)) {
|
||||
$sql_query = '';
|
||||
}
|
||||
if (! isset($num_tables)) {
|
||||
$num_tables = 0;
|
||||
}
|
||||
if (! isset($num_tables)) {
|
||||
$num_tables = 0;
|
||||
}
|
||||
if (! isset($unlim_num_rows)) {
|
||||
$unlim_num_rows = 0;
|
||||
}
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addHTML(
|
||||
PMA_getExportDisplay(
|
||||
'server', $db, $table, $sql_query, $num_tables,
|
||||
$unlim_num_rows, $multi_values
|
||||
)
|
||||
);
|
||||
|
||||
@ -173,5 +173,27 @@ if (! empty($sql_query)) {
|
||||
echo PMA_Util::getMessage(PMA_Message::success());
|
||||
}
|
||||
|
||||
$export_type = 'table';
|
||||
require_once 'libraries/display_export.inc.php';
|
||||
require_once 'libraries/display_export.lib.php';
|
||||
|
||||
if (! isset($sql_query)) {
|
||||
$sql_query = '';
|
||||
}
|
||||
if (! isset($num_tables)) {
|
||||
$num_tables = 0;
|
||||
}
|
||||
if (! isset($num_tables)) {
|
||||
$num_tables = 0;
|
||||
}
|
||||
if (! isset($unlim_num_rows)) {
|
||||
$unlim_num_rows = 0;
|
||||
}
|
||||
if (! isset($multi_values)) {
|
||||
$multi_values = '';
|
||||
}
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addHTML(
|
||||
PMA_getExportDisplay(
|
||||
'table', $db, $table, $sql_query, $num_tables,
|
||||
$unlim_num_rows, $multi_values
|
||||
)
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user