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()
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']);
64 if ($GLOBALS['error_handler']->hasDisplayErrors()) {
66 $GLOBALS['error_handler']->dispErrors();
70 if (count($GLOBALS['footnotes'])) {
71 echo '<div class="notice">';
72 foreach ($GLOBALS['footnotes'] as $footnote) {
73 echo '<span id="footnote_' . $footnote['nr'] . '"><sup>'
74 . $footnote['nr'] . '</sup> ' . $footnote['note'] . '</span><br />';
79 if (! empty($_SESSION['debug'])) {
82 foreach ($_SESSION['debug']['queries'] as $query) {
83 $sum_time +
= $query['count'] * $query['time'];
84 $sum_exec +
= $query['count'];
88 echo count($_SESSION['debug']['queries']) . ' queries executed'
89 . $sum_exec . ' times in ' . $sum_time . ' seconds';
91 print_r($_SESSION['debug']);
94 $_SESSION['debug'] = array();
98 <script type
="text/javascript">
101 if (empty($GLOBALS['error_message'])) {
103 $
(document
).ready(function(){
104 // updates current settings
105 if (window
.parent
.setAll
) {
106 window
.parent
.setAll('<?php
107 echo PMA_escapeJsString($GLOBALS['lang
']) . "', '";
108 echo PMA_escapeJsString($GLOBALS['collation_connection
']) . "', '";
109 echo PMA_escapeJsString($GLOBALS['server
']) . "', '";
110 echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db
'], '')) . "', '";
111 echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table
'], '')) . "', '";
112 echo PMA_escapeJsString($_SESSION[' PMA_token
']);?>');
115 if (! empty($GLOBALS['reload'])) {
117 // refresh navigation frame content
118 if (window
.parent
.refreshNavigation
) {
119 window
.parent
.refreshNavigation();
124 // set current db, table and sql query in the querywindow
125 if (window
.parent
.reload_querywindow
) {
126 window
.parent
.reload_querywindow(
127 '<?php echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db
'], '')) ?>',
128 '<?php echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table
'], '')) ?>',
129 '<?php echo strlen($GLOBALS['sql_query
']) > $GLOBALS['cfg
']['MaxCharactersInDisplayedSQL
'] ? PMA_escapeJsString($GLOBALS['sql_query
']) : ''; ?>');
134 if (! empty($GLOBALS['focus_querywindow'])) {
136 // set focus to the querywindow
137 if (parent
.querywindow
&& !parent
.querywindow
.closed
&& parent
.querywindow
.location
) {
144 if (window
.parent
.frame_content
) {
145 // reset content frame name, as querywindow needs to set a unique name
146 // before submitting form data, and navigation frame needs the original name
147 if (typeof(window
.parent
.frame_content
.name
) != 'undefined'
148 && window
.parent
.frame_content
.name
!= 'frame_content') {
149 window
.parent
.frame_content
.name
= 'frame_content';
151 if (typeof(window
.parent
.frame_content
.id
) != 'undefined'
152 && window
.parent
.frame_content
.id
!= 'frame_content') {
153 window
.parent
.frame_content
.id
= 'frame_content';
155 //window.parent.frame_content.setAttribute('name', 'frame_content');
156 //window.parent.frame_content.setAttribute('id', 'frame_content');
164 // Link to itself to replicate windows including frameset
165 if (!isset($GLOBALS['checked_special'])) {
166 $GLOBALS['checked_special'] = false;
169 if (PMA_getenv('SCRIPT_NAME') && empty($_POST) && !$GLOBALS['checked_special']) {
170 echo '<div id="selflink" class="print_ignore">' . "\n";
171 $url_params['target'] = basename(PMA_getenv('SCRIPT_NAME'));
173 <script type
="text/javascript">
176 /* Store current location in hash part of URL to allow direct bookmarking */
177 setURLHash("<?php echo PMA_generate_common_url($url_params, 'text', ''); ?>");
183 echo '<a href="index.php' . PMA_generate_common_url($url_params) . '"'
184 . ' title="' . $GLOBALS['strOpenNewWindow'] . '" target="_blank">';
186 echo '<a href="index.php?target=' . basename(PMA_getenv('SCRIPT_NAME'));
187 $url = PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']);
191 echo '" target="_blank">';
193 if ($GLOBALS['cfg']['NavigationBarIconic']) {
194 echo '<img class="icon" src="'. $GLOBALS['pmaThemeImage'] . 'window-new.png"'
195 . ' alt="' . $GLOBALS['strOpenNewWindow'] . '" />';
197 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
198 echo $GLOBALS['strOpenNewWindow'];
201 echo '</div>' . "\n";
204 // Include possible custom footers
205 if (file_exists(CUSTOM_FOOTER_FILE
)) {
206 require CUSTOM_FOOTER_FILE
;
211 * Generates profiling data if requested
214 // profiling deactivated due to licensing issues
215 if (! empty($GLOBALS['cfg']['DBG']['php'])
216 && ! empty($GLOBALS['cfg']['DBG']['profile']['enable'])) {
217 //run the basic setup code first
218 require_once './libraries/dbg/setup.php';
219 //if the setup ran fine, then do the profiling
221 if (! empty($GLOBALS['DBG'])) {
222 require_once './libraries/dbg/profiling.php';
223 dbg_dump_profiling_results();
233 * Stops the script execution