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
#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:
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>
* 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
* 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()
@@ -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 ( $cfg['QueryFrame'] && $cfg['QueryFrameJS'] ) {
if ( $GLOBALS['cfg']['QueryFrame'] && $GLOBALS['cfg']['QueryFrameJS'] ) {
?>
<script type="text/javascript">
//<![CDATA[
<?php
if (!isset($no_history) && !empty($db) && (!isset($error_message) || $error_message == '')) {
$table = isset( $table ) ? $table : '';
if ( ! isset( $GLOBALS['no_history'] ) && ! empty( $GLOBALS['db'] ) && empty( $GLOBALS['error_message'] ) ) {
$table = isset( $GLOBALS['table'] ) ? $GLOBALS['table'] : '';
// 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
}
if ( ! empty( $reload ) ) {
if ( ! empty( $GLOBALS['reload'] ) ) {
?>
window.parent.refreshLeft();
<?php
}
if ( ! isset( $no_history ) && empty( $error_message ) ) {
if ( isset( $LockFromUpdate ) && $LockFromUpdate == '1' && isset( $sql_query ) ) {
if ( ! isset( $GLOBALS['no_history'] ) && empty( $GLOBALS['error_message'] ) ) {
if ( isset( $GLOBALS['LockFromUpdate'] ) && $GLOBALS['LockFromUpdate'] == '1' && isset( $GLOBALS['sql_query'] ) ) {
// When the button 'LockFromUpdate' was selected in the querywindow,
// it does not submit it's contents to
// itself. So we create a SQL-history entry here.
if ($cfg['QueryHistoryDB'] && $cfgRelation['historywork']) {
PMA_setHistory( ( isset( $db ) ? $db : '' ),
( isset( $table ) ? $table : '' ),
$cfg['Server']['user'],
$sql_query );
if ($GLOBALS['cfg']['QueryHistoryDB'] && $GLOBALS['cfgRelation']['historywork']) {
PMA_setHistory( ( isset( $GLOBALS['db'] ) ? $GLOBALS['db'] : '' ),
( isset( $GLOBALS['table'] ) ? $GLOBALS['table'] : '' ),
$GLOBALS['cfg']['Server']['user'],
$GLOBALS['sql_query'] );
}
}
?>
window.parent.reload_querywindow(
"<?php echo isset( $db ) ? addslashes( $db ) : '' ?>",
"<?php echo isset( $table ) ? addslashes( $table ) : '' ?>",
"<?php echo isset( $sql_query ) ? urlencode( $sql_query ) : ''; ?>" );
"<?php echo isset( $GLOBALS['db'] ) ? addslashes( $GLOBALS['db'] ) : '' ?>",
"<?php echo isset( $GLOBALS['table'] ) ? addslashes( $GLOBALS['table'] ) : '' ?>",
"<?php echo isset( $GLOBALS['sql_query'] ) ? urlencode( $GLOBALS['sql_query'] ) : ''; ?>" );
<?php
}
if ( ! empty( $focus_querywindow ) ) {
if ( ! empty( $GLOBALS['focus_querywindow'] ) ) {
?>
if ( parent.querywindow && !parent.querywindow.closed && parent.querywindow.location) {
self.focus();
@@ -78,10 +81,6 @@ if (isset($GLOBALS['userlink']) && $GLOBALS['userlink']) {
}
include('./config.footer.inc.php');
?>
</body>
</html>
<?php
/**
* Generates profiling data if requested
@@ -97,6 +96,10 @@ if ( ! empty( $GLOBALS['cfg']['DBG']['enable'] )
}
}
?>
</body>
</html>
<?php
/**
* Sends bufferized data
*/

View File

@@ -1,9 +1,14 @@
<?php
/* $Id$ */
// 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']
&& isset($GLOBALS['cfg']['DBG']['profile']['enable'])
if ( ! empty( $GLOBALS['DBG'] )
&& $GLOBALS['cfg']['DBG']['profile']['enable'] ) {
/**

View File

@@ -1,14 +1,19 @@
<?php
/* $Id$ */
// 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
*/
if ( ! @extension_loaded('dbg') && ! PMA_dl('dbg') ) {
echo '<div class="warning">'
.sprintf($strCantLoad, 'DBG')
.sprintf( $GLOBALS['strCantLoad'], 'DBG' )
.' <a href="./Documentation.html#faqdbg" target="documentation">'
.$GLOBALS['strDocu'] . '</a>'
.'</div>';