diff options
author | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2019-07-08 23:03:00 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2019-07-10 03:51:49 +0300 |
commit | 12561a598d871cf3df4eee0cba151042213d2dab (patch) | |
tree | 75d9c7373936636fe79d20b4d53aa3386a0d7729 /js | |
parent | bd89155063654aa031228558367863bc81d555e3 (diff) |
Remove direct access to server_databases.php
Uses the router instead
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'js')
-rw-r--r-- | js/common.js | 16 | ||||
-rw-r--r-- | js/database/operations.js | 2 | ||||
-rw-r--r-- | js/server/databases.js | 2 |
3 files changed, 13 insertions, 7 deletions
diff --git a/js/common.js b/js/common.js index 69b5b6aaf7..ba0ac2d4d4 100644 --- a/js/common.js +++ b/js/common.js @@ -79,19 +79,21 @@ var CommonParams = (function () { /** * Returns the url query string using the saved parameters * + * @param {string} separator New separator + * * @return string */ - getUrlQuery: function () { + getUrlQuery: function (separator) { + var sep = (typeof separator !== 'undefined') ? separator : '?'; var common = this.get('common_query'); - var separator = '?'; var argsep = CommonParams.get('arg_separator'); if (common.length > 0) { - separator = argsep; + sep = argsep; } return Functions.sprintf( '%s%sserver=%s' + argsep + 'db=%s' + argsep + 'table=%s', this.get('common_query'), - separator, + sep, encodeURIComponent(this.get('server')), encodeURIComponent(this.get('db')), encodeURIComponent(this.get('table')) @@ -150,7 +152,11 @@ var CommonActions = { newUrl = $('#selflink').find('a').attr('href') || window.location.pathname; newUrl = newUrl.substring(0, newUrl.indexOf('?')); } - newUrl += CommonParams.getUrlQuery(); + if (newUrl.indexOf('?') !== -1) { + newUrl += CommonParams.getUrlQuery('&'); + } else { + newUrl += CommonParams.getUrlQuery(); + } $('<a></a>', { href: newUrl }) .appendTo('body') .trigger('click') diff --git a/js/database/operations.js b/js/database/operations.js index e8f927c5cc..140ae0e99a 100644 --- a/js/database/operations.js +++ b/js/database/operations.js @@ -153,7 +153,7 @@ AJAX.registerOnload('database/operations.js', function () { Navigation.reload(); CommonParams.set('db', ''); CommonActions.refreshMain( - 'server_databases.php', + 'index.php?route=/server/databases', function () { Functions.ajaxShowMessage(data.message); } diff --git a/js/server/databases.js b/js/server/databases.js index b10d0ddd0f..8dd811b7c3 100644 --- a/js/server/databases.js +++ b/js/server/databases.js @@ -19,7 +19,7 @@ AJAX.registerTeardown('server/databases.js', function () { }); /** - * AJAX scripts for server_databases.php + * AJAX scripts for /server/databases * * Actions ajaxified here: * Drop Databases |