Header and footer my now be included inside a function as well (Better fix against bug #549570).

This commit is contained in:
Alexander M. Turek
2002-06-19 17:19:47 +00:00
parent ddde729980
commit 52432daa40
3 changed files with 54 additions and 51 deletions

View File

@@ -10,6 +10,9 @@ $Source$
config.inc.php3: Rewrote the whole backwards compatibility code for old
config files.
* config.inc.php3: Beautified code.
* header.inc.php3, footer.inc.php3, libraries/common.lib.php3:
Header and footer my now be included inside a function as well
(Better fix against bug #549570).
2002-06-19 Marc Delisle <lem9@users.sourceforge.net>
* index.php3: missing header, thanks to Michal Cihar

View File

@@ -8,11 +8,11 @@
/**
* Close MySql non-persistent connections
*/
if (isset($dbh) && $dbh) {
@mysql_close($dbh);
if (isset($GLOBALS['dbh']) && $GLOBALS['dbh']) {
@mysql_close($GLOBALS['dbh']);
}
if (isset($userlink) && $userlink) {
@mysql_close($userlink);
if (isset($GLOBALS['userlink']) && $GLOBALS['userlink']) {
@mysql_close($GLOBALS['userlink']);
}
?>
@@ -24,8 +24,8 @@ if (isset($userlink) && $userlink) {
/**
* Sends bufferized data
*/
if (isset($cfg['OBGzip']) && $cfg['OBGzip']
&& isset($ob_mode) && $ob_mode) {
PMA_outBufferPost($ob_mode);
if (isset($GLOBALS['cfg']['OBGzip']) && $GLOBALS['cfg']['OBGzip']
&& isset($GLOBALS['ob_mode']) && $GLOBALS['ob_mode']) {
PMA_outBufferPost($GLOBALS['ob_mode']);
}
?>

View File

@@ -7,10 +7,10 @@
*/
require('./libraries/common.lib.php3');
require('./libraries/ob.lib.php3');
if ($cfg['OBGzip']) {
$ob_mode = PMA_outBufferModeGet();
if ($ob_mode) {
PMA_outBufferPre($ob_mode);
if ($GLOBALS['cfg']['OBGzip']) {
$GLOBALS['ob_mode'] = PMA_outBufferModeGet();
if ($GLOBALS['ob_mode']) {
PMA_outBufferPre($GLOBALS['ob_mode']);
}
}
@@ -19,13 +19,13 @@ if ($cfg['OBGzip']) {
* Sends http headers
*/
// Don't use cache (required for Opera)
$now = gmdate('D, d M Y H:i:s') . ' GMT';
$GLOBALS['now'] = gmdate('D, d M Y H:i:s') . ' GMT';
header('Expires: 0'); // rfc2616 - Section 14.21
header('Last-Modified: ' . $now);
header('Last-Modified: ' . $GLOBALS['now']);
header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
header('Pragma: no-cache'); // HTTP/1.0
// Define the charset to be used
header('Content-Type: text/html; charset=' . $charset);
header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
/**
@@ -34,23 +34,23 @@ header('Content-Type: text/html; charset=' . $charset);
// Gets the font sizes to use
PMA_setFontSizes();
// Defines the cell alignment values depending on text direction
if ($text_dir == 'ltr') {
$cell_align_left = 'left';
$cell_align_right = 'right';
if ($GLOBALS['text_dir'] == 'ltr') {
$GLOBALS['cell_align_left'] = 'left';
$GLOBALS['cell_align_right'] = 'right';
} else {
$cell_align_left = 'right';
$cell_align_right = 'left';
$GLOBALS['cell_align_left'] = 'right';
$GLOBALS['cell_align_right'] = 'left';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $available_languages[$lang][2]; ?>" lang="<?php echo $available_languages[$lang][2]; ?>" dir="<?php echo $text_dir; ?>">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>" lang="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>" dir="<?php echo $GLOBALS['text_dir']; ?>">
<head>
<title>phpMyAdmin</title>
<?php
if (!empty($cfg['PmaAbsoluteUri'])) {
echo '<base href="' . $cfg['PmaAbsoluteUri'] . '" />' . "\n";
if (!empty($GLOBALS['cfg']['PmaAbsoluteUri'])) {
echo '<base href="' . $GLOBALS['cfg']['PmaAbsoluteUri'] . '" />' . "\n";
}
?>
<style type="text/css">
@@ -60,17 +60,17 @@ body {
font-size: <?php echo $font_size; ?>;
color: #000000;
<?php
if ($cfg['RightBgImage'] == '') {
if ($GLOBALS['cfg']['RightBgImage'] == '') {
echo ' background-image: url(\'./images/vertical_line.gif\');' . "\n"
. ' background-repeat: repeat-y;' . "\n";
} else {
echo ' background-image: url(\'' . $cfg['RightBgImage'] . '\');' . "\n";
echo ' background-image: url(\'' . $GLOBALS['cfg']['RightBgImage'] . '\');' . "\n";
} // end if... else...
?>
background-color: <?php echo $cfg['RightBgColor'] . "\n"; ?>
background-color: <?php echo $GLOBALS['cfg']['RightBgColor'] . "\n"; ?>
}
pre, tt {font-size: <?php echo $font_size; ?>}
th {font-family: <?php echo $right_font_family; ?>; font-size: <?php echo $font_size; ?>; font-weight: bold; color: #000000; background-color: <?php echo $cfg['ThBgcolor']; ?>}
th {font-family: <?php echo $right_font_family; ?>; font-size: <?php echo $font_size; ?>; font-weight: bold; color: #000000; background-color: <?php echo $GLOBALS['cfg']['ThBgcolor']; ?>}
td {font-family: <?php echo $right_font_family; ?>; font-size: <?php echo $font_size; ?>}
form {font-family: <?php echo $right_font_family; ?>; font-size: <?php echo $font_size; ?>}
input {font-family: <?php echo $right_font_family; ?>; font-size: <?php echo $font_size; ?>}
@@ -97,15 +97,15 @@ a.drop:hover {font-family: <?php echo $right_font_family; ?>; color: #ffffff;
<?php
$title = '';
if (isset($db)) {
$title .= str_replace('\'', '\\\'', $db);
if (isset($GLOBALS['db'])) {
$title .= str_replace('\'', '\\\'', $GLOBALS['db']);
}
if (isset($table)) {
$title .= (empty($title) ? '' : '.') . str_replace('\'', '\\\'', $table);
if (isset($GLOBALS['table'])) {
$title .= (empty($title) ? '' : '.') . str_replace('\'', '\\\'', $GLOBALS['table']);
}
if (!empty($cfg['Server']) && isset($cfg['Server']['host'])) {
if (!empty($GLOBALS['cfg']['Server']) && isset($GLOBALS['cfg']['Server']['host'])) {
$title .= (empty($title) ? 'phpMyAdmin ' : ' ')
. sprintf($strRunning, (empty($cfg['Server']['verbose']) ? str_replace('\'', '\\\'', $cfg['Server']['host']) : str_replace('\'', '\\\'', $cfg['Server']['verbose'])));
. sprintf($GLOBALS['strRunning'], (empty($GLOBALS['cfg']['Server']['verbose']) ? str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['host']) : str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['verbose'])));
}
$title .= (empty($title) ? '' : ' - ') . 'phpMyAdmin ' . PMA_VERSION;
?>
@@ -121,11 +121,11 @@ if (isset($js_to_run) && $js_to_run == 'functions.js') {
echo "\n";
?>
// js form validation stuff
var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $strFormEmpty); ?>';
var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $strNotNumber); ?>';
var errorMsg2 = '<?php echo str_replace('\'', '\\\'', $strNotValidNumber); ?>';
var noDropDbMsg = '<?php echo((!$cfg['AllowUserDropDatabase']) ? str_replace('\'', '\\\'', $strNoDropDatabases) : ''); ?>';
var confirmMsg = '<?php echo(($cfg['Confirm']) ? str_replace('\'', '\\\'', $strDoYouReally) : ''); ?>';
var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
var errorMsg2 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotValidNumber']); ?>';
var noDropDbMsg = '<?php echo((!$GLOBALS['cfg']['AllowUserDropDatabase']) ? str_replace('\'', '\\\'', $GLOBALS['strNoDropDatabases']) : ''); ?>';
var confirmMsg = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDoYouReally']) : ''); ?>';
//-->
</script>
<script src="libraries/functions.js" type="text/javascript" language="javascript"></script>
@@ -146,9 +146,9 @@ var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPassw
echo "\n";
?>
// js index validation stuff
var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $strFormEmpty); ?>';
var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $strNotNumber); ?>';
var errorMsg2 = '<?php echo str_replace('\'', '\\\'', $strNotValidNumber); ?>';
var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
var errorMsg2 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotValidNumber']); ?>';
//-->
</script>
<script src="libraries/indexes.js" type="text/javascript" language="javascript"></script>
@@ -173,20 +173,20 @@ echo "\n";
<body bgcolor="<?php
echo $cfg['RightBgColor'];
if ($cfg['RightBgImage'] != '') echo '" background="' . $cfg['RightBgImage'];
echo $GLOBALS['cfg']['RightBgColor'];
if ($GLOBALS['cfg']['RightBgImage'] != '') echo '" background="' . $GLOBALS['cfg']['RightBgImage'];
?>">
<?php
if (isset($db)) {
$header_url_qry = '?lang=' . urlencode($lang)
. '&amp;convcharset=' . $convcharset
. '&amp;server=' . $server;
if (isset($GLOBALS['db'])) {
$header_url_qry = '?lang=' . urlencode($GLOBALS['lang'])
. '&amp;convcharset=' . $GLOBALS['convcharset']
. '&amp;server=' . $GLOBALS['server'];
echo '<h1>' . "\n";
echo ' ' . $strDatabase . ' <i><a class="h1" href="db_details.php3' . $header_url_qry . '&amp;db=' . urlencode($db) . '">' . htmlspecialchars($db) . '</a></i>' . "\n";
if (!empty($table)) {
echo ' - ' . $strTable . ' <i><a class="h1" href="tbl_properties.php3' . $header_url_qry . '&amp;db=' . urlencode($db) . '&amp;table=' . urlencode($table) . '">' . htmlspecialchars($table) . '</a></i>' . "\n";
echo ' ' . $GLOBALS['strDatabase'] . ' <i><a class="h1" href="db_details.php3' . $header_url_qry . '&amp;db=' . urlencode($GLOBALS['db']) . '">' . htmlspecialchars($GLOBALS['db']) . '</a></i>' . "\n";
if (!empty($GLOBALS['table'])) {
echo ' - ' . $GLOBALS['strTable'] . ' <i><a class="h1" href="tbl_properties.php3' . $header_url_qry . '&amp;db=' . urlencode($GLOBALS['db']) . '&amp;table=' . urlencode($GLOBALS['table']) . '">' . htmlspecialchars($GLOBALS['table']) . '</a></i>' . "\n";
}
echo ' ' . sprintf($strRunning, ' <i>' . (($cfg['Server']['verbose']) ? $cfg['Server']['verbose'] : $cfg['Server']['host']) . '</i>') . "\n";
echo ' ' . sprintf($GLOBALS['strRunning'], ' <i>' . (($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : $GLOBALS['cfg']['Server']['host']) . '</i>') . "\n";
echo '</h1>' . "\n";
}
echo "\n";
@@ -195,5 +195,5 @@ echo "\n";
/**
* Sets a variable to remember headers have been sent
*/
$is_header_sent = TRUE;
$GLOBALS['is_header_sent'] = TRUE;
?>