home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / footer.inc.php < prev    next >
Encoding:
PHP Script  |  2003-11-26  |  6.8 KB  |  168 lines

  1. <?php
  2. /* $Id: footer.inc.php,v 2.2 2003/11/26 22:52:24 rabus Exp $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4.  
  5. /**
  6.  * In this file you may add PHP or HTML statements that will be used to define
  7.  * the footer for phpMyAdmin pages.
  8.  *
  9.  * WARNING: This script has to be included at the very end of your code because
  10.  *          it will stop the script execution!
  11.  */
  12.  
  13. require_once('./libraries/relation.lib.php'); // for PMA_setHistory()
  14.  
  15. /**
  16.  * Query window
  17.  */
  18.  
  19. // If query window is wanted and open, update with latest selected db/table.
  20. if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
  21. ?>
  22.  
  23. <script type="text/javascript">
  24. <!--
  25. <?php
  26.     if ($cfg['QueryFrameDebug']) {
  27.     ?>
  28.         document.writeln("Updating query window. DB: <?php echo (isset($db) ? addslashes($db) : 'FALSE'); ?>, Table: <?php echo (isset($table) ? addslashes($table) : 'FALSE'); ?><br>");
  29.         document.writeln("Window: " + parent.frames.queryframe.querywindow.location + "<br>");
  30.     <?php
  31.     }
  32.     ?>
  33.  
  34.     <?php
  35.     if (!isset($no_history) && (!isset($error_message) || $error_message == '')) {
  36.     ?>
  37.     if (parent.frames.queryframe && parent.frames.queryframe.document && parent.frames.queryframe.document.queryframeform) {
  38.         parent.frames.queryframe.document.queryframeform.db.value = "<?php echo (isset($db) ? addslashes($db) : ''); ?>";
  39.         parent.frames.queryframe.document.queryframeform.table.value = "<?php echo (isset($table) ? addslashes($table) : ''); ?>";
  40.     }
  41.     <?php
  42.     }
  43.     ?>
  44.  
  45.     function reload_querywindow () {
  46.         if (parent.frames.queryframe && parent.frames.queryframe.querywindow && !parent.frames.queryframe.querywindow.closed && parent.frames.queryframe.querywindow.location) {
  47.             <?php echo ($cfg['QueryFrameDebug'] ? 'document.writeln("<a href=\'#\' onClick=\'parent.frames.queryframe.querywindow.focus(); return false;\'>Query Window</a> can be updated.<br>");' : ''); ?>
  48.  
  49.             <?php
  50.             if (!isset($no_history) && (!isset($error_message) || $error_message == '')) {
  51.                 if (isset($LockFromUpdate) && $LockFromUpdate == '1' && isset($sql_query)) {
  52.                     // When the button 'LockFromUpdate' was selected in the querywindow, it does not submit it's contents to
  53.                     // itself. So we create a SQL-history entry here.
  54.                     if ($cfg['QueryHistoryDB'] && $cfgRelation['historywork']) {
  55.                         PMA_setHistory((isset($db) ? $db : ''), (isset($table) ? $table : ''), $cfg['Server']['user'], $sql_query);
  56.                     }
  57.                 }
  58.             ?>
  59.             if (!parent.frames.queryframe.querywindow.document.sqlform.LockFromUpdate || !parent.frames.queryframe.querywindow.document.sqlform.LockFromUpdate.checked) {
  60.                 parent.frames.queryframe.querywindow.document.querywindow.db.value = "<?php echo (isset($db) ? addslashes($db) : '') ?>";
  61.                 parent.frames.queryframe.querywindow.document.querywindow.query_history_latest_db.value = "<?php echo (isset($db) ? addslashes($db) : '') ?>";
  62.                 parent.frames.queryframe.querywindow.document.querywindow.table.value = "<?php echo (isset($table) ? addslashes($table) : '') ?>";
  63.                 parent.frames.queryframe.querywindow.document.querywindow.query_history_latest_table.value = "<?php echo (isset($table) ? addslashes($table) : '') ?>";
  64.  
  65.                 <?php echo (isset($sql_query) ? 'parent.frames.queryframe.querywindow.document.querywindow.query_history_latest.value = "' . urlencode($sql_query) . '";' : '// no sql query update') . "\n"; ?>
  66.  
  67.                 <?php echo ($cfg['QueryFrameDebug'] ? 'alert(\'Querywindow submits. Last chance to check variables.\');' : '') . "\n"; ?>
  68.                 parent.frames.queryframe.querywindow.document.querywindow.submit();
  69.             }
  70.             <?php
  71.             } else {
  72.             ?>
  73.             // no submit, query was invalid
  74.             <?php
  75.             }
  76.             ?>
  77.         }
  78.     }
  79.  
  80.     function focus_querywindow(sql_query) {
  81.         if (parent.frames.queryframe && parent.frames.queryframe.querywindow && !parent.frames.queryframe.querywindow.closed && parent.frames.queryframe.querywindow.location) {
  82.             if (parent.frames.queryframe.querywindow.document.querywindow.querydisplay_tab != 'sql') {
  83.                 parent.frames.queryframe.querywindow.document.querywindow.querydisplay_tab.value = "sql";
  84.                 parent.frames.queryframe.querywindow.document.querywindow.query_history_latest.value = sql_query;
  85.                 parent.frames.queryframe.querywindow.document.querywindow.submit();
  86.                 parent.frames.queryframe.querywindow.focus();
  87.             } else {
  88.                 parent.frames.queryframe.querywindow.focus();
  89.             }
  90.  
  91.             return false;
  92.         } else if (parent.frames.queryframe) {
  93.             new_win_url = 'querywindow.php?sql_query=' + sql_query + '&<?php echo PMA_generate_common_url(isset($db) ? addslashes($db) : '', isset($table) ? addslashes($table) : '', '&'); ?>';
  94.             parent.frames.queryframe.querywindow=window.open(new_win_url, '','toolbar=0,location=1,directories=0,status=1,menubar=0,scrollbars=yes,resizable=yes,width=<?php echo $cfg['QueryWindowWidth']; ?>,height=<?php echo $cfg['QueryWindowHeight']; ?>');
  95.  
  96.             if (!parent.frames.queryframe.querywindow.opener) {
  97.                parent.frames.queryframe.querywindow.opener = parent.frames.queryframe;
  98.             }
  99.  
  100.             // reload_querywindow();
  101.             return false;
  102.         }
  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. //-->
  117. </script>
  118. <?php
  119. }
  120.  
  121.  
  122. /**
  123.  * Close MySql non-persistent connections
  124.  */
  125. if (isset($GLOBALS['dbh']) && $GLOBALS['dbh']) {
  126.     @mysql_close($GLOBALS['dbh']);
  127. }
  128. if (isset($GLOBALS['userlink']) && $GLOBALS['userlink']) {
  129.     @mysql_close($GLOBALS['userlink']);
  130. }
  131. ?>
  132.  
  133. </body>
  134.  
  135. </html>
  136. <?php
  137.  
  138. /**
  139.  * Generates profiling data if requested
  140.  */
  141. if (isset($GLOBALS['cfg']['DBG']['enable'])
  142.         && $GLOBALS['cfg']['DBG']['enable']
  143.         && isset($GLOBALS['cfg']['DBG']['profile']['enable'])
  144.         && $GLOBALS['cfg']['DBG']['profile']['enable']) {
  145.     //run the basic setup code first
  146.     require_once('./libraries/dbg/setup.php');
  147.     //if the setup ran fine, then do the profiling
  148.     if (isset($GLOBALS['DBG']) && $GLOBALS['DBG']) {
  149.         require_once('./libraries/dbg/profiling.php');
  150.         dbg_dump_profiling_results();
  151.     }
  152. }
  153.  
  154. /**
  155.  * Sends bufferized data
  156.  */
  157. if (isset($GLOBALS['cfg']['OBGzip']) && $GLOBALS['cfg']['OBGzip']
  158.         && isset($GLOBALS['ob_mode']) && $GLOBALS['ob_mode']) {
  159.     PMA_outBufferPost($GLOBALS['ob_mode']);
  160. }
  161.  
  162. /**
  163.  * Stops the script execution
  164.  */
  165. exit;
  166.  
  167. ?>
  168.