3 // vim: expandtab sw=4 ts=4 sts=4:
5 // In this file you may add PHP or HTML statements that will be used to define
6 // the footer for phpMyAdmin pages.
12 // If query window is wanted and open, update with latest selected db/table.
13 if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
15 <script type
="text/javascript">
18 if ($cfg['QueryFrameDebug']) {
20 document
.writeln("Updating query window. DB: <?php echo (isset($db) ? addslashes($db) : 'FALSE'); ?>, Table: <?php echo (isset($table) ? addslashes($table) : 'FALSE'); ?><br>");
21 document
.writeln("Window: " + parent
.frames
.queryframe
.querywindow
.location +
"<br>");
27 if (!isset($error_message) ||
$error_message == '') {
29 if (parent
.frames
.queryframe
&& parent
.frames
.queryframe
.document
&& parent
.frames
.queryframe
.document
.queryframeform
) {
30 parent
.frames
.queryframe
.document
.queryframeform
.db
.value
= "<?php echo (isset($db) ? addslashes($db) : ''); ?>";
31 parent
.frames
.queryframe
.document
.queryframeform
.table
.value
= "<?php echo (isset($table) ? addslashes($table) : ''); ?>";
37 function reload_querywindow () {
38 if (parent
.frames
.queryframe
&& parent
.frames
.queryframe
.querywindow
&& !parent
.frames
.queryframe
.querywindow
.closed
&& parent
.frames
.queryframe
.querywindow
.location
) {
39 <?php
echo ($cfg['QueryFrameDebug'] ?
'document.writeln("<a href=\'#\' onClick=\'parent.frames.queryframe.querywindow.focus(); return false;\'>Query Window</a> can be updated.<br>");' : ''); ?
>
42 if (!isset($error_message) ||
$error_message == '') {
43 if (isset($LockFromUpdate) && $LockFromUpdate == '1' && isset($sql_query)) {
44 // When the button 'LockFromUpdate' was selected in the querywindow, it does not submit it's contents to
45 // itself. So we create a SQL-history entry here.
46 PMA_setHistory((isset($db) ?
$db : ''), (isset($table) ?
$table : ''), $cfg['Server']['user'], $sql_query);
49 if (!parent
.frames
.queryframe
.querywindow
.document
.sqlform
.LockFromUpdate ||
!parent
.frames
.queryframe
.querywindow
.document
.sqlform
.LockFromUpdate
.checked
) {
50 parent
.frames
.queryframe
.querywindow
.document
.querywindow
.db
.value
= "<?php echo (isset($db) ? addslashes($db) : '') ?>";
51 parent
.frames
.queryframe
.querywindow
.document
.querywindow
.query_history_latest_db
.value
= "<?php echo (isset($db) ? addslashes($db) : '') ?>";
52 parent
.frames
.queryframe
.querywindow
.document
.querywindow
.table
.value
= "<?php echo (isset($table) ? addslashes($table) : '') ?>";
53 parent
.frames
.queryframe
.querywindow
.document
.querywindow
.query_history_latest_table
.value
= "<?php echo (isset($table) ? addslashes($table) : '') ?>";
55 <?php
echo (isset($sql_query) ?
'parent.frames.queryframe.querywindow.document.querywindow.query_history_latest.value = "' . urlencode($sql_query) . '";' : '// no sql query update') . "\n"; ?
>
57 <?php
echo ($cfg['QueryFrameDebug'] ?
'alert(\'Querywindow submits. Last chance to check variables.\');' : '') . "\n"; ?
>
58 parent
.frames
.queryframe
.querywindow
.document
.querywindow
.submit();
63 // no submit, query was invalid
70 function focus_querywindow(sql_query
) {
71 if (parent
.frames
.queryframe
&& parent
.frames
.queryframe
.querywindow
&& !parent
.frames
.queryframe
.querywindow
.closed
&& parent
.frames
.queryframe
.querywindow
.location
) {
72 if (parent
.frames
.queryframe
.querywindow
.document
.querywindow
.querydisplay_tab
!= 'sql') {
73 parent
.frames
.queryframe
.querywindow
.document
.querywindow
.querydisplay_tab
.value
= "sql";
74 parent
.frames
.queryframe
.querywindow
.document
.querywindow
.query_history_latest
.value
= sql_query
;
75 parent
.frames
.queryframe
.querywindow
.document
.querywindow
.submit();
76 parent
.frames
.queryframe
.querywindow
.focus();
78 parent
.frames
.queryframe
.querywindow
.focus();
82 } else if (parent
.frames
.queryframe
) {
83 new_win_url
= 'querywindow.php3?sql_query=' + sql_query +
'&<?php echo PMA_generate_common_url(isset($db) ? addslashes($db) : '', isset($table) ? addslashes($table) : '', '&'); ?>';
84 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
']; ?>');
86 if (!parent
.frames
.queryframe
.querywindow
.opener
) {
87 parent
.frames
.queryframe
.querywindow
.opener
= parent
.frames
.queryframe
;
90 // reload_querywindow();
97 if (isset($focus_querywindow) && $focus_querywindow == "true") {
99 if (parent
.frames
.queryframe
&& parent
.frames
.queryframe
.querywindow
&& !parent
.frames
.queryframe
.querywindow
.closed
&& parent
.frames
.queryframe
.querywindow
.location
) {
113 * Close MySql non-persistent connections
115 if (isset($GLOBALS['dbh']) && $GLOBALS['dbh']) {
116 @mysql_close
($GLOBALS['dbh']);
118 if (isset($GLOBALS['userlink']) && $GLOBALS['userlink']) {
119 @mysql_close
($GLOBALS['userlink']);
129 * Generates profiling data if requested
131 if (isset($GLOBALS['cfg']['DBG']['enable'])
132 && $GLOBALS['cfg']['DBG']['enable']
133 && isset($GLOBALS['cfg']['DBG']['profile']['enable'])
134 && $GLOBALS['cfg']['DBG']['profile']['enable']) {
135 //run the basic setup code first
136 include('./libraries/dbg/setup.php3');
137 //if the setup ran fine, then do the profiling
138 if (isset($GLOBALS['DBG']) && $GLOBALS['DBG']) {
139 include('./libraries/dbg/profiling.php3');
140 dbg_dump_profiling_results();
145 * Sends bufferized data
147 if (isset($GLOBALS['cfg']['OBGzip']) && $GLOBALS['cfg']['OBGzip']
148 && isset($GLOBALS['ob_mode']) && $GLOBALS['ob_mode']) {
149 PMA_outBufferPost($GLOBALS['ob_mode']);