/pma/libraries/footer.inc.php
PHP | 222 lines | 123 code | 16 blank | 83 comment | 34 complexity | 3f4a94dbda261ee44c468c364629ad7c MD5 | raw file
1<?php 2/* vim: set expandtab sw=4 ts=4 sts=4: */ 3/** 4 * finishes HTML output 5 * 6 * updates javascript variables in index.php for correct working with querywindow 7 * and navigation frame refreshing 8 * 9 * send buffered data if buffered 10 * 11 * WARNING: This script has to be included at the very end of your code because 12 * it will stop the script execution! 13 * 14 * always use $GLOBALS, as this script is also included by functions 15 * 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'] 36 * @uses PMA_isValid() 37 * @uses PMA_setHistory() 38 * @uses PMA_ifSetOr() 39 * @uses PMA_escapeJsString() 40 * @uses PMA_getenv() 41 * @uses PMA_generate_common_url() 42 * @uses basename() 43 * @uses file_exists() 44 * @version $Id$ 45 * @package phpMyAdmin 46 */ 47if (! defined('PHPMYADMIN')) { 48 exit; 49} 50 51/** 52 * for PMA_setHistory() 53 */ 54require_once './libraries/relation.lib.php'; 55 56if (! 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']); 62} 63 64if ($GLOBALS['error_handler']->hasDisplayErrors()) { 65 echo '<div>'; 66 $GLOBALS['error_handler']->dispErrors(); 67 echo '</div>'; 68} 69 70if (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 />'; 75 } 76 echo '</div>'; 77} 78 79if (! empty($_SESSION['debug'])) { 80 $sum_time = 0; 81 $sum_exec = 0; 82 foreach ($_SESSION['debug']['queries'] as $query) { 83 $sum_time += $query['count'] * $query['time']; 84 $sum_exec += $query['count']; 85 } 86 87 echo '<div>'; 88 echo count($_SESSION['debug']['queries']) . ' queries executed' 89 . $sum_exec . ' times in ' . $sum_time . ' seconds'; 90 echo '<pre>'; 91 print_r($_SESSION['debug']); 92 echo '</pre>'; 93 echo '</div>'; 94 $_SESSION['debug'] = array(); 95} 96 97?> 98<script type="text/javascript"> 99//<![CDATA[ 100<?php 101if (empty($GLOBALS['error_message'])) { 102 ?> 103// updates current settings 104if (window.parent.setAll) { 105 window.parent.setAll('<?php 106 echo PMA_escapeJsString($GLOBALS['lang']) . "', '"; 107 echo PMA_escapeJsString($GLOBALS['collation_connection']) . "', '"; 108 echo PMA_escapeJsString($GLOBALS['server']) . "', '"; 109 echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db'], '')) . "', '"; 110 echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table'], '')) . "', '"; 111 echo PMA_escapeJsString($_SESSION[' PMA_token ']);?>'); 112} 113 <?php 114 if (! empty($GLOBALS['reload'])) { 115 ?> 116// refresh navigation frame content 117if (window.parent.refreshNavigation) { 118 window.parent.refreshNavigation(); 119} 120 <?php 121 } 122 ?> 123// set current db, table and sql query in the querywindow 124if (window.parent.reload_querywindow) { 125 window.parent.reload_querywindow( 126 '<?php echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db'], '')) ?>', 127 '<?php echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table'], '')) ?>', 128 '<?php echo strlen($GLOBALS['sql_query']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] ? PMA_escapeJsString($GLOBALS['sql_query']) : ''; ?>'); 129} 130 <?php 131} 132 133if (! empty($GLOBALS['focus_querywindow'])) { 134 ?> 135// set focus to the querywindow 136if (parent.querywindow && !parent.querywindow.closed && parent.querywindow.location) { 137 self.focus(); 138} 139 <?php 140} 141?> 142 143if (window.parent.frame_content) { 144 // reset content frame name, as querywindow needs to set a unique name 145 // before submitting form data, and navigation frame needs the original name 146 if (typeof(window.parent.frame_content.name) != 'undefined' 147 && window.parent.frame_content.name != 'frame_content') { 148 window.parent.frame_content.name = 'frame_content'; 149 } 150 if (typeof(window.parent.frame_content.id) != 'undefined' 151 && window.parent.frame_content.id != 'frame_content') { 152 window.parent.frame_content.id = 'frame_content'; 153 } 154 //window.parent.frame_content.setAttribute('name', 'frame_content'); 155 //window.parent.frame_content.setAttribute('id', 'frame_content'); 156} 157//]]> 158</script> 159<?php 160 161// Link to itself to replicate windows including frameset 162if (!isset($GLOBALS['checked_special'])) { 163 $GLOBALS['checked_special'] = false; 164} 165 166if (PMA_getenv('SCRIPT_NAME') && empty($_POST) && !$GLOBALS['checked_special']) { 167 echo '<div id="selflink" class="print_ignore">' . "\n"; 168 $url_params['target'] = basename(PMA_getenv('SCRIPT_NAME')); 169 echo '<a href="index.php' . PMA_generate_common_url($url_params) . '"' 170 . ' title="' . $GLOBALS['strOpenNewWindow'] . '" target="_blank">'; 171 /* 172 echo '<a href="index.php?target=' . basename(PMA_getenv('SCRIPT_NAME')); 173 $url = PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']); 174 if (!empty($url)) { 175 echo '&' . $url; 176 } 177 echo '" target="_blank">'; 178 */ 179 if ($GLOBALS['cfg']['NavigationBarIconic']) { 180 echo '<img class="icon" src="'. $GLOBALS['pmaThemeImage'] . 'window-new.png"' 181 . ' alt="' . $GLOBALS['strOpenNewWindow'] . '" />'; 182 } 183 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) { 184 echo $GLOBALS['strOpenNewWindow']; 185 } 186 echo '</a>' . "\n"; 187 echo '</div>' . "\n"; 188} 189 190// Include possible custom footers 191if (file_exists('./config.footer.inc.php')) { 192 require './config.footer.inc.php'; 193} 194 195 196/** 197 * Generates profiling data if requested 198 */ 199 200// profiling deactivated due to licensing issues 201if (! empty($GLOBALS['cfg']['DBG']['php']) 202 && ! empty($GLOBALS['cfg']['DBG']['profile']['enable'])) { 203 //run the basic setup code first 204 require_once './libraries/dbg/setup.php'; 205 //if the setup ran fine, then do the profiling 206 /* 207 if (! empty($GLOBALS['DBG'])) { 208 require_once './libraries/dbg/profiling.php'; 209 dbg_dump_profiling_results(); 210 } 211 */ 212} 213 214?> 215</body> 216</html> 217<?php 218/** 219 * Stops the script execution 220 */ 221exit; 222?>