00001 <?php
00002
00003
00004
00010 require_once('./libraries/relation.lib.php');
00011
00016
00017 if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
00018 ?>
00019
00020 <script type="text/javascript">
00021 <!--
00022 <?php
00023 if (!isset($no_history) && !empty($db) && (!isset($error_message) || $error_message == '')) {
00024 $tables = PMA_DBI_try_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
00025 $num_tables = ($tables) ? @PMA_DBI_num_rows($tables) : 0;
00026 $common_url_query = PMA_generate_common_url($db);
00027
00028
00029 if ($num_tables) {
00030 $num_tables_disp = '(' . $num_tables . ')';
00031 } else {
00032 $num_tables_disp = '(-)';
00033 }
00034 ?>
00035 var forceQueryFrameReload = false;
00036 <?php
00037
00038
00039 if ((isset($is_drop_database) && $is_drop_database) || (isset($force_queryframe_reload) && $force_queryframe_reload == TRUE)) {
00040 ?>
00041 forceQueryFrameReload = true;
00042 <?php
00043 }
00044 ?>
00045 var dbBoxSetupDone = false;
00046 function dbBoxSetup() {
00047 if (dbBoxSetupDone != true) {
00048 if (parent.frames.queryframe && parent.frames.queryframe.document.left && parent.frames.queryframe.document.left.lightm_db) {
00049 parent.frames.queryframe.document.left.lightm_db.value = '<?php echo addslashes($db); ?>';
00050 dbBoxSetupDone = true;
00051 } else {
00052 setTimeout("dbBoxSetup();",500);
00053 }
00054 }
00055 }
00056 if (parent.frames.queryframe && parent.frames.queryframe.document && parent.frames.queryframe.document.queryframeform) {
00057 parent.frames.queryframe.document.queryframeform.db.value = "<?php echo (isset($db) ? addslashes($db) : ''); ?>";
00058 parent.frames.queryframe.document.queryframeform.table.value = "<?php echo (isset($table) ? addslashes($table) : ''); ?>";
00059 }
00060 if (parent.frames.queryframe && parent.frames.queryframe.document && parent.frames.queryframe.document.left && parent.frames.queryframe.document.left.lightm_db) {
00061 selidx = parent.frames.queryframe.document.left.lightm_db.selectedIndex;
00062 if (parent.frames.queryframe.document.left.lightm_db.options[selidx].value == "<?php echo addslashes($db); ?>" && forceQueryFrameReload == false) {
00063 parent.frames.queryframe.document.left.lightm_db.options[selidx].text =
00064 parent.frames.queryframe.document.left.lightm_db.options[selidx].text.replace(/(.*)\([0-9]+\)/,'$1<?php echo $num_tables_disp;?>');
00065 } else {
00066 parent.frames.queryframe.location.reload();
00067 setTimeout("dbBoxSetup();",2000);
00068 }
00069 }
00070 <?php
00071 }
00072 ?>
00073
00074 function reload_querywindow () {
00075 if (parent.frames.queryframe && parent.frames.queryframe.querywindow && !parent.frames.queryframe.querywindow.closed && parent.frames.queryframe.querywindow.location) {
00076 <?php
00077 if (!isset($no_history) && (!isset($error_message) || $error_message == '')) {
00078 if (isset($LockFromUpdate) && $LockFromUpdate == '1' && isset($sql_query)) {
00079
00080
00081 if ($cfg['QueryHistoryDB'] && $cfgRelation['historywork']) {
00082 PMA_setHistory((isset($db) ? $db : ''), (isset($table) ? $table : ''), $cfg['Server']['user'], $sql_query);
00083 }
00084 }
00085 ?>
00086 if (!parent.frames.queryframe.querywindow.document.sqlform.LockFromUpdate || !parent.frames.queryframe.querywindow.document.sqlform.LockFromUpdate.checked) {
00087 parent.frames.queryframe.querywindow.document.querywindow.db.value = "<?php echo (isset($db) ? addslashes($db) : '') ?>";
00088 parent.frames.queryframe.querywindow.document.querywindow.query_history_latest_db.value = "<?php echo (isset($db) ? addslashes($db) : '') ?>";
00089 parent.frames.queryframe.querywindow.document.querywindow.table.value = "<?php echo (isset($table) ? addslashes($table) : '') ?>";
00090 parent.frames.queryframe.querywindow.document.querywindow.query_history_latest_table.value = "<?php echo (isset($table) ? addslashes($table) : '') ?>";
00091
00092 <?php echo (isset($sql_query) ? 'parent.frames.queryframe.querywindow.document.querywindow.query_history_latest.value = "' . urlencode($sql_query) . '";' : '
00093
00094 parent.frames.queryframe.querywindow.document.querywindow.submit();
00095 }
00096 <?php
00097 } else {
00098 ?>
00099
00100 <?php
00101 }
00102 ?>
00103 }
00104 }
00105
00106 function focus_querywindow(sql_query) {
00107 if (parent.frames.queryframe && parent.frames.queryframe.querywindow && !parent.frames.queryframe.querywindow.closed && parent.frames.queryframe.querywindow.location) {
00108 if (parent.frames.queryframe.querywindow.document.querywindow.querydisplay_tab != 'sql') {
00109 parent.frames.queryframe.querywindow.document.querywindow.querydisplay_tab.value = "sql";
00110 parent.frames.queryframe.querywindow.document.querywindow.query_history_latest.value = sql_query;
00111 parent.frames.queryframe.querywindow.document.querywindow.submit();
00112 parent.frames.queryframe.querywindow.focus();
00113 } else {
00114 parent.frames.queryframe.querywindow.focus();
00115 }
00116
00117 return false;
00118 } else if (parent.frames.queryframe) {
00119 new_win_url = 'querywindow.php?sql_query=' + sql_query + '&<?php echo PMA_generate_common_url(isset($db) ? addslashes($db) : '', isset($table) ? addslashes($table) : '', '&'); ?>';
00120 parent.frames.queryframe.querywindow=window.open(new_win_url, '','toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=yes,resizable=yes,width=<?php echo $cfg['QueryWindowWidth']; ?>,height=<?php echo $cfg['QueryWindowHeight']; ?>');
00121
00122 if (!parent.frames.queryframe.querywindow.opener) {
00123 parent.frames.queryframe.querywindow.opener = parent.frames.queryframe;
00124 }
00125
00126
00127 return false;
00128 }
00129 }
00130
00131 reload_querywindow();
00132 <?php
00133 if (isset($focus_querywindow) && $focus_querywindow == "true") {
00134 ?>
00135 if (parent.frames.queryframe && parent.frames.queryframe.querywindow && !parent.frames.queryframe.querywindow.closed && parent.frames.queryframe.querywindow.location) {
00136 self.focus();
00137 }
00138 <?php
00139 }
00140 ?>
00141
00142
00143 </script>
00144 <?php
00145 }
00146
00147
00151 if (isset($GLOBALS['dbh']) && $GLOBALS['dbh']) {
00152 @PMA_DBI_close($GLOBALS['dbh']);
00153 }
00154 if (isset($GLOBALS['userlink']) && $GLOBALS['userlink']) {
00155 @PMA_DBI_close($GLOBALS['userlink']);
00156 }
00157 ?>
00158
00159 <?php include('./config.footer.inc.php'); ?>
00160 <script type="text/javascript" language="javascript" src="libraries/tooltip.js"></script>
00161 </body>
00162
00163 </html>
00164 <?php
00165
00169 if (isset($GLOBALS['cfg']['DBG']['enable'])
00170 && $GLOBALS['cfg']['DBG']['enable']
00171 && isset($GLOBALS['cfg']['DBG']['profile']['enable'])
00172 && $GLOBALS['cfg']['DBG']['profile']['enable']) {
00173
00174 require_once('./libraries/dbg/setup.php');
00175
00176 if (isset($GLOBALS['DBG']) && $GLOBALS['DBG']) {
00177 require_once('./libraries/dbg/profiling.php');
00178 dbg_dump_profiling_results();
00179 }
00180 }
00181
00185 if (isset($GLOBALS['cfg']['OBGzip']) && $GLOBALS['cfg']['OBGzip']
00186 && isset($GLOBALS['ob_mode']) && $GLOBALS['ob_mode']) {
00187 PMA_outBufferPost($GLOBALS['ob_mode']);
00188 }
00189
00193 exit;
00194
00195 ?>