diff --git a/index.php b/index.php index 3f9fcabc52..3321ace8fa 100644 --- a/index.php +++ b/index.php @@ -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 diff --git a/js/export.js b/js/export.js index 733c6cd468..6f0b63018e 100644 --- a/js/export.js +++ b/js/export.js @@ -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( '
' + diff --git a/libraries/classes/Core.php b/libraries/classes/Core.php index 7cdbfea10b..52ca48277d 100644 --- a/libraries/classes/Core.php +++ b/libraries/classes/Core.php @@ -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', diff --git a/libraries/classes/Display/Export.php b/libraries/classes/Display/Export.php index db02a5e7c8..93bec15471 100644 --- a/libraries/classes/Display/Export.php +++ b/libraries/classes/Display/Export.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 .= '
'; + $html .= ''; //output Hidden Inputs $singleTableStr = isset($GLOBALS['single_table']) ? $GLOBALS['single_table'] diff --git a/libraries/classes/Export.php b/libraries/classes/Export.php index c08829672b..0f8b30a091 100644 --- a/libraries/classes/Export.php +++ b/libraries/classes/Export.php @@ -531,7 +531,7 @@ class Export $back_button .= '&repopulate=1">' . __('Back') . ' ]

'; $html .= '
'; $html .= $back_button; - $refreshButton = ''; + $refreshButton = ''; $refreshButton .= '[ ' . __('Refresh') . ' ]'; foreach ($_POST as $name => $value) { if (is_array($value)) { diff --git a/libraries/classes/Plugins/Export/ExportHtmlword.php b/libraries/classes/Plugins/Export/ExportHtmlword.php index 329c8b596a..bd206347a8 100644 --- a/libraries/classes/Plugins/Export/ExportHtmlword.php +++ b/libraries/classes/Plugins/Export/ExportHtmlword.php @@ -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 diff --git a/libraries/classes/Plugins/Export/ExportLatex.php b/libraries/classes/Plugins/Export/ExportLatex.php index 0c47b8ec35..c059600bc1 100644 --- a/libraries/classes/Plugins/Export/ExportLatex.php +++ b/libraries/classes/Plugins/Export/ExportLatex.php @@ -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 diff --git a/libraries/classes/Plugins/Export/ExportMediawiki.php b/libraries/classes/Plugins/Export/ExportMediawiki.php index 9d971cb876..35c6699905 100644 --- a/libraries/classes/Plugins/Export/ExportMediawiki.php +++ b/libraries/classes/Plugins/Export/ExportMediawiki.php @@ -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 diff --git a/libraries/classes/Plugins/Export/ExportOdt.php b/libraries/classes/Plugins/Export/ExportOdt.php index 0e9209ffbc..ba26cc2ceb 100644 --- a/libraries/classes/Plugins/Export/ExportOdt.php +++ b/libraries/classes/Plugins/Export/ExportOdt.php @@ -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 diff --git a/libraries/classes/Plugins/Export/ExportPdf.php b/libraries/classes/Plugins/Export/ExportPdf.php index 49e74b3d88..875f40b28d 100644 --- a/libraries/classes/Plugins/Export/ExportPdf.php +++ b/libraries/classes/Plugins/Export/ExportPdf.php @@ -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 diff --git a/libraries/classes/Plugins/Export/ExportSql.php b/libraries/classes/Plugins/Export/ExportSql.php index 81e72d7749..c3e85a3627 100644 --- a/libraries/classes/Plugins/Export/ExportSql.php +++ b/libraries/classes/Plugins/Export/ExportSql.php @@ -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 diff --git a/libraries/classes/Plugins/Export/ExportTexytext.php b/libraries/classes/Plugins/Export/ExportTexytext.php index f0ba58ca1f..daa0f76a8f 100644 --- a/libraries/classes/Plugins/Export/ExportTexytext.php +++ b/libraries/classes/Plugins/Export/ExportTexytext.php @@ -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 diff --git a/libraries/classes/Plugins/Export/Helpers/Pdf.php b/libraries/classes/Plugins/Export/Helpers/Pdf.php index dbc75930eb..838b82bb9a 100644 --- a/libraries/classes/Plugins/Export/Helpers/Pdf.php +++ b/libraries/classes/Plugins/Export/Helpers/Pdf.php @@ -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 diff --git a/libraries/classes/Plugins/ExportPlugin.php b/libraries/classes/Plugins/ExportPlugin.php index 8bab6572df..36a747f3a8 100644 --- a/libraries/classes/Plugins/ExportPlugin.php +++ b/libraries/classes/Plugins/ExportPlugin.php @@ -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 diff --git a/export.php b/libraries/entry_points/export.php similarity index 99% rename from export.php rename to libraries/entry_points/export.php index 948fa8eec1..ca16b709a5 100644 --- a/export.php +++ b/libraries/entry_points/export.php @@ -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); diff --git a/test/classes/CoreTest.php b/test/classes/CoreTest.php index 011a23211a..a7df3d1a24 100644 --- a/test/classes/CoreTest.php +++ b/test/classes/CoreTest.php @@ -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,