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
18 if (! defined('PHPMYADMIN')) {
23 * for PMA_setHistory()
25 if (! PMA_isValid($_REQUEST['no_history']) && empty($GLOBALS['error_message'])
26 && ! empty($GLOBALS['sql_query'])) {
27 PMA_setHistory(PMA_ifSetOr($GLOBALS['db'], ''),
28 PMA_ifSetOr($GLOBALS['table'], ''),
29 $GLOBALS['cfg']['Server']['user'],
30 $GLOBALS['sql_query']);
33 if ($GLOBALS['error_handler']->hasDisplayErrors()) {
35 $GLOBALS['error_handler']->dispErrors();
39 if (count($GLOBALS['footnotes'])) {
40 echo '<div class="footnotes">';
41 foreach ($GLOBALS['footnotes'] as $footnote) {
42 echo '<span id="footnote_' . $footnote['nr'] . '"><sup>'
43 . $footnote['nr'] . '</sup> ' . $footnote['note'] . '</span><br />';
48 if (! empty($_SESSION['debug'])) {
51 foreach ($_SESSION['debug']['queries'] as $query) {
52 $sum_time +
= $query['count'] * $query['time'];
53 $sum_exec +
= $query['count'];
57 echo count($_SESSION['debug']['queries']) . ' queries executed '
58 . $sum_exec . ' times in ' . $sum_time . ' seconds';
60 print_r($_SESSION['debug']);
63 $_SESSION['debug'] = array();
66 if (!$GLOBALS['is_ajax_request']) {
68 <script type
="text/javascript">
71 if (empty($GLOBALS['error_message'])) {
73 $
(document
).ready(function() {
74 // updates current settings
75 if (window
.parent
.setAll
) {
76 window
.parent
.setAll('<?php
77 echo PMA_escapeJsString($GLOBALS['lang
']) . "', '";
78 echo PMA_escapeJsString($GLOBALS['collation_connection
']) . "', '";
79 echo PMA_escapeJsString($GLOBALS['server
']) . "', '";
80 echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db
'], '')) . "', '";
81 echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table
'], '')) . "', '";
82 echo PMA_escapeJsString($_SESSION[' PMA_token
']);?>');
85 if (! empty($GLOBALS['reload'])) {
87 // refresh navigation frame content
88 if (window
.parent
.refreshNavigation
) {
89 window
.parent
.refreshNavigation();
92 } else if (isset($_GET['reload_left_frame']) && $_GET['reload_left_frame'] == '1') {
93 // reload left frame (used by user preferences)
95 if (window
.parent
&& window
.parent
.frame_navigation
) {
96 window
.parent
.frame_navigation
.location
.reload();
102 // set current db, table and sql query in the querywindow
103 if (window
.parent
.reload_querywindow
) {
104 window
.parent
.reload_querywindow(
105 '<?php echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db
'], '')) ?>',
106 '<?php echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table
'], '')) ?>',
107 '<?php echo strlen($GLOBALS['sql_query
']) > $GLOBALS['cfg
']['MaxCharactersInDisplayedSQL
'] ? PMA_escapeJsString($GLOBALS['sql_query
']) : ''; ?>');
112 if (! empty($GLOBALS['focus_querywindow'])) {
114 // set focus to the querywindow
115 if (parent
.querywindow
&& !parent
.querywindow
.closed
&& parent
.querywindow
.location
) {
122 if (window
.parent
.frame_content
) {
123 // reset content frame name, as querywindow needs to set a unique name
124 // before submitting form data, and navigation frame needs the original name
125 if (typeof(window
.parent
.frame_content
.name
) != 'undefined'
126 && window
.parent
.frame_content
.name
!= 'frame_content') {
127 window
.parent
.frame_content
.name
= 'frame_content';
129 if (typeof(window
.parent
.frame_content
.id
) != 'undefined'
130 && window
.parent
.frame_content
.id
!= 'frame_content') {
131 window
.parent
.frame_content
.id
= 'frame_content';
133 //window.parent.frame_content.setAttribute('name', 'frame_content');
134 //window.parent.frame_content.setAttribute('id', 'frame_content');
143 // Link to itself to replicate windows including frameset
144 if (! isset($GLOBALS['checked_special'])) {
145 $GLOBALS['checked_special'] = false;
148 if (PMA_getenv('SCRIPT_NAME') && empty($_POST) && !$GLOBALS['checked_special'] && ! $GLOBALS['is_ajax_request']) {
149 echo '<div id="selflink" class="print_ignore">' . "\n";
150 $url_params['target'] = basename(PMA_getenv('SCRIPT_NAME'));
152 <script type
="text/javascript">
155 /* Store current location in hash part of URL to allow direct bookmarking */
156 setURLHash("<?php echo PMA_generate_common_url($url_params, 'text', ''); ?>");
162 echo '<a href="index.php' . PMA_generate_common_url($url_params) . '"'
163 . ' title="' . __('Open new phpMyAdmin window') . '" target="_blank">';
164 if ($GLOBALS['cfg']['NavigationBarIconic']) {
165 echo '<img class="icon ic_window-new" src="themes/dot.gif"'
166 . ' alt="' . __('Open new phpMyAdmin window') . '" />';
168 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
169 echo __('Open new phpMyAdmin window');
172 echo '</div>' . "\n";
175 // Include possible custom footers
176 if (! $GLOBALS['is_ajax_request'] && file_exists(CUSTOM_FOOTER_FILE
)) {
177 require CUSTOM_FOOTER_FILE
;
181 * If we are in an AJAX request, we do not need to generate the closing tags for
184 if (! $GLOBALS['is_ajax_request']) {
191 * Stops the script execution