home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / header.inc.php < prev    next >
Encoding:
PHP Script  |  2004-01-23  |  7.1 KB  |  159 lines

  1. <?php
  2. /* $Id: header.inc.php,v 2.2.4.1 2004/01/23 16:06:54 rabus Exp $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4.  
  5. if (empty($GLOBALS['is_header_sent'])) {
  6.  
  7.     /**
  8.      * Gets a core script and starts output buffering work
  9.      */
  10.     require_once('./libraries/common.lib.php');
  11.     require_once('./libraries/ob.lib.php');
  12.     if ($GLOBALS['cfg']['OBGzip']) {
  13.         $GLOBALS['ob_mode'] = PMA_outBufferModeGet();
  14.         if ($GLOBALS['ob_mode']) {
  15.             PMA_outBufferPre($GLOBALS['ob_mode']);
  16.         }
  17.     }
  18.  
  19.     // garvin: For re-usability, moved http-headers and stylesheets
  20.     // to a seperate file. It can now be included by header.inc.php,
  21.     // queryframe.php, querywindow.php.
  22.  
  23.     require_once('./libraries/header_http.inc.php');
  24.     require_once('./libraries/header_meta_style.inc.php');
  25.  
  26.     $title     = '';
  27.     if (isset($GLOBALS['db'])) {
  28.         $title .= str_replace('\'', '\\\'', $GLOBALS['db']);
  29.     }
  30.     if (isset($GLOBALS['table'])) {
  31.         $title .= (empty($title) ? '' : '.') . str_replace('\'', '\\\'', $GLOBALS['table']);
  32.     }
  33.     if (!empty($GLOBALS['cfg']['Server']) && isset($GLOBALS['cfg']['Server']['host'])) {
  34.         $title .= (empty($title) ? 'phpMyAdmin ' : ' ')
  35.                . sprintf($GLOBALS['strRunning'], (empty($GLOBALS['cfg']['Server']['verbose']) ? str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['host']) : str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['verbose'])));
  36.     }
  37.     $title     .= (empty($title) ? '' : ' - ') . 'phpMyAdmin ' . PMA_VERSION;
  38.     ?>
  39.     <script type="text/javascript" language="javascript">
  40.     <!--
  41.     // Updates the title of the frameset if possible (ns4 does not allow this)
  42.     if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown'
  43.         && typeof(parent.document.title) == 'string') {
  44.         parent.document.title = '<?php echo $title; ?>';
  45.     }
  46.     <?php
  47.     // Add some javascript instructions if required
  48.     if (isset($js_to_run) && $js_to_run == 'functions.js') {
  49.         echo "\n";
  50.         ?>
  51.     // js form validation stuff
  52.     var errorMsg0   = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
  53.     var errorMsg1   = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
  54.     var errorMsg2   = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotValidNumber']); ?>';
  55.     var noDropDbMsg = '<?php echo((!$GLOBALS['cfg']['AllowUserDropDatabase']) ? str_replace('\'', '\\\'', $GLOBALS['strNoDropDatabases']) : ''); ?>';
  56.     var confirmMsg  = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDoYouReally']) : ''); ?>';
  57.     //-->
  58.     </script>
  59.     <script src="libraries/functions.js" type="text/javascript" language="javascript"></script>
  60.         <?php
  61.     } else if (isset($js_to_run) && $js_to_run == 'user_password.js') {
  62.         echo "\n";
  63.         ?>
  64.     // js form validation stuff
  65.     var jsHostEmpty       = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
  66.     var jsUserEmpty       = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
  67.     var jsPasswordEmpty   = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
  68.     var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
  69.     //-->
  70.     </script>
  71.     <script src="libraries/user_password.js" type="text/javascript" language="javascript"></script>
  72.         <?php
  73.     } else if (isset($js_to_run) && $js_to_run == 'server_privileges.js') {
  74.         echo "\n";
  75.         ?>
  76.     // js form validation stuff
  77.     var jsHostEmpty       = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
  78.     var jsUserEmpty       = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
  79.     var jsPasswordEmpty   = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
  80.     var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
  81.     //-->
  82.     </script>
  83.     <script src="libraries/server_privileges.js" type="text/javascript" language="javascript"></script>
  84.         <?php
  85.     } else if (isset($js_to_run) && $js_to_run == 'indexes.js') {
  86.         echo "\n";
  87.         ?>
  88.     // js index validation stuff
  89.     var errorMsg0   = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
  90.     var errorMsg1   = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
  91.     var errorMsg2   = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotValidNumber']); ?>';
  92.     //-->
  93.     </script>
  94.     <script src="libraries/indexes.js" type="text/javascript" language="javascript"></script>
  95.         <?php
  96.     } else if (isset($js_to_run) && $js_to_run == 'tbl_change.js') {
  97.         echo "\n";
  98.         ?>
  99.     //-->
  100.     </script>
  101.     <script src="libraries/tbl_change.js" type="text/javascript" language="javascript"></script>
  102.         <?php
  103.     } else {
  104.         echo "\n";
  105.         ?>
  106.     //-->
  107.     </script>
  108.         <?php
  109.     }
  110.     echo "\n";
  111.     ?>
  112.         <meta name="OBGZip" content="<?php echo ($cfg['OBGzip'] ? 'true' : 'false'); ?>" />
  113.     </head>
  114.  
  115.  
  116.     <?php
  117.     if ($GLOBALS['cfg']['RightBgImage'] != '') {
  118.         $bkg_img = ' background="' . $GLOBALS['cfg']['RightBgImage'] . '"';
  119.     } else {
  120.         $bkg_img = '';
  121.     }
  122.     ?>
  123.     <body bgcolor="<?php echo $GLOBALS['cfg']['RightBgColor'] . '"' . $bkg_img; ?>>
  124.     <?php
  125.     if (!defined('PMA_DISPLAY_HEADING')) {
  126.         define('PMA_DISPLAY_HEADING', 1);
  127.     }
  128.     if (PMA_DISPLAY_HEADING) {
  129.         $header_url_qry = '?' . PMA_generate_common_url();
  130.         echo '<h1>' . "\n";
  131.         $server_info = (!empty($cfg['Server']['verbose'])
  132.                         ? $cfg['Server']['verbose']
  133.                         : $server_info = $cfg['Server']['host'] . (empty($cfg['Server']['port'])
  134.                                                                    ? ''
  135.                                                                    : ':' . $cfg['Server']['port']
  136.                                                                   )
  137.                        );
  138.         if (isset($GLOBALS['db'])) {
  139.             echo '    ' . $GLOBALS['strDatabase'] . ' <i><a class="h1" href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . $header_url_qry . '&db=' . urlencode($GLOBALS['db']) . '">' . htmlspecialchars($GLOBALS['db']) . '</a></i>' . "\n";
  140.             if (!empty($GLOBALS['table'])) {
  141.                 echo '    - ' . $GLOBALS['strTable'] . ' <i><a class="h1" href="' . $GLOBALS['cfg']['DefaultTabTable'] . $header_url_qry . '&db=' . urlencode($GLOBALS['db']) . '&table=' . urlencode($GLOBALS['table']) . '">' . htmlspecialchars($GLOBALS['table']) . '</a></i>' . "\n";
  142.             }
  143.             echo '    ' . sprintf($GLOBALS['strRunning'], '<i><a class="h1" href="' . $GLOBALS['cfg']['DefaultTabServer'] . $header_url_qry . '">' . htmlspecialchars($server_info) . '</a></i>');
  144.         } else {
  145.             echo '    ' . sprintf($GLOBALS['strServer'], '<i><a class="h1" href="' . $GLOBALS['cfg']['DefaultTabServer'] . $header_url_qry . '">' . htmlspecialchars($server_info) . '</a></i>');
  146.         }
  147.         echo "\n" . '</h1>' . "\n";
  148.     }
  149.     echo "\n";
  150.  
  151.  
  152.     /**
  153.      * Sets a variable to remember headers have been sent
  154.      */
  155.     $GLOBALS['is_header_sent'] = TRUE;
  156. }
  157.  
  158. ?>
  159.