diff --git a/js/ajax.js b/js/ajax.js index e74c4f225a..deadb4c750 100644 --- a/js/ajax.js +++ b/js/ajax.js @@ -276,6 +276,9 @@ var AJAX = { var params = 'ajax_request=true&ajax_page_request=true'; if (! isLink) { params += '&' + $(this).serialize(); + } else if (AJAX.source.attr('data-post')) { + params += '&' + AJAX.source.attr('data-post'); + isLink = false; } if (! (history && history.pushState)) { // Add a list of menu hashes that we have in the cache to the request diff --git a/js/functions.js b/js/functions.js index b02abdea92..76545a6b68 100644 --- a/js/functions.js +++ b/js/functions.js @@ -665,18 +665,7 @@ function confirmLink (theLink, theSqlQuery) { var is_confirmed = confirm(PMA_sprintf(PMA_messages.strDoYouReally, theSqlQuery)); if (is_confirmed) { - if ($(theLink).hasClass('formLinkSubmit')) { - var name = 'is_js_confirmed'; - - if ($(theLink).attr('href').indexOf('usesubform') !== -1) { - var matches = $(theLink).attr('href').substr('#').match(/usesubform\[(\d+)\]/i); - if (matches !== null) { - name = 'subform[' + matches[1] + '][is_js_confirmed]'; - } - } - - $(theLink).parents('form').append(''); - } else if (typeof(theLink.href) !== 'undefined') { + if (typeof(theLink.href) !== 'undefined') { theLink.href += '&is_js_confirmed=1'; } else if (typeof(theLink.form) !== 'undefined') { theLink.form.action += '?is_js_confirmed=1'; @@ -4074,7 +4063,6 @@ AJAX.registerOnload('functions.js', function () { */ AJAX.registerTeardown('functions.js', function () { $(document).off('change', 'select.pageselector'); - $(document).off('click', 'a.formLinkSubmit'); $('#update_recent_tables').off('ready'); $('#sync_favorite_tables').off('ready'); }); @@ -4119,16 +4107,6 @@ AJAX.registerOnload('functions.js', function () { */ PMA_init_slider(); - /** - * Enables the text generated by PhpMyAdmin\Util::linkOrButton() to be clickable - */ - $(document).on('click', 'a.formLinkSubmit', function (e) { - if (! $(this).hasClass('requireConfirm')) { - submitFormLink($(this)); - return false; - } - }); - var $updateRecentTables = $('#update_recent_tables'); if ($updateRecentTables.length) { $.get( diff --git a/js/gis_data_editor.js b/js/gis_data_editor.js index 93ac847123..977520763c 100644 --- a/js/gis_data_editor.js +++ b/js/gis_data_editor.js @@ -221,9 +221,6 @@ AJAX.registerTeardown('gis_data_editor.js', function () { }); AJAX.registerOnload('gis_data_editor.js', function () { - // Remove the class that is added due to the URL being too long. - $('span.open_gis_editor a').removeClass('formLinkSubmit'); - /** * Prepares and insert the GIS data to the input field on clicking 'copy'. */ diff --git a/js/sql.js b/js/sql.js index 7c175f9761..2a06186d18 100644 --- a/js/sql.js +++ b/js/sql.js @@ -187,22 +187,18 @@ AJAX.registerOnload('sql.js', function () { var $link = $(this); $link.PMA_confirm(question, $link.attr('href'), function (url) { $msgbox = PMA_ajaxShowMessage(); - if ($link.hasClass('formLinkSubmit')) { - submitFormLink($link); - } else { - var params = { - 'ajax_request': true, - 'is_js_confirmed': true - }; - $.post(url, params, function (data) { - if (data.success) { - PMA_ajaxShowMessage(data.message); - $link.closest('tr').remove(); - } else { - PMA_ajaxShowMessage(data.error, false); - } - }); + var params = 'ajax_request=1&is_js_confirmed=1'; + if ($link.attr('data-post')) { + params += '&' + $link.attr('data-post'); } + $.post(url, params, function (data) { + if (data.success) { + PMA_ajaxShowMessage(data.message); + $link.closest('tr').remove(); + } else { + PMA_ajaxShowMessage(data.error, false); + } + }); }); }); diff --git a/libraries/classes/Display/Results.php b/libraries/classes/Display/Results.php index a35651d461..e01438264b 100644 --- a/libraries/classes/Display/Results.php +++ b/libraries/classes/Display/Results.php @@ -1863,9 +1863,7 @@ class Results . $tmp_txt . '" title="' . $tmp_txt . '" />'; $tmp_url = 'sql.php' . Url::getCommon($url_params_full_text); - return Util::linkOrButton( - $tmp_url, $tmp_image, array(), false - ); + return Util::linkOrButton($tmp_url, $tmp_image); } // end of the '_getFullOrPartialTextButtonOrLink()' function @@ -2324,8 +2322,7 @@ class Results . ''; return Util::linkOrButton( - $order_url, $inner_link_content, - $order_link_params, false, true + $order_url, $inner_link_content, $order_link_params ); } // end of the '_getSortOrderLink()' function @@ -4978,7 +4975,7 @@ class Results Util::getIcon( 'b_view_add.png', __('Create view'), true ), - array('class' => 'create_view' . $ajax_class), true, true, '' + array('class' => 'create_view' . $ajax_class) ) . '' . "\n"; } @@ -5024,10 +5021,7 @@ class Results Util::getIcon( 'b_insrow.png', __('Copy to clipboard'), true ), - array('id' => 'copyToClipBoard'), - true, - true, - 'copy_to_clip_board' + array('id' => 'copyToClipBoard') ); return $html; @@ -5048,8 +5042,6 @@ class Results 'b_print.png', __('Print'), true ), array('id' => 'printView'), - true, - true, 'print_view' ); @@ -5154,11 +5146,7 @@ class Results 'tbl_export.php' . Url::getCommon($_url_params), Util::getIcon( 'b_tblexport.png', __('Export'), true - ), - '', - true, - true, - '' + ) ) . "\n"; @@ -5167,11 +5155,7 @@ class Results 'tbl_chart.php' . Url::getCommon($_url_params), Util::getIcon( 'b_chart.png', __('Display chart'), true - ), - '', - true, - true, - '' + ) ) . "\n"; @@ -5192,11 +5176,7 @@ class Results . Url::getCommon($_url_params), Util::getIcon( 'b_globe.gif', __('Visualize GIS data'), true - ), - '', - true, - true, - '' + ) ) . "\n"; } @@ -5621,9 +5601,7 @@ class Results $ret .= '
- *
- *
- *
- * so we now check if a subform is submitted
- */
-$__redirect = null;
-if (isset($_POST['usesubform']) && ! defined('PMA_MINIMUM_COMMON')) {
- // if a subform is present and should be used
- // the rest of the form is deprecated
- $subform_id = key($_POST['usesubform']);
- $subform = $_POST['subform'][$subform_id];
- $_POST = $subform;
- $_REQUEST = $subform;
- /**
- * some subforms need another page than the main form, so we will just
- * include this page at the end of this script - we use $__redirect to
- * track this
- */
- if (isset($_POST['redirect'])
- && $_POST['redirect'] != basename($PMA_PHP_SELF)
- ) {
- $__redirect = $_POST['redirect'];
- unset($_POST['redirect']);
- }
- unset($subform_id, $subform);
-} else {
- // Note: here we overwrite $_REQUEST so that it does not contain cookies,
- // because another application for the same domain could have set
- // a cookie (with a compatible path) that overrides a variable
- // we expect from GET or POST.
- // We'll refer to cookies explicitly with the $_COOKIE syntax.
- $_REQUEST = array_merge($_GET, $_POST);
-}
-// end check if a subform is submitted
-
-
/******************************************************************************/
/* parsing configuration file LABEL_parsing_config_file */
@@ -300,13 +247,6 @@ $goto_whitelist = array(
'user_password.php',
);
-/**
- * check $__redirect against whitelist
- */
-if (! Core::checkPageValidity($__redirect, $goto_whitelist)) {
- $__redirect = null;
-}
-
/**
* holds page that should be displayed
* @global string $GLOBALS['goto']
@@ -634,14 +574,6 @@ if (! defined('PMA_MINIMUM_COMMON')) {
/* Tell tracker that it can actually work */
Tracker::enable();
-if (!empty($__redirect) && in_array($__redirect, $goto_whitelist)) {
- /**
- * include subform target page
- */
- include $__redirect;
- exit();
-}
-
// If Zero configuration mode enabled, check PMA tables in current db.
if (! defined('PMA_MINIMUM_COMMON')
&& ! empty($GLOBALS['server'])
diff --git a/templates/table/search/input_box.twig b/templates/table/search/input_box.twig
index bea3180b7a..dd0c380abb 100644
--- a/templates/table/search/input_box.twig
+++ b/templates/table/search/input_box.twig
@@ -38,7 +38,7 @@
{% set edit_url = 'gis_data_editor.php' ~ Url_getCommon() %}
{% set edit_str = Util_getIcon('b_edit.png', 'Edit/Insert'|trans) %}
- {{ Util_linkOrButton(edit_url, edit_str, [], false, false, '_blank') }}
+ {{ Util_linkOrButton(edit_url, edit_str, [], '_blank') }}
{% endif %}
{% elseif column_type starts with 'enum'
diff --git a/test/classes/Display/ResultsTest.php b/test/classes/Display/ResultsTest.php
index 661236638f..ed0d820019 100644
--- a/test/classes/Display/ResultsTest.php
+++ b/test/classes/Display/ResultsTest.php
@@ -438,11 +438,11 @@ class ResultsTest extends PmaTestCase
'%60customer%60.%60id%60+%3D+1',
'
Edit'
. '
Copy'
. '
Edit'
. '
Copy'
. '
Copy'
. '
Edit'
. 'text'
+ ],
+ [
+ ['index.php?some=parameter', 'text'],
+ 20,
+ 'text',
+ ],
+ [
+ ['index.php', 'text', [], 'target'],
+ 1000,
+ 'text',
+ ],
+ [
+ ['url.php?url=http://phpmyadmin.net/', 'text', [], '_blank'],
+ 1000,
+ 'text',
+ ],
+ ];
+ }
}