diff --git a/Documentation.html b/Documentation.html
index 887b8a0fe..b928cb7dd 100644
--- a/Documentation.html
+++ b/Documentation.html
@@ -1421,7 +1421,7 @@ CREATE DATABASE,ALTER DATABASE,DROP DATABASE
comments. Defaults to TRUE.
$cfg['AllowArbitraryServer'] boolean
- If enabled allows you to log in to arbitrary servers using cookie auth.
+ If enabled, allows you to log in to arbitrary servers using cookie auth and permits to specify servers of your choice in the Synchronize dialog.
NOTE: Please use this carefully, as this may allow users access to
diff --git a/js/server_synchronize.js b/js/server_synchronize.js
index 4857530db..e1645aeca 100644
--- a/js/server_synchronize.js
+++ b/js/server_synchronize.js
@@ -301,26 +301,42 @@ function validateConnectionParams()
return form_is_ok;
}
+/**
+ * Handles the dynamic display of form fields related to a server selector
+ */
+
+function hideOrDisplayServerFields($server_selector, selected_option)
+{
+ $tbody = $server_selector.closest('tbody');
+ if (selected_option == 'cur') {
+ $tbody.children('.current-server').css('display', '');
+ $tbody.children('.remote-server').css('display', 'none');
+ } else if (selected_option == 'rmt') {
+ $tbody.children('.current-server').css('display', 'none');
+ $tbody.children('.remote-server').css('display', '');
+ } else {
+ $tbody.children('.current-server').css('display', 'none');
+ $tbody.children('.remote-server').css('display', '');
+ var parts = selected_option.split('||||');
+ $tbody.find('.server-host').val(parts[0]);
+ $tbody.find('.server-port').val(parts[1]);
+ $tbody.find('.server-socket').val(parts[2]);
+ $tbody.find('.server-user').val(parts[3]);
+ $tbody.find('.server-pass').val('');
+ $tbody.find('.server-db').val(parts[4])
+ }
+}
+
$(document).ready(function() {
$('.server_selector').change(function(evt) {
- var server = $(evt.target).val();
- if (server == 'cur') {
- $(this).closest('tbody').children('.current-server').css('display', '');
- $(this).closest('tbody').children('.remote-server').css('display', 'none');
- } else if (server == 'rmt') {
- $(this).closest('tbody').children('.current-server').css('display', 'none');
- $(this).closest('tbody').children('.remote-server').css('display', '');
- } else {
- $(this).closest('tbody').children('.current-server').css('display', 'none');
- $(this).closest('tbody').children('.remote-server').css('display', '');
- var parts = server.split('||||');
- $(this).closest('tbody').find('.server-host').val(parts[0]);
- $(this).closest('tbody').find('.server-port').val(parts[1]);
- $(this).closest('tbody').find('.server-socket').val(parts[2]);
- $(this).closest('tbody').find('.server-user').val(parts[3]);
- $(this).closest('tbody').find('.server-pass').val('');
- $(this).closest('tbody').find('.server-db').val(parts[4])
- }
+ var selected_option = $(evt.target).val();
+ hideOrDisplayServerFields($(evt.target), selected_option);
+ });
+
+ // initial display of the selectors
+ $('.server_selector').each(function() {
+ var selected_option = $(this).val();
+ hideOrDisplayServerFields($(this), selected_option);
});
$('.struct_img').hover(
diff --git a/server_synchronize.php b/server_synchronize.php
index 4fc0ac92c..bb08fd666 100644
--- a/server_synchronize.php
+++ b/server_synchronize.php
@@ -1104,21 +1104,39 @@ if (isset($_REQUEST['synchronize_db'])) {
$databases = PMA_DBI_get_databases_full(null, false, null, 'SCHEMA_NAME',
'ASC', 0, true);
+ if ($GLOBALS['cfg']['AllowArbitraryServer'] === false) {
+ $possibly_disabled = ' disabled="disabled"';
+ } else {
+ $possibly_disabled = '';
+ }
+
foreach ($cons as $type) {
if ('src' == $type) {
$database_header = __('Source database');
} else {
$database_header = __('Target database');
}
+
+ $database_header .= PMA_showHint(PMA_sanitize(sprintf('%sAllowArbitraryServer%s', '[a@./Documentation.html#AllowArbitraryServer@_blank]', '[/a]')));
?>