Merge branch 'QA_3_3'
[phpmyadmin/dkf.git] / libraries / header_scripts.inc.php
blob6a4aacb4782c02d5d78ed655ca2b5992a0f8419c
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 * @package phpMyAdmin
7 */
8 if (! defined('PHPMYADMIN')) {
9 exit;
12 /**
15 require_once './libraries/common.inc.php';
18 // Cross-framing protection
19 if ( false === $GLOBALS['cfg']['AllowThirdPartyFraming']) {
21 <script src="./js/cross_framing_protection.js" type="text/javascript"></script>
22 <?php
24 // generate title
25 $title = str_replace(
26 array(
27 '@HTTP_HOST@',
28 '@SERVER@',
29 '@VERBOSE@',
30 '@VSERVER@',
31 '@DATABASE@',
32 '@TABLE@',
33 '@PHPMYADMIN@',
35 array(
36 PMA_getenv('HTTP_HOST') ? PMA_getenv('HTTP_HOST') : '',
37 isset($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['Server']['host'] : '',
38 isset($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : '',
39 !empty($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : (isset($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['Server']['host'] : ''),
40 $GLOBALS['db'],
41 $GLOBALS['table'],
42 'phpMyAdmin ' . PMA_VERSION,
44 !empty($GLOBALS['table']) ? $GLOBALS['cfg']['TitleTable'] :
45 (!empty($GLOBALS['db']) ? $GLOBALS['cfg']['TitleDatabase'] :
46 (!empty($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['TitleServer'] :
47 $GLOBALS['cfg']['TitleDefault']))
49 // here, the function does not exist with this configuration: $cfg['ServerDefault'] = 0;
50 $is_superuser = function_exists('PMA_isSuperuser') && PMA_isSuperuser();
52 $GLOBALS['js_include'][] = 'tooltip.js';
53 $params = array('lang' => $GLOBALS['lang']);
54 if (isset($GLOBALS['db'])) {
55 $params['db'] = $GLOBALS['db'];
57 $GLOBALS['js_include'][] = 'messages.php' . PMA_generate_common_url($params);
59 $GLOBALS['js_events'][] = array(
60 'event' => 'load',
61 'function' => 'PMA_TT_init',
64 /**
65 * Here we add a timestamp when loading the file, so that users who
66 * upgrade phpMyAdmin are not stuck with older .js files in their
67 * browser cache. This produces an HTTP 304 request for each file.
69 foreach ($GLOBALS['js_include'] as $js_script_file) {
70 if (strpos($js_script_file, '?') === FALSE) {
71 echo '<script src="./js/' . $js_script_file . '?ts=' . filemtime('./js/' . $js_script_file) . '" type="text/javascript"></script>' . "\n";
72 } else {
73 echo '<script src="./js/' . $js_script_file . '" type="text/javascript"></script>' . "\n";
77 <script type="text/javascript">
78 // <![CDATA[
79 // Updates the title of the frameset if possible (ns4 does not allow this)
80 if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown'
81 && typeof(parent.document.title) == 'string') {
82 parent.document.title = '<?php echo PMA_sanitize(PMA_escapeJsString($title)); ?>';
85 <?php
86 foreach ($GLOBALS['js_events'] as $js_event) {
87 echo "$(window.parent).bind('" . $js_event['event'] . "', "
88 . $js_event['function'] . ");\n";
91 // ]]>
92 </script>
93 <?php
94 // Reloads the navigation frame via JavaScript if required
95 PMA_reloadNavigation();