PageRenderTime 24ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/pma/libraries/footer.inc.php

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