fixed: bugID = 3112614
[phpmyadmin/adnan.git] / libraries / footer.inc.php
blobf5e6e9872557dcc590eaf612c5fbd8c1a10bc2cd
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * finishes HTML output
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']
33 * @uses PMA_isValid()
34 * @uses PMA_setHistory()
35 * @uses PMA_ifSetOr()
36 * @uses PMA_escapeJsString()
37 * @uses PMA_getenv()
38 * @uses PMA_generate_common_url()
39 * @uses basename()
40 * @uses file_exists()
41 * @package phpMyAdmin
43 if (! defined('PHPMYADMIN')) {
44 exit;
47 /**
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()) {
59 echo '<div>';
60 $GLOBALS['error_handler']->dispErrors();
61 echo '</div>';
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 />';
70 echo '</div>';
73 if (! empty($_SESSION['debug'])) {
74 $sum_time = 0;
75 $sum_exec = 0;
76 foreach ($_SESSION['debug']['queries'] as $query) {
77 $sum_time += $query['count'] * $query['time'];
78 $sum_exec += $query['count'];
81 echo '<div>';
82 echo count($_SESSION['debug']['queries']) . ' queries executed'
83 . $sum_exec . ' times in ' . $sum_time . ' seconds';
84 echo '<pre>';
85 print_r($_SESSION['debug']);
86 echo '</pre>';
87 echo '</div>';
88 $_SESSION['debug'] = array();
92 <script type="text/javascript">
93 //<![CDATA[
94 <?php
95 if (empty($GLOBALS['error_message'])) {
97 $(document).ready(function(){
98 // updates current settings
99 if (window.parent.setAll) {
100 window.parent.setAll('<?php
101 echo PMA_escapeJsString($GLOBALS['lang']) . "', '";
102 echo PMA_escapeJsString($GLOBALS['collation_connection']) . "', '";
103 echo PMA_escapeJsString($GLOBALS['server']) . "', '";
104 echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db'], '')) . "', '";
105 echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table'], '')) . "', '";
106 echo PMA_escapeJsString($_SESSION[' PMA_token ']);?>');
108 <?php
109 if (! empty($GLOBALS['reload'])) {
111 // refresh navigation frame content
112 if (window.parent.refreshNavigation) {
113 window.parent.refreshNavigation();
115 <?php
116 } else if (isset($_GET['reload_left_frame']) && $_GET['reload_left_frame'] == '1') {
117 // reload left frame (used by user preferences)
119 if (window.parent && window.parent.frame_navigation) {
120 window.parent.frame_navigation.location.reload();
122 <?php
126 // set current db, table and sql query in the querywindow
127 if (window.parent.reload_querywindow) {
128 window.parent.reload_querywindow(
129 '<?php echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db'], '')) ?>',
130 '<?php echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table'], '')) ?>',
131 '<?php echo strlen($GLOBALS['sql_query']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] ? PMA_escapeJsString($GLOBALS['sql_query']) : ''; ?>');
133 <?php
136 if (! empty($GLOBALS['focus_querywindow'])) {
138 // set focus to the querywindow
139 if (parent.querywindow && !parent.querywindow.closed && parent.querywindow.location) {
140 self.focus();
142 <?php
146 if (window.parent.frame_content) {
147 // reset content frame name, as querywindow needs to set a unique name
148 // before submitting form data, and navigation frame needs the original name
149 if (typeof(window.parent.frame_content.name) != 'undefined'
150 && window.parent.frame_content.name != 'frame_content') {
151 window.parent.frame_content.name = 'frame_content';
153 if (typeof(window.parent.frame_content.id) != 'undefined'
154 && window.parent.frame_content.id != 'frame_content') {
155 window.parent.frame_content.id = 'frame_content';
157 //window.parent.frame_content.setAttribute('name', 'frame_content');
158 //window.parent.frame_content.setAttribute('id', 'frame_content');
162 //]]>
163 </script>
164 <?php
166 // Link to itself to replicate windows including frameset
167 if (!isset($GLOBALS['checked_special'])) {
168 $GLOBALS['checked_special'] = false;
171 if (PMA_getenv('SCRIPT_NAME') && empty($_POST) && !$GLOBALS['checked_special']) {
172 echo '<div id="selflink" class="print_ignore">' . "\n";
173 $url_params['target'] = basename(PMA_getenv('SCRIPT_NAME'));
175 <script type="text/javascript">
176 //<![CDATA[
178 /* Store current location in hash part of URL to allow direct bookmarking */
179 setURLHash("<?php echo PMA_generate_common_url($url_params, 'text', ''); ?>");
181 //]]>
182 </script>
183 <?php
185 echo '<a href="index.php' . PMA_generate_common_url($url_params) . '"'
186 . ' title="' . __('Open new phpMyAdmin window') . '" target="_blank">';
187 if ($GLOBALS['cfg']['NavigationBarIconic']) {
188 echo '<img class="icon" src="'. $GLOBALS['pmaThemeImage'] . 'window-new.png"'
189 . ' alt="' . __('Open new phpMyAdmin window') . '" />';
191 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
192 echo __('Open new phpMyAdmin window');
194 echo '</a>' . "\n";
195 echo '</div>' . "\n";
198 // Include possible custom footers
199 if (! $GLOBALS['is_ajax_request'] && file_exists(CUSTOM_FOOTER_FILE)) {
200 require CUSTOM_FOOTER_FILE;
204 * If we are in an AJAX request, we do not need to generate the closing tags for
205 * body and html.
207 if (! $GLOBALS['is_ajax_request']) {
209 </body>
210 </html>
211 <?php
214 * Stops the script execution
216 exit;