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