improve coding style
This commit is contained in:
parent
59d27ae71c
commit
e67e930328
@ -383,8 +383,10 @@ class FormDisplay
|
||||
}
|
||||
$js_default[] = $js_line;
|
||||
|
||||
display_input($translated_path, $name, $description, $type,
|
||||
$value, $value_is_default, $opts);
|
||||
display_input(
|
||||
$translated_path, $name, $description, $type,
|
||||
$value, $value_is_default, $opts
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -509,7 +511,8 @@ class FormDisplay
|
||||
} else {
|
||||
$this->errors[$form->name][] = sprintf(
|
||||
__('Missing data for %s'),
|
||||
'<i>' . PMA_lang_name($system_path) . '</i>');
|
||||
'<i>' . PMA_lang_name($system_path) . '</i>'
|
||||
);
|
||||
$result = false;
|
||||
continue;
|
||||
}
|
||||
@ -571,8 +574,10 @@ class FormDisplay
|
||||
// now we have value with proper type
|
||||
$values[$system_path] = $_POST[$key];
|
||||
if ($change_index !== false) {
|
||||
$work_path = str_replace("Servers/$form->index/",
|
||||
"Servers/$change_index/", $work_path);
|
||||
$work_path = str_replace(
|
||||
"Servers/$form->index/",
|
||||
"Servers/$change_index/", $work_path
|
||||
);
|
||||
}
|
||||
$to_save[$work_path] = $system_path;
|
||||
}
|
||||
@ -710,8 +715,10 @@ class FormDisplay
|
||||
}
|
||||
if (!function_exists('recode_string')) {
|
||||
$opts['values']['recode'] .= ' (' . __('unavailable') . ')';
|
||||
$comment .= ($comment ? ", " : '') . sprintf(__('"%s" requires %s extension'),
|
||||
'recode', 'recode');
|
||||
$comment .= ($comment ? ", " : '') . sprintf(
|
||||
__('"%s" requires %s extension'),
|
||||
'recode', 'recode'
|
||||
);
|
||||
}
|
||||
$opts['comment'] = $comment;
|
||||
$opts['comment_warning'] = true;
|
||||
@ -724,12 +731,16 @@ class FormDisplay
|
||||
'GZipDump' => array('gzopen', 'gzencode'),
|
||||
'BZipDump' => array('bzopen', 'bzcompress'));
|
||||
if (!function_exists($funcs[$system_path][0])) {
|
||||
$comment = sprintf(__('import will not work, missing function (%s)'),
|
||||
$funcs[$system_path][0]);
|
||||
$comment = sprintf(
|
||||
__('import will not work, missing function (%s)'),
|
||||
$funcs[$system_path][0]
|
||||
);
|
||||
}
|
||||
if (!function_exists($funcs[$system_path][1])) {
|
||||
$comment .= ($comment ? '; ' : '') . sprintf(__('export will not work, missing function (%s)'),
|
||||
$funcs[$system_path][1]);
|
||||
$comment .= ($comment ? '; ' : '') . sprintf(
|
||||
__('export will not work, missing function (%s)'),
|
||||
$funcs[$system_path][1]
|
||||
);
|
||||
}
|
||||
$opts['comment'] = $comment;
|
||||
$opts['comment_warning'] = true;
|
||||
|
||||
@ -81,9 +81,11 @@ if ((isset($_REQUEST['submit_connect']))) {
|
||||
}
|
||||
}
|
||||
|
||||
${"{$con}_connection"} = PMA_DBI_connect(${"{$con}_username"},
|
||||
${"{$con}_connection"} = PMA_DBI_connect(
|
||||
${"{$con}_username"},
|
||||
${"{$con}_password"}, $is_controluser = false,
|
||||
${"{$con}_server"}, $auxiliary_connection = true);
|
||||
${"{$con}_server"}, $auxiliary_connection = true
|
||||
);
|
||||
} // end foreach ($cons as $con)
|
||||
|
||||
if ((! $src_connection && $src_type != 'cur')
|
||||
@ -111,8 +113,10 @@ if ((isset($_REQUEST['submit_connect']))) {
|
||||
*/
|
||||
foreach ($cons as $con) {
|
||||
if (${"{$con}_connection"} != null) {
|
||||
${"{$con}_link"} = PMA_DBI_connect(${"{$con}_username"},
|
||||
${"{$con}_password"}, $is_controluser = false, ${"{$con}_server"});
|
||||
${"{$con}_link"} = PMA_DBI_connect(
|
||||
${"{$con}_username"},
|
||||
${"{$con}_password"}, $is_controluser = false, ${"{$con}_server"}
|
||||
);
|
||||
} else {
|
||||
${"{$con}_link"} = null;
|
||||
}
|
||||
@ -205,19 +209,25 @@ if ((isset($_REQUEST['submit_connect']))) {
|
||||
* Finding out all the differences structure, data and index diff
|
||||
* for all the matching tables only
|
||||
*/
|
||||
PMA_dataDiffInTables($src_db, $trg_db, $src_link, $trg_link,
|
||||
PMA_dataDiffInTables(
|
||||
$src_db, $trg_db, $src_link, $trg_link,
|
||||
$matching_tables, $matching_tables_fields, $update_array,
|
||||
$insert_array, $delete_array, $fields_num, $i,
|
||||
$matching_tables_keys);
|
||||
$matching_tables_keys
|
||||
);
|
||||
|
||||
PMA_structureDiffInTables($src_db, $trg_db, $src_link, $trg_link,
|
||||
PMA_structureDiffInTables(
|
||||
$src_db, $trg_db, $src_link, $trg_link,
|
||||
$matching_tables, $source_columns, $target_columns,
|
||||
$alter_str_array, $add_column_array, $uncommon_columns,
|
||||
$criteria, $target_tables_keys, $i);
|
||||
$criteria, $target_tables_keys, $i
|
||||
);
|
||||
|
||||
PMA_indexesDiffInTables($src_db, $trg_db, $src_link, $trg_link,
|
||||
PMA_indexesDiffInTables(
|
||||
$src_db, $trg_db, $src_link, $trg_link,
|
||||
$matching_tables, $source_indexes, $target_indexes,
|
||||
$add_indexes_array, $alter_indexes_array, $remove_indexes_array, $i);
|
||||
$add_indexes_array, $alter_indexes_array, $remove_indexes_array, $i
|
||||
);
|
||||
}
|
||||
|
||||
for ($j = 0; $j < sizeof($source_tables_uncommon); $j++) {
|
||||
@ -225,8 +235,10 @@ if ((isset($_REQUEST['submit_connect']))) {
|
||||
* Finding out the number of rows to be added in tables
|
||||
* that need to be added in target database
|
||||
*/
|
||||
PMA_dataDiffInUncommonTables($source_tables_uncommon, $src_db,
|
||||
$src_link, $j, $row_count);
|
||||
PMA_dataDiffInUncommonTables(
|
||||
$source_tables_uncommon, $src_db,
|
||||
$src_link, $j, $row_count
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -524,8 +536,10 @@ if (isset($_REQUEST['Table_ids'])) {
|
||||
*/
|
||||
foreach ($cons as $con) {
|
||||
if (${"{$con}_type"} != "cur") {
|
||||
${"{$con}_link"} = PMA_DBI_connect(${"{$con}_username"},
|
||||
${"{$con}_password"}, $is_controluser = false, ${"{$con}_server"});
|
||||
${"{$con}_link"} = PMA_DBI_connect(
|
||||
${"{$con}_username"},
|
||||
${"{$con}_password"}, $is_controluser = false, ${"{$con}_server"}
|
||||
);
|
||||
} else {
|
||||
${"{$con}_link"} = null;
|
||||
// working on current server, so initialize this for tracking
|
||||
@ -568,36 +582,46 @@ if (isset($_REQUEST['Table_ids'])) {
|
||||
*/
|
||||
for ($q = 0; $q < sizeof($matching_table_structure_diff); $q++) {
|
||||
if (isset($alter_str_array[$matching_table_structure_diff[$q]])) {
|
||||
PMA_alterTargetTableStructure($trg_db, $trg_link, $matching_tables,
|
||||
PMA_alterTargetTableStructure(
|
||||
$trg_db, $trg_link, $matching_tables,
|
||||
$source_columns, $alter_str_array, $matching_tables_fields,
|
||||
$criteria, $matching_tables_keys, $target_tables_keys,
|
||||
$matching_table_structure_diff[$q], false);
|
||||
$matching_table_structure_diff[$q], false
|
||||
);
|
||||
|
||||
unset($alter_str_array[$matching_table_structure_diff[$q]]);
|
||||
}
|
||||
if (isset($add_column_array[$matching_table_structure_diff[$q]])) {
|
||||
PMA_findDeleteRowsFromTargetTables($delete_array, $matching_tables,
|
||||
PMA_findDeleteRowsFromTargetTables(
|
||||
$delete_array, $matching_tables,
|
||||
$matching_table_structure_diff[$q], $target_tables_keys,
|
||||
$matching_tables_keys, $trg_db, $trg_link, $src_db, $src_link);
|
||||
$matching_tables_keys, $trg_db, $trg_link, $src_db, $src_link
|
||||
);
|
||||
|
||||
if (isset($delete_array[$matching_table_structure_diff[$q]])) {
|
||||
PMA_deleteFromTargetTable($trg_db, $trg_link, $matching_tables,
|
||||
PMA_deleteFromTargetTable(
|
||||
$trg_db, $trg_link, $matching_tables,
|
||||
$matching_table_structure_diff[$q], $target_tables_keys,
|
||||
$delete_array, false);
|
||||
$delete_array, false
|
||||
);
|
||||
|
||||
unset($delete_array[$matching_table_structure_diff[$q]]);
|
||||
}
|
||||
PMA_addColumnsInTargetTable($src_db, $trg_db, $src_link, $trg_link,
|
||||
PMA_addColumnsInTargetTable(
|
||||
$src_db, $trg_db, $src_link, $trg_link,
|
||||
$matching_tables, $source_columns, $add_column_array,
|
||||
$matching_tables_fields, $criteria, $matching_tables_keys,
|
||||
$target_tables_keys, $uncommon_tables, $uncommon_tables_fields,
|
||||
$matching_table_structure_diff[$q], $uncommon_cols, false);
|
||||
$matching_table_structure_diff[$q], $uncommon_cols, false
|
||||
);
|
||||
|
||||
unset($add_column_array[$matching_table_structure_diff[$q]]);
|
||||
}
|
||||
if (isset($uncommon_columns[$matching_table_structure_diff[$q]])) {
|
||||
PMA_removeColumnsFromTargetTable($trg_db, $trg_link, $matching_tables,
|
||||
$uncommon_columns, $matching_table_structure_diff[$q], false);
|
||||
PMA_removeColumnsFromTargetTable(
|
||||
$trg_db, $trg_link, $matching_tables,
|
||||
$uncommon_columns, $matching_table_structure_diff[$q], false
|
||||
);
|
||||
|
||||
unset($uncommon_columns[$matching_table_structure_diff[$q]]);
|
||||
}
|
||||
@ -605,10 +629,12 @@ if (isset($_REQUEST['Table_ids'])) {
|
||||
|| isset($remove_indexes_array[$matching_table_structure_diff[$q]])
|
||||
|| isset($alter_indexes_array[$matching_table_structure_diff[$q]])
|
||||
) {
|
||||
PMA_applyIndexesDiff ($trg_db, $trg_link, $matching_tables,
|
||||
PMA_applyIndexesDiff(
|
||||
$trg_db, $trg_link, $matching_tables,
|
||||
$source_indexes, $target_indexes, $add_indexes_array,
|
||||
$alter_indexes_array, $remove_indexes_array,
|
||||
$matching_table_structure_diff[$q], false);
|
||||
$matching_table_structure_diff[$q], false
|
||||
);
|
||||
|
||||
unset($add_indexes_array[$matching_table_structure_diff[$q]]);
|
||||
unset($alter_indexes_array[$matching_table_structure_diff[$q]]);
|
||||
@ -621,49 +647,63 @@ if (isset($_REQUEST['Table_ids'])) {
|
||||
*/
|
||||
for ($p = 0; $p < sizeof($matching_table_data_diff); $p++) {
|
||||
if ($_REQUEST['checked'] == 'true') {
|
||||
PMA_findDeleteRowsFromTargetTables($delete_array, $matching_tables,
|
||||
PMA_findDeleteRowsFromTargetTables(
|
||||
$delete_array, $matching_tables,
|
||||
$matching_table_data_diff[$p], $target_tables_keys,
|
||||
$matching_tables_keys, $trg_db, $trg_link, $src_db, $src_link);
|
||||
$matching_tables_keys, $trg_db, $trg_link, $src_db, $src_link
|
||||
);
|
||||
|
||||
if (isset($delete_array[$matching_table_data_diff[$p]])) {
|
||||
PMA_deleteFromTargetTable($trg_db, $trg_link, $matching_tables,
|
||||
PMA_deleteFromTargetTable(
|
||||
$trg_db, $trg_link, $matching_tables,
|
||||
$matching_table_data_diff[$p], $target_tables_keys,
|
||||
$delete_array, false);
|
||||
$delete_array, false
|
||||
);
|
||||
|
||||
unset($delete_array[$matching_table_data_diff[$p]]);
|
||||
}
|
||||
}
|
||||
if (isset($alter_str_array[$matching_table_data_diff[$p]])) {
|
||||
PMA_alterTargetTableStructure($trg_db, $trg_link, $matching_tables,
|
||||
PMA_alterTargetTableStructure(
|
||||
$trg_db, $trg_link, $matching_tables,
|
||||
$source_columns, $alter_str_array, $matching_tables_fields,
|
||||
$criteria, $matching_tables_keys, $target_tables_keys,
|
||||
$matching_table_data_diff[$p], false);
|
||||
$matching_table_data_diff[$p], false
|
||||
);
|
||||
|
||||
unset($alter_str_array[$matching_table_data_diff[$p]]);
|
||||
}
|
||||
if (isset($add_column_array[$matching_table_data_diff[$p]])) {
|
||||
PMA_findDeleteRowsFromTargetTables($delete_array, $matching_tables,
|
||||
PMA_findDeleteRowsFromTargetTables(
|
||||
$delete_array, $matching_tables,
|
||||
$matching_table_data_diff[$p], $target_tables_keys,
|
||||
$matching_tables_keys, $trg_db, $trg_link, $src_db, $src_link);
|
||||
$matching_tables_keys, $trg_db, $trg_link, $src_db, $src_link
|
||||
);
|
||||
|
||||
if (isset($delete_array[$matching_table_data_diff[$p]])) {
|
||||
PMA_deleteFromTargetTable($trg_db, $trg_link, $matching_tables,
|
||||
PMA_deleteFromTargetTable(
|
||||
$trg_db, $trg_link, $matching_tables,
|
||||
$matching_table_data_diff[$p], $target_tables_keys,
|
||||
$delete_array, false);
|
||||
$delete_array, false
|
||||
);
|
||||
|
||||
unset($delete_array[$matching_table_data_diff[$p]]);
|
||||
}
|
||||
PMA_addColumnsInTargetTable($src_db, $trg_db, $src_link, $trg_link,
|
||||
PMA_addColumnsInTargetTable(
|
||||
$src_db, $trg_db, $src_link, $trg_link,
|
||||
$matching_tables, $source_columns, $add_column_array,
|
||||
$matching_tables_fields, $criteria, $matching_tables_keys,
|
||||
$target_tables_keys, $uncommon_tables, $uncommon_tables_fields,
|
||||
$matching_table_data_diff[$p], $uncommon_cols, false);
|
||||
$matching_table_data_diff[$p], $uncommon_cols, false
|
||||
);
|
||||
|
||||
unset($add_column_array[$matching_table_data_diff[$p]]);
|
||||
}
|
||||
if (isset($uncommon_columns[$matching_table_data_diff[$p]])) {
|
||||
PMA_removeColumnsFromTargetTable($trg_db, $trg_link, $matching_tables,
|
||||
$uncommon_columns, $matching_table_data_diff[$p], false);
|
||||
PMA_removeColumnsFromTargetTable(
|
||||
$trg_db, $trg_link, $matching_tables,
|
||||
$uncommon_columns, $matching_table_data_diff[$p], false
|
||||
);
|
||||
|
||||
unset($uncommon_columns[$matching_table_data_diff[$p]]);
|
||||
}
|
||||
@ -674,10 +714,12 @@ if (isset($_REQUEST['Table_ids'])) {
|
||||
|| (isset($matching_table_structure_diff[$q])
|
||||
&& isset($alter_indexes_array[$matching_table_structure_diff[$q]]))
|
||||
) {
|
||||
PMA_applyIndexesDiff ($trg_db, $trg_link, $matching_tables,
|
||||
PMA_applyIndexesDiff(
|
||||
$trg_db, $trg_link, $matching_tables,
|
||||
$source_indexes, $target_indexes, $add_indexes_array,
|
||||
$alter_indexes_array, $remove_indexes_array,
|
||||
$matching_table_structure_diff[$q], false);
|
||||
$matching_table_structure_diff[$q], false
|
||||
);
|
||||
|
||||
unset($add_indexes_array[$matching_table_structure_diff[$q]]);
|
||||
unset($alter_indexes_array[$matching_table_structure_diff[$q]]);
|
||||
@ -686,16 +728,20 @@ if (isset($_REQUEST['Table_ids'])) {
|
||||
/**
|
||||
* Applying the data difference.
|
||||
*/
|
||||
PMA_updateTargetTables($matching_tables, $update_array, $src_db, $trg_db,
|
||||
$trg_link, $matching_table_data_diff[$p], $matching_tables_keys, false);
|
||||
PMA_updateTargetTables(
|
||||
$matching_tables, $update_array, $src_db, $trg_db,
|
||||
$trg_link, $matching_table_data_diff[$p], $matching_tables_keys, false
|
||||
);
|
||||
|
||||
PMA_insertIntoTargetTable($matching_tables, $src_db, $trg_db, $src_link,
|
||||
PMA_insertIntoTargetTable(
|
||||
$matching_tables, $src_db, $trg_db, $src_link,
|
||||
$trg_link, $matching_tables_fields, $insert_array,
|
||||
$matching_table_data_diff[$p], $matching_tables_keys, $source_columns,
|
||||
$add_column_array, $criteria, $target_tables_keys, $uncommon_tables,
|
||||
$uncommon_tables_fields, $uncommon_cols, $alter_str_array,
|
||||
$source_indexes, $target_indexes, $add_indexes_array,
|
||||
$alter_indexes_array, $delete_array, $update_array, false);
|
||||
$alter_indexes_array, $delete_array, $update_array, false
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Updating the session variables to the latest values of the arrays.
|
||||
@ -714,9 +760,11 @@ if (isset($_REQUEST['Table_ids'])) {
|
||||
* (present in Source but absent from Target).
|
||||
*/
|
||||
for ($s = 0; $s < sizeof($uncommon_table_structure_diff); $s++) {
|
||||
PMA_createTargetTables($src_db, $trg_db, $src_link, $trg_link,
|
||||
PMA_createTargetTables(
|
||||
$src_db, $trg_db, $src_link, $trg_link,
|
||||
$uncommon_tables, $uncommon_table_structure_diff[$s],
|
||||
$uncommon_tables_fields, false);
|
||||
$uncommon_tables_fields, false
|
||||
);
|
||||
$_SESSION['uncommon_tables_fields'] = $uncommon_tables_fields;
|
||||
|
||||
unset($uncommon_tables[$uncommon_table_structure_diff[$s]]);
|
||||
@ -729,17 +777,21 @@ if (isset($_REQUEST['Table_ids'])) {
|
||||
for ($r = 0; $r < sizeof($uncommon_table_data_diff); $r++) {
|
||||
if (!(in_array($uncommon_table_data_diff[$r], $uncommon_table_structure_diff))) {
|
||||
if (isset($uncommon_tables[$uncommon_table_data_diff[$r]])) {
|
||||
PMA_createTargetTables($src_db, $trg_db, $src_link, $trg_link,
|
||||
PMA_createTargetTables(
|
||||
$src_db, $trg_db, $src_link, $trg_link,
|
||||
$uncommon_tables, $uncommon_table_data_diff[$r],
|
||||
$uncommon_tables_fields, false);
|
||||
$uncommon_tables_fields, false
|
||||
);
|
||||
$_SESSION['uncommon_tables_fields'] = $uncommon_tables_fields;
|
||||
|
||||
unset($uncommon_tables[$uncommon_table_data_diff[$r]]);
|
||||
}
|
||||
}
|
||||
PMA_populateTargetTables($src_db, $trg_db, $src_link, $trg_link,
|
||||
PMA_populateTargetTables(
|
||||
$src_db, $trg_db, $src_link, $trg_link,
|
||||
$source_tables_uncommon, $uncommon_table_data_diff[$r],
|
||||
$_SESSION['uncommon_tables_fields'], false);
|
||||
$_SESSION['uncommon_tables_fields'], false
|
||||
);
|
||||
|
||||
unset($row_count[$uncommon_table_data_diff[$r]]);
|
||||
}
|
||||
@ -1053,42 +1105,56 @@ if (isset($_REQUEST['synchronize_db'])) {
|
||||
* first find out rows to be deleted and then delete the rows.
|
||||
*/
|
||||
if (isset($_REQUEST['delete_rows'])) {
|
||||
PMA_findDeleteRowsFromTargetTables($delete_array, $matching_tables, $p,
|
||||
PMA_findDeleteRowsFromTargetTables(
|
||||
$delete_array, $matching_tables, $p,
|
||||
$target_tables_keys, $matching_tables_keys,
|
||||
$trg_db, $trg_link, $src_db, $src_link);
|
||||
$trg_db, $trg_link, $src_db, $src_link
|
||||
);
|
||||
|
||||
if (isset($delete_array[$p])) {
|
||||
PMA_deleteFromTargetTable($trg_db, $trg_link, $matching_tables, $p,
|
||||
$target_tables_keys, $delete_array, true);
|
||||
PMA_deleteFromTargetTable(
|
||||
$trg_db, $trg_link, $matching_tables, $p,
|
||||
$target_tables_keys, $delete_array, true
|
||||
);
|
||||
unset($delete_array[$p]);
|
||||
}
|
||||
}
|
||||
if (isset($alter_str_array[$p])) {
|
||||
PMA_alterTargetTableStructure($trg_db, $trg_link, $matching_tables,
|
||||
PMA_alterTargetTableStructure(
|
||||
$trg_db, $trg_link, $matching_tables,
|
||||
$source_columns, $alter_str_array, $matching_tables_fields,
|
||||
$criteria, $matching_tables_keys, $target_tables_keys, $p, true);
|
||||
$criteria, $matching_tables_keys, $target_tables_keys, $p, true
|
||||
);
|
||||
unset($alter_str_array[$p]);
|
||||
}
|
||||
if (! empty($add_column_array[$p])) {
|
||||
PMA_findDeleteRowsFromTargetTables($delete_array, $matching_tables, $p,
|
||||
PMA_findDeleteRowsFromTargetTables(
|
||||
$delete_array, $matching_tables, $p,
|
||||
$target_tables_keys, $matching_tables_keys,
|
||||
$trg_db, $trg_link, $src_db, $src_link);
|
||||
$trg_db, $trg_link, $src_db, $src_link
|
||||
);
|
||||
|
||||
if (isset($delete_array[$p])) {
|
||||
PMA_deleteFromTargetTable($trg_db, $trg_link, $matching_tables, $p,
|
||||
$target_tables_keys, $delete_array, true);
|
||||
PMA_deleteFromTargetTable(
|
||||
$trg_db, $trg_link, $matching_tables, $p,
|
||||
$target_tables_keys, $delete_array, true
|
||||
);
|
||||
unset($delete_array[$p]);
|
||||
}
|
||||
PMA_addColumnsInTargetTable($src_db, $trg_db, $src_link, $trg_link,
|
||||
PMA_addColumnsInTargetTable(
|
||||
$src_db, $trg_db, $src_link, $trg_link,
|
||||
$matching_tables, $source_columns, $add_column_array,
|
||||
$matching_tables_fields, $criteria, $matching_tables_keys,
|
||||
$target_tables_keys, $uncommon_tables, $uncommon_tables_fields,
|
||||
$p, $uncommon_cols, true);
|
||||
$p, $uncommon_cols, true
|
||||
);
|
||||
unset($add_column_array[$p]);
|
||||
}
|
||||
if (isset($uncommon_columns[$p])) {
|
||||
PMA_removeColumnsFromTargetTable($trg_db, $trg_link, $matching_tables,
|
||||
$uncommon_columns, $p, true);
|
||||
PMA_removeColumnsFromTargetTable(
|
||||
$trg_db, $trg_link, $matching_tables,
|
||||
$uncommon_columns, $p, true
|
||||
);
|
||||
unset($uncommon_columns[$p]);
|
||||
}
|
||||
if (isset($matching_table_structure_diff)
|
||||
@ -1096,18 +1162,22 @@ if (isset($_REQUEST['synchronize_db'])) {
|
||||
|| isset($remove_indexes_array[$matching_table_structure_diff[$p]])
|
||||
|| isset($alter_indexes_array[$matching_table_structure_diff[$p]]))
|
||||
) {
|
||||
PMA_applyIndexesDiff ($trg_db, $trg_link, $matching_tables,
|
||||
PMA_applyIndexesDiff(
|
||||
$trg_db, $trg_link, $matching_tables,
|
||||
$source_indexes, $target_indexes, $add_indexes_array,
|
||||
$alter_indexes_array, $remove_indexes_array,
|
||||
$matching_table_structure_diff[$p], true);
|
||||
$matching_table_structure_diff[$p], true
|
||||
);
|
||||
|
||||
unset($add_indexes_array[$matching_table_structure_diff[$p]]);
|
||||
unset($alter_indexes_array[$matching_table_structure_diff[$p]]);
|
||||
unset($remove_indexes_array[$matching_table_structure_diff[$p]]);
|
||||
}
|
||||
|
||||
PMA_updateTargetTables($matching_tables, $update_array, $src_db, $trg_db,
|
||||
$trg_link, $p, $matching_tables_keys, true);
|
||||
PMA_updateTargetTables(
|
||||
$matching_tables, $update_array, $src_db, $trg_db,
|
||||
$trg_link, $p, $matching_tables_keys, true
|
||||
);
|
||||
|
||||
PMA_insertIntoTargetTable(
|
||||
$matching_tables, $src_db, $trg_db, $src_link,
|
||||
@ -1126,12 +1196,16 @@ if (isset($_REQUEST['synchronize_db'])) {
|
||||
*/
|
||||
for ($q = 0; $q < sizeof($source_tables_uncommon); $q++) {
|
||||
if (isset($uncommon_tables[$q])) {
|
||||
PMA_createTargetTables($src_db, $trg_db, $src_link, $trg_link,
|
||||
$source_tables_uncommon, $q, $uncommon_tables_fields, true);
|
||||
PMA_createTargetTables(
|
||||
$src_db, $trg_db, $src_link, $trg_link,
|
||||
$source_tables_uncommon, $q, $uncommon_tables_fields, true
|
||||
);
|
||||
}
|
||||
if (isset($row_count[$q])) {
|
||||
PMA_populateTargetTables($src_db, $trg_db, $src_link, $trg_link,
|
||||
$source_tables_uncommon, $q, $uncommon_tables_fields, true);
|
||||
PMA_populateTargetTables(
|
||||
$src_db, $trg_db, $src_link, $trg_link,
|
||||
$source_tables_uncommon, $q, $uncommon_tables_fields, true
|
||||
);
|
||||
}
|
||||
}
|
||||
echo "</fieldset>";
|
||||
@ -1164,8 +1238,10 @@ if (! isset($_REQUEST['submit_connect'])
|
||||
* Displays the forms
|
||||
*/
|
||||
|
||||
$databases = PMA_DBI_get_databases_full(null, false, null, 'SCHEMA_NAME',
|
||||
'ASC', 0, true);
|
||||
$databases = PMA_DBI_get_databases_full(
|
||||
null, false, null, 'SCHEMA_NAME',
|
||||
'ASC', 0, true
|
||||
);
|
||||
|
||||
$databases_to_hide = array(
|
||||
'information_schema',
|
||||
@ -1188,8 +1264,14 @@ if (! isset($_REQUEST['submit_connect'])
|
||||
$database_header = __('Target database');
|
||||
}
|
||||
|
||||
$database_header .= PMA_showHint(PMA_sanitize(sprintf('%sAllowArbitraryServer%s',
|
||||
'[a@./Documentation.html#AllowArbitraryServer@_blank]', '[/a]')));
|
||||
$database_header .= PMA_showHint(
|
||||
PMA_sanitize(
|
||||
sprintf(
|
||||
'%sAllowArbitraryServer%s',
|
||||
'[a@./Documentation.html#AllowArbitraryServer@_blank]', '[/a]'
|
||||
)
|
||||
)
|
||||
);
|
||||
?>
|
||||
<table id="serverconnection_<?php echo $type; ?>_remote" class="data noclick">
|
||||
<caption class="tblHeaders"><?php echo $database_header; ?></caption>
|
||||
|
||||
@ -25,8 +25,10 @@ class PMA_sanitize_test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testXssInHref()
|
||||
{
|
||||
$this->assertEquals('[a@javascript:alert(\'XSS\');@target]link</a>',
|
||||
PMA_sanitize('[a@javascript:alert(\'XSS\');@target]link[/a]'));
|
||||
$this->assertEquals(
|
||||
'[a@javascript:alert(\'XSS\');@target]link</a>',
|
||||
PMA_sanitize('[a@javascript:alert(\'XSS\');@target]link[/a]')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -37,8 +39,10 @@ class PMA_sanitize_test extends PHPUnit_Framework_TestCase
|
||||
unset($GLOBALS['server']);
|
||||
unset($GLOBALS['lang']);
|
||||
unset($GLOBALS['collation_connection']);
|
||||
$this->assertEquals('<a href="./url.php?url=http%3A%2F%2Fwww.phpmyadmin.net%2F&token=token" target="target">link</a>',
|
||||
PMA_sanitize('[a@http://www.phpmyadmin.net/@target]link[/a]'));
|
||||
$this->assertEquals(
|
||||
'<a href="./url.php?url=http%3A%2F%2Fwww.phpmyadmin.net%2F&token=token" target="target">link</a>',
|
||||
PMA_sanitize('[a@http://www.phpmyadmin.net/@target]link[/a]')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -46,8 +50,10 @@ class PMA_sanitize_test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testLinkDoc()
|
||||
{
|
||||
$this->assertEquals('<a href="./Documentation.html">doc</a>',
|
||||
PMA_sanitize('[a@./Documentation.html]doc[/a]'));
|
||||
$this->assertEquals(
|
||||
'<a href="./Documentation.html">doc</a>',
|
||||
PMA_sanitize('[a@./Documentation.html]doc[/a]')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,8 +61,10 @@ class PMA_sanitize_test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testInvalidTarget()
|
||||
{
|
||||
$this->assertEquals('[a@./Documentation.html@INVALID9]doc</a>',
|
||||
PMA_sanitize('[a@./Documentation.html@INVALID9]doc[/a]'));
|
||||
$this->assertEquals(
|
||||
'[a@./Documentation.html@INVALID9]doc</a>',
|
||||
PMA_sanitize('[a@./Documentation.html@INVALID9]doc[/a]')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -64,8 +72,10 @@ class PMA_sanitize_test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testLinkDocXss()
|
||||
{
|
||||
$this->assertEquals('[a@./Documentation.html" onmouseover="alert(foo)"]doc</a>',
|
||||
PMA_sanitize('[a@./Documentation.html" onmouseover="alert(foo)"]doc[/a]'));
|
||||
$this->assertEquals(
|
||||
'[a@./Documentation.html" onmouseover="alert(foo)"]doc</a>',
|
||||
PMA_sanitize('[a@./Documentation.html" onmouseover="alert(foo)"]doc[/a]')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -73,8 +83,10 @@ class PMA_sanitize_test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testLinkAndXssInHref()
|
||||
{
|
||||
$this->assertEquals('<a href="./Documentation.html">doc</a>[a@javascript:alert(\'XSS\');@target]link</a>',
|
||||
PMA_sanitize('[a@./Documentation.html]doc[/a][a@javascript:alert(\'XSS\');@target]link[/a]'));
|
||||
$this->assertEquals(
|
||||
'<a href="./Documentation.html">doc</a>[a@javascript:alert(\'XSS\');@target]link</a>',
|
||||
PMA_sanitize('[a@./Documentation.html]doc[/a][a@javascript:alert(\'XSS\');@target]link[/a]')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,8 +94,10 @@ class PMA_sanitize_test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testHtmlTags()
|
||||
{
|
||||
$this->assertEquals('<div onclick="">',
|
||||
PMA_sanitize('<div onclick="">'));
|
||||
$this->assertEquals(
|
||||
'<div onclick="">',
|
||||
PMA_sanitize('<div onclick="">')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -91,8 +105,10 @@ class PMA_sanitize_test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testBBCode()
|
||||
{
|
||||
$this->assertEquals('<strong>strong</strong>',
|
||||
PMA_sanitize('[b]strong[/b]'));
|
||||
$this->assertEquals(
|
||||
'<strong>strong</strong>',
|
||||
PMA_sanitize('[b]strong[/b]')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,8 +116,10 @@ class PMA_sanitize_test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testEscape()
|
||||
{
|
||||
$this->assertEquals('<strong>strong</strong>',
|
||||
PMA_sanitize('[strong]strong[/strong]', true));
|
||||
$this->assertEquals(
|
||||
'<strong>strong</strong>',
|
||||
PMA_sanitize('[strong]strong[/strong]', true)
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -39,26 +39,36 @@ class PMA_getDbLink_test extends PHPUnit_Framework_TestCase
|
||||
global $cfg;
|
||||
$GLOBALS['db'] = 'test_db';
|
||||
$database = $GLOBALS['db'];
|
||||
$this->assertEquals('<a href="' . $cfg['DefaultTabDatabase'] . '?db=' . $database
|
||||
. '&server=99&lang=en&token=token" title="Jump to database "' . htmlspecialchars($database) . '".">'
|
||||
. htmlspecialchars($database) . '</a>', PMA_getDbLink());
|
||||
$this->assertEquals(
|
||||
'<a href="' . $cfg['DefaultTabDatabase'] . '?db=' . $database
|
||||
. '&server=99&lang=en&token=token" title="Jump to database "'
|
||||
. htmlspecialchars($database) . '".">'
|
||||
. htmlspecialchars($database) . '</a>', PMA_getDbLink()
|
||||
);
|
||||
}
|
||||
|
||||
function testGetDbLink()
|
||||
{
|
||||
global $cfg;
|
||||
$database = 'test_database';
|
||||
$this->assertEquals('<a href="' . $cfg['DefaultTabDatabase'] . '?db=' . $database
|
||||
. '&server=99&lang=en&token=token" title="Jump to database "' . htmlspecialchars($database) . '".">'
|
||||
. htmlspecialchars($database) . '</a>', PMA_getDbLink($database));
|
||||
$this->assertEquals(
|
||||
'<a href="' . $cfg['DefaultTabDatabase'] . '?db=' . $database
|
||||
. '&server=99&lang=en&token=token" title="Jump to database "'
|
||||
. htmlspecialchars($database) . '".">'
|
||||
. htmlspecialchars($database) . '</a>', PMA_getDbLink($database)
|
||||
);
|
||||
}
|
||||
|
||||
function testGetDbLinkWithSpecialChars()
|
||||
{
|
||||
global $cfg;
|
||||
$database = 'test&data\'base';
|
||||
$this->assertEquals('<a href="' . $cfg['DefaultTabDatabase'] . '?db=' . htmlspecialchars(urlencode($database))
|
||||
. '&server=99&lang=en&token=token" title="Jump to database "' . htmlspecialchars($database) . '".">'
|
||||
. htmlspecialchars($database) . '</a>', PMA_getDbLink($database));
|
||||
$this->assertEquals(
|
||||
'<a href="' . $cfg['DefaultTabDatabase'] . '?db='
|
||||
. htmlspecialchars(urlencode($database))
|
||||
. '&server=99&lang=en&token=token" title="Jump to database "'
|
||||
. htmlspecialchars($database) . '".">'
|
||||
. htmlspecialchars($database) . '</a>', PMA_getDbLink($database)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,15 +17,19 @@ class PMA_pow_test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testIntOverflow()
|
||||
{
|
||||
$this->assertEquals('1267650600228229401496703205376',
|
||||
PMA_pow(2, 100));
|
||||
$this->assertEquals(
|
||||
'1267650600228229401496703205376',
|
||||
PMA_pow(2, 100)
|
||||
);
|
||||
}
|
||||
|
||||
public function testBcpow()
|
||||
{
|
||||
if (function_exists('bcpow')) {
|
||||
$this->assertEquals('1267650600228229401496703205376',
|
||||
PMA_pow(2, 100, 'bcpow'));
|
||||
$this->assertEquals(
|
||||
'1267650600228229401496703205376',
|
||||
PMA_pow(2, 100, 'bcpow')
|
||||
);
|
||||
} else {
|
||||
$this->markTestSkipped('function bcpow() does not exist');
|
||||
}
|
||||
@ -34,8 +38,10 @@ class PMA_pow_test extends PHPUnit_Framework_TestCase
|
||||
public function testGmppow()
|
||||
{
|
||||
if (function_exists('gmp_pow')) {
|
||||
$this->assertEquals('1267650600228229401496703205376',
|
||||
PMA_pow(2, 100, 'gmp_pow'));
|
||||
$this->assertEquals(
|
||||
'1267650600228229401496703205376',
|
||||
PMA_pow(2, 100, 'gmp_pow')
|
||||
);
|
||||
} else {
|
||||
$this->markTestSkipped('function gmp_pow() does not exist');
|
||||
}
|
||||
@ -43,15 +49,19 @@ class PMA_pow_test extends PHPUnit_Framework_TestCase
|
||||
|
||||
public function _testNegativeExp()
|
||||
{
|
||||
$this->assertEquals(0.25,
|
||||
PMA_pow(2, -2));
|
||||
$this->assertEquals(
|
||||
0.25,
|
||||
PMA_pow(2, -2)
|
||||
);
|
||||
}
|
||||
|
||||
public function _testNegativeExpPow()
|
||||
{
|
||||
if (function_exists('pow')) {
|
||||
$this->assertEquals(0.25,
|
||||
PMA_pow(2, -2, 'pow'));
|
||||
$this->assertEquals(
|
||||
0.25,
|
||||
PMA_pow(2, -2, 'pow')
|
||||
);
|
||||
} else {
|
||||
$this->markTestSkipped('function pow() does not exist');
|
||||
}
|
||||
@ -60,8 +70,10 @@ class PMA_pow_test extends PHPUnit_Framework_TestCase
|
||||
public function _testNegativeExpBcpow()
|
||||
{
|
||||
if (function_exists('bcpow')) {
|
||||
$this->assertEquals(0.25,
|
||||
PMA_pow(2, -2, 'bcpow'));
|
||||
$this->assertEquals(
|
||||
0.25,
|
||||
PMA_pow(2, -2, 'bcpow')
|
||||
);
|
||||
} else {
|
||||
$this->markTestSkipped('function bcpow() does not exist');
|
||||
}
|
||||
@ -70,8 +82,10 @@ class PMA_pow_test extends PHPUnit_Framework_TestCase
|
||||
public function _testNegativeExpGmppow()
|
||||
{
|
||||
if (function_exists('gmp_pow')) {
|
||||
$this->assertEquals(0.25,
|
||||
PMA_pow(2, -2, 'gmp_pow'));
|
||||
$this->assertEquals(
|
||||
0.25,
|
||||
PMA_pow(2, -2, 'gmp_pow')
|
||||
);
|
||||
} else {
|
||||
$this->markTestSkipped('function gmp_pow() does not exist');
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user