added database name to relation querys

This commit is contained in:
Sebastian Mendel
2005-12-17 17:36:58 +00:00
parent d1b9d33269
commit 16a71a194e
11 changed files with 186 additions and 143 deletions

View File

@@ -5,6 +5,13 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2005-12-17 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* db_details_importdocsql.php, db_operations.php,
libraries\relation.lib.php, libraries\relation_cleanup.lib.php
libraries\tbl_move_copy.php, libraries\transformations.lib.php
pdf_pages.php, pdf_schema.php, tbl_alter.php, tbl_relation.php:
added database name to relation querys
2005-12-17 Marc Delisle <lem9@users.sourceforge.net> 2005-12-17 Marc Delisle <lem9@users.sourceforge.net>
* libraries/url_generating.lib.php: problem with accented table names * libraries/url_generating.lib.php: problem with accented table names

View File

@@ -64,13 +64,15 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
//echo '<p>' . $line . '</p>'; //echo '<p>' . $line . '</p>';
$inf = explode('|',$line); $inf = explode('|',$line);
if (!empty($inf[1]) && strlen(trim($inf[1])) > 0) { if (!empty($inf[1]) && strlen(trim($inf[1])) > 0) {
$qry = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['column_info']) $qry = '
. ' (db_name, table_name, column_name, ' . PMA_backquote('comment') . ') ' INSERT INTO
. ' VALUES(' ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['column_info']) . '
. '\'' . PMA_sqlAddslashes($GLOBALS['db']) . '\',' ( db_name, table_name, column_name, ' . PMA_backquote('comment') . ' )
. '\'' . PMA_sqlAddslashes(trim($tab)) . '\',' VALUES (
. '\'' . PMA_sqlAddslashes(trim($inf[0])) . '\',' \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\',
. '\'' . PMA_sqlAddslashes(trim($inf[1])) . '\')'; \'' . PMA_sqlAddslashes(trim($tab)) . '\',
\'' . PMA_sqlAddslashes(trim($inf[0])) . '\',
\'' . PMA_sqlAddslashes(trim($inf[1])) . '\')';
if (PMA_query_as_cu($qry)) { if (PMA_query_as_cu($qry)) {
echo '<p>' . $GLOBALS['strAddedColumnComment'] . ' ' . htmlspecialchars($tab) . '.' . htmlspecialchars($inf[0]) . '</p>'; echo '<p>' . $GLOBALS['strAddedColumnComment'] . ' ' . htmlspecialchars($tab) . '.' . htmlspecialchars($inf[0]) . '</p>';
} else { } else {
@@ -80,15 +82,17 @@ if (isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])) {
} // end inf[1] exists } // end inf[1] exists
if (!empty($inf[2]) && strlen(trim($inf[2])) > 0) { if (!empty($inf[2]) && strlen(trim($inf[2])) > 0) {
$for = explode('->', $inf[2]); $for = explode('->', $inf[2]);
$qry = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['relation']) $qry = '
. '(master_db, master_table, master_field, foreign_db, foreign_table, foreign_field)' INSERT INTO
. ' VALUES(' ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['relation']) . '
. '\'' . PMA_sqlAddslashes($GLOBALS['db']) . '\', ' ( master_db, master_table, master_field, foreign_db, foreign_table, foreign_field)
. '\'' . PMA_sqlAddslashes(trim($tab)) . '\', ' VALUES (
. '\'' . PMA_sqlAddslashes(trim($inf[0])) . '\', ' \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\',
. '\'' . PMA_sqlAddslashes($GLOBALS['db']) . '\', ' \'' . PMA_sqlAddslashes(trim($tab)) . '\',
. '\'' . PMA_sqlAddslashes(trim($for[0])) . '\',' \'' . PMA_sqlAddslashes(trim($inf[0])) . '\',
. '\'' . PMA_sqlAddslashes(trim($for[1])) . '\')'; \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\',
\'' . PMA_sqlAddslashes(trim($for[0])) . '\',
\'' . PMA_sqlAddslashes(trim($for[1])) . '\')';
if (PMA_query_as_cu($qry)) { if (PMA_query_as_cu($qry)) {
echo '<p>' . $GLOBALS['strAddedColumnRelation'] . ' ' . htmlspecialchars($tab) . '.' . htmlspecialchars($inf[0]) . ' to ' . htmlspecialchars($inf[2]) . '</p>'; echo '<p>' . $GLOBALS['strAddedColumnRelation'] . ' ' . htmlspecialchars($tab) . '.' . htmlspecialchars($inf[0]) . ' to ' . htmlspecialchars($inf[2]) . '</p>';
} else { } else {

View File

@@ -328,8 +328,10 @@ if ($cfgRelation['pdfwork'] && $num_tables > 0) { ?>
<?php <?php
// We only show this if we find something in the new pdf_pages table // We only show this if we find something in the new pdf_pages table
$test_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages']) $test_query = '
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''; SELECT *
FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages']) . '
WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$test_rs = PMA_query_as_cu($test_query, NULL, PMA_DBI_QUERY_STORE); $test_rs = PMA_query_as_cu($test_query, NULL, PMA_DBI_QUERY_STORE);
if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) { ?> if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) { ?>

View File

@@ -287,10 +287,14 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both') {
global $cfgRelation, $err_url_0; global $cfgRelation, $err_url_0;
if ($cfgRelation['relwork'] && ($source == 'both' || $source == 'internal')) { if ($cfgRelation['relwork'] && ($source == 'both' || $source == 'internal')) {
$rel_query = 'SELECT master_field, foreign_db, foreign_table, foreign_field' $rel_query = '
. ' FROM ' . PMA_backquote($cfgRelation['relation']) SELECT master_field,
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\' ' foreign_db,
. ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\' '; foreign_table,
foreign_field
FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['relation']) . '
WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'
AND master_table = \'' . PMA_sqlAddslashes($table) . '\' ';
if (!empty($column)) { if (!empty($column)) {
$rel_query .= ' AND master_field = \'' . PMA_sqlAddslashes($column) . '\''; $rel_query .= ' AND master_field = \'' . PMA_sqlAddslashes($column) . '\'';
} }
@@ -406,9 +410,11 @@ function PMA_getDisplayField($db, $table) {
*/ */
if (trim(@$cfgRelation['table_info']) != '') { if (trim(@$cfgRelation['table_info']) != '') {
$disp_query = 'SELECT display_field FROM ' . PMA_backquote($cfgRelation['table_info']) $disp_query = '
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' SELECT display_field
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''; FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['table_info']) . '
WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'
AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
$disp_res = PMA_query_as_cu($disp_query); $disp_res = PMA_query_as_cu($disp_query);
$row = ($disp_res ? PMA_DBI_fetch_assoc($disp_res) : ''); $row = ($disp_res ? PMA_DBI_fetch_assoc($disp_res) : '');
@@ -477,17 +483,22 @@ function PMA_getComments($db, $table = '') {
// (this function can be called even if $cfgRelation['commwork'] is // (this function can be called even if $cfgRelation['commwork'] is
// FALSE, to get native column comments, so recheck here) // FALSE, to get native column comments, so recheck here)
if ($cfgRelation['commwork']) { if ($cfgRelation['commwork']) {
$com_qry = 'SELECT column_name, comment FROM ' . PMA_backquote($cfgRelation['db']) . '.' .PMA_backquote($cfgRelation['column_info']) $com_qry = '
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' SELECT column_name,
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''; comment
FROM ' . PMA_backquote($cfgRelation['db']) . '.' .PMA_backquote($cfgRelation['column_info']) . '
WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'
AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
$com_rs = PMA_query_as_cu($com_qry, TRUE, PMA_DBI_QUERY_STORE); $com_rs = PMA_query_as_cu($com_qry, TRUE, PMA_DBI_QUERY_STORE);
} }
} else { } else {
// pmadb internal db comments // pmadb internal db comments
$com_qry = 'SELECT ' . PMA_backquote('comment') . ' FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) $com_qry = '
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' SELECT ' . PMA_backquote('comment') . '
. ' AND table_name = \'\'' FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
. ' AND column_name = \'(db_comment)\''; WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'
AND table_name = \'\'
AND column_name = \'(db_comment)\'';
$com_rs = PMA_query_as_cu($com_qry, TRUE, PMA_DBI_QUERY_STORE); $com_rs = PMA_query_as_cu($com_qry, TRUE, PMA_DBI_QUERY_STORE);
} }
@@ -584,18 +595,25 @@ function PMA_setComment($db, $table, $col, $comment, $removekey = '', $mode='aut
); );
if ($removekey != '' AND $removekey != $col) { if ($removekey != '' AND $removekey != $col) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info']) $remove_query = '
. ' WHERE ' . $cols['db_name'] . ' = \'' . PMA_sqlAddslashes($db) . '\'' DELETE FROM
. ' AND ' . $cols['table_name'] . ' = \'' . PMA_sqlAddslashes($table) . '\'' ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
. ' AND ' . $cols['column_name'] . ' = \'' . PMA_sqlAddslashes($removekey) . '\''; WHERE ' . $cols['db_name'] . ' = \'' . PMA_sqlAddslashes($db) . '\'
AND ' . $cols['table_name'] . ' = \'' . PMA_sqlAddslashes($table) . '\'
AND ' . $cols['column_name'] . ' = \'' . PMA_sqlAddslashes($removekey) . '\'';
PMA_query_as_cu($remove_query); PMA_query_as_cu($remove_query);
unset($remove_query); unset($remove_query);
} }
$test_qry = 'SELECT ' . PMA_backquote('comment') . ', mimetype, transformation, transformation_options FROM ' . PMA_backquote($cfgRelation['column_info']) $test_qry = '
. ' WHERE ' . $cols['db_name'] . ' = \'' . PMA_sqlAddslashes($db) . '\'' SELECT ' . PMA_backquote('comment') . ',
. ' AND ' . $cols['table_name'] . ' = \'' . PMA_sqlAddslashes($table) . '\'' mimetype,
. ' AND ' . $cols['column_name'] . ' = \'' . PMA_sqlAddslashes($col) . '\''; transformation,
transformation_options
FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
WHERE ' . $cols['db_name'] . ' = \'' . PMA_sqlAddslashes($db) . '\'
AND ' . $cols['table_name'] . ' = \'' . PMA_sqlAddslashes($table) . '\'
AND ' . $cols['column_name'] . ' = \'' . PMA_sqlAddslashes($col) . '\'';
$test_rs = PMA_query_as_cu($test_qry, TRUE, PMA_DBI_QUERY_STORE); $test_rs = PMA_query_as_cu($test_qry, TRUE, PMA_DBI_QUERY_STORE);
if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) { if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) {
@@ -603,25 +621,30 @@ function PMA_setComment($db, $table, $col, $comment, $removekey = '', $mode='aut
PMA_DBI_free_result($test_rs); PMA_DBI_free_result($test_rs);
if (strlen($comment) > 0 || strlen($row['mimetype']) > 0 || strlen($row['transformation']) > 0 || strlen($row['transformation_options']) > 0) { if (strlen($comment) > 0 || strlen($row['mimetype']) > 0 || strlen($row['transformation']) > 0 || strlen($row['transformation_options']) > 0) {
$upd_query = 'UPDATE ' . PMA_backquote($cfgRelation['column_info']) $upd_query = '
. ' SET ' . PMA_backquote('comment') . ' = \'' . PMA_sqlAddslashes($comment) . '\'' UPDATE ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
. ' WHERE ' . $cols['db_name'] . ' = \'' . PMA_sqlAddslashes($db) . '\'' SET ' . PMA_backquote('comment') . ' = \'' . PMA_sqlAddslashes($comment) . '\'
. ' AND ' . $cols['table_name'] . ' = \'' . PMA_sqlAddslashes($table) . '\'' WHERE ' . $cols['db_name'] . ' = \'' . PMA_sqlAddslashes($db) . '\'
. ' AND ' . $cols['column_name'] . ' = \'' . PMA_sqlAddSlashes($col) . '\''; AND ' . $cols['table_name'] . ' = \'' . PMA_sqlAddslashes($table) . '\'
AND ' . $cols['column_name'] . ' = \'' . PMA_sqlAddSlashes($col) . '\'';
} else { } else {
$upd_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info']) $upd_query = '
. ' WHERE ' . $cols['db_name'] . ' = \'' . PMA_sqlAddslashes($db) . '\'' DELETE FROM
. ' AND ' . $cols['table_name'] . ' = \'' . PMA_sqlAddslashes($table) . '\'' ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
. ' AND ' . $cols['column_name'] . ' = \'' . PMA_sqlAddslashes($col) . '\''; WHERE ' . $cols['db_name'] . ' = \'' . PMA_sqlAddslashes($db) . '\'
AND ' . $cols['table_name'] . ' = \'' . PMA_sqlAddslashes($table) . '\'
AND ' . $cols['column_name'] . ' = \'' . PMA_sqlAddslashes($col) . '\'';
} }
} else if (strlen($comment) > 0) { } else if (strlen($comment) > 0) {
$upd_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['column_info']) $upd_query = '
. ' (db_name, table_name, column_name, ' . PMA_backquote('comment') . ') ' INSERT INTO
. ' VALUES(' ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
. '\'' . PMA_sqlAddslashes($db) . '\',' (db_name, table_name, column_name, ' . PMA_backquote('comment') . ')
. '\'' . PMA_sqlAddslashes($table) . '\',' VALUES (
. '\'' . PMA_sqlAddslashes($col) . '\',' \'' . PMA_sqlAddslashes($db) . '\',
. '\'' . PMA_sqlAddslashes($comment) . '\')'; \'' . PMA_sqlAddslashes($table) . '\',
\'' . PMA_sqlAddslashes($col) . '\',
\'' . PMA_sqlAddslashes($comment) . '\')';
} }
if (isset($upd_query)){ if (isset($upd_query)){
@@ -650,18 +673,20 @@ function PMA_setComment($db, $table, $col, $comment, $removekey = '', $mode='aut
function PMA_setHistory($db, $table, $username, $sqlquery) { function PMA_setHistory($db, $table, $username, $sqlquery) {
global $cfgRelation; global $cfgRelation;
$hist_rs = PMA_query_as_cu('INSERT INTO ' . PMA_backquote($cfgRelation['history']) . ' (' $hist_rs = PMA_query_as_cu('
. PMA_backquote('username') . ',' INSERT INTO
. PMA_backquote('db') . ',' ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['history']) . '
. PMA_backquote('table') . ',' ( ' . PMA_backquote('username') . ',
. PMA_backquote('timevalue') . ',' ' . PMA_backquote('db') . ',
. PMA_backquote('sqlquery') ' . PMA_backquote('table') . ',
. ') VALUES (' ' . PMA_backquote('timevalue') . ',
. '\'' . PMA_sqlAddslashes($username) . '\',' ' . PMA_backquote('sqlquery') . ' )
. '\'' . PMA_sqlAddslashes($db) . '\',' VALUES
. '\'' . PMA_sqlAddslashes($table) . '\',' ( \'' . PMA_sqlAddslashes($username) . '\',
. 'NOW(),' \'' . PMA_sqlAddslashes($db) . '\',
. '\'' . PMA_sqlAddslashes($sqlquery) . '\')'); \'' . PMA_sqlAddslashes($table) . '\',
NOW(),
\'' . PMA_sqlAddslashes($sqlquery) . '\' )');
return true; return true;
} // end of 'PMA_setHistory()' function } // end of 'PMA_setHistory()' function
@@ -679,13 +704,13 @@ function PMA_setHistory($db, $table, $username, $sqlquery) {
function PMA_getHistory($username) { function PMA_getHistory($username) {
global $cfgRelation; global $cfgRelation;
$hist_query = 'SELECT ' $hist_query = '
. PMA_backquote('db') . ',' SELECT ' . PMA_backquote('db') . ',
. PMA_backquote('table') . ',' ' . PMA_backquote('table') . ',
. PMA_backquote('sqlquery') ' . PMA_backquote('sqlquery') . '
. ' FROM ' . PMA_backquote($cfgRelation['history']) FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['history']) . '
. ' WHERE username = \'' . PMA_sqlAddslashes($username) . '\'' WHERE username = \'' . PMA_sqlAddslashes($username) . '\'
. ' ORDER BY id DESC'; ORDER BY id DESC';
$hist_rs = PMA_query_as_cu($hist_query); $hist_rs = PMA_query_as_cu($hist_query);
unset($hist_query); unset($hist_query);
@@ -719,9 +744,11 @@ function PMA_getHistory($username) {
function PMA_purgeHistory($username) { function PMA_purgeHistory($username) {
global $cfgRelation, $cfg; global $cfgRelation, $cfg;
$purge_query = 'SELECT timevalue FROM ' . PMA_backquote($cfgRelation['history']) $purge_query = '
. ' WHERE username = \'' . PMA_sqlAddSlashes($username) . '\'' SELECT timevalue
. ' ORDER BY timevalue DESC LIMIT ' . $cfg['QueryHistoryMax'] . ', 1'; FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['history']) . '
WHERE username = \'' . PMA_sqlAddSlashes($username) . '\'
ORDER BY timevalue DESC LIMIT ' . $cfg['QueryHistoryMax'] . ', 1';
$purge_rs = PMA_query_as_cu($purge_query); $purge_rs = PMA_query_as_cu($purge_query);
$i = 0; $i = 0;
$row = PMA_DBI_fetch_row($purge_rs); $row = PMA_DBI_fetch_row($purge_rs);
@@ -731,7 +758,10 @@ function PMA_purgeHistory($username) {
$maxtime = $row[0]; $maxtime = $row[0];
// quotes added around $maxtime to prevent a difficult to // quotes added around $maxtime to prevent a difficult to
// reproduce problem // reproduce problem
$remove_rs = PMA_query_as_cu('DELETE FROM ' . PMA_backquote($cfgRelation['history']) . ' WHERE timevalue <= "' . $maxtime . '"'); $remove_rs = PMA_query_as_cu('
DELETE FROM
' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['history']) . '
WHERE timevalue <= \'' . $maxtime . '\'');
} }
return true; return true;

View File

@@ -13,7 +13,7 @@ $cfgRelation = PMA_getRelationsParam();
function PMA_relationsCleanupColumn($db, $table, $column) { function PMA_relationsCleanupColumn($db, $table, $column) {
global $cfgRelation; global $cfgRelation;
if ($cfgRelation['commwork']) { if ($cfgRelation['commwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info']) $remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND column_name = \'' . PMA_sqlAddslashes(urldecode($column)) . '\''; . ' AND column_name = \'' . PMA_sqlAddslashes(urldecode($column)) . '\'';
@@ -22,7 +22,7 @@ function PMA_relationsCleanupColumn($db, $table, $column) {
} }
if ($cfgRelation['displaywork']) { if ($cfgRelation['displaywork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info']) $remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND display_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\''; . ' AND display_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\'';
@@ -31,14 +31,14 @@ function PMA_relationsCleanupColumn($db, $table, $column) {
} }
if ($cfgRelation['relwork']) { if ($cfgRelation['relwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation']) $remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND master_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\''; . ' AND master_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($remove_query); unset($remove_query);
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation']) $remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND foreign_table = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND foreign_table = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND foreign_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\''; . ' AND foreign_field = \'' . PMA_sqlAddslashes(urldecode($column)) . '\'';
@@ -51,7 +51,7 @@ function PMA_relationsCleanupTable($db, $table) {
global $cfgRelation; global $cfgRelation;
if ($cfgRelation['commwork']) { if ($cfgRelation['commwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info']) $remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''; . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
@@ -59,7 +59,7 @@ function PMA_relationsCleanupTable($db, $table) {
} }
if ($cfgRelation['displaywork']) { if ($cfgRelation['displaywork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info']) $remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''; . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
@@ -67,7 +67,7 @@ function PMA_relationsCleanupTable($db, $table) {
} }
if ($cfgRelation['pdfwork']) { if ($cfgRelation['pdfwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords']) $remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''; . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
@@ -75,13 +75,13 @@ function PMA_relationsCleanupTable($db, $table) {
} }
if ($cfgRelation['relwork']) { if ($cfgRelation['relwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation']) $remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\''; . ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($remove_query); unset($remove_query);
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation']) $remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND foreign_table = \'' . PMA_sqlAddslashes($table) . '\''; . ' AND foreign_table = \'' . PMA_sqlAddslashes($table) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
@@ -93,45 +93,45 @@ function PMA_relationsCleanupDatabase($db) {
global $cfgRelation; global $cfgRelation;
if ($cfgRelation['commwork']) { if ($cfgRelation['commwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info']) $remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''; . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($remove_query); unset($remove_query);
} }
if ($cfgRelation['bookmarkwork']) { if ($cfgRelation['bookmarkwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['bookmark']) $remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['bookmark'])
. ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\''; . ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($remove_query); unset($remove_query);
} }
if ($cfgRelation['displaywork']) { if ($cfgRelation['displaywork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info']) $remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''; . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($remove_query); unset($remove_query);
} }
if ($cfgRelation['pdfwork']) { if ($cfgRelation['pdfwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['pdf_pages']) $remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''; . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($remove_query); unset($remove_query);
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords']) $remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''; . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($remove_query); unset($remove_query);
} }
if ($cfgRelation['relwork']) { if ($cfgRelation['relwork']) {
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation']) $remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''; . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($remove_query); unset($remove_query);
$remove_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation']) $remove_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\''; . ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\'';
$rmv_rs = PMA_query_as_cu($remove_query); $rmv_rs = PMA_query_as_cu($remove_query);
unset($remove_query); unset($remove_query);

View File

@@ -46,7 +46,7 @@ function PMA_duplicate_table_info($work, $pma_table, $get_fields, $where_fields,
} }
$table_copy_query = 'SELECT ' . implode(', ', $select_parts) $table_copy_query = 'SELECT ' . implode(', ', $select_parts)
. ' FROM ' . PMA_backquote($cfgRelation[$pma_table]) . ' FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation[$pma_table])
. ' WHERE ' . implode(' AND ', $where_parts); . ' WHERE ' . implode(' AND ', $where_parts);
// must use PMA_DBI_QUERY_STORE here, since we execute another // must use PMA_DBI_QUERY_STORE here, since we execute another
@@ -61,7 +61,7 @@ function PMA_duplicate_table_info($work, $pma_table, $get_fields, $where_fields,
} }
} }
$new_table_query = 'INSERT IGNORE INTO ' . PMA_backquote($cfgRelation[$pma_table]) $new_table_query = 'INSERT IGNORE INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation[$pma_table])
. ' (' . implode(', ', $select_parts) . ', ' . implode(', ', $new_parts) . ')' . ' (' . implode(', ', $select_parts) . ', ' . implode(', ', $new_parts) . ')'
. ' VALUES ' . ' VALUES '
. ' (\'' . implode('\', \'', $value_parts) . '\', \'' . implode('\', \'', $new_value_parts) . '\')'; . ' (\'' . implode('\', \'', $value_parts) . '\', \'' . implode('\', \'', $new_value_parts) . '\')';
@@ -214,7 +214,7 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
// garvin: Move old entries from PMA-DBs to new table // garvin: Move old entries from PMA-DBs to new table
if ($cfgRelation['commwork']) { if ($cfgRelation['commwork']) {
$remove_query = 'UPDATE ' . PMA_backquote($cfgRelation['column_info']) $remove_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' SET table_name = \'' . PMA_sqlAddslashes($target_table) . '\', ' . ' SET table_name = \'' . PMA_sqlAddslashes($target_table) . '\', '
. ' db_name = \'' . PMA_sqlAddslashes($target_db) . '\'' . ' db_name = \'' . PMA_sqlAddslashes($target_db) . '\''
. ' WHERE db_name = \'' . PMA_sqlAddslashes($source_db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($source_db) . '\''
@@ -226,7 +226,7 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
// garvin: updating bookmarks is not possible since only a single table is moved, // garvin: updating bookmarks is not possible since only a single table is moved,
// and not the whole DB. // and not the whole DB.
// if ($cfgRelation['bookmarkwork']) { // if ($cfgRelation['bookmarkwork']) {
// $remove_query = 'UPDATE ' . PMA_backquote($cfgRelation['bookmark']) // $remove_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['bookmark'])
// . ' SET dbase = \'' . PMA_sqlAddslashes($target_db) . '\'' // . ' SET dbase = \'' . PMA_sqlAddslashes($target_db) . '\''
// . ' WHERE dbase = \'' . PMA_sqlAddslashes($source_db) . '\''; // . ' WHERE dbase = \'' . PMA_sqlAddslashes($source_db) . '\'';
// $rmv_rs = PMA_query_as_cu($remove_query); // $rmv_rs = PMA_query_as_cu($remove_query);
@@ -234,7 +234,7 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
// } // }
if ($cfgRelation['displaywork']) { if ($cfgRelation['displaywork']) {
$table_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_info']) $table_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info'])
. ' SET db_name = \'' . PMA_sqlAddslashes($target_db) . '\', ' . ' SET db_name = \'' . PMA_sqlAddslashes($target_db) . '\', '
. ' table_name = \'' . PMA_sqlAddslashes($target_table) . '\'' . ' table_name = \'' . PMA_sqlAddslashes($target_table) . '\''
. ' WHERE db_name = \'' . PMA_sqlAddslashes($source_db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($source_db) . '\''
@@ -245,7 +245,7 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
} }
if ($cfgRelation['relwork']) { if ($cfgRelation['relwork']) {
$table_query = 'UPDATE ' . PMA_backquote($cfgRelation['relation']) $table_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' SET foreign_table = \'' . PMA_sqlAddslashes($target_table) . '\',' . ' SET foreign_table = \'' . PMA_sqlAddslashes($target_table) . '\','
. ' foreign_db = \'' . PMA_sqlAddslashes($target_db) . '\'' . ' foreign_db = \'' . PMA_sqlAddslashes($target_db) . '\''
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($source_db) . '\'' . ' WHERE foreign_db = \'' . PMA_sqlAddslashes($source_db) . '\''
@@ -254,7 +254,7 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
unset($table_query); unset($table_query);
unset($tb_rs); unset($tb_rs);
$table_query = 'UPDATE ' . PMA_backquote($cfgRelation['relation']) $table_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' SET master_table = \'' . PMA_sqlAddslashes($target_table) . '\',' . ' SET master_table = \'' . PMA_sqlAddslashes($target_table) . '\','
. ' master_db = \'' . PMA_sqlAddslashes($target_db) . '\'' . ' master_db = \'' . PMA_sqlAddslashes($target_db) . '\''
. ' WHERE master_db = \'' . PMA_sqlAddslashes($source_db) . '\'' . ' WHERE master_db = \'' . PMA_sqlAddslashes($source_db) . '\''
@@ -270,7 +270,7 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
// please have a look at it? // please have a look at it?
if ($cfgRelation['pdfwork']) { if ($cfgRelation['pdfwork']) {
$table_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_coords']) $table_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' SET table_name = \'' . PMA_sqlAddslashes($target_table) . '\',' . ' SET table_name = \'' . PMA_sqlAddslashes($target_table) . '\','
. ' db_name = \'' . PMA_sqlAddslashes($target_db) . '\'' . ' db_name = \'' . PMA_sqlAddslashes($target_db) . '\''
. ' WHERE db_name = \'' . PMA_sqlAddslashes($source_db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($source_db) . '\''
@@ -280,13 +280,13 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
unset($tb_rs); unset($tb_rs);
/* /*
$pdf_query = 'SELECT pdf_page_number ' $pdf_query = 'SELECT pdf_page_number '
. ' FROM ' . PMA_backquote($cfgRelation['table_coords']) . ' FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($target_db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($target_db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($target_table) . '\''; . ' AND table_name = \'' . PMA_sqlAddslashes($target_table) . '\'';
$pdf_rs = PMA_query_as_cu($pdf_query); $pdf_rs = PMA_query_as_cu($pdf_query);
while ($pdf_copy_row = PMA_DBI_fetch_assoc($pdf_rs)) { while ($pdf_copy_row = PMA_DBI_fetch_assoc($pdf_rs)) {
$table_query = 'UPDATE ' . PMA_backquote($cfgRelation['pdf_pages']) $table_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
. ' SET db_name = \'' . PMA_sqlAddslashes($target_db) . '\'' . ' SET db_name = \'' . PMA_sqlAddslashes($target_db) . '\''
. ' WHERE db_name = \'' . PMA_sqlAddslashes($source_db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($source_db) . '\''
. ' AND page_nr = \'' . PMA_sqlAddslashes($pdf_copy_row['pdf_page_number']) . '\''; . ' AND page_nr = \'' . PMA_sqlAddslashes($pdf_copy_row['pdf_page_number']) . '\'';
@@ -305,7 +305,7 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
// Get all comments and MIME-Types for current table // Get all comments and MIME-Types for current table
$comments_copy_query = 'SELECT $comments_copy_query = 'SELECT
column_name, ' . PMA_backquote('comment') . ($cfgRelation['mimework'] ? ', mimetype, transformation, transformation_options' : '') . ' column_name, ' . PMA_backquote('comment') . ($cfgRelation['mimework'] ? ', mimetype, transformation, transformation_options' : '') . '
FROM ' . PMA_backquote($cfgRelation['column_info']) . ' FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
WHERE WHERE
db_name = \'' . PMA_sqlAddslashes($source_db) . '\' AND db_name = \'' . PMA_sqlAddslashes($source_db) . '\' AND
table_name = \'' . PMA_sqlAddslashes($source_table) . '\''; table_name = \'' . PMA_sqlAddslashes($source_table) . '\'';
@@ -313,7 +313,7 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
// Write every comment as new copied entry. [MIME] // Write every comment as new copied entry. [MIME]
while ($comments_copy_row = PMA_DBI_fetch_assoc($comments_copy_rs)) { while ($comments_copy_row = PMA_DBI_fetch_assoc($comments_copy_rs)) {
$new_comment_query = 'REPLACE INTO ' . PMA_backquote($cfgRelation['column_info']) $new_comment_query = 'REPLACE INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' (db_name, table_name, column_name, ' . PMA_backquote('comment') . ($cfgRelation['mimework'] ? ', mimetype, transformation, transformation_options' : '') . ') ' . ' (db_name, table_name, column_name, ' . PMA_backquote('comment') . ($cfgRelation['mimework'] ? ', mimetype, transformation, transformation_options' : '') . ') '
. ' VALUES(' . ' VALUES('
. '\'' . PMA_sqlAddslashes($target_db) . '\',' . '\'' . PMA_sqlAddslashes($target_db) . '\','
@@ -397,7 +397,7 @@ function PMA_table_rename( $old_name, $new_name )
$cfgRelation = PMA_getRelationsParam(); $cfgRelation = PMA_getRelationsParam();
if ( $cfgRelation['commwork'] ) { if ( $cfgRelation['commwork'] ) {
$remove_query = ' $remove_query = '
UPDATE ' . PMA_backquote($cfgRelation['column_info']) . ' UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
SET table_name = \'' . PMA_sqlAddslashes($new_name) . '\' SET table_name = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE db_name = \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\' WHERE db_name = \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\'
AND table_name = \'' . PMA_sqlAddslashes($old_name) . '\''; AND table_name = \'' . PMA_sqlAddslashes($old_name) . '\'';
@@ -407,7 +407,7 @@ function PMA_table_rename( $old_name, $new_name )
if ( $cfgRelation['displaywork'] ) { if ( $cfgRelation['displaywork'] ) {
$table_query = ' $table_query = '
UPDATE ' . PMA_backquote($cfgRelation['table_info']) . ' UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info']) . '
SET table_name = \'' . PMA_sqlAddslashes($new_name) . '\' SET table_name = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE db_name = \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\' WHERE db_name = \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\'
AND table_name = \'' . PMA_sqlAddslashes($old_name) . '\''; AND table_name = \'' . PMA_sqlAddslashes($old_name) . '\'';
@@ -417,14 +417,14 @@ function PMA_table_rename( $old_name, $new_name )
if ( $cfgRelation['relwork'] ) { if ( $cfgRelation['relwork'] ) {
$table_query = ' $table_query = '
UPDATE ' . PMA_backquote($cfgRelation['relation']) . ' UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation']) . '
SET foreign_table = \'' . PMA_sqlAddslashes($new_name) . '\' SET foreign_table = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE foreign_db = \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\' WHERE foreign_db = \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\'
AND foreign_table = \'' . PMA_sqlAddslashes($old_name) . '\''; AND foreign_table = \'' . PMA_sqlAddslashes($old_name) . '\'';
PMA_query_as_cu($table_query); PMA_query_as_cu($table_query);
$table_query = ' $table_query = '
UPDATE ' . PMA_backquote($cfgRelation['relation']) . ' UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation']) . '
SET master_table = \'' . PMA_sqlAddslashes($new_name) . '\' SET master_table = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE master_db = \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\' WHERE master_db = \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\'
AND master_table = \'' . PMA_sqlAddslashes($old_name) . '\''; AND master_table = \'' . PMA_sqlAddslashes($old_name) . '\'';
@@ -434,7 +434,7 @@ function PMA_table_rename( $old_name, $new_name )
if ( $cfgRelation['pdfwork'] ) { if ( $cfgRelation['pdfwork'] ) {
$table_query = ' $table_query = '
UPDATE ' . PMA_backquote($cfgRelation['table_coords']) . ' UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . '
SET table_name = \'' . PMA_sqlAddslashes($new_name) . '\' SET table_name = \'' . PMA_sqlAddslashes($new_name) . '\'
WHERE db_name = \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\' WHERE db_name = \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\'
AND table_name = \'' . PMA_sqlAddslashes($old_name) . '\''; AND table_name = \'' . PMA_sqlAddslashes($old_name) . '\'';

View File

@@ -95,7 +95,7 @@ function PMA_getAvailableMIMEtypes() {
function PMA_getMIME($db, $table, $strict = false) { function PMA_getMIME($db, $table, $strict = false) {
global $cfgRelation; global $cfgRelation;
$com_qry = 'SELECT column_name, mimetype, transformation, transformation_options FROM ' . PMA_backquote($cfgRelation['column_info']) $com_qry = 'SELECT column_name, mimetype, transformation, transformation_options FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND (mimetype != \'\'' . (!$strict ? ' OR transformation != \'\' OR transformation_options != \'\'' : '') . ')'; . ' AND (mimetype != \'\'' . (!$strict ? ' OR transformation != \'\' OR transformation_options != \'\'' : '') . ')';
@@ -137,7 +137,7 @@ function PMA_getMIME($db, $table, $strict = false) {
function PMA_setMIME($db, $table, $key, $mimetype, $transformation, $transformation_options, $forcedelete = false) { function PMA_setMIME($db, $table, $key, $mimetype, $transformation, $transformation_options, $forcedelete = false) {
global $cfgRelation; global $cfgRelation;
$test_qry = 'SELECT mimetype, ' . PMA_backquote('comment') . ' FROM ' . PMA_backquote($cfgRelation['column_info']) $test_qry = 'SELECT mimetype, ' . PMA_backquote('comment') . ' FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\''; . ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\'';
@@ -149,7 +149,7 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation, $transformat
unset($test_rs); unset($test_rs);
if (!$forcedelete && (strlen($mimetype) > 0 || strlen($transformation) > 0 || strlen($transformation_options) > 0 || strlen($row['comment']) > 0)) { if (!$forcedelete && (strlen($mimetype) > 0 || strlen($transformation) > 0 || strlen($transformation_options) > 0 || strlen($row['comment']) > 0)) {
$upd_query = 'UPDATE ' . PMA_backquote($cfgRelation['column_info']) $upd_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' SET mimetype = \'' . PMA_sqlAddslashes($mimetype) . '\',' . ' SET mimetype = \'' . PMA_sqlAddslashes($mimetype) . '\','
. ' transformation = \'' . PMA_sqlAddslashes($transformation) . '\',' . ' transformation = \'' . PMA_sqlAddslashes($transformation) . '\','
. ' transformation_options = \'' . PMA_sqlAddslashes($transformation_options) . '\'' . ' transformation_options = \'' . PMA_sqlAddslashes($transformation_options) . '\''
@@ -157,13 +157,13 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation, $transformat
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\''; . ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\'';
} else { } else {
$upd_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['column_info']) $upd_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\''; . ' AND column_name = \'' . PMA_sqlAddslashes($key) . '\'';
} }
} else if (strlen($mimetype) > 0 || strlen($transformation) > 0 || strlen($transformation_options) > 0) { } else if (strlen($mimetype) > 0 || strlen($transformation) > 0 || strlen($transformation_options) > 0) {
$upd_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['column_info']) $upd_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['column_info'])
. ' (db_name, table_name, column_name, mimetype, transformation, transformation_options) ' . ' (db_name, table_name, column_name, mimetype, transformation, transformation_options) '
. ' VALUES(' . ' VALUES('
. '\'' . PMA_sqlAddslashes($db) . '\',' . '\'' . PMA_sqlAddslashes($db) . '\','

View File

@@ -57,12 +57,12 @@ if ($cfgRelation['pdfwork']) {
switch ($do) { switch ($do) {
case 'choosepage': case 'choosepage':
if ($action_choose=="1") { if ($action_choose=="1") {
$ch_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords']) $ch_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND pdf_page_number = ' . $chpage; . ' AND pdf_page_number = ' . $chpage;
PMA_query_as_cu($ch_query, FALSE, $query_default_option); PMA_query_as_cu($ch_query, FALSE, $query_default_option);
$ch_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['pdf_pages']) $ch_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND page_nr = ' . $chpage; . ' AND page_nr = ' . $chpage;
PMA_query_as_cu($ch_query, FALSE, $query_default_option); PMA_query_as_cu($ch_query, FALSE, $query_default_option);
@@ -74,7 +74,7 @@ if ($cfgRelation['pdfwork']) {
if (!isset($newpage) || $newpage == '') { if (!isset($newpage) || $newpage == '') {
$newpage = $strNoDescription; $newpage = $strNoDescription;
} }
$ins_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['pdf_pages']) $ins_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
. ' (db_name, page_descr)' . ' (db_name, page_descr)'
. ' VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($newpage) . '\')'; . ' VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($newpage) . '\')';
PMA_query_as_cu($ins_query, FALSE, $query_default_option); PMA_query_as_cu($ins_query, FALSE, $query_default_option);
@@ -90,7 +90,7 @@ if ($cfgRelation['pdfwork']) {
// get the tables that have relations, by descending // get the tables that have relations, by descending
// number of links // number of links
$master_tables = 'SELECT COUNT(master_table), master_table' $master_tables = 'SELECT COUNT(master_table), master_table'
. ' FROM ' . PMA_backquote($cfgRelation['relation']) . ' FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . $db . '\'' . ' WHERE master_db = \'' . $db . '\''
. ' GROUP BY master_table' . ' GROUP BY master_table'
. ' ORDER BY ' . PMA_backquote('COUNT(master_table)') . ' DESC '; . ' ORDER BY ' . PMA_backquote('COUNT(master_table)') . ' DESC ';
@@ -135,7 +135,7 @@ if ($cfgRelation['pdfwork']) {
foreach ($all_tables AS $current_table) { foreach ($all_tables AS $current_table) {
// save current table's coordinates // save current table's coordinates
$insert_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['table_coords']) . ' ' $insert_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
. '(db_name, table_name, pdf_page_number, x, y) ' . '(db_name, table_name, pdf_page_number, x, y) '
. 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($current_table) . '\',' . $pdf_page_number . ',' . $pos_x . ',' . $pos_y . ')'; . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($current_table) . '\',' . $pdf_page_number . ',' . $pos_x . ',' . $pos_y . ')';
PMA_query_as_cu($insert_query, FALSE, $query_default_option); PMA_query_as_cu($insert_query, FALSE, $query_default_option);
@@ -182,26 +182,26 @@ if ($cfgRelation['pdfwork']) {
$arrvalue['y'] = 0; $arrvalue['y'] = 0;
} }
if (isset($arrvalue['name']) && $arrvalue['name'] != '--') { if (isset($arrvalue['name']) && $arrvalue['name'] != '--') {
$test_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['table_coords']) $test_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
. ' AND pdf_page_number = ' . $chpage; . ' AND pdf_page_number = ' . $chpage;
$test_rs = PMA_query_as_cu($test_query, FALSE, $query_default_option); $test_rs = PMA_query_as_cu($test_query, FALSE, $query_default_option);
if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) { if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) {
if (isset($arrvalue['delete']) && $arrvalue['delete'] == 'y') { if (isset($arrvalue['delete']) && $arrvalue['delete'] == 'y') {
$ch_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords']) $ch_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
. ' AND pdf_page_number = ' . $chpage; . ' AND pdf_page_number = ' . $chpage;
} else { } else {
$ch_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_coords']) . ' ' $ch_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
. 'SET x = ' . $arrvalue['x'] . ', y= ' . $arrvalue['y'] . 'SET x = ' . $arrvalue['x'] . ', y= ' . $arrvalue['y']
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
. ' AND pdf_page_number = ' . $chpage; . ' AND pdf_page_number = ' . $chpage;
} }
} else { } else {
$ch_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['table_coords']) . ' ' $ch_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
. '(db_name, table_name, pdf_page_number, x, y) ' . '(db_name, table_name, pdf_page_number, x, y) '
. 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($arrvalue['name']) . '\',' . $chpage . ',' . $arrvalue['x'] . ',' . $arrvalue['y'] . ')'; . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($arrvalue['name']) . '\',' . $chpage . ',' . $arrvalue['x'] . ',' . $arrvalue['y'] . ')';
} }
@@ -211,7 +211,7 @@ if ($cfgRelation['pdfwork']) {
break; break;
case 'deleteCrap': case 'deleteCrap':
foreach ($delrow AS $current_row) { foreach ($delrow AS $current_row) {
$d_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords']) . ' ' . "\n" $d_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' ' . "\n"
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . "\n" . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . "\n"
. ' AND table_name = \'' . PMA_sqlAddslashes($current_row) . '\'' . "\n" . ' AND table_name = \'' . PMA_sqlAddslashes($current_row) . '\'' . "\n"
. ' AND pdf_page_number = ' . $chpage; . ' AND pdf_page_number = ' . $chpage;
@@ -229,7 +229,7 @@ if ($cfgRelation['pdfwork']) {
} }
// Now first show some possibility to choose a page for the pdf // Now first show some possibility to choose a page for the pdf
$page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages']) $page_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''; . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$page_rs = PMA_query_as_cu($page_query, FALSE, $query_default_option); $page_rs = PMA_query_as_cu($page_query, FALSE, $query_default_option);
@@ -285,7 +285,7 @@ if ($cfgRelation['pdfwork']) {
<h2><?php echo $strSelectTables ;?></h2> <h2><?php echo $strSelectTables ;?></h2>
<?php <?php
$page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['table_coords']) $page_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND pdf_page_number = ' . $chpage; . ' AND pdf_page_number = ' . $chpage;
$page_rs = PMA_query_as_cu($page_query, FALSE, $query_default_option); $page_rs = PMA_query_as_cu($page_query, FALSE, $query_default_option);

View File

@@ -316,7 +316,7 @@ class PMA_PDF extends PMA_FPDF
global $cfgRelation,$db,$pdf_page_number,$with_doc; global $cfgRelation,$db,$pdf_page_number,$with_doc;
if ($with_doc){ if ($with_doc){
$test_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages']) $test_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND page_nr = \'' . $pdf_page_number . '\''; . ' AND page_nr = \'' . $pdf_page_number . '\'';
$test_rs = PMA_query_as_cu($test_query); $test_rs = PMA_query_as_cu($test_query);
@@ -709,7 +709,7 @@ class PMA_RT_Table
//x and y //x and y
$sql = 'SELECT x, y FROM ' $sql = 'SELECT x, y FROM '
. PMA_backquote($cfgRelation['table_coords']) . PMA_backquote($GLOBALS['cfgRelation']['db']) . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table_name) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table_name) . '\''
. ' AND pdf_page_number = ' . $pdf_page_number; . ' AND pdf_page_number = ' . $pdf_page_number;
@@ -1046,7 +1046,7 @@ class PMA_RT
$pdf->SetLineWidth(0.2); $pdf->SetLineWidth(0.2);
$pdf->SetDisplayMode('fullpage'); $pdf->SetDisplayMode('fullpage');
// Get the name of this pdfpage to use as filename (Mike Beck) // Get the name of this pdfpage to use as filename (Mike Beck)
$_name_sql = 'SELECT page_descr FROM ' . PMA_backquote($cfgRelation['pdf_pages']) $_name_sql = 'SELECT page_descr FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
. ' WHERE page_nr = ' . $pdf_page_number; . ' WHERE page_nr = ' . $pdf_page_number;
$_name_rs = PMA_query_as_cu($_name_sql); $_name_rs = PMA_query_as_cu($_name_sql);
if ($_name_rs) { if ($_name_rs) {
@@ -1116,7 +1116,7 @@ class PMA_RT
$pdf->SetAutoPageBreak('auto'); $pdf->SetAutoPageBreak('auto');
// Gets tables on this page // Gets tables on this page
$tab_sql = 'SELECT table_name FROM ' . PMA_backquote($cfgRelation['table_coords']) $tab_sql = 'SELECT table_name FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND pdf_page_number = ' . $which_rel; . ' AND pdf_page_number = ' . $which_rel;
$tab_rs = PMA_query_as_cu($tab_sql, NULL, PMA_DBI_QUERY_STORE); $tab_rs = PMA_query_as_cu($tab_sql, NULL, PMA_DBI_QUERY_STORE);
@@ -1176,7 +1176,7 @@ class PMA_RT
$pdf->PMA_PDF_setFontSizeScale(14); $pdf->PMA_PDF_setFontSizeScale(14);
// $sql = 'SELECT * FROM ' . PMA_backquote($cfgRelation['relation']) // $sql = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
// . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\' ' // . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\' '
// . ' AND foreign_db = \'' . PMA_sqlAddslashes($db) . '\' ' // . ' AND foreign_db = \'' . PMA_sqlAddslashes($db) . '\' '
// . ' AND master_table IN (' . $intable . ')' // . ' AND master_table IN (' . $intable . ')'

View File

@@ -94,7 +94,7 @@ if (isset($do_save_data)) {
foreach ($field_orig AS $fieldindex => $fieldcontent) { foreach ($field_orig AS $fieldindex => $fieldcontent) {
if ($field_name[$fieldindex] != $fieldcontent) { if ($field_name[$fieldindex] != $fieldcontent) {
if ($cfgRelation['displaywork']) { if ($cfgRelation['displaywork']) {
$table_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_info']) $table_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info'])
. ' SET display_field = \'' . PMA_sqlAddslashes($field_name[$fieldindex]) . '\'' . ' SET display_field = \'' . PMA_sqlAddslashes($field_name[$fieldindex]) . '\''
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''
@@ -105,7 +105,7 @@ if (isset($do_save_data)) {
} }
if ($cfgRelation['relwork']) { if ($cfgRelation['relwork']) {
$table_query = 'UPDATE ' . PMA_backquote($cfgRelation['relation']) $table_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' SET master_field = \'' . PMA_sqlAddslashes($field_name[$fieldindex]) . '\'' . ' SET master_field = \'' . PMA_sqlAddslashes($field_name[$fieldindex]) . '\''
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\''
@@ -114,7 +114,7 @@ if (isset($do_save_data)) {
unset($table_query); unset($table_query);
unset($tb_rs); unset($tb_rs);
$table_query = 'UPDATE ' . PMA_backquote($cfgRelation['relation']) $table_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' SET foreign_field = \'' . PMA_sqlAddslashes($field_name[$fieldindex]) . '\'' . ' SET foreign_field = \'' . PMA_sqlAddslashes($field_name[$fieldindex]) . '\''
. ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE foreign_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND foreign_table = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND foreign_table = \'' . PMA_sqlAddslashes($table) . '\''

View File

@@ -89,7 +89,7 @@ if (isset($destination) && $cfgRelation['relwork']) {
if ($foreign_string != 'nix') { if ($foreign_string != 'nix') {
list($foreign_db, $foreign_table, $foreign_field) = explode('.', $foreign_string); list($foreign_db, $foreign_table, $foreign_field) = explode('.', $foreign_string);
if (!isset($existrel[$master_field])) { if (!isset($existrel[$master_field])) {
$upd_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['relation']) $upd_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. '(master_db, master_table, master_field, foreign_db, foreign_table, foreign_field)' . '(master_db, master_table, master_field, foreign_db, foreign_table, foreign_field)'
. ' values(' . ' values('
. '\'' . PMA_sqlAddslashes($db) . '\', ' . '\'' . PMA_sqlAddslashes($db) . '\', '
@@ -99,7 +99,7 @@ if (isset($destination) && $cfgRelation['relwork']) {
. '\'' . PMA_sqlAddslashes($foreign_table) . '\',' . '\'' . PMA_sqlAddslashes($foreign_table) . '\','
. '\'' . PMA_sqlAddslashes($foreign_field) . '\')'; . '\'' . PMA_sqlAddslashes($foreign_field) . '\')';
} elseif ($existrel[$master_field]['foreign_db'] . '.' .$existrel[$master_field]['foreign_table'] . '.' . $existrel[$master_field]['foreign_field'] != $foreign_string) { } elseif ($existrel[$master_field]['foreign_db'] . '.' .$existrel[$master_field]['foreign_table'] . '.' . $existrel[$master_field]['foreign_field'] != $foreign_string) {
$upd_query = 'UPDATE ' . PMA_backquote($cfgRelation['relation']) . ' SET' $upd_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation']) . ' SET'
. ' foreign_db = \'' . PMA_sqlAddslashes($foreign_db) . '\', ' . ' foreign_db = \'' . PMA_sqlAddslashes($foreign_db) . '\', '
. ' foreign_table = \'' . PMA_sqlAddslashes($foreign_table) . '\', ' . ' foreign_table = \'' . PMA_sqlAddslashes($foreign_table) . '\', '
. ' foreign_field = \'' . PMA_sqlAddslashes($foreign_field) . '\' ' . ' foreign_field = \'' . PMA_sqlAddslashes($foreign_field) . '\' '
@@ -108,7 +108,7 @@ if (isset($destination) && $cfgRelation['relwork']) {
. ' AND master_field = \'' . PMA_sqlAddslashes($master_field) . '\''; . ' AND master_field = \'' . PMA_sqlAddslashes($master_field) . '\'';
} // end if... else.... } // end if... else....
} elseif (isset($existrel[$master_field])) { } elseif (isset($existrel[$master_field])) {
$upd_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation']) $upd_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\''
. ' AND master_field = \'' . PMA_sqlAddslashes($master_field) . '\''; . ' AND master_field = \'' . PMA_sqlAddslashes($master_field) . '\'';
@@ -220,17 +220,17 @@ if ($cfgRelation['displaywork']
if ($disp) { if ($disp) {
if ($display_field != '') { if ($display_field != '') {
$upd_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_info']) $upd_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info'])
. ' SET display_field = \'' . PMA_sqlAddslashes($display_field) . '\'' . ' SET display_field = \'' . PMA_sqlAddslashes($display_field) . '\''
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''; . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
} else { } else {
$upd_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info']) $upd_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\''; . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
} }
} elseif ($display_field != '') { } elseif ($display_field != '') {
$upd_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['table_info']) $upd_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_info'])
. '(db_name, table_name, display_field) ' . '(db_name, table_name, display_field) '
. ' VALUES(' . ' VALUES('
. '\'' . PMA_sqlAddslashes($db) . '\',' . '\'' . PMA_sqlAddslashes($db) . '\','