This should be checked in common, not in dbi library
[phpmyadmin.git] / libraries / footer.inc.php
blobaa1af7a5d8f26d68c3c0bf6416cb4929a9cd9069
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 * @package phpMyAdmin
18 if (! defined('PHPMYADMIN')) {
19 exit;
22 /**
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()) {
34 echo '<div>';
35 $GLOBALS['error_handler']->dispErrors();
36 echo '</div>';
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 />';
45 echo '</div>';
48 if (! empty($_SESSION['debug'])) {
49 $sum_time = 0;
50 $sum_exec = 0;
51 foreach ($_SESSION['debug']['queries'] as $query) {
52 $sum_time += $query['count'] * $query['time'];
53 $sum_exec += $query['count'];
56 echo '<div>';
57 echo count($_SESSION['debug']['queries']) . ' queries executed '
58 . $sum_exec . ' times in ' . $sum_time . ' seconds';
59 echo '<pre>';
60 print_r($_SESSION['debug']);
61 echo '</pre>';
62 echo '</div>';
63 $_SESSION['debug'] = array();
66 if (!$GLOBALS['is_ajax_request']) {
68 <script type="text/javascript">
69 //<![CDATA[
70 <?php
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 ']);?>');
84 <?php
85 if (! empty($GLOBALS['reload'])) {
87 // refresh navigation frame content
88 if (window.parent.refreshNavigation) {
89 window.parent.refreshNavigation();
91 <?php
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();
98 <?php
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']) : ''; ?>');
109 <?php
112 if (! empty($GLOBALS['focus_querywindow'])) {
114 // set focus to the querywindow
115 if (parent.querywindow && !parent.querywindow.closed && parent.querywindow.location) {
116 self.focus();
118 <?php
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');
138 //]]>
139 </script>
140 <?php
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">
153 //<![CDATA[
155 /* Store current location in hash part of URL to allow direct bookmarking */
156 setURLHash("<?php echo PMA_generate_common_url($url_params, 'text', ''); ?>");
158 //]]>
159 </script>
160 <?php
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');
171 echo '</a>' . "\n";
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
182 * body and html.
184 if (! $GLOBALS['is_ajax_request']) {
186 </body>
187 </html>
188 <?php
191 * Stops the script execution
193 exit;