PageRenderTime 48ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/admin/phpMyAdmin_old/footer.inc.php

https://bitbucket.org/steve_delbar/iepsm-projet-de-d-veloppement-internet-2013
PHP | 182 lines | 131 code | 22 blank | 29 comment | 73 complexity | 7f44ee87dd09dfd5551e1b493eb2f3ea MD5 | raw file
  1. <?php
  2. /* $Id: footer.inc.php,v 2.13 2005/01/20 16:35:52 mkkeck Exp $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4. /**
  5. * WARNING: This script has to be included at the very end of your code because
  6. * it will stop the script execution!
  7. */
  8. require_once('./libraries/relation.lib.php'); // for PMA_setHistory()
  9. /**
  10. * Query window
  11. */
  12. // If query window is wanted and open, update with latest selected db/table.
  13. if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
  14. ?>
  15. <script type="text/javascript">
  16. <!--
  17. <?php
  18. if (!isset($no_history) && !empty($db) && (!isset($error_message) || $error_message == '')) {
  19. $tables = PMA_DBI_try_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
  20. $num_tables = ($tables) ? @PMA_DBI_num_rows($tables) : 0;
  21. $common_url_query = PMA_generate_common_url($db);
  22. if ($num_tables) {
  23. $num_tables_disp = ' (' . $num_tables . ')';
  24. } else {
  25. $num_tables_disp = ' (-)';
  26. }
  27. ?>
  28. var dbBoxSetupDone = false;
  29. function dbBoxSetup() {
  30. if (dbBoxSetupDone != true) {
  31. if (parent.frames.queryframe && parent.frames.queryframe.document.left && parent.frames.queryframe.document.left.lightm_db) {
  32. parent.frames.queryframe.document.left.lightm_db.value = '<?php echo addslashes($db); ?>';
  33. dbBoxSetupDone = true;
  34. } else {
  35. setTimeout("dbBoxSetup();",500);
  36. }
  37. }
  38. }
  39. if (parent.frames.queryframe && parent.frames.queryframe.document && parent.frames.queryframe.document.queryframeform) {
  40. parent.frames.queryframe.document.queryframeform.db.value = "<?php echo (isset($db) ? addslashes($db) : ''); ?>";
  41. parent.frames.queryframe.document.queryframeform.table.value = "<?php echo (isset($table) ? addslashes($table) : ''); ?>";
  42. }
  43. if (parent.frames.queryframe && parent.frames.queryframe.document && parent.frames.queryframe.document.left && parent.frames.queryframe.document.left.lightm_db) {
  44. selidx = parent.frames.queryframe.document.left.lightm_db.selectedIndex;
  45. if (parent.frames.queryframe.document.left.lightm_db.options[selidx].value == "<?php echo addslashes($db); ?>") {
  46. parent.frames.queryframe.document.left.lightm_db.options[selidx].text = "<?php echo addslashes($db) . $num_tables_disp; ?>";
  47. } else {
  48. parent.frames.queryframe.location.reload();
  49. setTimeout("dbBoxSetup();",2000);
  50. }
  51. }
  52. <?php
  53. }
  54. ?>
  55. function reload_querywindow () {
  56. if (parent.frames.queryframe && parent.frames.queryframe.querywindow && !parent.frames.queryframe.querywindow.closed && parent.frames.queryframe.querywindow.location) {
  57. <?php
  58. if (!isset($no_history) && (!isset($error_message) || $error_message == '')) {
  59. if (isset($LockFromUpdate) && $LockFromUpdate == '1' && isset($sql_query)) {
  60. // When the button 'LockFromUpdate' was selected in the querywindow, it does not submit it's contents to
  61. // itself. So we create a SQL-history entry here.
  62. if ($cfg['QueryHistoryDB'] && $cfgRelation['historywork']) {
  63. PMA_setHistory((isset($db) ? $db : ''), (isset($table) ? $table : ''), $cfg['Server']['user'], $sql_query);
  64. }
  65. }
  66. ?>
  67. if (!parent.frames.queryframe.querywindow.document.sqlform.LockFromUpdate || !parent.frames.queryframe.querywindow.document.sqlform.LockFromUpdate.checked) {
  68. parent.frames.queryframe.querywindow.document.querywindow.db.value = "<?php echo (isset($db) ? addslashes($db) : '') ?>";
  69. parent.frames.queryframe.querywindow.document.querywindow.query_history_latest_db.value = "<?php echo (isset($db) ? addslashes($db) : '') ?>";
  70. parent.frames.queryframe.querywindow.document.querywindow.table.value = "<?php echo (isset($table) ? addslashes($table) : '') ?>";
  71. parent.frames.queryframe.querywindow.document.querywindow.query_history_latest_table.value = "<?php echo (isset($table) ? addslashes($table) : '') ?>";
  72. <?php echo (isset($sql_query) ? 'parent.frames.queryframe.querywindow.document.querywindow.query_history_latest.value = "' . urlencode($sql_query) . '";' : '// no sql query update') . "\n"; ?>
  73. parent.frames.queryframe.querywindow.document.querywindow.submit();
  74. }
  75. <?php
  76. } else {
  77. ?>
  78. // no submit, query was invalid
  79. <?php
  80. }
  81. ?>
  82. }
  83. }
  84. function focus_querywindow(sql_query) {
  85. if (parent.frames.queryframe && parent.frames.queryframe.querywindow && !parent.frames.queryframe.querywindow.closed && parent.frames.queryframe.querywindow.location) {
  86. if (parent.frames.queryframe.querywindow.document.querywindow.querydisplay_tab != 'sql') {
  87. parent.frames.queryframe.querywindow.document.querywindow.querydisplay_tab.value = "sql";
  88. parent.frames.queryframe.querywindow.document.querywindow.query_history_latest.value = sql_query;
  89. parent.frames.queryframe.querywindow.document.querywindow.submit();
  90. parent.frames.queryframe.querywindow.focus();
  91. } else {
  92. parent.frames.queryframe.querywindow.focus();
  93. }
  94. return false;
  95. } else if (parent.frames.queryframe) {
  96. new_win_url = 'querywindow.php?sql_query=' + sql_query + '&<?php echo PMA_generate_common_url(isset($db) ? addslashes($db) : '', isset($table) ? addslashes($table) : '', '&'); ?>';
  97. parent.frames.queryframe.querywindow=window.open(new_win_url, '','toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=yes,resizable=yes,width=<?php echo $cfg['QueryWindowWidth']; ?>,height=<?php echo $cfg['QueryWindowHeight']; ?>');
  98. if (!parent.frames.queryframe.querywindow.opener) {
  99. parent.frames.queryframe.querywindow.opener = parent.frames.queryframe;
  100. }
  101. // reload_querywindow();
  102. return false;
  103. }
  104. }
  105. reload_querywindow();
  106. <?php
  107. if (isset($focus_querywindow) && $focus_querywindow == "true") {
  108. ?>
  109. if (parent.frames.queryframe && parent.frames.queryframe.querywindow && !parent.frames.queryframe.querywindow.closed && parent.frames.queryframe.querywindow.location) {
  110. self.focus();
  111. }
  112. <?php
  113. }
  114. ?>
  115. //-->
  116. </script>
  117. <?php
  118. }
  119. /**
  120. * Close database connections
  121. */
  122. if (isset($GLOBALS['dbh']) && $GLOBALS['dbh']) {
  123. @PMA_DBI_close($GLOBALS['dbh']);
  124. }
  125. if (isset($GLOBALS['userlink']) && $GLOBALS['userlink']) {
  126. @PMA_DBI_close($GLOBALS['userlink']);
  127. }
  128. ?>
  129. <?php include('./config.footer.inc.php'); ?>
  130. <script type="text/javascript" language="javascript" src="libraries/tooltip.js"></script>
  131. </body>
  132. </html>
  133. <?php
  134. /**
  135. * Generates profiling data if requested
  136. */
  137. if (isset($GLOBALS['cfg']['DBG']['enable'])
  138. && $GLOBALS['cfg']['DBG']['enable']
  139. && isset($GLOBALS['cfg']['DBG']['profile']['enable'])
  140. && $GLOBALS['cfg']['DBG']['profile']['enable']) {
  141. //run the basic setup code first
  142. require_once('./libraries/dbg/setup.php');
  143. //if the setup ran fine, then do the profiling
  144. if (isset($GLOBALS['DBG']) && $GLOBALS['DBG']) {
  145. require_once('./libraries/dbg/profiling.php');
  146. dbg_dump_profiling_results();
  147. }
  148. }
  149. /**
  150. * Sends bufferized data
  151. */
  152. if (isset($GLOBALS['cfg']['OBGzip']) && $GLOBALS['cfg']['OBGzip']
  153. && isset($GLOBALS['ob_mode']) && $GLOBALS['ob_mode']) {
  154. PMA_outBufferPost($GLOBALS['ob_mode']);
  155. }
  156. /**
  157. * Stops the script execution
  158. */
  159. exit;
  160. ?>