2 /* vim: set expandtab sw=4 ts=4 sts=4: */
6 * updates javascript variables in index.php for coorect working with querywindow
7 * and navigation frame refreshing
9 * send buffered data if buffered
11 * WARNING: This script has to be included at the very end of your code because
12 * it will stop the script execution!
14 * always use $GLOBALS, as this script is also included by functions
16 * @uses $_REQUEST['no_history']
17 * @uses $GLOBALS['lang']
18 * @uses $GLOBALS['collation_connection']
19 * @uses $GLOBALS['server']
20 * @uses $GLOBALS['db']
21 * @uses $GLOBALS['table']
22 * @uses $GLOBALS['error_message']
23 * @uses $GLOBALS['reload']
24 * @uses $GLOBALS['sql_query']
25 * @uses $GLOBALS['focus_querywindow']
26 * @uses $GLOBALS['checked_special']
27 * @uses $GLOBALS['pmaThemeImage']
28 * @uses $GLOBALS['controllink'] to close it
29 * @uses $GLOBALS['userlink'] to close it
30 * @uses $cfg['Server']['user']
31 * @uses $cfg['NavigationBarIconic']
32 * @uses $cfg['DBG']['enable']
33 * @uses $cfg['DBG']['profile']['enable']
34 * @uses $GLOBALS['strOpenNewWindow']
35 * @uses $cfg['MaxCharactersInDisplayedSQL']
37 * @uses PMA_setHistory()
39 * @uses PMA_escapeJsString()
41 * @uses PMA_generate_common_url()
42 * @uses PMA_DBI_close()
47 if (! defined('PHPMYADMIN')) {
52 * for PMA_setHistory()
54 require_once './libraries/relation.lib.php';
56 if (! PMA_isValid($_REQUEST['no_history']) && empty($GLOBALS['error_message'])
57 && ! empty($GLOBALS['sql_query'])) {
58 PMA_setHistory(PMA_ifSetOr($GLOBALS['db'], ''),
59 PMA_ifSetOr($GLOBALS['table'], ''),
60 $GLOBALS['cfg']['Server']['user'],
61 $GLOBALS['sql_query']);
65 <script type
="text/javascript">
68 if (empty($GLOBALS['error_message'])) {
70 // updates current settings
71 if (window
.parent
.setAll
) {
72 window
.parent
.setAll('<?php
73 echo PMA_escapeJsString($GLOBALS['lang
']) . "', '";
74 echo PMA_escapeJsString($GLOBALS['collation_connection
']) . "', '";
75 echo PMA_escapeJsString($GLOBALS['server
']) . "', '";
76 echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db
'], '')) . "', '";
77 echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table
'], '')); ?>');
80 if (! empty($GLOBALS['reload'])) {
82 // refresh navigation frame content
83 if (window
.parent
.refreshNavigation
) {
84 window
.parent
.refreshNavigation();
89 // set current db, table and sql query in the querywindow
90 if (window
.parent
.reload_querywindow
) {
91 window
.parent
.reload_querywindow(
92 '<?php echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db
'], '')) ?>',
93 '<?php echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table
'], '')) ?>',
94 '<?php echo strlen($GLOBALS['sql_query
']) > $GLOBALS['cfg
']['MaxCharactersInDisplayedSQL
'] ? PMA_escapeJsString($GLOBALS['sql_query
']) : ''; ?>');
99 if (! empty($GLOBALS['focus_querywindow'])) {
101 // set focus to the querywindow
102 if (parent
.querywindow
&& !parent
.querywindow
.closed
&& parent
.querywindow
.location
) {
109 if (window
.parent
.frame_content
) {
110 // reset content frame name, as querywindow needs to set a unique name
111 // before submitting form data, and navigation frame needs the original name
112 if (typeof(window
.parent
.frame_content
.name
) != 'undefined'
113 && window
.parent
.frame_content
.name
!= 'frame_content') {
114 window
.parent
.frame_content
.name
= 'frame_content';
116 if (typeof(window
.parent
.frame_content
.id
) != 'undefined'
117 && window
.parent
.frame_content
.id
!= 'frame_content') {
118 window
.parent
.frame_content
.id
= 'frame_content';
120 //window.parent.frame_content.setAttribute('name', 'frame_content');
121 //window.parent.frame_content.setAttribute('id', 'frame_content');
127 // Link to itself to replicate windows including frameset
128 if (!isset($GLOBALS['checked_special'])) {
129 $GLOBALS['checked_special'] = false;
132 if (PMA_getenv('SCRIPT_NAME') && empty($_POST) && !$GLOBALS['checked_special']) {
133 echo '<div id="selflink" class="print_ignore">' . "\n";
134 $url_params['target'] = basename(PMA_getenv('SCRIPT_NAME'));
135 echo '<a href="index.php' . PMA_generate_common_url($url_params) . '"'
136 . ' title="' . $GLOBALS['strOpenNewWindow'] . '" target="_blank">';
138 echo '<a href="index.php?target=' . basename(PMA_getenv('SCRIPT_NAME'));
139 $url = PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']);
143 echo '" target="_blank">';
145 if ($GLOBALS['cfg']['NavigationBarIconic']) {
146 echo '<img class="icon" src="'. $GLOBALS['pmaThemeImage'] . 'window-new.png"'
147 . ' alt="' . $GLOBALS['strOpenNewWindow'] . '" />';
149 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
150 echo $GLOBALS['strOpenNewWindow'];
153 echo '</div>' . "\n";
157 * Close database connections
159 if (! empty($GLOBALS['controllink'])) {
160 @PMA_DBI_close
($GLOBALS['controllink']);
162 if (! empty($GLOBALS['userlink'])) {
163 @PMA_DBI_close
($GLOBALS['userlink']);
166 // Include possible custom footers
167 if (file_exists('./config.footer.inc.php')) {
168 require './config.footer.inc.php';
173 * Generates profiling data if requested
176 // profiling deactivated due to licensing issues
177 if (! empty($GLOBALS['cfg']['DBG']['enable'])
178 && ! empty($GLOBALS['cfg']['DBG']['profile']['enable'])) {
179 //run the basic setup code first
180 require_once './libraries/dbg/setup.php';
181 //if the setup ran fine, then do the profiling
183 if (! empty($GLOBALS['DBG'])) {
184 require_once './libraries/dbg/profiling.php';
185 dbg_dump_profiling_results();
195 * Stops the script execution