header.inc.php3: Don't allow including this file twice.

This commit is contained in:
Michal Čihař
2003-08-05 16:56:50 +00:00
parent 38aeb84c79
commit 54db701f8b
2 changed files with 153 additions and 148 deletions

View File

@@ -12,6 +12,7 @@ $Source$
* libraries/display_export.lib.php3, libraries/export/csv.php3, * libraries/display_export.lib.php3, libraries/export/csv.php3,
libraries/config_import.lib.php3, config.inc.php3: Allow column headers libraries/config_import.lib.php3, config.inc.php3: Allow column headers
for Excel export (bug #771299). for Excel export (bug #771299).
* header.inc.php3: Don't allow including this file twice.
2003-08-05 Marc Delisle <lem9@users.sourceforge.net> 2003-08-05 Marc Delisle <lem9@users.sourceforge.net>
* libraries/sqlparser.data.php3: bug 779453, wrong count * libraries/sqlparser.data.php3: bug 779453, wrong count

View File

@@ -2,132 +2,135 @@
/* $Id$ */ /* $Id$ */
// vim: expandtab sw=4 ts=4 sts=4: // vim: expandtab sw=4 ts=4 sts=4:
/** if (!defined('PMA_HEADER_INC_INCLUDED')) {
define('PMA_HEADER_INC_INCLUDED', 1);
/**
* Gets a core script and starts output buffering work * Gets a core script and starts output buffering work
*/ */
if (!defined('PMA_COMMON_LIB_INCLUDED')) { if (!defined('PMA_COMMON_LIB_INCLUDED')) {
include('./libraries/common.lib.php3'); include('./libraries/common.lib.php3');
} }
if (!defined('PMA_OB_LIB_INCLUDED')) { if (!defined('PMA_OB_LIB_INCLUDED')) {
include('./libraries/ob.lib.php3'); include('./libraries/ob.lib.php3');
} }
if ($GLOBALS['cfg']['OBGzip']) { if ($GLOBALS['cfg']['OBGzip']) {
$GLOBALS['ob_mode'] = PMA_outBufferModeGet(); $GLOBALS['ob_mode'] = PMA_outBufferModeGet();
if ($GLOBALS['ob_mode']) { if ($GLOBALS['ob_mode']) {
PMA_outBufferPre($GLOBALS['ob_mode']); PMA_outBufferPre($GLOBALS['ob_mode']);
} }
} }
// garvin: For re-usability, moved http-headers and stylesheets // garvin: For re-usability, moved http-headers and stylesheets
// to a seperate file. It can now be included by header.inc.php3, // to a seperate file. It can now be included by header.inc.php3,
// queryframe.php3, querywindow.php3. // queryframe.php3, querywindow.php3.
include('./libraries/header_http.inc.php3'); include('./libraries/header_http.inc.php3');
include('./libraries/header_meta_style.inc.php3'); include('./libraries/header_meta_style.inc.php3');
$title = ''; $title = '';
if (isset($GLOBALS['db'])) { if (isset($GLOBALS['db'])) {
$title .= str_replace('\'', '\\\'', $GLOBALS['db']); $title .= str_replace('\'', '\\\'', $GLOBALS['db']);
} }
if (isset($GLOBALS['table'])) { if (isset($GLOBALS['table'])) {
$title .= (empty($title) ? '' : '.') . str_replace('\'', '\\\'', $GLOBALS['table']); $title .= (empty($title) ? '' : '.') . str_replace('\'', '\\\'', $GLOBALS['table']);
} }
if (!empty($GLOBALS['cfg']['Server']) && isset($GLOBALS['cfg']['Server']['host'])) { if (!empty($GLOBALS['cfg']['Server']) && isset($GLOBALS['cfg']['Server']['host'])) {
$title .= (empty($title) ? 'phpMyAdmin ' : ' ') $title .= (empty($title) ? 'phpMyAdmin ' : ' ')
. sprintf($GLOBALS['strRunning'], (empty($GLOBALS['cfg']['Server']['verbose']) ? str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['host']) : str_replace('\'', '\\\'', $GLOBALS['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;
?> ?>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
<!-- <!--
// Updates the title of the frameset if possible (ns4 does not allow this) // Updates the title of the frameset if possible (ns4 does not allow this)
if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown' if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown'
&& typeof(parent.document.title) == 'string') { && typeof(parent.document.title) == 'string') {
parent.document.title = '<?php echo $title; ?>'; parent.document.title = '<?php echo $title; ?>';
} }
<?php <?php
// Add some javascript instructions if required // Add some javascript instructions if required
if (isset($js_to_run) && $js_to_run == 'functions.js') { 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('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>'; var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>'; var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
var errorMsg2 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotValidNumber']); ?>'; var errorMsg2 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotValidNumber']); ?>';
var noDropDbMsg = '<?php echo((!$GLOBALS['cfg']['AllowUserDropDatabase']) ? str_replace('\'', '\\\'', $GLOBALS['strNoDropDatabases']) : ''); ?>'; var noDropDbMsg = '<?php echo((!$GLOBALS['cfg']['AllowUserDropDatabase']) ? str_replace('\'', '\\\'', $GLOBALS['strNoDropDatabases']) : ''); ?>';
var confirmMsg = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['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>
<?php <?php
} else if (isset($js_to_run) && $js_to_run == 'user_password.js') { } else if (isset($js_to_run) && $js_to_run == 'user_password.js') {
echo "\n"; echo "\n";
?> ?>
// js form validation stuff // js form validation stuff
var jsHostEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>'; var jsHostEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
var jsUserEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>'; var jsUserEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
var jsPasswordEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>'; var jsPasswordEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>'; var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
//--> //-->
</script> </script>
<script src="libraries/user_password.js" type="text/javascript" language="javascript"></script> <script src="libraries/user_password.js" type="text/javascript" language="javascript"></script>
<?php <?php
} else if (isset($js_to_run) && $js_to_run == 'server_privileges.js') { } else if (isset($js_to_run) && $js_to_run == 'server_privileges.js') {
echo "\n"; echo "\n";
?> ?>
// js form validation stuff // js form validation stuff
var jsHostEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>'; var jsHostEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
var jsUserEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>'; var jsUserEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
var jsPasswordEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>'; var jsPasswordEmpty = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>'; var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
//--> //-->
</script> </script>
<script src="libraries/server_privileges.js" type="text/javascript" language="javascript"></script> <script src="libraries/server_privileges.js" type="text/javascript" language="javascript"></script>
<?php <?php
} else if (isset($js_to_run) && $js_to_run == 'indexes.js') { } else if (isset($js_to_run) && $js_to_run == 'indexes.js') {
echo "\n"; echo "\n";
?> ?>
// js index validation stuff // js index validation stuff
var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>'; var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>'; var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
var errorMsg2 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['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>
<?php <?php
} else if (isset($js_to_run) && $js_to_run == 'tbl_change.js') { } else if (isset($js_to_run) && $js_to_run == 'tbl_change.js') {
echo "\n"; echo "\n";
?> ?>
//--> //-->
</script> </script>
<script src="libraries/tbl_change.js" type="text/javascript" language="javascript"></script> <script src="libraries/tbl_change.js" type="text/javascript" language="javascript"></script>
<?php <?php
} else { } else {
echo "\n"; echo "\n";
?> ?>
//--> //-->
</script> </script>
<?php <?php
} }
echo "\n"; echo "\n";
?> ?>
<meta name="OBGZip" content="<?php echo ($cfg['OBGzip'] ? 'true' : 'false'); ?>" /> <meta name="OBGZip" content="<?php echo ($cfg['OBGzip'] ? 'true' : 'false'); ?>" />
</head> </head>
<?php <?php
if ($GLOBALS['cfg']['RightBgImage'] != '') { if ($GLOBALS['cfg']['RightBgImage'] != '') {
$bkg_img = ' background="' . $GLOBALS['cfg']['RightBgImage'] . '"'; $bkg_img = ' background="' . $GLOBALS['cfg']['RightBgImage'] . '"';
} else { } else {
$bkg_img = ''; $bkg_img = '';
} }
?> ?>
<body bgcolor="<?php echo $GLOBALS['cfg']['RightBgColor'] . '"' . $bkg_img; ?>> <body bgcolor="<?php echo $GLOBALS['cfg']['RightBgColor'] . '"' . $bkg_img; ?>>
<?php <?php
if (!defined('PMA_DISPLAY_HEADING')) { if (!defined('PMA_DISPLAY_HEADING')) {
define('PMA_DISPLAY_HEADING', 1); define('PMA_DISPLAY_HEADING', 1);
} }
if (PMA_DISPLAY_HEADING) { if (PMA_DISPLAY_HEADING) {
$header_url_qry = '?' . PMA_generate_common_url(); $header_url_qry = '?' . PMA_generate_common_url();
echo '<h1>' . "\n"; echo '<h1>' . "\n";
$server_info = (!empty($cfg['Server']['verbose']) $server_info = (!empty($cfg['Server']['verbose'])
@@ -147,12 +150,13 @@ if (PMA_DISPLAY_HEADING) {
echo ' ' . sprintf($GLOBALS['strServer'], '<i><a class="h1" href="' . $GLOBALS['cfg']['DefaultTabServer'] . $header_url_qry . '">' . htmlspecialchars($server_info) . '</a></i>'); echo ' ' . sprintf($GLOBALS['strServer'], '<i><a class="h1" href="' . $GLOBALS['cfg']['DefaultTabServer'] . $header_url_qry . '">' . htmlspecialchars($server_info) . '</a></i>');
} }
echo "\n" . '</h1>' . "\n"; echo "\n" . '</h1>' . "\n";
} }
echo "\n"; echo "\n";
/** /**
* Sets a variable to remember headers have been sent * Sets a variable to remember headers have been sent
*/ */
$GLOBALS['is_header_sent'] = TRUE; $GLOBALS['is_header_sent'] = TRUE;
} // PMA_HEADER_INC_INCLUDED
?> ?>