Merge remote branch 'origin/master'
[phpmyadmin/dkf.git] / libraries / header_scripts.inc.php
blob8021c345431116f0c3f3e3caa47ade9ff6f8ecab
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package phpMyAdmin
6 */
7 if (! defined('PHPMYADMIN')) {
8 exit;
11 /**
14 require_once './libraries/common.inc.php';
17 // Cross-framing protection
18 if ( false === $GLOBALS['cfg']['AllowThirdPartyFraming']) {
20 <script src="./js/cross_framing_protection.js" type="text/javascript"></script>
21 <?php
23 // generate title
24 $title = PMA_expandUserString(
25 !empty($GLOBALS['table']) ? $GLOBALS['cfg']['TitleTable'] :
26 (!empty($GLOBALS['db']) ? $GLOBALS['cfg']['TitleDatabase'] :
27 (!empty($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['TitleServer'] :
28 $GLOBALS['cfg']['TitleDefault']))
30 // here, the function does not exist with this configuration: $cfg['ServerDefault'] = 0;
31 $is_superuser = function_exists('PMA_isSuperuser') && PMA_isSuperuser();
33 $GLOBALS['js_include'][] = 'functions.js';
34 $GLOBALS['js_include'][] = 'tooltip.js';
35 $params = array('lang' => $GLOBALS['lang']);
36 if (isset($GLOBALS['db'])) {
37 $params['db'] = $GLOBALS['db'];
39 $GLOBALS['js_include'][] = 'messages.php' . PMA_generate_common_url($params);
41 $GLOBALS['js_events'][] = array(
42 'event' => 'load',
43 'function' => 'PMA_TT_init',
46 /**
47 * Here we add a timestamp when loading the file, so that users who
48 * upgrade phpMyAdmin are not stuck with older .js files in their
49 * browser cache. This produces an HTTP 304 request for each file.
52 // avoid loading twice a js file
53 $GLOBALS['js_include'] = array_unique($GLOBALS['js_include']);
54 foreach ($GLOBALS['js_include'] as $js_script_file) {
55 if (strpos($js_script_file, '?') === FALSE) {
56 echo '<script src="./js/' . $js_script_file . '?ts=' . filemtime('./js/' . $js_script_file) . '" type="text/javascript"></script>' . "\n";
57 } else {
58 echo '<script src="./js/' . $js_script_file . '" type="text/javascript"></script>' . "\n";
62 <script type="text/javascript">
63 // <![CDATA[
64 // Updates the title of the frameset if possible (ns4 does not allow this)
65 if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown'
66 && typeof(parent.document.title) == 'string') {
67 parent.document.title = '<?php echo PMA_sanitize(PMA_escapeJsString($title)); ?>';
70 <?php
71 foreach ($GLOBALS['js_events'] as $js_event) {
72 echo "$(window.parent).bind('" . $js_event['event'] . "', "
73 . $js_event['function'] . ");\n";
76 // ]]>
77 </script>
78 <?php
79 // Reloads the navigation frame via JavaScript if required
80 PMA_reloadNavigation();