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.inc.php3: Rewrote the whole backwards compatibility code for old
config files. config files.
* config.inc.php3: Beautified code. * 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> 2002-06-19 Marc Delisle <lem9@users.sourceforge.net>
* index.php3: missing header, thanks to Michal Cihar * index.php3: missing header, thanks to Michal Cihar

View File

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

View File

@@ -7,10 +7,10 @@
*/ */
require('./libraries/common.lib.php3'); require('./libraries/common.lib.php3');
require('./libraries/ob.lib.php3'); require('./libraries/ob.lib.php3');
if ($cfg['OBGzip']) { if ($GLOBALS['cfg']['OBGzip']) {
$ob_mode = PMA_outBufferModeGet(); $GLOBALS['ob_mode'] = PMA_outBufferModeGet();
if ($ob_mode) { if ($GLOBALS['ob_mode']) {
PMA_outBufferPre($ob_mode); PMA_outBufferPre($GLOBALS['ob_mode']);
} }
} }
@@ -19,13 +19,13 @@ if ($cfg['OBGzip']) {
* Sends http headers * Sends http headers
*/ */
// Don't use cache (required for Opera) // 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('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('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 header('Pragma: no-cache'); // HTTP/1.0
// Define the charset to be used // 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 // Gets the font sizes to use
PMA_setFontSizes(); PMA_setFontSizes();
// Defines the cell alignment values depending on text direction // Defines the cell alignment values depending on text direction
if ($text_dir == 'ltr') { if ($GLOBALS['text_dir'] == 'ltr') {
$cell_align_left = 'left'; $GLOBALS['cell_align_left'] = 'left';
$cell_align_right = 'right'; $GLOBALS['cell_align_right'] = 'right';
} else { } else {
$cell_align_left = 'right'; $GLOBALS['cell_align_left'] = 'right';
$cell_align_right = 'left'; $GLOBALS['cell_align_right'] = 'left';
} }
?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> "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> <head>
<title>phpMyAdmin</title> <title>phpMyAdmin</title>
<?php <?php
if (!empty($cfg['PmaAbsoluteUri'])) { if (!empty($GLOBALS['cfg']['PmaAbsoluteUri'])) {
echo '<base href="' . $cfg['PmaAbsoluteUri'] . '" />' . "\n"; echo '<base href="' . $GLOBALS['cfg']['PmaAbsoluteUri'] . '" />' . "\n";
} }
?> ?>
<style type="text/css"> <style type="text/css">
@@ -60,17 +60,17 @@ body {
font-size: <?php echo $font_size; ?>; font-size: <?php echo $font_size; ?>;
color: #000000; color: #000000;
<?php <?php
if ($cfg['RightBgImage'] == '') { if ($GLOBALS['cfg']['RightBgImage'] == '') {
echo ' background-image: url(\'./images/vertical_line.gif\');' . "\n" echo ' background-image: url(\'./images/vertical_line.gif\');' . "\n"
. ' background-repeat: repeat-y;' . "\n"; . ' background-repeat: repeat-y;' . "\n";
} else { } else {
echo ' background-image: url(\'' . $cfg['RightBgImage'] . '\');' . "\n"; echo ' background-image: url(\'' . $GLOBALS['cfg']['RightBgImage'] . '\');' . "\n";
} // end if... else... } // 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; ?>} 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; ?>} 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; ?>} 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; ?>} 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 <?php
$title = ''; $title = '';
if (isset($db)) { if (isset($GLOBALS['db'])) {
$title .= str_replace('\'', '\\\'', $db); $title .= str_replace('\'', '\\\'', $GLOBALS['db']);
} }
if (isset($table)) { if (isset($GLOBALS['table'])) {
$title .= (empty($title) ? '' : '.') . str_replace('\'', '\\\'', $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 ' : ' ') $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; $title .= (empty($title) ? '' : ' - ') . 'phpMyAdmin ' . PMA_VERSION;
?> ?>
@@ -121,11 +121,11 @@ if (isset($js_to_run) && $js_to_run == 'functions.js') {
echo "\n"; echo "\n";
?> ?>
// js form validation stuff // js form validation stuff
var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $strFormEmpty); ?>'; var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $strNotNumber); ?>'; var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
var errorMsg2 = '<?php echo str_replace('\'', '\\\'', $strNotValidNumber); ?>'; var errorMsg2 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotValidNumber']); ?>';
var noDropDbMsg = '<?php echo((!$cfg['AllowUserDropDatabase']) ? str_replace('\'', '\\\'', $strNoDropDatabases) : ''); ?>'; var noDropDbMsg = '<?php echo((!$GLOBALS['cfg']['AllowUserDropDatabase']) ? str_replace('\'', '\\\'', $GLOBALS['strNoDropDatabases']) : ''); ?>';
var confirmMsg = '<?php echo(($cfg['Confirm']) ? str_replace('\'', '\\\'', $strDoYouReally) : ''); ?>'; var confirmMsg = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDoYouReally']) : ''); ?>';
//--> //-->
</script> </script>
<script src="libraries/functions.js" type="text/javascript" language="javascript"></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"; echo "\n";
?> ?>
// js index validation stuff // js index validation stuff
var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $strFormEmpty); ?>'; var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $strNotNumber); ?>'; var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
var errorMsg2 = '<?php echo str_replace('\'', '\\\'', $strNotValidNumber); ?>'; var errorMsg2 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotValidNumber']); ?>';
//--> //-->
</script> </script>
<script src="libraries/indexes.js" type="text/javascript" language="javascript"></script> <script src="libraries/indexes.js" type="text/javascript" language="javascript"></script>
@@ -173,20 +173,20 @@ echo "\n";
<body bgcolor="<?php <body bgcolor="<?php
echo $cfg['RightBgColor']; echo $GLOBALS['cfg']['RightBgColor'];
if ($cfg['RightBgImage'] != '') echo '" background="' . $cfg['RightBgImage']; if ($GLOBALS['cfg']['RightBgImage'] != '') echo '" background="' . $GLOBALS['cfg']['RightBgImage'];
?>"> ?>">
<?php <?php
if (isset($db)) { if (isset($GLOBALS['db'])) {
$header_url_qry = '?lang=' . urlencode($lang) $header_url_qry = '?lang=' . urlencode($GLOBALS['lang'])
. '&amp;convcharset=' . $convcharset . '&amp;convcharset=' . $GLOBALS['convcharset']
. '&amp;server=' . $server; . '&amp;server=' . $GLOBALS['server'];
echo '<h1>' . "\n"; 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"; 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($table)) { if (!empty($GLOBALS['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['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 '</h1>' . "\n";
} }
echo "\n"; echo "\n";
@@ -195,5 +195,5 @@ echo "\n";
/** /**
* Sets a variable to remember headers have been sent * Sets a variable to remember headers have been sent
*/ */
$is_header_sent = TRUE; $GLOBALS['is_header_sent'] = TRUE;
?> ?>