From 54db701f8bc017dd9be1fa9853ef387690f31352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 5 Aug 2003 16:56:50 +0000 Subject: [PATCH] header.inc.php3: Don't allow including this file twice. --- ChangeLog | 1 + header.inc.php3 | 300 ++++++++++++++++++++++++------------------------ 2 files changed, 153 insertions(+), 148 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4dcd41929..d96792128 100755 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ $Source$ * libraries/display_export.lib.php3, libraries/export/csv.php3, libraries/config_import.lib.php3, config.inc.php3: Allow column headers for Excel export (bug #771299). + * header.inc.php3: Don't allow including this file twice. 2003-08-05 Marc Delisle * libraries/sqlparser.data.php3: bug 779453, wrong count diff --git a/header.inc.php3 b/header.inc.php3 index 245159b0e..459e41c48 100755 --- a/header.inc.php3 +++ b/header.inc.php3 @@ -2,157 +2,161 @@ /* $Id$ */ // vim: expandtab sw=4 ts=4 sts=4: -/** - * Gets a core script and starts output buffering work - */ -if (!defined('PMA_COMMON_LIB_INCLUDED')) { - include('./libraries/common.lib.php3'); -} -if (!defined('PMA_OB_LIB_INCLUDED')) { - include('./libraries/ob.lib.php3'); -} -if ($GLOBALS['cfg']['OBGzip']) { - $GLOBALS['ob_mode'] = PMA_outBufferModeGet(); - if ($GLOBALS['ob_mode']) { - PMA_outBufferPre($GLOBALS['ob_mode']); +if (!defined('PMA_HEADER_INC_INCLUDED')) { + define('PMA_HEADER_INC_INCLUDED', 1); + + /** + * Gets a core script and starts output buffering work + */ + if (!defined('PMA_COMMON_LIB_INCLUDED')) { + include('./libraries/common.lib.php3'); } -} - -// garvin: For re-usability, moved http-headers and stylesheets -// to a seperate file. It can now be included by header.inc.php3, -// queryframe.php3, querywindow.php3. - -include('./libraries/header_http.inc.php3'); -include('./libraries/header_meta_style.inc.php3'); - -$title = ''; -if (isset($GLOBALS['db'])) { - $title .= str_replace('\'', '\\\'', $GLOBALS['db']); -} -if (isset($GLOBALS['table'])) { - $title .= (empty($title) ? '' : '.') . str_replace('\'', '\\\'', $GLOBALS['table']); -} -if (!empty($GLOBALS['cfg']['Server']) && isset($GLOBALS['cfg']['Server']['host'])) { - $title .= (empty($title) ? 'phpMyAdmin ' : ' ') - . 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; -?> - - - -// js form validation stuff -var jsHostEmpty = ''; -var jsUserEmpty = ''; -var jsPasswordEmpty = ''; -var jsPasswordNotSame = ''; -//--> - - - -// js form validation stuff -var jsHostEmpty = ''; -var jsUserEmpty = ''; -var jsPasswordEmpty = ''; -var jsPasswordNotSame = ''; -//--> - - - -// js index validation stuff -var errorMsg0 = ''; -var errorMsg1 = ''; -var errorMsg2 = ''; -//--> - - - -//--> - - - -//--> - - - - - - - -> -' . "\n"; - $server_info = (!empty($cfg['Server']['verbose']) - ? $cfg['Server']['verbose'] - : $server_info = $cfg['Server']['host'] . (empty($cfg['Server']['port']) - ? '' - : ':' . $cfg['Server']['port'] - ) - ); - if (isset($GLOBALS['db'])) { - echo ' ' . $GLOBALS['strDatabase'] . ' ' . htmlspecialchars($GLOBALS['db']) . '' . "\n"; - if (!empty($GLOBALS['table'])) { - echo ' - ' . $GLOBALS['strTable'] . ' ' . htmlspecialchars($GLOBALS['table']) . '' . "\n"; + if (!defined('PMA_OB_LIB_INCLUDED')) { + include('./libraries/ob.lib.php3'); + } + if ($GLOBALS['cfg']['OBGzip']) { + $GLOBALS['ob_mode'] = PMA_outBufferModeGet(); + if ($GLOBALS['ob_mode']) { + PMA_outBufferPre($GLOBALS['ob_mode']); } - echo ' ' . sprintf($GLOBALS['strRunning'], '' . htmlspecialchars($server_info) . ''); - } else { - echo ' ' . sprintf($GLOBALS['strServer'], '' . htmlspecialchars($server_info) . ''); } - echo "\n" . '' . "\n"; -} -echo "\n"; + + // garvin: For re-usability, moved http-headers and stylesheets + // to a seperate file. It can now be included by header.inc.php3, + // queryframe.php3, querywindow.php3. + + include('./libraries/header_http.inc.php3'); + include('./libraries/header_meta_style.inc.php3'); + + $title = ''; + if (isset($GLOBALS['db'])) { + $title .= str_replace('\'', '\\\'', $GLOBALS['db']); + } + if (isset($GLOBALS['table'])) { + $title .= (empty($title) ? '' : '.') . str_replace('\'', '\\\'', $GLOBALS['table']); + } + if (!empty($GLOBALS['cfg']['Server']) && isset($GLOBALS['cfg']['Server']['host'])) { + $title .= (empty($title) ? 'phpMyAdmin ' : ' ') + . 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; + ?> + + + + // js form validation stuff + var jsHostEmpty = ''; + var jsUserEmpty = ''; + var jsPasswordEmpty = ''; + var jsPasswordNotSame = ''; + //--> + + + + // js form validation stuff + var jsHostEmpty = ''; + var jsUserEmpty = ''; + var jsPasswordEmpty = ''; + var jsPasswordNotSame = ''; + //--> + + + + // js index validation stuff + var errorMsg0 = ''; + var errorMsg1 = ''; + var errorMsg2 = ''; + //--> + + + + //--> + + + + //--> + + + + -/** - * Sets a variable to remember headers have been sent - */ -$GLOBALS['is_header_sent'] = TRUE; + + > + ' . "\n"; + $server_info = (!empty($cfg['Server']['verbose']) + ? $cfg['Server']['verbose'] + : $server_info = $cfg['Server']['host'] . (empty($cfg['Server']['port']) + ? '' + : ':' . $cfg['Server']['port'] + ) + ); + if (isset($GLOBALS['db'])) { + echo ' ' . $GLOBALS['strDatabase'] . ' ' . htmlspecialchars($GLOBALS['db']) . '' . "\n"; + if (!empty($GLOBALS['table'])) { + echo ' - ' . $GLOBALS['strTable'] . ' ' . htmlspecialchars($GLOBALS['table']) . '' . "\n"; + } + echo ' ' . sprintf($GLOBALS['strRunning'], '' . htmlspecialchars($server_info) . ''); + } else { + echo ' ' . sprintf($GLOBALS['strServer'], '' . htmlspecialchars($server_info) . ''); + } + echo "\n" . '' . "\n"; + } + echo "\n"; + + + /** + * Sets a variable to remember headers have been sent + */ + $GLOBALS['is_header_sent'] = TRUE; +} // PMA_HEADER_INC_INCLUDED ?>