PageRenderTime 38ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/libraries/footer.inc.php

https://github.com/gerrywastaken/phpmyadmin-GitHubed
PHP | 221 lines | 123 code | 16 blank | 82 comment | 34 complexity | 38f4d2f80dfd24fbd4257c077835f355 MD5 | raw file
Possible License(s): GPL-2.0
  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: footer.inc.php 11403 2008-07-15 19:03:11Z lem9 $
  45. */
  46. if (! defined('PHPMYADMIN')) {
  47. exit;
  48. }
  49. /**
  50. * for PMA_setHistory()
  51. */
  52. require_once './libraries/relation.lib.php';
  53. if (! PMA_isValid($_REQUEST['no_history']) && empty($GLOBALS['error_message'])
  54. && ! empty($GLOBALS['sql_query'])) {
  55. PMA_setHistory(PMA_ifSetOr($GLOBALS['db'], ''),
  56. PMA_ifSetOr($GLOBALS['table'], ''),
  57. $GLOBALS['cfg']['Server']['user'],
  58. $GLOBALS['sql_query']);
  59. }
  60. if ($GLOBALS['error_handler']->hasDisplayErrors()) {
  61. echo '<div>';
  62. $GLOBALS['error_handler']->dispErrors();
  63. echo '</div>';
  64. }
  65. if (count($GLOBALS['footnotes'])) {
  66. echo '<div class="notice">';
  67. foreach ($GLOBALS['footnotes'] as $footnote) {
  68. echo '<span id="footnote_' . $footnote['nr'] . '"><sup>'
  69. . $footnote['nr'] . '</sup> ' . $footnote['note'] . '</span><br />';
  70. }
  71. echo '</div>';
  72. }
  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'];
  79. }
  80. echo '<div>';
  81. echo count($_SESSION['debug']['queries']) . ' queries executed'
  82. . $sum_exec . ' times in ' . $sum_time . ' seconds';
  83. echo '<pre>';
  84. print_r($_SESSION['debug']);
  85. echo '</pre>';
  86. echo '</div>';
  87. $_SESSION['debug'] = array();
  88. }
  89. ?>
  90. <script type="text/javascript">
  91. //<![CDATA[
  92. <?php
  93. if (empty($GLOBALS['error_message'])) {
  94. ?>
  95. // updates current settings
  96. if (window.parent.setAll) {
  97. window.parent.setAll('<?php
  98. echo PMA_escapeJsString($GLOBALS['lang']) . "', '";
  99. echo PMA_escapeJsString($GLOBALS['collation_connection']) . "', '";
  100. echo PMA_escapeJsString($GLOBALS['server']) . "', '";
  101. echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db'], '')) . "', '";
  102. echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table'], '')) . "', '";
  103. echo PMA_escapeJsString($_SESSION[' PMA_token ']);?>');
  104. }
  105. <?php
  106. if (! empty($GLOBALS['reload'])) {
  107. ?>
  108. // refresh navigation frame content
  109. if (window.parent.refreshNavigation) {
  110. window.parent.refreshNavigation();
  111. }
  112. <?php
  113. }
  114. ?>
  115. // set current db, table and sql query in the querywindow
  116. if (window.parent.reload_querywindow) {
  117. window.parent.reload_querywindow(
  118. '<?php echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db'], '')) ?>',
  119. '<?php echo PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table'], '')) ?>',
  120. '<?php echo strlen($GLOBALS['sql_query']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] ? PMA_escapeJsString($GLOBALS['sql_query']) : ''; ?>');
  121. }
  122. <?php
  123. }
  124. if (! empty($GLOBALS['focus_querywindow'])) {
  125. ?>
  126. // set focus to the querywindow
  127. if (parent.querywindow && !parent.querywindow.closed && parent.querywindow.location) {
  128. self.focus();
  129. }
  130. <?php
  131. }
  132. ?>
  133. if (window.parent.frame_content) {
  134. // reset content frame name, as querywindow needs to set a unique name
  135. // before submitting form data, and navigation frame needs the original name
  136. if (typeof(window.parent.frame_content.name) != 'undefined'
  137. && window.parent.frame_content.name != 'frame_content') {
  138. window.parent.frame_content.name = 'frame_content';
  139. }
  140. if (typeof(window.parent.frame_content.id) != 'undefined'
  141. && window.parent.frame_content.id != 'frame_content') {
  142. window.parent.frame_content.id = 'frame_content';
  143. }
  144. //window.parent.frame_content.setAttribute('name', 'frame_content');
  145. //window.parent.frame_content.setAttribute('id', 'frame_content');
  146. }
  147. //]]>
  148. </script>
  149. <?php
  150. // Link to itself to replicate windows including frameset
  151. if (!isset($GLOBALS['checked_special'])) {
  152. $GLOBALS['checked_special'] = false;
  153. }
  154. if (PMA_getenv('SCRIPT_NAME') && empty($_POST) && !$GLOBALS['checked_special']) {
  155. echo '<div id="selflink" class="print_ignore">' . "\n";
  156. $url_params['target'] = basename(PMA_getenv('SCRIPT_NAME'));
  157. echo '<a href="index.php' . PMA_generate_common_url($url_params) . '"'
  158. . ' title="' . $GLOBALS['strOpenNewWindow'] . '" target="_blank">';
  159. /*
  160. echo '<a href="index.php?target=' . basename(PMA_getenv('SCRIPT_NAME'));
  161. $url = PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']);
  162. if (!empty($url)) {
  163. echo '&amp;' . $url;
  164. }
  165. echo '" target="_blank">';
  166. */
  167. if ($GLOBALS['cfg']['NavigationBarIconic']) {
  168. echo '<img class="icon" src="'. $GLOBALS['pmaThemeImage'] . 'window-new.png"'
  169. . ' alt="' . $GLOBALS['strOpenNewWindow'] . '" />';
  170. }
  171. if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
  172. echo $GLOBALS['strOpenNewWindow'];
  173. }
  174. echo '</a>' . "\n";
  175. echo '</div>' . "\n";
  176. }
  177. // Include possible custom footers
  178. if (file_exists('./config.footer.inc.php')) {
  179. require './config.footer.inc.php';
  180. }
  181. /**
  182. * Generates profiling data if requested
  183. */
  184. // profiling deactivated due to licensing issues
  185. if (! empty($GLOBALS['cfg']['DBG']['php'])
  186. && ! empty($GLOBALS['cfg']['DBG']['profile']['enable'])) {
  187. //run the basic setup code first
  188. require_once './libraries/dbg/setup.php';
  189. //if the setup ran fine, then do the profiling
  190. /*
  191. if (! empty($GLOBALS['DBG'])) {
  192. require_once './libraries/dbg/profiling.php';
  193. dbg_dump_profiling_results();
  194. }
  195. */
  196. }
  197. ?>
  198. </body>
  199. </html>
  200. <?php
  201. /**
  202. * Stops the script execution
  203. */
  204. exit;
  205. ?>