Bug #3168733 Synchronization does not honor AllowArbitraryServer
This commit is contained in:
@@ -1421,7 +1421,7 @@ CREATE DATABASE,ALTER DATABASE,DROP DATABASE</pre>
|
|||||||
comments. Defaults to <tt>TRUE</tt>.</dd>
|
comments. Defaults to <tt>TRUE</tt>.</dd>
|
||||||
<dt id="AllowArbitraryServer">
|
<dt id="AllowArbitraryServer">
|
||||||
<span id="cfg_AllowArbitraryServer">$cfg['AllowArbitraryServer']</span> boolean</dt>
|
<span id="cfg_AllowArbitraryServer">$cfg['AllowArbitraryServer']</span> boolean</dt>
|
||||||
<dd>If enabled allows you to log in to arbitrary servers using cookie auth.
|
<dd>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.
|
||||||
<br /><br />
|
<br /><br />
|
||||||
|
|
||||||
<b>NOTE:</b> Please use this carefully, as this may allow users access to
|
<b>NOTE:</b> Please use this carefully, as this may allow users access to
|
||||||
|
@@ -301,26 +301,42 @@ function validateConnectionParams()
|
|||||||
return form_is_ok;
|
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() {
|
$(document).ready(function() {
|
||||||
$('.server_selector').change(function(evt) {
|
$('.server_selector').change(function(evt) {
|
||||||
var server = $(evt.target).val();
|
var selected_option = $(evt.target).val();
|
||||||
if (server == 'cur') {
|
hideOrDisplayServerFields($(evt.target), selected_option);
|
||||||
$(this).closest('tbody').children('.current-server').css('display', '');
|
});
|
||||||
$(this).closest('tbody').children('.remote-server').css('display', 'none');
|
|
||||||
} else if (server == 'rmt') {
|
// initial display of the selectors
|
||||||
$(this).closest('tbody').children('.current-server').css('display', 'none');
|
$('.server_selector').each(function() {
|
||||||
$(this).closest('tbody').children('.remote-server').css('display', '');
|
var selected_option = $(this).val();
|
||||||
} else {
|
hideOrDisplayServerFields($(this), selected_option);
|
||||||
$(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])
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.struct_img').hover(
|
$('.struct_img').hover(
|
||||||
|
@@ -1104,21 +1104,39 @@ if (isset($_REQUEST['synchronize_db'])) {
|
|||||||
$databases = PMA_DBI_get_databases_full(null, false, null, 'SCHEMA_NAME',
|
$databases = PMA_DBI_get_databases_full(null, false, null, 'SCHEMA_NAME',
|
||||||
'ASC', 0, true);
|
'ASC', 0, true);
|
||||||
|
|
||||||
|
if ($GLOBALS['cfg']['AllowArbitraryServer'] === false) {
|
||||||
|
$possibly_disabled = ' disabled="disabled"';
|
||||||
|
} else {
|
||||||
|
$possibly_disabled = '';
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($cons as $type) {
|
foreach ($cons as $type) {
|
||||||
if ('src' == $type) {
|
if ('src' == $type) {
|
||||||
$database_header = __('Source database');
|
$database_header = __('Source database');
|
||||||
} else {
|
} else {
|
||||||
$database_header = __('Target database');
|
$database_header = __('Target database');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$database_header .= PMA_showHint(PMA_sanitize(sprintf('%sAllowArbitraryServer%s', '[a@./Documentation.html#AllowArbitraryServer@_blank]', '[/a]')));
|
||||||
?>
|
?>
|
||||||
<table id="serverconnection_<?php echo $type; ?>_remote" class="data">
|
<table id="serverconnection_<?php echo $type; ?>_remote" class="data">
|
||||||
<caption class="tblHeaders"><?php echo $database_header; ?></caption>
|
<caption class="tblHeaders"><?php echo $database_header; ?></caption>
|
||||||
<tr class="odd">
|
<tr class="odd">
|
||||||
<td colspan="2" style="text-align: center">
|
<td colspan="2" style="text-align: center">
|
||||||
<select name="<?php echo $type; ?>_type" id="<?php echo $type; ?>_type" class="server_selector">
|
<select name="<?php echo $type; ?>_type" id="<?php echo $type; ?>_type" class="server_selector">
|
||||||
<option value="rmt"><?php echo __('Enter manually'); ?></option>
|
|
||||||
<option value="cur"><?php echo __('Current connection'); ?></option>
|
|
||||||
<?php
|
<?php
|
||||||
|
if ($GLOBALS['cfg']['AllowArbitraryServer']) {
|
||||||
|
$preselected_option = 'rmt';
|
||||||
|
echo '<option value="rmt" selected="selected">' . __('Enter manually') . '</option>';
|
||||||
|
} else {
|
||||||
|
$preselected_option = 'cur';
|
||||||
|
}
|
||||||
|
echo '<option value="cur"';
|
||||||
|
if ('cur' == $preselected_option) {
|
||||||
|
echo ' selected="selected"';
|
||||||
|
}
|
||||||
|
echo '>' . __('Current connection') . '</option>';
|
||||||
|
|
||||||
foreach ($GLOBALS['cfg']['Servers'] as $key => $tmp_server) {
|
foreach ($GLOBALS['cfg']['Servers'] as $key => $tmp_server) {
|
||||||
if (empty($tmp_server['host'])) {
|
if (empty($tmp_server['host'])) {
|
||||||
continue;
|
continue;
|
||||||
@@ -1145,8 +1163,8 @@ if (isset($_REQUEST['synchronize_db'])) {
|
|||||||
$value .= $tmp_server['user'];
|
$value .= $tmp_server['user'];
|
||||||
$value .= '||||';
|
$value .= '||||';
|
||||||
$value .= $tmp_server['only_db'];
|
$value .= $tmp_server['only_db'];
|
||||||
echo '<option value="' . $value . '">'
|
echo '<option value="' . $value . '" >'
|
||||||
. htmlspecialchars(sprintf(__('Configuration: %s'), $label)) . '</option>' . "\n";
|
. htmlspecialchars(sprintf(__('Configuration: %s'), $label)) . '</option>';
|
||||||
} // end foreach
|
} // end foreach
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
@@ -1154,27 +1172,27 @@ if (isset($_REQUEST['synchronize_db'])) {
|
|||||||
</tr>
|
</tr>
|
||||||
<tr class="even toggler remote-server">
|
<tr class="even toggler remote-server">
|
||||||
<td><?php echo __('Server'); ?></td>
|
<td><?php echo __('Server'); ?></td>
|
||||||
<td><input type="text" name="<?php echo $type; ?>_host" class="server-host" /></td>
|
<td><input type="text" name="<?php echo $type; ?>_host" class="server-host" <?php echo $possibly_disabled; ?>/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="odd toggler remote-server">
|
<tr class="odd toggler remote-server">
|
||||||
<td><?php echo __('Port'); ?></td>
|
<td><?php echo __('Port'); ?></td>
|
||||||
<td><input type="text" name="<?php echo $type; ?>_port" class="server-port" value="3306" maxlength="5" size="5" /></td>
|
<td><input type="text" name="<?php echo $type; ?>_port" class="server-port" <?php echo $possibly_disabled; ?> value="3306" maxlength="5" size="5" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="even toggler remote-server">
|
<tr class="even toggler remote-server">
|
||||||
<td><?php echo __('Socket'); ?></td>
|
<td><?php echo __('Socket'); ?></td>
|
||||||
<td><input type="text" name="<?php echo $type; ?>_socket" class="server-socket" /></td>
|
<td><input type="text" name="<?php echo $type; ?>_socket" class="server-socket" <?php echo $possibly_disabled; ?>/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="odd toggler remote-server">
|
<tr class="odd toggler remote-server">
|
||||||
<td><?php echo __('User name'); ?></td>
|
<td><?php echo __('User name'); ?></td>
|
||||||
<td><input type="text" name="<?php echo $type; ?>_username" class="server-user" /></td>
|
<td><input type="text" name="<?php echo $type; ?>_username" class="server-user" <?php echo $possibly_disabled; ?>/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="even toggler remote-server">
|
<tr class="even toggler remote-server">
|
||||||
<td><?php echo __('Password'); ?></td>
|
<td><?php echo __('Password'); ?></td>
|
||||||
<td><input type="password" name="<?php echo $type; ?>_pass" class="server-pass" /> </td>
|
<td><input type="password" name="<?php echo $type; ?>_pass" class="server-pass" <?php echo $possibly_disabled; ?>/> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="odd toggler remote-server">
|
<tr class="odd toggler remote-server">
|
||||||
<td><?php echo __('Database'); ?></td>
|
<td><?php echo __('Database'); ?></td>
|
||||||
<td><input type="text" name="<?php echo $type; ?>_db" class="server-db" /></td>
|
<td><input type="text" name="<?php echo $type; ?>_db" class="server-db" <?php echo $possibly_disabled; ?>/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="even toggler current-server" style="display: none;">
|
<tr class="even toggler current-server" style="display: none;">
|
||||||
<td><?php echo __('Database'); ?></td>
|
<td><?php echo __('Database'); ?></td>
|
||||||
|
Reference in New Issue
Block a user