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()
48 * for PMA_setHistory()
50 require_once './libraries/relation.lib.php';
52 if (! PMA_isValid($_REQUEST['no_history']) && empty($GLOBALS['error_message'])
53 && ! empty($GLOBALS['sql_query'])) {
54 PMA_setHistory(PMA_ifSetOr($GLOBALS['db'], ''),
55 PMA_ifSetOr($GLOBALS['table'], ''),
56 $GLOBALS['cfg']['Server']['user'],
57 $GLOBALS['sql_query']);
60 if ($GLOBALS['error_handler']->hasDisplayErrors()) {
62 $GLOBALS['error_handler']->dispErrors();
66 if (count($GLOBALS['footnotes'])) {
67 echo '<div class="notice">';
68 foreach ($GLOBALS['footnotes'] as $footnote) {
69 echo '<span id="footnote_' . $footnote['nr'] . '"><sup>'
70 . $footnote['nr'] . '</sup> ' . $footnote['note'] . '</span><br />';
75 if (! empty($_SESSION['debug'])) {
78 foreach ($_SESSION['debug']['queries'] as $query) {
79 $sum_time +
= $query['count'] * $query['time'];
80 $sum_exec +
= $query['count'];
84 echo count($_SESSION['debug']['queries']) . ' queries executed'
85 . $sum_exec . ' times in ' . $sum_time . ' seconds';
87 print_r($_SESSION['debug']);
90 $_SESSION['debug'] = array();
94 <script type
="text/javascript">
97 if (empty($GLOBALS['error_message'])) {
99 // updates current settings
100 if (window
.parent
.setAll
) {
101 window
.parent
.setAll('<?php
102 echo PMA_escapeJsString($GLOBALS['lang
']) . "', '";
103 echo PMA_escapeJsString($GLOBALS['collation_connection
']) . "', '";
104 echo PMA_escapeJsString($GLOBALS['server
']) . "', '";
105 echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db
'], '')) . "', '";
106 echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table
'], '')); ?>');
109 if (! empty($GLOBALS['reload'])) {
111 // refresh navigation frame content
112 if (window
.parent
.refreshNavigation
) {
113 window
.parent
.refreshNavigation();
118 // set current db, table and sql query in the querywindow
119 if (window
.parent
.reload_querywindow
) {
120 window
.parent
.reload_querywindow(
121 '<?php echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db
'], '')) ?>',
122 '<?php echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table
'], '')) ?>',
123 '<?php echo strlen($GLOBALS['sql_query
']) > $GLOBALS['cfg
']['MaxCharactersInDisplayedSQL
'] ? PMA_escapeJsString($GLOBALS['sql_query
']) : ''; ?>');
128 if (! empty($GLOBALS['focus_querywindow'])) {
130 // set focus to the querywindow
131 if (parent
.querywindow
&& !parent
.querywindow
.closed
&& parent
.querywindow
.location
) {
138 if (window
.parent
.frame_content
) {
139 // reset content frame name, as querywindow needs to set a unique name
140 // before submitting form data, and navigation frame needs the original name
141 if (typeof(window
.parent
.frame_content
.name
) != 'undefined'
142 && window
.parent
.frame_content
.name
!= 'frame_content') {
143 window
.parent
.frame_content
.name
= 'frame_content';
145 if (typeof(window
.parent
.frame_content
.id
) != 'undefined'
146 && window
.parent
.frame_content
.id
!= 'frame_content') {
147 window
.parent
.frame_content
.id
= 'frame_content';
149 //window.parent.frame_content.setAttribute('name', 'frame_content');
150 //window.parent.frame_content.setAttribute('id', 'frame_content');
156 // Link to itself to replicate windows including frameset
157 if (!isset($GLOBALS['checked_special'])) {
158 $GLOBALS['checked_special'] = false;
161 if (PMA_getenv('SCRIPT_NAME') && empty($_POST) && !$GLOBALS['checked_special']) {
162 echo '<div id="selflink" class="print_ignore">' . "\n";
163 $url_params['target'] = basename(PMA_getenv('SCRIPT_NAME'));
164 echo '<a href="index.php' . PMA_generate_common_url($url_params) . '"'
165 . ' title="' . $GLOBALS['strOpenNewWindow'] . '" target="_blank">';
167 echo '<a href="index.php?target=' . basename(PMA_getenv('SCRIPT_NAME'));
168 $url = PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']);
172 echo '" target="_blank">';
174 if ($GLOBALS['cfg']['NavigationBarIconic']) {
175 echo '<img class="icon" src="'. $GLOBALS['pmaThemeImage'] . 'window-new.png"'
176 . ' alt="' . $GLOBALS['strOpenNewWindow'] . '" />';
178 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
179 echo $GLOBALS['strOpenNewWindow'];
182 echo '</div>' . "\n";
185 // Include possible custom footers
186 if (file_exists('./config.footer.inc.php')) {
187 require './config.footer.inc.php';
192 * Generates profiling data if requested
195 // profiling deactivated due to licensing issues
196 if (! empty($GLOBALS['cfg']['DBG']['php'])
197 && ! empty($GLOBALS['cfg']['DBG']['profile']['enable'])) {
198 //run the basic setup code first
199 require_once './libraries/dbg/setup.php';
200 //if the setup ran fine, then do the profiling
202 if (! empty($GLOBALS['DBG'])) {
203 require_once './libraries/dbg/profiling.php';
204 dbg_dump_profiling_results();
214 * Stops the script execution