00001 <?php
00002
00003
00004
00013 require_once('./libraries/relation.lib.php');
00014
00019
00020 if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
00021 ?>
00022
00023 <script type="text/javascript">
00024 <!--
00025 <?php
00026 if ($cfg['QueryFrameDebug']) {
00027 ?>
00028 document.writeln("Updating query window. DB: <?php echo (isset($db) ? addslashes($db) : 'FALSE'); ?>, Table: <?php echo (isset($table) ? addslashes($table) : 'FALSE'); ?><br>");
00029 document.writeln("Window: " + parent.frames.queryframe.querywindow.location + "<br>");
00030 <?php
00031 }
00032 ?>
00033
00034 <?php
00035 if (!isset($no_history) && (!isset($error_message) || $error_message == '')) {
00036 ?>
00037 if (parent.frames.queryframe && parent.frames.queryframe.document && parent.frames.queryframe.document.queryframeform) {
00038 parent.frames.queryframe.document.queryframeform.db.value = "<?php echo (isset($db) ? addslashes($db) : ''); ?>";
00039 parent.frames.queryframe.document.queryframeform.table.value = "<?php echo (isset($table) ? addslashes($table) : ''); ?>";
00040 }
00041 <?php
00042 }
00043 ?>
00044
00045 function reload_querywindow () {
00046 if (parent.frames.queryframe && parent.frames.queryframe.querywindow && !parent.frames.queryframe.querywindow.closed && parent.frames.queryframe.querywindow.location) {
00047 <?php echo ($cfg['QueryFrameDebug'] ? 'document.writeln("<a href=\'#\' onClick=\'parent.frames.queryframe.querywindow.focus(); return false;\'>Query Window</a> can be updated.<br>");' : ''); ?>
00048
00049 <?php
00050 if (!isset($no_history) && (!isset($error_message) || $error_message == '')) {
00051 if (isset($LockFromUpdate) && $LockFromUpdate == '1' && isset($sql_query)) {
00052
00053
00054 if ($cfg['QueryHistoryDB'] && $cfgRelation['historywork']) {
00055 PMA_setHistory((isset($db) ? $db : ''), (isset($table) ? $table : ''), $cfg['Server']['user'], $sql_query);
00056 }
00057 }
00058 ?>
00059 if (!parent.frames.queryframe.querywindow.document.sqlform.LockFromUpdate || !parent.frames.queryframe.querywindow.document.sqlform.LockFromUpdate.checked) {
00060 parent.frames.queryframe.querywindow.document.querywindow.db.value = "<?php echo (isset($db) ? addslashes($db) : '') ?>";
00061 parent.frames.queryframe.querywindow.document.querywindow.query_history_latest_db.value = "<?php echo (isset($db) ? addslashes($db) : '') ?>";
00062 parent.frames.queryframe.querywindow.document.querywindow.table.value = "<?php echo (isset($table) ? addslashes($table) : '') ?>";
00063 parent.frames.queryframe.querywindow.document.querywindow.query_history_latest_table.value = "<?php echo (isset($table) ? addslashes($table) : '') ?>";
00064
00065 <?php echo (isset($sql_query) ? 'parent.frames.queryframe.querywindow.document.querywindow.query_history_latest.value = "' . urlencode($sql_query) . '";' : '
00066
00067 <?php echo ($cfg['QueryFrameDebug'] ? 'alert(\'Querywindow submits. Last chance to check variables.\');' : '') . "\n"; ?>
00068 parent.frames.queryframe.querywindow.document.querywindow.submit();
00069 }
00070 <?php
00071 } else {
00072 ?>
00073
00074 <?php
00075 }
00076 ?>
00077 }
00078 }
00079
00080 function focus_querywindow(sql_query) {
00081 if (parent.frames.queryframe && parent.frames.queryframe.querywindow && !parent.frames.queryframe.querywindow.closed && parent.frames.queryframe.querywindow.location) {
00082 if (parent.frames.queryframe.querywindow.document.querywindow.querydisplay_tab != 'sql') {
00083 parent.frames.queryframe.querywindow.document.querywindow.querydisplay_tab.value = "sql";
00084 parent.frames.queryframe.querywindow.document.querywindow.query_history_latest.value = sql_query;
00085 parent.frames.queryframe.querywindow.document.querywindow.submit();
00086 parent.frames.queryframe.querywindow.focus();
00087 } else {
00088 parent.frames.queryframe.querywindow.focus();
00089 }
00090
00091 return false;
00092 } else if (parent.frames.queryframe) {
00093 new_win_url = 'querywindow.php?sql_query=' + sql_query + '&<?php echo PMA_generate_common_url(isset($db) ? addslashes($db) : '', isset($table) ? addslashes($table) : '', '&'); ?>';
00094 parent.frames.queryframe.querywindow=window.open(new_win_url, '','toolbar=0,location=1,directories=0,status=1,menubar=0,scrollbars=yes,resizable=yes,width=<?php echo $cfg['QueryWindowWidth']; ?>,height=<?php echo $cfg['QueryWindowHeight']; ?>');
00095
00096 if (!parent.frames.queryframe.querywindow.opener) {
00097 parent.frames.queryframe.querywindow.opener = parent.frames.queryframe;
00098 }
00099
00100
00101 return false;
00102 }
00103 }
00104
00105 reload_querywindow();
00106 <?php
00107 if (isset($focus_querywindow) && $focus_querywindow == "true") {
00108 ?>
00109 if (parent.frames.queryframe && parent.frames.queryframe.querywindow && !parent.frames.queryframe.querywindow.closed && parent.frames.queryframe.querywindow.location) {
00110 self.focus();
00111 }
00112 <?php
00113 }
00114 ?>
00115
00116
00117 </script>
00118 <?php
00119 }
00120
00121
00125 if (isset($GLOBALS['dbh']) && $GLOBALS['dbh']) {
00126 @mysql_close($GLOBALS['dbh']);
00127 }
00128 if (isset($GLOBALS['userlink']) && $GLOBALS['userlink']) {
00129 @mysql_close($GLOBALS['userlink']);
00130 }
00131 ?>
00132
00133 </body>
00134
00135 </html>
00136 <?php
00137
00141 if (isset($GLOBALS['cfg']['DBG']['enable'])
00142 && $GLOBALS['cfg']['DBG']['enable']
00143 && isset($GLOBALS['cfg']['DBG']['profile']['enable'])
00144 && $GLOBALS['cfg']['DBG']['profile']['enable']) {
00145
00146 require_once('./libraries/dbg/setup.php');
00147
00148 if (isset($GLOBALS['DBG']) && $GLOBALS['DBG']) {
00149 require_once('./libraries/dbg/profiling.php');
00150 dbg_dump_profiling_results();
00151 }
00152 }
00153
00157 if (isset($GLOBALS['cfg']['OBGzip']) && $GLOBALS['cfg']['OBGzip']
00158 && isset($GLOBALS['ob_mode']) && $GLOBALS['ob_mode']) {
00159 PMA_outBufferPost($GLOBALS['ob_mode']);
00160 }
00161
00165 exit;
00166
00167 ?>