use $GLOBALS as this scripts can be included from inside a function

This commit is contained in:
Sebastian Mendel
2005-11-03 12:22:08 +00:00
parent 4be384426b
commit 5fd01ea5b9
4 changed files with 47 additions and 32 deletions

View File

@@ -9,9 +9,11 @@ $Source$
* libraries/common.lib.php: Incorrect message for validate links (bug * libraries/common.lib.php: Incorrect message for validate links (bug
#1346608). #1346608).
2005-11-02 Sebastian Mendel <cybot_tm@users.sourceforge.net> 2005-11-03 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* themes/dakrblue_orange/theme_right.css.php, css/phpmyadmin.css.php: * themes/dakrblue_orange/theme_right.css.php, css/phpmyadmin.css.php:
fixed different font sizes fixed different font sizes
* footer.inc.php, libraries/dbg/*:
use $GLOBALS as this scripts can be included from inside a function
2005-11-02 Michal Čihař <michal@cihar.com> 2005-11-02 Michal Čihař <michal@cihar.com>
* config.default.php: This is not a configuration file. * config.default.php: This is not a configuration file.

View File

@@ -5,6 +5,9 @@
/** /**
* WARNING: This script has to be included at the very end of your code because * WARNING: This script has to be included at the very end of your code because
* it will stop the script execution! * it will stop the script execution!
*
* always use $GLOBALS, as this script is also included by functions
*
*/ */
require_once('./libraries/relation.lib.php'); // for PMA_setHistory() require_once('./libraries/relation.lib.php'); // for PMA_setHistory()
@@ -14,46 +17,46 @@ require_once('./libraries/relation.lib.php'); // for PMA_setHistory()
*/ */
// If query window is wanted and open, update with latest selected db/table. // If query window is wanted and open, update with latest selected db/table.
if ( $cfg['QueryFrame'] && $cfg['QueryFrameJS'] ) { if ( $GLOBALS['cfg']['QueryFrame'] && $GLOBALS['cfg']['QueryFrameJS'] ) {
?> ?>
<script type="text/javascript"> <script type="text/javascript">
//<![CDATA[ //<![CDATA[
<?php <?php
if (!isset($no_history) && !empty($db) && (!isset($error_message) || $error_message == '')) { if ( ! isset( $GLOBALS['no_history'] ) && ! empty( $GLOBALS['db'] ) && empty( $GLOBALS['error_message'] ) ) {
$table = isset( $table ) ? $table : ''; $table = isset( $GLOBALS['table'] ) ? $GLOBALS['table'] : '';
// updates current settings // updates current settings
?> ?>
window.parent.setAll( '<?php echo $lang; ?>', '<?php echo $collation_connection; ?>', '<?php echo $server; ?>', '<?php echo $db; ?>', '<?php echo $table; ?>' ); window.parent.setAll( '<?php echo $GLOBALS['lang']; ?>', '<?php echo $GLOBALS['collation_connection']; ?>', '<?php echo $GLOBALS['server']; ?>', '<?php echo $GLOBALS['db']; ?>', '<?php echo $table; ?>' );
<?php <?php
} }
if ( ! empty( $reload ) ) { if ( ! empty( $GLOBALS['reload'] ) ) {
?> ?>
window.parent.refreshLeft(); window.parent.refreshLeft();
<?php <?php
} }
if ( ! isset( $no_history ) && empty( $error_message ) ) { if ( ! isset( $GLOBALS['no_history'] ) && empty( $GLOBALS['error_message'] ) ) {
if ( isset( $LockFromUpdate ) && $LockFromUpdate == '1' && isset( $sql_query ) ) { if ( isset( $GLOBALS['LockFromUpdate'] ) && $GLOBALS['LockFromUpdate'] == '1' && isset( $GLOBALS['sql_query'] ) ) {
// When the button 'LockFromUpdate' was selected in the querywindow, // When the button 'LockFromUpdate' was selected in the querywindow,
// it does not submit it's contents to // it does not submit it's contents to
// itself. So we create a SQL-history entry here. // itself. So we create a SQL-history entry here.
if ($cfg['QueryHistoryDB'] && $cfgRelation['historywork']) { if ($GLOBALS['cfg']['QueryHistoryDB'] && $GLOBALS['cfgRelation']['historywork']) {
PMA_setHistory( ( isset( $db ) ? $db : '' ), PMA_setHistory( ( isset( $GLOBALS['db'] ) ? $GLOBALS['db'] : '' ),
( isset( $table ) ? $table : '' ), ( isset( $GLOBALS['table'] ) ? $GLOBALS['table'] : '' ),
$cfg['Server']['user'], $GLOBALS['cfg']['Server']['user'],
$sql_query ); $GLOBALS['sql_query'] );
} }
} }
?> ?>
window.parent.reload_querywindow( window.parent.reload_querywindow(
"<?php echo isset( $db ) ? addslashes( $db ) : '' ?>", "<?php echo isset( $GLOBALS['db'] ) ? addslashes( $GLOBALS['db'] ) : '' ?>",
"<?php echo isset( $table ) ? addslashes( $table ) : '' ?>", "<?php echo isset( $GLOBALS['table'] ) ? addslashes( $GLOBALS['table'] ) : '' ?>",
"<?php echo isset( $sql_query ) ? urlencode( $sql_query ) : ''; ?>" ); "<?php echo isset( $GLOBALS['sql_query'] ) ? urlencode( $GLOBALS['sql_query'] ) : ''; ?>" );
<?php <?php
} }
if ( ! empty( $focus_querywindow ) ) { if ( ! empty( $GLOBALS['focus_querywindow'] ) ) {
?> ?>
if ( parent.querywindow && !parent.querywindow.closed && parent.querywindow.location) { if ( parent.querywindow && !parent.querywindow.closed && parent.querywindow.location) {
self.focus(); self.focus();
@@ -70,18 +73,14 @@ if ( $cfg['QueryFrame'] && $cfg['QueryFrameJS'] ) {
/** /**
* Close database connections * Close database connections
*/ */
if (isset($GLOBALS['dbh']) && $GLOBALS['dbh']) { if ( isset( $GLOBALS['dbh'] ) && $GLOBALS['dbh'] ) {
@PMA_DBI_close($GLOBALS['dbh']); @PMA_DBI_close( $GLOBALS['dbh'] );
} }
if (isset($GLOBALS['userlink']) && $GLOBALS['userlink']) { if ( isset( $GLOBALS['userlink'] ) && $GLOBALS['userlink'] ) {
@PMA_DBI_close($GLOBALS['userlink']); @PMA_DBI_close( $GLOBALS['userlink'] );
} }
include('./config.footer.inc.php'); include('./config.footer.inc.php');
?>
</body>
</html>
<?php
/** /**
* Generates profiling data if requested * Generates profiling data if requested
@@ -97,12 +96,16 @@ if ( ! empty( $GLOBALS['cfg']['DBG']['enable'] )
} }
} }
?>
</body>
</html>
<?php
/** /**
* Sends bufferized data * Sends bufferized data
*/ */
if ( ! empty( $GLOBALS['cfg']['OBGzip'] ) if ( ! empty( $GLOBALS['cfg']['OBGzip'] )
&& ! empty( $GLOBALS['ob_mode'] ) ) { && ! empty( $GLOBALS['ob_mode'] ) ) {
PMA_outBufferPost($GLOBALS['ob_mode']); PMA_outBufferPost( $GLOBALS['ob_mode'] );
} }
/** /**

View File

@@ -1,10 +1,15 @@
<?php <?php
/* $Id$ */ /* $Id$ */
// vim: expandtab sw=4 ts=4 sts=4: // vim: expandtab sw=4 ts=4 sts=4:
/**
* holds function for dumping profiling data
*
* allways use $GLOBALS here, as this script is included by footer.inc.hp
* which can also be included from inside a function
*/
if (isset($GLOBALS['DBG']) && $GLOBALS['DBG'] if ( ! empty( $GLOBALS['DBG'] )
&& isset($GLOBALS['cfg']['DBG']['profile']['enable']) && $GLOBALS['cfg']['DBG']['profile']['enable'] ) {
&& $GLOBALS['cfg']['DBG']['profile']['enable']) {
/** /**
* Displays profiling results when called * Displays profiling results when called

View File

@@ -1,14 +1,19 @@
<?php <?php
/* $Id$ */ /* $Id$ */
// vim: expandtab sw=4 ts=4 sts=4: // vim: expandtab sw=4 ts=4 sts=4:
/**
if (isset($GLOBALS['cfg']['DBG']['enable']) && $GLOBALS['cfg']['DBG']['enable']) { * checks for DBG extension and trys to load if not loaded
*
* allways use $GLOBALS here, as this script is included by footer.inc.hp
* which can also be included from inside a function
*/
if ( $GLOBALS['cfg']['DBG']['enable'] ) {
/** /**
* Loads the DBG extension if needed * Loads the DBG extension if needed
*/ */
if ( ! @extension_loaded('dbg') && ! PMA_dl('dbg') ) { if ( ! @extension_loaded('dbg') && ! PMA_dl('dbg') ) {
echo '<div class="warning">' echo '<div class="warning">'
.sprintf($strCantLoad, 'DBG') .sprintf( $GLOBALS['strCantLoad'], 'DBG' )
.' <a href="./Documentation.html#faqdbg" target="documentation">' .' <a href="./Documentation.html#faqdbg" target="documentation">'
.$GLOBALS['strDocu'] . '</a>' .$GLOBALS['strDocu'] . '</a>'
.'</div>'; .'</div>';