Use the router for the export entry point
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
fb6fcec5f5
commit
3262a276e8
@ -86,6 +86,9 @@ if (isset($_GET['route']) || isset($_POST['route'])) {
|
||||
require_once ROOT_PATH . 'libraries/entry_points/database/triggers.php';
|
||||
});
|
||||
});
|
||||
$routes->addRoute(['GET', 'POST'], '/export', function () {
|
||||
require_once ROOT_PATH . 'libraries/entry_points/export.php';
|
||||
});
|
||||
$routes->addGroup('/server', function (RouteCollector $routes) {
|
||||
$routes->addRoute(['GET', 'POST'], '/binlog', function () {
|
||||
require_once ROOT_PATH . 'libraries/entry_points/server/binlog.php';
|
||||
@ -256,7 +259,6 @@ unset($drops, $each_drop);
|
||||
*/
|
||||
$target_blacklist = [
|
||||
'import.php',
|
||||
'export.php',
|
||||
];
|
||||
|
||||
// If we have a valid target, let's load that script instead
|
||||
|
||||
@ -728,14 +728,13 @@ Export.checkTimeOut = function (timeLimit) {
|
||||
}
|
||||
// margin of one second to avoid race condition to set/access session variable
|
||||
limit = limit + 1;
|
||||
var href = 'export.php';
|
||||
var params = {
|
||||
'ajax_request' : true,
|
||||
'check_time_out' : true
|
||||
};
|
||||
clearTimeout(timeOut);
|
||||
timeOut = setTimeout(function () {
|
||||
$.get(href, params, function (data) {
|
||||
$.get('index.php?route=/export', params, function (data) {
|
||||
if (data.message === 'timeout') {
|
||||
Functions.ajaxShowMessage(
|
||||
'<div class="error">' +
|
||||
|
||||
@ -28,7 +28,6 @@ class Core
|
||||
public static $goto_whitelist = [
|
||||
'db_importdocsql.php',
|
||||
'db_import.php',
|
||||
'export.php',
|
||||
'import.php',
|
||||
'index.php',
|
||||
'pdf_pages.php',
|
||||
|
||||
@ -19,6 +19,7 @@ use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Table;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
use Throwable;
|
||||
use Twig_Error_Loader;
|
||||
@ -74,7 +75,7 @@ class Export
|
||||
public function getHtmlForSelectOptions($tmpSelect = '')
|
||||
{
|
||||
// Check if the selected databases are defined in $_POST
|
||||
// (from clicking Back button on export.php)
|
||||
// (from clicking Back button on /export page)
|
||||
if (isset($_POST['db_select'])) {
|
||||
$_POST['db_select'] = urldecode($_POST['db_select']);
|
||||
$_POST['db_select'] = explode(",", $_POST['db_select']);
|
||||
@ -716,8 +717,8 @@ class Export
|
||||
]);
|
||||
}
|
||||
|
||||
$html .= '<form method="post" action="export.php" '
|
||||
. ' name="dump" class="disableAjax">';
|
||||
$html .= '<form method="post" action="' . Url::getFromRoute('/export')
|
||||
. '" name="dump" class="disableAjax">';
|
||||
|
||||
//output Hidden Inputs
|
||||
$singleTableStr = isset($GLOBALS['single_table']) ? $GLOBALS['single_table']
|
||||
|
||||
@ -531,7 +531,7 @@ class Export
|
||||
$back_button .= '&repopulate=1">' . __('Back') . '</a> ]</p>';
|
||||
$html .= '<br>';
|
||||
$html .= $back_button;
|
||||
$refreshButton = '<form id="export_refresh_form" method="POST" action="export.php" class="disableAjax">';
|
||||
$refreshButton = '<form id="export_refresh_form" method="POST" action="' . Url::getFromRoute('/export') . '" class="disableAjax">';
|
||||
$refreshButton .= '[ <a class="disableAjax" onclick="$(this).parent().submit()">' . __('Refresh') . '</a> ]';
|
||||
foreach ($_POST as $name => $value) {
|
||||
if (is_array($value)) {
|
||||
|
||||
@ -344,7 +344,7 @@ class ExportHtmlword extends ExportPlugin
|
||||
* @param bool $do_comments whether to include the pmadb-style column
|
||||
* comments as comments in the structure;
|
||||
* this is deprecated but the parameter is
|
||||
* left here because export.php calls
|
||||
* left here because /export calls
|
||||
* PMA_exportStructure() also for other
|
||||
* export types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
@ -531,7 +531,7 @@ class ExportHtmlword extends ExportPlugin
|
||||
* @param bool $do_comments whether to include the pmadb-style column
|
||||
* comments as comments in the structure;
|
||||
* this is deprecated but the parameter is
|
||||
* left here because export.php calls
|
||||
* left here because /export calls
|
||||
* PMA_exportStructure() also for other
|
||||
* export types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
|
||||
@ -459,7 +459,7 @@ class ExportLatex extends ExportPlugin
|
||||
* @param bool $do_comments whether to include the pmadb-style column
|
||||
* comments as comments in the structure;
|
||||
* this is deprecated but the parameter is
|
||||
* left here because export.php calls
|
||||
* left here because /export calls
|
||||
* exportStructure() also for other
|
||||
* export types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
|
||||
@ -174,7 +174,7 @@ class ExportMediawiki extends ExportPlugin
|
||||
* @param bool $do_comments whether to include the pmadb-style column
|
||||
* comments as comments in the structure; this is
|
||||
* deprecated but the parameter is left here
|
||||
* because export.php calls exportStructure()
|
||||
* because /export calls exportStructure()
|
||||
* also for other export types which use this
|
||||
* parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
|
||||
@ -428,7 +428,7 @@ class ExportOdt extends ExportPlugin
|
||||
* @param bool $do_comments whether to include the pmadb-style column
|
||||
* comments as comments in the structure;
|
||||
* this is deprecated but the parameter is
|
||||
* left here because export.php calls
|
||||
* left here because /export calls
|
||||
* PMA_exportStructure() also for other
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
* @param bool $show_dates whether to include creation/update/check dates
|
||||
@ -669,7 +669,7 @@ class ExportOdt extends ExportPlugin
|
||||
* @param bool $do_comments whether to include the pmadb-style column
|
||||
* comments as comments in the structure;
|
||||
* this is deprecated but the parameter is
|
||||
* left here because export.php calls
|
||||
* left here because /export calls
|
||||
* PMA_exportStructure() also for other
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
* @param bool $dates whether to include creation/update/check dates
|
||||
|
||||
@ -254,7 +254,7 @@ class ExportPdf extends ExportPlugin
|
||||
* @param bool $do_comments whether to include the pmadb-style column
|
||||
* comments as comments in the structure;
|
||||
* this is deprecated but the parameter is
|
||||
* left here because export.php calls
|
||||
* left here because /export calls
|
||||
* PMA_exportStructure() also for other
|
||||
* export types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
|
||||
@ -2009,7 +2009,7 @@ class ExportSql extends ExportPlugin
|
||||
* @param bool $comments whether to include the pmadb-style column
|
||||
* comments as comments in the structure; this is
|
||||
* deprecated but the parameter is left here
|
||||
* because export.php calls exportStructure()
|
||||
* because /export calls exportStructure()
|
||||
* also for other export types which use this
|
||||
* parameter
|
||||
* @param bool $mime whether to include mime comments
|
||||
|
||||
@ -323,7 +323,7 @@ class ExportTexytext extends ExportPlugin
|
||||
* @param bool $do_comments whether to include the pmadb-style column
|
||||
* comments as comments in the structure;
|
||||
* this is deprecated but the parameter is
|
||||
* left here because export.php calls
|
||||
* left here because /export calls
|
||||
* $this->exportStructure() also for other
|
||||
* export types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
@ -489,7 +489,7 @@ class ExportTexytext extends ExportPlugin
|
||||
* @param bool $do_comments whether to include the pmadb-style column
|
||||
* comments as comments in the structure;
|
||||
* this is deprecated but the parameter is
|
||||
* left here because export.php calls
|
||||
* left here because /export calls
|
||||
* $this->exportStructure() also for other
|
||||
* export types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
|
||||
@ -468,7 +468,7 @@ class Pdf extends PdfLib
|
||||
* @param bool $do_comments whether to include the pmadb-style column
|
||||
* comments as comments in the structure;
|
||||
* this is deprecated but the parameter is
|
||||
* left here because export.php calls
|
||||
* left here because /export calls
|
||||
* PMA_exportStructure() also for other
|
||||
* export types which use this parameter
|
||||
* @param bool $do_mime whether to include mime comments
|
||||
|
||||
@ -123,7 +123,7 @@ abstract class ExportPlugin
|
||||
);
|
||||
|
||||
/**
|
||||
* The following methods are used in export.php or in /database/operations,
|
||||
* The following methods are used in /export or in /database/operations,
|
||||
* but they are not implemented by all export plugins
|
||||
*/
|
||||
|
||||
@ -163,7 +163,7 @@ abstract class ExportPlugin
|
||||
* @param bool $relation whether to include relation comments
|
||||
* @param bool $comments whether to include the pmadb-style column comments
|
||||
* as comments in the structure; this is deprecated
|
||||
* but the parameter is left here because export.php
|
||||
* but the parameter is left here because /export
|
||||
* calls exportStructure() also for other export
|
||||
* types which use this parameter
|
||||
* @param bool $mime whether to include mime comments
|
||||
|
||||
@ -22,14 +22,12 @@ use PhpMyAdmin\SqlParser\Utils\Misc;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
if (! defined('ROOT_PATH')) {
|
||||
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
global $containerBuilder, $db, $export_type, $filename_template, $sql_query;
|
||||
|
||||
include_once ROOT_PATH . 'libraries/common.inc.php';
|
||||
|
||||
/** @var Response $response */
|
||||
$response = $containerBuilder->get(Response::class);
|
||||
|
||||
@ -23,7 +23,6 @@ use stdClass;
|
||||
class CoreTest extends PmaTestCase
|
||||
{
|
||||
protected $goto_whitelist = [
|
||||
'export.php',
|
||||
'import.php',
|
||||
'index.php',
|
||||
'pdf_pages.php',
|
||||
@ -331,30 +330,6 @@ class CoreTest extends PmaTestCase
|
||||
true,
|
||||
false,
|
||||
],
|
||||
[
|
||||
'export.php',
|
||||
[],
|
||||
false,
|
||||
true,
|
||||
],
|
||||
[
|
||||
'export.php',
|
||||
[],
|
||||
true,
|
||||
true,
|
||||
],
|
||||
[
|
||||
'export.php',
|
||||
$this->goto_whitelist,
|
||||
false,
|
||||
true,
|
||||
],
|
||||
[
|
||||
'export.php',
|
||||
$this->goto_whitelist,
|
||||
true,
|
||||
true,
|
||||
],
|
||||
[
|
||||
'shell.php',
|
||||
$this->goto_whitelist,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user