2 /* vim: set expandtab sw=4 ts=4 sts=4: */
6 * updates javascript variables in index.php for correct 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()
46 if (! defined('PHPMYADMIN')) {
51 * for PMA_setHistory()
53 require_once './libraries/relation.lib.php';
55 if (! PMA_isValid($_REQUEST['no_history']) && empty($GLOBALS['error_message'])
56 && ! empty($GLOBALS['sql_query'])) {
57 PMA_setHistory(PMA_ifSetOr($GLOBALS['db'], ''),
58 PMA_ifSetOr($GLOBALS['table'], ''),
59 $GLOBALS['cfg']['Server']['user'],
60 $GLOBALS['sql_query']);
63 if ($GLOBALS['error_handler']->hasDisplayErrors()) {
65 $GLOBALS['error_handler']->dispErrors();
69 if (count($GLOBALS['footnotes'])) {
70 echo '<div class="notice">';
71 foreach ($GLOBALS['footnotes'] as $footnote) {
72 echo '<span id="footnote_' . $footnote['nr'] . '"><sup>'
73 . $footnote['nr'] . '</sup> ' . $footnote['note'] . '</span><br />';
78 if (! empty($_SESSION['debug'])) {
81 foreach ($_SESSION['debug']['queries'] as $query) {
82 $sum_time +
= $query['count'] * $query['time'];
83 $sum_exec +
= $query['count'];
87 echo count($_SESSION['debug']['queries']) . ' queries executed'
88 . $sum_exec . ' times in ' . $sum_time . ' seconds';
90 print_r($_SESSION['debug']);
93 $_SESSION['debug'] = array();
97 <script type
="text/javascript">
100 if (empty($GLOBALS['error_message'])) {
102 // updates current settings
103 if (window
.parent
.setAll
) {
104 window
.parent
.setAll('<?php
105 echo PMA_escapeJsString($GLOBALS['lang
']) . "', '";
106 echo PMA_escapeJsString($GLOBALS['collation_connection
']) . "', '";
107 echo PMA_escapeJsString($GLOBALS['server
']) . "', '";
108 echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db
'], '')) . "', '";
109 echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table
'], '')); ?>');
112 if (! empty($GLOBALS['reload'])) {
114 // refresh navigation frame content
115 if (window
.parent
.refreshNavigation
) {
116 window
.parent
.refreshNavigation();
121 // set current db, table and sql query in the querywindow
122 if (window
.parent
.reload_querywindow
) {
123 window
.parent
.reload_querywindow(
124 '<?php echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db
'], '')) ?>',
125 '<?php echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table
'], '')) ?>',
126 '<?php echo strlen($GLOBALS['sql_query
']) > $GLOBALS['cfg
']['MaxCharactersInDisplayedSQL
'] ? PMA_escapeJsString($GLOBALS['sql_query
']) : ''; ?>');
131 if (! empty($GLOBALS['focus_querywindow'])) {
133 // set focus to the querywindow
134 if (parent
.querywindow
&& !parent
.querywindow
.closed
&& parent
.querywindow
.location
) {
141 if (window
.parent
.frame_content
) {
142 // reset content frame name, as querywindow needs to set a unique name
143 // before submitting form data, and navigation frame needs the original name
144 if (typeof(window
.parent
.frame_content
.name
) != 'undefined'
145 && window
.parent
.frame_content
.name
!= 'frame_content') {
146 window
.parent
.frame_content
.name
= 'frame_content';
148 if (typeof(window
.parent
.frame_content
.id
) != 'undefined'
149 && window
.parent
.frame_content
.id
!= 'frame_content') {
150 window
.parent
.frame_content
.id
= 'frame_content';
152 //window.parent.frame_content.setAttribute('name', 'frame_content');
153 //window.parent.frame_content.setAttribute('id', 'frame_content');
159 // Link to itself to replicate windows including frameset
160 if (!isset($GLOBALS['checked_special'])) {
161 $GLOBALS['checked_special'] = false;
164 if (PMA_getenv('SCRIPT_NAME') && empty($_POST) && !$GLOBALS['checked_special']) {
165 echo '<div id="selflink" class="print_ignore">' . "\n";
166 $url_params['target'] = basename(PMA_getenv('SCRIPT_NAME'));
167 echo '<a href="index.php' . PMA_generate_common_url($url_params) . '"'
168 . ' title="' . $GLOBALS['strOpenNewWindow'] . '" target="_blank">';
170 echo '<a href="index.php?target=' . basename(PMA_getenv('SCRIPT_NAME'));
171 $url = PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']);
175 echo '" target="_blank">';
177 if ($GLOBALS['cfg']['NavigationBarIconic']) {
178 echo '<img class="icon" src="'. $GLOBALS['pmaThemeImage'] . 'window-new.png"'
179 . ' alt="' . $GLOBALS['strOpenNewWindow'] . '" />';
181 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
182 echo $GLOBALS['strOpenNewWindow'];
185 echo '</div>' . "\n";
188 // Include possible custom footers
189 if (file_exists('./config.footer.inc.php')) {
190 require './config.footer.inc.php';
195 * Generates profiling data if requested
198 // profiling deactivated due to licensing issues
199 if (! empty($GLOBALS['cfg']['DBG']['php'])
200 && ! empty($GLOBALS['cfg']['DBG']['profile']['enable'])) {
201 //run the basic setup code first
202 require_once './libraries/dbg/setup.php';
203 //if the setup ran fine, then do the profiling
205 if (! empty($GLOBALS['DBG'])) {
206 require_once './libraries/dbg/profiling.php';
207 dbg_dump_profiling_results();
217 * Stops the script execution