3 // vim: expandtab sw=4 ts=4 sts=4:
6 * In this file you may add PHP or HTML statements that will be used to define
7 * the footer for phpMyAdmin pages.
9 * WARNING: This script has to be included at the very end of your code because
10 * it will stop the script execution!
13 require_once('./libraries/relation.lib.php'); // for PMA_setHistory()
19 // If query window is wanted and open, update with latest selected db/table.
20 if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
23 <script type
="text/javascript">
26 if ($cfg['QueryFrameDebug']) {
28 document
.writeln("Updating query window. DB: <?php echo (isset($db) ? addslashes($db) : 'FALSE'); ?>, Table: <?php echo (isset($table) ? addslashes($table) : 'FALSE'); ?><br>");
29 document
.writeln("Window: " + parent
.frames
.queryframe
.querywindow
.location +
"<br>");
35 if (!isset($no_history) && (!isset($error_message) ||
$error_message == '')) {
37 if (parent
.frames
.queryframe
&& parent
.frames
.queryframe
.document
&& parent
.frames
.queryframe
.document
.queryframeform
) {
38 parent
.frames
.queryframe
.document
.queryframeform
.db
.value
= "<?php echo (isset($db) ? addslashes($db) : ''); ?>";
39 parent
.frames
.queryframe
.document
.queryframeform
.table
.value
= "<?php echo (isset($table) ? addslashes($table) : ''); ?>";
45 function reload_querywindow () {
46 if (parent
.frames
.queryframe
&& parent
.frames
.queryframe
.querywindow
&& !parent
.frames
.queryframe
.querywindow
.closed
&& parent
.frames
.queryframe
.querywindow
.location
) {
47 <?php
echo ($cfg['QueryFrameDebug'] ?
'document.writeln("<a href=\'#\' onClick=\'parent.frames.queryframe.querywindow.focus(); return false;\'>Query Window</a> can be updated.<br>");' : ''); ?
>
50 if (!isset($no_history) && (!isset($error_message) ||
$error_message == '')) {
51 if (isset($LockFromUpdate) && $LockFromUpdate == '1' && isset($sql_query)) {
52 // When the button 'LockFromUpdate' was selected in the querywindow, it does not submit it's contents to
53 // itself. So we create a SQL-history entry here.
54 if ($cfg['QueryHistoryDB'] && $cfgRelation['historywork']) {
55 PMA_setHistory((isset($db) ?
$db : ''), (isset($table) ?
$table : ''), $cfg['Server']['user'], $sql_query);
59 if (!parent
.frames
.queryframe
.querywindow
.document
.sqlform
.LockFromUpdate ||
!parent
.frames
.queryframe
.querywindow
.document
.sqlform
.LockFromUpdate
.checked
) {
60 parent
.frames
.queryframe
.querywindow
.document
.querywindow
.db
.value
= "<?php echo (isset($db) ? addslashes($db) : '') ?>";
61 parent
.frames
.queryframe
.querywindow
.document
.querywindow
.query_history_latest_db
.value
= "<?php echo (isset($db) ? addslashes($db) : '') ?>";
62 parent
.frames
.queryframe
.querywindow
.document
.querywindow
.table
.value
= "<?php echo (isset($table) ? addslashes($table) : '') ?>";
63 parent
.frames
.queryframe
.querywindow
.document
.querywindow
.query_history_latest_table
.value
= "<?php echo (isset($table) ? addslashes($table) : '') ?>";
65 <?php
echo (isset($sql_query) ?
'parent.frames.queryframe.querywindow.document.querywindow.query_history_latest.value = "' . urlencode($sql_query) . '";' : '// no sql query update') . "\n"; ?
>
67 <?php
echo ($cfg['QueryFrameDebug'] ?
'alert(\'Querywindow submits. Last chance to check variables.\');' : '') . "\n"; ?
>
68 parent
.frames
.queryframe
.querywindow
.document
.querywindow
.submit();
73 // no submit, query was invalid
80 function focus_querywindow(sql_query
) {
81 if (parent
.frames
.queryframe
&& parent
.frames
.queryframe
.querywindow
&& !parent
.frames
.queryframe
.querywindow
.closed
&& parent
.frames
.queryframe
.querywindow
.location
) {
82 if (parent
.frames
.queryframe
.querywindow
.document
.querywindow
.querydisplay_tab
!= 'sql') {
83 parent
.frames
.queryframe
.querywindow
.document
.querywindow
.querydisplay_tab
.value
= "sql";
84 parent
.frames
.queryframe
.querywindow
.document
.querywindow
.query_history_latest
.value
= sql_query
;
85 parent
.frames
.queryframe
.querywindow
.document
.querywindow
.submit();
86 parent
.frames
.queryframe
.querywindow
.focus();
88 parent
.frames
.queryframe
.querywindow
.focus();
92 } else if (parent
.frames
.queryframe
) {
93 new_win_url
= 'querywindow.php?sql_query=' + sql_query +
'&<?php echo PMA_generate_common_url(isset($db) ? addslashes($db) : '', isset($table) ? addslashes($table) : '', '&'); ?>';
94 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
']; ?>');
96 if (!parent
.frames
.queryframe
.querywindow
.opener
) {
97 parent
.frames
.queryframe
.querywindow
.opener
= parent
.frames
.queryframe
;
100 // reload_querywindow();
105 reload_querywindow();
107 if (isset($focus_querywindow) && $focus_querywindow == "true") {
109 if (parent
.frames
.queryframe
&& parent
.frames
.queryframe
.querywindow
&& !parent
.frames
.queryframe
.querywindow
.closed
&& parent
.frames
.queryframe
.querywindow
.location
) {
123 * Close MySql non-persistent connections
125 if (isset($GLOBALS['dbh']) && $GLOBALS['dbh']) {
126 @mysql_close
($GLOBALS['dbh']);
128 if (isset($GLOBALS['userlink']) && $GLOBALS['userlink']) {
129 @mysql_close
($GLOBALS['userlink']);
139 * Generates profiling data if requested
141 if (isset($GLOBALS['cfg']['DBG']['enable'])
142 && $GLOBALS['cfg']['DBG']['enable']
143 && isset($GLOBALS['cfg']['DBG']['profile']['enable'])
144 && $GLOBALS['cfg']['DBG']['profile']['enable']) {
145 //run the basic setup code first
146 require_once('./libraries/dbg/setup.php');
147 //if the setup ran fine, then do the profiling
148 if (isset($GLOBALS['DBG']) && $GLOBALS['DBG']) {
149 require_once('./libraries/dbg/profiling.php');
150 dbg_dump_profiling_results();
155 * Sends bufferized data
157 if (isset($GLOBALS['cfg']['OBGzip']) && $GLOBALS['cfg']['OBGzip']
158 && isset($GLOBALS['ob_mode']) && $GLOBALS['ob_mode']) {
159 PMA_outBufferPost($GLOBALS['ob_mode']);
163 * Stops the script execution