diff --git a/ChangeLog b/ChangeLog index 5619350cc..f2710877d 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,15 @@ phpMyAdmin - Changelog $Id$ $Source$ +2003-04-20 Garvin Hicking + * libraries/display_tbl.lib.php3, index.php3, left.php3, + tbl_query_box.php3, queryframe.php3, querywindow.php3: + Fixed Bug #723955, 723736, 723713 (Query Frame). Workaround for + (serious) issues with multiple instances of phpMyAdmin and + the query window. Also made sure that disabling the QueryFrame + is possible without seeing errors. Of course, this is + extremely reduced usability without JS. + 2003-04-18 Garvin Hicking * left.php3, index.php3, tbl_query_box.php3, libraries/display_tbl.lib.php3, queryframe.php3: diff --git a/index.php3 b/index.php3 index 895cbdbd3..3a77d99e9 100755 --- a/index.php3 +++ b/index.php3 @@ -48,6 +48,13 @@ $cfgRelation = PMA_getRelationsParam(); if ($cfg['QueryHistoryDB'] && $cfgRelation['historywork']) { PMA_purgeHistory($cfg['Server']['user']); } + +if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) { + $phpmain_hash = md5($cfg['PmaAbsoluteUri'] . time()); +} else { + $phpmain_hash = md5($cfg['PmaAbsoluteUri']); +} + ?> @@ -62,12 +69,12 @@ if ($cfg['QueryHistoryDB'] && $cfgRelation['historywork']) { - + - + - + <body bgcolor="#FFFFFF"> diff --git a/left.php3 b/left.php3 index 4e762e924..86402105f 100755 --- a/left.php3 +++ b/left.php3 @@ -60,7 +60,7 @@ PMA_setFontSizes(); <head> <title>phpMyAdmin</title> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" /> - <base<?php if (!empty($cfg['PmaAbsoluteUri'])) echo ' href="' . $cfg['PmaAbsoluteUri'] . '"'; ?> target="phpmain<?php echo md5($cfg['PmaAbsoluteUri']); ?>" /> + <base<?php if (!empty($cfg['PmaAbsoluteUri'])) echo ' href="' . $cfg['PmaAbsoluteUri'] . '"'; ?> target="phpmain<?php echo $hash; ?>" /> <?php // Expandable/collapsible databases list is only used if there is more than one // database to display @@ -252,10 +252,10 @@ if ($num_dbs > 1) { $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label'); ?> <nobr><img src="images/spacer.gif" border="0" width="9" height="9" alt="" /> - <a target="phpmain<?php echo md5($cfg['PmaAbsoluteUri']); ?>" href="sql.php3?<?php echo $common_url_query; ?>&amp;table=<?php echo urlencode($table); ?>&amp;sql_query=<?php echo (isset($book_sql_query) && $book_sql_query != FALSE ? urlencode($book_sql_query) : urlencode('SELECT * FROM ' . PMA_backquote($table))); ?>&amp;pos=0&amp;goto=<?php echo $cfg['DefaultTabTable']; ?>" title="<?php echo $strBrowse . ': ' . htmlspecialchars($url_title); ?>"> + <a target="phpmain<?php echo $hash; ?>" href="sql.php3?<?php echo $common_url_query; ?>&amp;table=<?php echo urlencode($table); ?>&amp;sql_query=<?php echo (isset($book_sql_query) && $book_sql_query != FALSE ? urlencode($book_sql_query) : urlencode('SELECT * FROM ' . PMA_backquote($table))); ?>&amp;pos=0&amp;goto=<?php echo $cfg['DefaultTabTable']; ?>" title="<?php echo $strBrowse . ': ' . htmlspecialchars($url_title); ?>"> <img src="images/browse.png" width="8" height="8" border="0" alt="<?php echo $strBrowse . ': ' . $url_title; ?>" /></a><bdo dir="<?php echo $text_dir; ?>">&nbsp;</bdo> <a class="tblItem" id="tbl_<?php echo md5($table); ?>" title="<?php echo htmlspecialchars($url_title); ?>" -target="phpmain<?php echo md5($cfg['PmaAbsoluteUri']); ?>" href="<?php echo $cfg['DefaultTabTable']; ?>?<?php echo $common_url_query; ?>&amp;table=<?php echo urlencode($table); ?>"> +target="phpmain<?php echo $hash; ?>" href="<?php echo $cfg['DefaultTabTable']; ?>?<?php echo $common_url_query; ?>&amp;table=<?php echo urlencode($table); ?>"> <?php echo ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)); ?></a></nobr><br /> <?php } // end for $t (tables list) @@ -286,12 +286,12 @@ target="phpmain<?php echo md5($cfg['PmaAbsoluteUri']); ?>" href="<?php echo $cfg $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label'); - $table_list .= ' <nobr><a target="phpmain' . md5($cfg['PmaAbsoluteUri']) . '" href="sql.php3?' . $common_url_query . '&amp;table=' . urlencode($table) . '&amp;sql_query=' . (isset($book_sql_query) && $book_sql_query != FALSE ? urlencode($book_sql_query) : urlencode('SELECT * FROM ' . PMA_backquote($table))) . '&amp;pos=0&amp;goto=' . $cfg['DefaultTabTable'] . '">' . "\n"; + $table_list .= ' <nobr><a target="phpmain' . $hash . '" href="sql.php3?' . $common_url_query . '&amp;table=' . urlencode($table) . '&amp;sql_query=' . (isset($book_sql_query) && $book_sql_query != FALSE ? urlencode($book_sql_query) : urlencode('SELECT * FROM ' . PMA_backquote($table))) . '&amp;pos=0&amp;goto=' . $cfg['DefaultTabTable'] . '">' . "\n"; $table_list .= ' <img src="images/browse.png" width="8" height="8" border="0" alt="' . $strBrowse . ': ' . $url_title . '" title="' . $strBrowse . ': ' . htmlspecialchars($url_title) . '" /></a><bdo dir="' . $text_dir . '">&nbsp;</bdo>' . "\n"; if (PMA_USR_BROWSER_AGENT == 'IE') { - $table_list .= ' <span class="tblItem"><a class="tblItem" id="tbl_' . md5($table) . '" title="' . htmlspecialchars($url_title) . '" target="phpmain' . md5($cfg['PmaAbsoluteUri']) . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&amp;table=' . urlencode($table) . '">' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '</a></span></nobr><br />' . "\n"; + $table_list .= ' <span class="tblItem"><a class="tblItem" id="tbl_' . md5($table) . '" title="' . htmlspecialchars($url_title) . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&amp;table=' . urlencode($table) . '">' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '</a></span></nobr><br />' . "\n"; } else { - $table_list .= ' <a class="tblItem" id="tbl_' . md5($table) . '" title="' . htmlspecialchars($url_title) . '" target="phpmain' . md5($cfg['PmaAbsoluteUri']) . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&amp;table=' . urlencode($table) . '">' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '</a></nobr><br />' . "\n"; + $table_list .= ' <a class="tblItem" id="tbl_' . md5($table) . '" title="' . htmlspecialchars($url_title) . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&amp;table=' . urlencode($table) . '">' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '</a></nobr><br />' . "\n"; } } // end for $t (tables list) @@ -301,7 +301,7 @@ target="phpmain<?php echo md5($cfg['PmaAbsoluteUri']); ?>" href="<?php echo $cfg } $selected = ' selected="selected"'; - $table_list_header .= ' <a class="item" target="phpmain' . md5($cfg['PmaAbsoluteUri']) . '" href="' . $cfg['DefaultTabDatabase'] . '?' . $common_url_query . '">' . "\n"; + $table_list_header .= ' <a class="item" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabDatabase'] . '?' . $common_url_query . '">' . "\n"; $table_list_header .= ' <span class="heada"><b>' . ($db_tooltip != '' && $cfg['ShowTooltipAliasTB'] ? htmlspecialchars($db_tooltip) : htmlspecialchars($db)) . '</b><bdo dir="' . $text_dir . '">&nbsp;&nbsp;</bdo></span></a><br />' . "\n\n"; } else { $selected = ''; @@ -418,9 +418,9 @@ else if ($num_dbs == 1) { echo "\n"; ?> - <nobr><a target="phpmain<?php echo md5($cfg['PmaAbsoluteUri']); ?>" href="sql.php3?<?php echo $common_url_query; ?>&amp;table=<?php echo urlencode($table); ?>&amp;sql_query=<?php echo (isset($book_sql_query) && $book_sql_query != FALSE ? urlencode($book_sql_query) : urlencode('SELECT * FROM ' . PMA_backquote($table))); ?>&amp;pos=0&amp;goto=<?php echo $cfg['DefaultTabTable']; ?>" title="<?php echo $strBrowse . ': ' . htmlspecialchars($table); ?>"> + <nobr><a target="phpmain<?php echo $hash; ?>" href="sql.php3?<?php echo $common_url_query; ?>&amp;table=<?php echo urlencode($table); ?>&amp;sql_query=<?php echo (isset($book_sql_query) && $book_sql_query != FALSE ? urlencode($book_sql_query) : urlencode('SELECT * FROM ' . PMA_backquote($table))); ?>&amp;pos=0&amp;goto=<?php echo $cfg['DefaultTabTable']; ?>" title="<?php echo $strBrowse . ': ' . htmlspecialchars($table); ?>"> <img src="images/browse.png" width="8" height="8" border="0" alt="<?php echo $strBrowse . ': ' . htmlspecialchars($table); ?>" /></a><bdo dir="<?php echo $text_dir; ?>">&nbsp;</bdo> - <a class="tblItem" id="tbl_<?php echo md5($table); ?>" title="<?php echo $url_title; ?>" target="phpmain<?php echo md5($cfg['PmaAbsoluteUri']); ?>" href="<?php echo $cfg['DefaultTabTable']; ?>?<?php echo $common_url_query; ?>&amp;table=<?php echo urlencode($table); ?>"> + <a class="tblItem" id="tbl_<?php echo md5($table); ?>" title="<?php echo $url_title; ?>" target="phpmain<?php echo $hash; ?>" href="<?php echo $cfg['DefaultTabTable']; ?>?<?php echo $common_url_query; ?>&amp;table=<?php echo urlencode($table); ?>"> <?php echo ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)); ?></a></nobr><br /> <?php } // end for $j (tables list) @@ -439,6 +439,9 @@ else { echo "\n"; ?> +<form name="hashform" action="left.php3"> + <input type="hidden" name="hash" value="<?php echo $hash; ?>"> +</form> </body> </html> diff --git a/libraries/display_tbl.lib.php3 b/libraries/display_tbl.lib.php3 index fd91ae247..f59865fba 100644 --- a/libraries/display_tbl.lib.php3 +++ b/libraries/display_tbl.lib.php3 @@ -1001,7 +1001,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) { } // end if (1.2.1) if ($table == $GLOBALS['cfg']['Bookmark']['table'] && $db == $GLOBALS['cfg']['Bookmark']['db']) { - $bookmark_go = '<form method="post" target="phpmain' . md5($GLOBALS['cfg']['PmaAbsoluteUri']) . '" action="read_dump.php3">' + $bookmark_go = '<form method="post" action="read_dump.php3">' . PMA_generate_common_hidden_inputs($row['dbase'], '') . '<input type="hidden" name="id_bookmark" value="' . $row['id'] . '" />' . '<input type="hidden" name="action_bookmark" value="0" />' diff --git a/queryframe.php3 b/queryframe.php3 index 9f312a2ac..217ada54b 100644 --- a/queryframe.php3 +++ b/queryframe.php3 @@ -91,7 +91,7 @@ if ($cfg['QueryFrameJS']) { $onclick = 'onClick="javascript:open_querywindow(this.href); return false;"'; } else { $href = $anchor; - $target = 'target="phpmain' . md5($cfg['PmaAbsoluteUri']) . '"'; + $target = 'target="phpmain' . $hash . '"'; $onclick = ''; } ?> diff --git a/querywindow.php3 b/querywindow.php3 index 792b57e12..b93b7c588 100644 --- a/querywindow.php3 +++ b/querywindow.php3 @@ -92,27 +92,32 @@ var confirmMsg = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', ' <body bgcolor="<?php echo ($cfg['QueryFrameJS'] ? $cfg['LeftBgColor'] : $cfg['RightBgColor']); ?>"> <?php -$querydisplay_tab = (isset($querydisplay_tab) ? $querydisplay_tab : $cfg['QueryWindowDefTab']); +if ($cfg['QueryFrameJS']) { + $querydisplay_tab = (isset($querydisplay_tab) ? $querydisplay_tab : $cfg['QueryWindowDefTab']); + + if ($cfg['LightTabs']) { + echo '&nbsp;'; + } else { + echo '<table border="0" cellspacing="0" cellpadding="3" width="100%" class="tabs"> + <tr> + <td width="8">&nbsp;</td>'; + } + echo "\n"; + echo PMA_printTab($strSQL, '#', '', 'onClick="javascript:query_tab_commit(\'sql\');return false;"', '', (isset($querydisplay_tab) && $querydisplay_tab == 'sql' ? TRUE : FALSE)); + echo PMA_printTab($strImportFiles, '#', '', 'onClick="javascript:query_tab_commit(\'files\');return false;"', '', (isset($querydisplay_tab) && $querydisplay_tab == 'files' ? TRUE : FALSE)); + echo PMA_printTab($strQuerySQLHistory, '#', '', 'onClick="javascript:query_tab_commit(\'history\');return false;"', '', (isset($querydisplay_tab) && $querydisplay_tab == 'history' ? TRUE : FALSE)); -if ($cfg['LightTabs']) { - echo '&nbsp;'; -} else { - echo '<table border="0" cellspacing="0" cellpadding="3" width="100%" class="tabs"> - <tr> - <td width="8">&nbsp;</td>'; -} -echo "\n"; -echo PMA_printTab($strSQL, '#', '', 'onClick="javascript:query_tab_commit(\'sql\');return false;"', '', (isset($querydisplay_tab) && $querydisplay_tab == 'sql' ? TRUE : FALSE)); -echo PMA_printTab($strImportFiles, '#', '', 'onClick="javascript:query_tab_commit(\'files\');return false;"', '', (isset($querydisplay_tab) && $querydisplay_tab == 'files' ? TRUE : FALSE)); -echo PMA_printTab($strQuerySQLHistory, '#', '', 'onClick="javascript:query_tab_commit(\'history\');return false;"', '', (isset($querydisplay_tab) && $querydisplay_tab == 'history' ? TRUE : FALSE)); -if ($cfg['QueryWindowDefTab'] == 'full') { - echo PMA_printTab($strAll, '#', '', 'onClick="javascript:query_tab_commit(\'full\');return false;"', '', (isset($querydisplay_tab) && $querydisplay_tab == 'full' ? TRUE : FALSE)); -} + if ($cfg['QueryWindowDefTab'] == 'full') { + echo PMA_printTab($strAll, '#', '', 'onClick="javascript:query_tab_commit(\'full\');return false;"', '', (isset($querydisplay_tab) && $querydisplay_tab == 'full' ? TRUE : FALSE)); + } -if (!$cfg['LightTabs']) { - echo '</tr></table>'; + if (!$cfg['LightTabs']) { + echo '</tr></table>'; + } else { + echo '<br />'; + } } else { - echo '<br />'; + $querydisplay_tab = 'full'; } ?> diff --git a/tbl_query_box.php3 b/tbl_query_box.php3 index b29cce696..1511b8c87 100755 --- a/tbl_query_box.php3 +++ b/tbl_query_box.php3 @@ -55,7 +55,7 @@ $auto_sel = ($cfg['TextareaAutoSelect'] // garvin: If non-JS query window is embedded, display a list of databases to choose from. // Apart from that, a non-js query window sucks badly. -if ($cfg['QueryFrame'] && (!$cfg['QueryFrameJS'] || ($cfg['QueryFrameJS'] && !$db))) { +if ($cfg['QueryFrame'] && (!$cfg['QueryFrameJS'] && !$db || ($cfg['QueryFrameJS'] && !$db))) { /** * Get the list and number of available databases. */ @@ -77,8 +77,18 @@ if ($cfg['QueryFrame'] && (!$cfg['QueryFrameJS'] || ($cfg['QueryFrameJS'] && !$d $queryframe_db_list = ''; } +if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) { +?> + <script> + document.writeln('<form method="post" target="phpmain' + <?php echo ((isset($is_inside_querywindow) && $is_inside_querywindow == TRUE) ? 'opener.' : ''); ?>top.frames.nav.document.hashform.hash.value + '" action="read_dump.php3"<?php if ($is_upload) echo ' enctype="multipart/form-data"'; ?>'); + </script> +<?php +} else { ?> <form method="post" target="phpmain<?php echo md5($cfg['PmaAbsoluteUri']); ?>" action="read_dump.php3"<?php if ($is_upload) echo ' enctype="multipart/form-data"'; echo "\n"; ?> +<?php +} +?> onsubmit="return checkSqlQuery(this)" name="sqlform"> <input type="hidden" name="is_js_confirmed" value="0" /> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?> @@ -278,7 +288,23 @@ if (!isset($is_inside_querywindow) || <!-- Insert a text file --> <br /><br /> <li> + <?php + if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) { + ?> + + <script> + document.writeln('<div style="margin-bottom: 10px"><a href="<?php echo (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE ? '#' : $ldi_target); ?>" <?php echo (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE ? 'onclick="opener.top.frames.phpmain\' + opener.top.frames.nav.document.hashform.hash.value + \'.location.href = \'' . $ldi_target . '\'; return false;"' : ''); ?>><?php echo $strInsertTextfiles; ?></a></div>'); + </script> + + <?php + } else { + ?> + <div style="margin-bottom: 10px"><a href="<?php echo (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE ? '#' : $ldi_target); ?>" <?php echo (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE ? 'onclick="opener.top.frames.phpmain' . md5($cfg['PmaAbsoluteUri']) . '.location.href = \'' . $ldi_target . '\'; return false;"' : ''); ?>><?php echo $strInsertTextfiles; ?></a></div> + + <?php + } + ?> </li> <?php }