home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / phpMyAdmin / libraries / header.inc.php < prev    next >
Encoding:
PHP Script  |  2008-06-23  |  11.1 KB  |  273 lines

  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4.  *
  5.  * @version $Id: header.inc.php 11326 2008-06-17 21:32:48Z lem9 $
  6.  */
  7. if (! defined('PHPMYADMIN')) {
  8.     exit;
  9. }
  10.  
  11. /**
  12.  *
  13.  */
  14. require_once './libraries/common.inc.php';
  15.  
  16. if (empty($GLOBALS['is_header_sent'])) {
  17.  
  18.     /**
  19.      * Gets a core script and starts output buffering work
  20.      */
  21.     require_once './libraries/common.inc.php';
  22.     require_once './libraries/ob.lib.php';
  23.     PMA_outBufferPre();
  24.  
  25.     // garvin: For re-usability, moved http-headers and stylesheets
  26.     // to a seperate file. It can now be included by header.inc.php,
  27.     // querywindow.php.
  28.  
  29.     require_once './libraries/header_http.inc.php';
  30.     require_once './libraries/header_meta_style.inc.php';
  31.  
  32.     // generate title
  33.     $title     = str_replace(
  34.                     array(
  35.                         '@HTTP_HOST@',
  36.                         '@SERVER@',
  37.                         '@VERBOSE@',
  38.                         '@VSERVER@',
  39.                         '@DATABASE@',
  40.                         '@TABLE@',
  41.                         '@PHPMYADMIN@',
  42.                         ),
  43.                     array(
  44.                         PMA_getenv('HTTP_HOST') ? PMA_getenv('HTTP_HOST') : '',
  45.                         isset($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['Server']['host'] : '',
  46.                         isset($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : '',
  47.                         !empty($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : (isset($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['Server']['host'] : ''),
  48.                         $GLOBALS['db'],
  49.                         $GLOBALS['table'],
  50.                         'phpMyAdmin ' . PMA_VERSION,
  51.                         ),
  52.                     !empty($GLOBALS['table']) ? $GLOBALS['cfg']['TitleTable'] :
  53.                     (!empty($GLOBALS['db']) ? $GLOBALS['cfg']['TitleDatabase'] :
  54.                     (!empty($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['TitleServer'] :
  55.                     $GLOBALS['cfg']['TitleDefault']))
  56.                     );
  57.     // here, the function does not exist with this configuration: $cfg['ServerDefault'] = 0;
  58.     $is_superuser    = function_exists('PMA_isSuperuser') && PMA_isSuperuser();
  59.     ?>
  60.     <script type="text/javascript">
  61.     // <![CDATA[
  62.     // Updates the title of the frameset if possible (ns4 does not allow this)
  63.     if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown'
  64.         && typeof(parent.document.title) == 'string') {
  65.         parent.document.title = '<?php echo PMA_sanitize(str_replace('\'', '\\\'', $title)); ?>';
  66.     }
  67.     <?php
  68.     // Add some javascript instructions if required
  69.     if (isset($js_to_run) && $js_to_run == 'functions.js') {
  70.         echo "\n";
  71.         ?>
  72.     // js form validation stuff
  73.     var errorMsg0   = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
  74.     var errorMsg1   = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
  75.     var noDropDbMsg = '<?php echo (!$is_superuser && !$GLOBALS['cfg']['AllowUserDropDatabase'])
  76.         ? str_replace('\'', '\\\'', $GLOBALS['strNoDropDatabases']) : ''; ?>';
  77.     var confirmMsg  = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDoYouReally']) : ''); ?>';
  78.     var confirmMsgDropDB  = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDropDatabaseStrongWarning']) : ''); ?>';
  79.     // ]]>
  80.     </script>
  81.     <script src="./js/functions.js" type="text/javascript"></script>
  82.         <?php
  83.     } elseif (isset($js_to_run) && $js_to_run == 'user_password.js') {
  84.         echo "\n";
  85.         ?>
  86.     // js form validation stuff
  87.     var jsHostEmpty       = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
  88.     var jsUserEmpty       = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
  89.     var jsPasswordEmpty   = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
  90.     var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
  91.     // ]]>
  92.     </script>
  93.     <script src="./js/user_password.js" type="text/javascript"></script>
  94.         <?php
  95.     } elseif (isset($js_to_run) && $js_to_run == 'server_privileges.js') {
  96.         echo "\n";
  97.         ?>
  98.     // js form validation stuff
  99.     var jsHostEmpty       = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strHostEmpty']); ?>';
  100.     var jsUserEmpty       = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strUserEmpty']); ?>';
  101.     var jsPasswordEmpty   = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordEmpty']); ?>';
  102.     var jsPasswordNotSame = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strPasswordNotSame']); ?>';
  103.     // ]]>
  104.     </script>
  105.     <script src="./js/server_privileges.js" type="text/javascript"></script>
  106.     <script src="./js/functions.js" type="text/javascript"></script>
  107.         <?php
  108.     } elseif (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="./js/indexes.js" type="text/javascript"></script>
  117.         <?php
  118.     } elseif (isset($js_to_run) && $js_to_run == 'tbl_change.js') {
  119.         echo "\n";
  120.         ?>
  121.     // ]]>
  122.     </script>
  123.     <script src="./js/tbl_change.js" type="text/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.     <script src="./js/tooltip.js" type="text/javascript"></script>
  138.     <meta name="OBGZip" content="<?php echo ($GLOBALS['cfg']['OBGzip'] ? 'true' : 'false'); ?>" />
  139.     <?php /* remove vertical scroll bar bug in ie */ ?>
  140.     <!--[if IE 6]>
  141.     <style type="text/css">
  142.     /* <![CDATA[ */
  143.     html {
  144.         overflow-y: scroll;
  145.     }
  146.     /* ]]> */
  147.     </style>
  148.     <![endif]-->
  149. </head>
  150.  
  151. <body>
  152. <div id="TooltipContainer" onmouseover="holdTooltip();" onmouseout="swapTooltip('default');"></div>
  153.     <?php
  154.  
  155.     // Include possible custom headers
  156.     if (file_exists('./config.header.inc.php')) {
  157.         require './config.header.inc.php';
  158.     }
  159.  
  160.  
  161.     // message of "Cookies required" displayed for auth_type http or config
  162.     // note: here, the decoration won't work because without cookies,
  163.     // our standard CSS is not operational
  164.     if (empty($_COOKIE)) {
  165.          echo '<div class="notice">' . $GLOBALS['strCookiesRequired'] . '</div>' . "\n";
  166.     }
  167.  
  168.     if (!defined('PMA_DISPLAY_HEADING')) {
  169.         define('PMA_DISPLAY_HEADING', 1);
  170.     }
  171.  
  172.     /**
  173.      * Display heading if needed. Design can be set in css file.
  174.      */
  175.  
  176.     if (PMA_DISPLAY_HEADING) {
  177.         $server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
  178.                         ? $GLOBALS['cfg']['Server']['verbose']
  179.                         : $GLOBALS['cfg']['Server']['host'] . (empty($GLOBALS['cfg']['Server']['port'])
  180.                                                                ? ''
  181.                                                                : ':' . $GLOBALS['cfg']['Server']['port']
  182.                                                               )
  183.                        );
  184.         $item = '<a href="%1$s?%2$s" class="item">';
  185.         if ($GLOBALS['cfg']['NavigationBarIconic']) {
  186.             $separator = '        <span class="separator"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'item_ltr.png" width="5" height="9" alt="-" /></span>' . "\n";
  187.             $item .= '        <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . '%5$s" width="16" height="16" alt="" /> ' . "\n";
  188.         } else {
  189.             $separator = '        <span class="separator"> - </span>' . "\n";
  190.         }
  191.  
  192.         if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
  193.             $item .= '%4$s: ';
  194.         }
  195.         $item .= '%3$s</a>' . "\n";
  196.  
  197.         echo '<div id="serverinfo">' . "\n";
  198.         printf($item,
  199.                 $GLOBALS['cfg']['DefaultTabServer'],
  200.                 PMA_generate_common_url(),
  201.                 htmlspecialchars($server_info),
  202.                 $GLOBALS['strServer'],
  203.                 's_host.png');
  204.  
  205.         if (strlen($GLOBALS['db'])) {
  206.  
  207.             echo $separator;
  208.             printf($item,
  209.                     $GLOBALS['cfg']['DefaultTabDatabase'],
  210.                     PMA_generate_common_url($GLOBALS['db']),
  211.                     htmlspecialchars($GLOBALS['db']),
  212.                     $GLOBALS['strDatabase'],
  213.                     's_db.png');
  214.  
  215.             if (strlen($GLOBALS['table'])) {
  216.                 require_once './libraries/tbl_info.inc.php';
  217.  
  218.                 echo $separator;
  219.                 printf($item,
  220.                         $GLOBALS['cfg']['DefaultTabTable'],
  221.                         PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']),
  222.                         str_replace(' ', ' ', htmlspecialchars($GLOBALS['table'])),
  223.                         (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? $GLOBALS['strView'] : $GLOBALS['strTable']),
  224.                         (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views' : 's_tbl') . '.png');
  225.  
  226.                 /**
  227.                  * Displays table comment
  228.                  * @uses $show_comment from libraries/tbl_info.inc.php
  229.                  * @uses $GLOBALS['avoid_show_comment'] from tbl_relation.php
  230.                  */
  231.                 if (!empty($show_comment) && !isset($GLOBALS['avoid_show_comment'])) {
  232.                     if (strstr($show_comment, '; InnoDB free')) {
  233.                         $show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
  234.                     }
  235.                     echo '<span class="table_comment" id="span_table_comment">'
  236.                         .'"' . htmlspecialchars($show_comment)
  237.                         .'"</span>' . "\n";
  238.                 } // end if
  239.             } else {
  240.                 // no table selected, display database comment if present
  241.                 /**
  242.                  * Settings for relations stuff
  243.                  */
  244.                 require_once './libraries/relation.lib.php';
  245.                 $cfgRelation = PMA_getRelationsParam();
  246.  
  247.                 // Get additional information about tables for tooltip is done
  248.                 // in libraries/db_info.inc.php only once
  249.                 if ($cfgRelation['commwork']) {
  250.                     $comment = PMA_getComments($GLOBALS['db']);
  251.  
  252.                     /**
  253.                      * Displays table comment
  254.                      */
  255.                     if (is_array($comment) && ! empty($comment)) {
  256.                         echo '<span class="table_comment"'
  257.                             .' id="span_table_comment">"'
  258.                             .htmlspecialchars(implode(' ', $comment))
  259.                             .'"</span>' . "\n";
  260.                     } // end if
  261.                 }
  262.             }
  263.         }
  264.         echo '</div>';
  265.  
  266.     }
  267.     /**
  268.      * Sets a variable to remember headers have been sent
  269.      */
  270.     $GLOBALS['is_header_sent'] = true;
  271. }
  272. ?>
  273.