Fix left frame reloading after dropping table (bug #1034531).
[phpmyadmin/crack.git] / footer.inc.php
blobebcc18e53742962164d7b41b71ff2773ea5abe7b
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 /**
6 * WARNING: This script has to be included at the very end of your code because
7 * it will stop the script execution!
8 */
10 require_once('./libraries/relation.lib.php'); // for PMA_setHistory()
12 /**
13 * Query window
16 // If query window is wanted and open, update with latest selected db/table.
17 if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
20 <script type="text/javascript">
21 <!--
22 <?php
23 if (!isset($no_history) && !empty($db) && (!isset($error_message) || $error_message == '')) {
24 $tables = PMA_DBI_try_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
25 $num_tables = ($tables) ? @PMA_DBI_num_rows($tables) : 0;
26 $common_url_query = PMA_generate_common_url($db);
27 if ($num_tables) {
28 $num_tables_disp = ' (' . $num_tables . ')';
29 } else {
30 $num_tables_disp = ' (-)';
33 var dbBoxSetupDone = false;
34 function dbBoxSetup() {
35 if (dbBoxSetupDone != true) {
36 if (parent.frames.queryframe && parent.frames.queryframe.document.left && parent.frames.queryframe.document.left.lightm_db) {
37 parent.frames.queryframe.document.left.lightm_db.value = '<?php echo addslashes($db); ?>';
38 dbBoxSetupDone = true;
39 } else {
40 setTimeout("dbBoxSetup();",500);
44 if (parent.frames.queryframe && parent.frames.queryframe.document && parent.frames.queryframe.document.queryframeform) {
45 parent.frames.queryframe.document.queryframeform.db.value = "<?php echo (isset($db) ? addslashes($db) : ''); ?>";
46 parent.frames.queryframe.document.queryframeform.table.value = "<?php echo (isset($table) ? addslashes($table) : ''); ?>";
48 if (parent.frames.queryframe && parent.frames.queryframe.document && parent.frames.queryframe.document.left && parent.frames.queryframe.document.left.lightm_db) {
49 selidx = parent.frames.queryframe.document.left.lightm_db.selectedIndex;
50 if (parent.frames.queryframe.document.left.lightm_db.options[selidx].value == "<?php echo addslashes($db); ?>") {
51 parent.frames.queryframe.document.left.lightm_db.options[selidx].text = "<?php echo addslashes($db) . $num_tables_disp; ?>";
52 } else {
53 parent.frames.queryframe.location.reload();
54 setTimeout("dbBoxSetup();",2000);
57 <?php
61 function reload_querywindow () {
62 if (parent.frames.queryframe && parent.frames.queryframe.querywindow && !parent.frames.queryframe.querywindow.closed && parent.frames.queryframe.querywindow.location) {
63 <?php
64 if (!isset($no_history) && (!isset($error_message) || $error_message == '')) {
65 if (isset($LockFromUpdate) && $LockFromUpdate == '1' && isset($sql_query)) {
66 // When the button 'LockFromUpdate' was selected in the querywindow, it does not submit it's contents to
67 // itself. So we create a SQL-history entry here.
68 if ($cfg['QueryHistoryDB'] && $cfgRelation['historywork']) {
69 PMA_setHistory((isset($db) ? $db : ''), (isset($table) ? $table : ''), $cfg['Server']['user'], $sql_query);
73 if (!parent.frames.queryframe.querywindow.document.sqlform.LockFromUpdate || !parent.frames.queryframe.querywindow.document.sqlform.LockFromUpdate.checked) {
74 parent.frames.queryframe.querywindow.document.querywindow.db.value = "<?php echo (isset($db) ? addslashes($db) : '') ?>";
75 parent.frames.queryframe.querywindow.document.querywindow.query_history_latest_db.value = "<?php echo (isset($db) ? addslashes($db) : '') ?>";
76 parent.frames.queryframe.querywindow.document.querywindow.table.value = "<?php echo (isset($table) ? addslashes($table) : '') ?>";
77 parent.frames.queryframe.querywindow.document.querywindow.query_history_latest_table.value = "<?php echo (isset($table) ? addslashes($table) : '') ?>";
79 <?php echo (isset($sql_query) ? 'parent.frames.queryframe.querywindow.document.querywindow.query_history_latest.value = "' . urlencode($sql_query) . '";' : '// no sql query update') . "\n"; ?>
81 parent.frames.queryframe.querywindow.document.querywindow.submit();
83 <?php
84 } else {
86 // no submit, query was invalid
87 <?php
93 function focus_querywindow(sql_query) {
94 if (parent.frames.queryframe && parent.frames.queryframe.querywindow && !parent.frames.queryframe.querywindow.closed && parent.frames.queryframe.querywindow.location) {
95 if (parent.frames.queryframe.querywindow.document.querywindow.querydisplay_tab != 'sql') {
96 parent.frames.queryframe.querywindow.document.querywindow.querydisplay_tab.value = "sql";
97 parent.frames.queryframe.querywindow.document.querywindow.query_history_latest.value = sql_query;
98 parent.frames.queryframe.querywindow.document.querywindow.submit();
99 parent.frames.queryframe.querywindow.focus();
100 } else {
101 parent.frames.queryframe.querywindow.focus();
104 return false;
105 } else if (parent.frames.queryframe) {
106 new_win_url = 'querywindow.php?sql_query=' + sql_query + '&<?php echo PMA_generate_common_url(isset($db) ? addslashes($db) : '', isset($table) ? addslashes($table) : '', '&'); ?>';
107 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']; ?>');
109 if (!parent.frames.queryframe.querywindow.opener) {
110 parent.frames.queryframe.querywindow.opener = parent.frames.queryframe;
113 // reload_querywindow();
114 return false;
118 reload_querywindow();
119 <?php
120 if (isset($focus_querywindow) && $focus_querywindow == "true") {
122 if (parent.frames.queryframe && parent.frames.queryframe.querywindow && !parent.frames.queryframe.querywindow.closed && parent.frames.queryframe.querywindow.location) {
123 self.focus();
125 <?php
129 //-->
130 </script>
131 <?php
136 * Close database connections
138 if (isset($GLOBALS['dbh']) && $GLOBALS['dbh']) {
139 @PMA_DBI_close($GLOBALS['dbh']);
141 if (isset($GLOBALS['userlink']) && $GLOBALS['userlink']) {
142 @PMA_DBI_close($GLOBALS['userlink']);
146 <?php include('./config.footer.inc.php'); ?>
148 </body>
150 </html>
151 <?php
154 * Generates profiling data if requested
156 if (isset($GLOBALS['cfg']['DBG']['enable'])
157 && $GLOBALS['cfg']['DBG']['enable']
158 && isset($GLOBALS['cfg']['DBG']['profile']['enable'])
159 && $GLOBALS['cfg']['DBG']['profile']['enable']) {
160 //run the basic setup code first
161 require_once('./libraries/dbg/setup.php');
162 //if the setup ran fine, then do the profiling
163 if (isset($GLOBALS['DBG']) && $GLOBALS['DBG']) {
164 require_once('./libraries/dbg/profiling.php');
165 dbg_dump_profiling_results();
170 * Sends bufferized data
172 if (isset($GLOBALS['cfg']['OBGzip']) && $GLOBALS['cfg']['OBGzip']
173 && isset($GLOBALS['ob_mode']) && $GLOBALS['ob_mode']) {
174 PMA_outBufferPost($GLOBALS['ob_mode']);
178 * Stops the script execution
180 exit;