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['MaxCharactersInDisplayedSQL']
34 * @uses PMA_setHistory()
36 * @uses PMA_escapeJsString()
38 * @uses PMA_generate_common_url()
43 if (! defined('PHPMYADMIN')) {
48 * for PMA_setHistory()
50 if (! PMA_isValid($_REQUEST['no_history']) && empty($GLOBALS['error_message'])
51 && ! empty($GLOBALS['sql_query'])) {
52 PMA_setHistory(PMA_ifSetOr($GLOBALS['db'], ''),
53 PMA_ifSetOr($GLOBALS['table'], ''),
54 $GLOBALS['cfg']['Server']['user'],
55 $GLOBALS['sql_query']);
58 if ($GLOBALS['error_handler']->hasDisplayErrors()) {
60 $GLOBALS['error_handler']->dispErrors();
64 if (count($GLOBALS['footnotes'])) {
65 echo '<div class="footnotes">';
66 foreach ($GLOBALS['footnotes'] as $footnote) {
67 echo '<span id="footnote_' . $footnote['nr'] . '"><sup>'
68 . $footnote['nr'] . '</sup> ' . $footnote['note'] . '</span><br />';
73 if (! empty($_SESSION['debug'])) {
76 foreach ($_SESSION['debug']['queries'] as $query) {
77 $sum_time +
= $query['count'] * $query['time'];
78 $sum_exec +
= $query['count'];
82 echo count($_SESSION['debug']['queries']) . ' queries executed '
83 . $sum_exec . ' times in ' . $sum_time . ' seconds';
85 print_r($_SESSION['debug']);
88 $_SESSION['debug'] = array();
91 if (!$GLOBALS['is_ajax_request']) {
93 <script type
="text/javascript">
96 if (empty($GLOBALS['error_message'])) {
98 $
(document
).ready(function(){
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
'], '')) . "', '";
107 echo PMA_escapeJsString($_SESSION[' PMA_token
']);?>');
110 if (! empty($GLOBALS['reload'])) {
112 // refresh navigation frame content
113 if (window
.parent
.refreshNavigation
) {
114 window
.parent
.refreshNavigation();
117 } else if (isset($_GET['reload_left_frame']) && $_GET['reload_left_frame'] == '1') {
118 // reload left frame (used by user preferences)
120 if (window
.parent
&& window
.parent
.frame_navigation
) {
121 window
.parent
.frame_navigation
.location
.reload();
127 // set current db, table and sql query in the querywindow
128 if (window
.parent
.reload_querywindow
) {
129 window
.parent
.reload_querywindow(
130 '<?php echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db
'], '')) ?>',
131 '<?php echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table
'], '')) ?>',
132 '<?php echo strlen($GLOBALS['sql_query
']) > $GLOBALS['cfg
']['MaxCharactersInDisplayedSQL
'] ? PMA_escapeJsString($GLOBALS['sql_query
']) : ''; ?>');
137 if (! empty($GLOBALS['focus_querywindow'])) {
139 // set focus to the querywindow
140 if (parent
.querywindow
&& !parent
.querywindow
.closed
&& parent
.querywindow
.location
) {
147 if (window
.parent
.frame_content
) {
148 // reset content frame name, as querywindow needs to set a unique name
149 // before submitting form data, and navigation frame needs the original name
150 if (typeof(window
.parent
.frame_content
.name
) != 'undefined'
151 && window
.parent
.frame_content
.name
!= 'frame_content') {
152 window
.parent
.frame_content
.name
= 'frame_content';
154 if (typeof(window
.parent
.frame_content
.id
) != 'undefined'
155 && window
.parent
.frame_content
.id
!= 'frame_content') {
156 window
.parent
.frame_content
.id
= 'frame_content';
158 //window.parent.frame_content.setAttribute('name', 'frame_content');
159 //window.parent.frame_content.setAttribute('id', 'frame_content');
168 // Link to itself to replicate windows including frameset
169 if (!isset($GLOBALS['checked_special'])) {
170 $GLOBALS['checked_special'] = false;
173 if (PMA_getenv('SCRIPT_NAME') && empty($_POST) && !$GLOBALS['checked_special'] && ! $GLOBALS['is_ajax_request']) {
174 echo '<div id="selflink" class="print_ignore">' . "\n";
175 $url_params['target'] = basename(PMA_getenv('SCRIPT_NAME'));
177 <script type
="text/javascript">
180 /* Store current location in hash part of URL to allow direct bookmarking */
181 setURLHash("<?php echo PMA_generate_common_url($url_params, 'text', ''); ?>");
187 echo '<a href="index.php' . PMA_generate_common_url($url_params) . '"'
188 . ' title="' . __('Open new phpMyAdmin window') . '" target="_blank">';
189 if ($GLOBALS['cfg']['NavigationBarIconic']) {
190 echo '<img class="icon" src="'. $GLOBALS['pmaThemeImage'] . 'window-new.png"'
191 . ' alt="' . __('Open new phpMyAdmin window') . '" />';
193 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
194 echo __('Open new phpMyAdmin window');
197 echo '</div>' . "\n";
200 // Include possible custom footers
201 if (! $GLOBALS['is_ajax_request'] && file_exists(CUSTOM_FOOTER_FILE
)) {
202 require CUSTOM_FOOTER_FILE
;
206 * If we are in an AJAX request, we do not need to generate the closing tags for
209 if (! $GLOBALS['is_ajax_request']) {
216 * Stops the script execution