home *** CD-ROM | disk | FTP | other *** search
/ Exame Informatica 139 / Exame Informatica 139.iso / Revista / Flash / Uniform Server / diskw / home / admin / www / phpMyAdmin / header.inc.php < prev    next >
Encoding:
PHP Script  |  2005-09-05  |  10.0 KB  |  235 lines

  1. <?php
  2. /* $Id: header.inc.php,v 2.31.2.1 2005/09/05 22:09:08 lem9 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.     /* replaced 2004-05-05 by Michael Keck (mkkeck)
  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.     /* the new one
  40.      * 2004-05-05: replaced by Michael Keck (mkkeck)
  41.      */
  42.     $title     = '';
  43.     if ($cfg['ShowHttpHostTitle']) {
  44.         $title .= (empty($GLOBALS['cfg']['SetHttpHostTitle']) && isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $GLOBALS['cfg']['SetHttpHostTitle']) . ' / ';
  45.     }
  46.     if (!empty($GLOBALS['cfg']['Server']) && isset($GLOBALS['cfg']['Server']['host'])) {
  47.         $title.=str_replace('\'', '\\\'', $GLOBALS['cfg']['Server']['host']);
  48.     }
  49.     if (isset($GLOBALS['db'])) {
  50.         $title .= ' / ' . str_replace('\'', '\\\'', $GLOBALS['db']);
  51.     }
  52.     if (isset($GLOBALS['table'])) {
  53.         $title .= (empty($title) ? '' : ' ') . ' / ' . str_replace('\'', '\\\'', $GLOBALS['table']);
  54.     }
  55.     $title .= ' | phpMyAdmin ' . PMA_VERSION;
  56.     ?>
  57.     <script type="text/javascript" language="javascript">
  58.     <!--
  59.     // Updates the title of the frameset if possible (ns4 does not allow this)
  60.     if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown'
  61.         && typeof(parent.document.title) == 'string') {
  62.         parent.document.title = '<?php echo PMA_sanitize($title); ?>';
  63.     }
  64.  
  65.     document.write('<style type="text/css">');
  66.     document.write('img.lightbulb { cursor: pointer; }');
  67.     document.write('<\/style>');
  68.     
  69.     <?php
  70.     // Add some javascript instructions if required
  71.     if (isset($js_to_run) && $js_to_run == 'functions.js') {
  72.         echo "\n";
  73.         ?>
  74.     // js form validation stuff
  75.     var errorMsg0   = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
  76.     var errorMsg1   = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
  77.     var noDropDbMsg = '<?php echo((!$GLOBALS['cfg']['AllowUserDropDatabase']) ? str_replace('\'', '\\\'', $GLOBALS['strNoDropDatabases']) : ''); ?>';
  78.     var confirmMsg  = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDoYouReally']) : ''); ?>';
  79.     var confirmMsgDropDB  = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDropDatabaseStrongWarning']) : ''); ?>';
  80.     //-->
  81.     </script>
  82.     <script src="libraries/functions.js" type="text/javascript" language="javascript"></script>
  83.         <?php
  84.     } else if (isset($js_to_run) && $js_to_run == 'user_password.js') {
  85.         echo "\n";
  86.         ?>
  87.     // js form validation stuff
  88.     var jsHostEmpty       = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
  89.     var jsUserEmpty       = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
  90.     var jsPasswordEmpty   = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
  91.     var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
  92.     //-->
  93.     </script>
  94.     <script src="libraries/user_password.js" type="text/javascript" language="javascript"></script>
  95.         <?php
  96.     } else if (isset($js_to_run) && $js_to_run == 'server_privileges.js') {
  97.         echo "\n";
  98.         ?>
  99.     // js form validation stuff
  100.     var jsHostEmpty       = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
  101.     var jsUserEmpty       = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
  102.     var jsPasswordEmpty   = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
  103.     var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
  104.     //-->
  105.     </script>
  106.     <script src="libraries/server_privileges.js" type="text/javascript" language="javascript"></script>
  107.         <?php
  108.     } else if (isset($js_to_run) && $js_to_run == 'indexes.js') {
  109.         echo "\n";
  110.         ?>
  111.     // js index validation stuff
  112.     var errorMsg0   = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
  113.     var errorMsg1   = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
  114.     //-->
  115.     </script>
  116.     <script src="libraries/indexes.js" type="text/javascript" language="javascript"></script>
  117.         <?php
  118.     } else if (isset($js_to_run) && $js_to_run == 'tbl_change.js') {
  119.         echo "\n";
  120.         ?>
  121.     //-->
  122.     </script>
  123.     <script src="libraries/tbl_change.js" type="text/javascript" language="javascript"></script>
  124.         <?php
  125.     } else {
  126.         echo "\n";
  127.         ?>
  128.     //-->
  129.     </script>
  130.         <?php
  131.     }
  132.     echo "\n";
  133.  
  134.     // Reloads the navigation frame via JavaScript if required
  135.     PMA_reloadNavigation();
  136.     ?>
  137.         <meta name="OBGZip" content="<?php echo ($cfg['OBGzip'] ? 'true' : 'false'); ?>" />
  138.     </head>
  139.  
  140.  
  141.     <?php
  142.     if ($GLOBALS['cfg']['RightBgImage'] != '') {
  143.         $bkg_img = ' background="' . $GLOBALS['cfg']['RightBgImage'] . '"';
  144.     } else {
  145.         $bkg_img = '';
  146.     }
  147.     ?>
  148.     <body bgcolor="<?php echo $GLOBALS['cfg']['RightBgColor'] . '"' . $bkg_img; ?>>
  149.     <div id="TooltipContainer" name="TooltipContainer" onmouseover="holdTooltip();" onmouseout="swapTooltip('default');"></div>
  150.     <?php
  151.     include('./config.header.inc.php');
  152.  
  153.     if (!defined('PMA_DISPLAY_HEADING')) {
  154.         define('PMA_DISPLAY_HEADING', 1);
  155.     }
  156.  
  157.     /**
  158.      * Display heading if needed. Design can be set in css file.
  159.      */
  160.  
  161.     if (PMA_DISPLAY_HEADING) {
  162.         $server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
  163.                         ? $GLOBALS['cfg']['Server']['verbose']
  164.                         : $GLOBALS['cfg']['Server']['host'] . (empty($GLOBALS['cfg']['Server']['port'])
  165.                                                                ? ''
  166.                                                                : ':' . $GLOBALS['cfg']['Server']['port']
  167.                                                               )
  168.                        );
  169.         $item = '<a href="%1$s?%2$s" class="item">';
  170.         if ( $GLOBALS['cfg']['NavigationBarIconic'] ) {
  171.             $separator = '        <span class="separator"><img src="' . $GLOBALS['pmaThemeImage'] . 'item_ltr.png" width="5" height="9" alt="-" /></span>' . "\n";
  172.             $item .= '        <img src="' . $GLOBALS['pmaThemeImage'] . '%5$s" width="16" height="16" alt="" border="0" /> ' . "\n";
  173.         } else {
  174.             $separator = '        <span class="separator"> - </span>' . "\n";
  175.         }
  176.  
  177.         if ( $GLOBALS['cfg']['NavigationBarIconic'] !== true ) {
  178.             $item .= '%4$s: ';
  179.         }
  180.         $item .= '%3$s</a>' . "\n";
  181.         
  182.         echo '<div id="serverinfo">' . "\n";
  183.         printf( $item,
  184.                 $GLOBALS['cfg']['DefaultTabServer'],
  185.                 PMA_generate_common_url(),
  186.                 htmlspecialchars($server_info),
  187.                 $GLOBALS['strServer'],
  188.                 's_host.png' );
  189.         
  190.         if (!empty($GLOBALS['db'])) {
  191.             
  192.             echo $separator;
  193.             printf( $item,
  194.                     $GLOBALS['cfg']['DefaultTabDatabase'],
  195.                     PMA_generate_common_url($GLOBALS['db']),
  196.                     htmlspecialchars($GLOBALS['db']),
  197.                     $GLOBALS['strDatabase'],
  198.                     's_db.png' );
  199.             
  200.             if (!empty($GLOBALS['table'])) {
  201.                 require_once('./tbl_properties_table_info.php');
  202.  
  203.                 echo $separator;
  204.                 printf( $item,
  205.                         $GLOBALS['cfg']['DefaultTabTable'],
  206.                         PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']),
  207.                         htmlspecialchars($GLOBALS['table']),
  208.                         (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? $GLOBALS['strView'] : $GLOBALS['strTable']),
  209.                         (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views' : 's_tbl') . '.png' );
  210.                                 
  211.                 /**
  212.                  * Displays table comment
  213.                  * @uses $show_comment from tbl_properties_table_info.php
  214.                  * @uses $GLOBALS['avoid_show_comment'] from tbl_relation.php
  215.                  */
  216.                 if (!empty($show_comment) && !isset($GLOBALS['avoid_show_comment'])) {
  217.                     if (strstr($show_comment, '; InnoDB free')) {
  218.                         $show_comment = preg_replace('@; InnoDB free:.*?$@' , '', $show_comment);
  219.                     }
  220.                     echo '<!-- Table comment -->' . "\n"
  221.                        . '<span class="table_comment" id="span_table_comment">"' .  htmlspecialchars($show_comment) . '"</span>' . "\n";
  222.                 } // end if
  223.             }
  224.         }
  225.         echo '</div>';
  226.         
  227.     }
  228.     /**
  229.      * Sets a variable to remember headers have been sent
  230.      */
  231.     $GLOBALS['is_header_sent'] = TRUE;
  232. }
  233.  
  234. ?>
  235.