fixed: bugID = 3112614
[phpmyadmin/adnan.git] / libraries / header_scripts.inc.php
blob76b0852d5b202b8074785b38136b269e89dc4c63
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'][] = 'jquery/jquery.qtip-1.0.0.min.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 /**
42 * Here we add a timestamp when loading the file, so that users who
43 * upgrade phpMyAdmin are not stuck with older .js files in their
44 * browser cache. This produces an HTTP 304 request for each file.
47 // avoid loading twice a js file
48 $GLOBALS['js_include'] = array_unique($GLOBALS['js_include']);
49 foreach ($GLOBALS['js_include'] as $js_script_file) {
50 if (strpos($js_script_file, '?') === FALSE) {
51 echo '<script src="./js/' . $js_script_file . '?ts=' . filemtime('./js/' . $js_script_file) . '" type="text/javascript"></script>' . "\n";
52 } else {
53 echo '<script src="./js/' . $js_script_file . '" type="text/javascript"></script>' . "\n";
57 <script type="text/javascript">
58 // <![CDATA[
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(PMA_escapeJsString(htmlspecialchars($title))); ?>';
65 <?php
66 foreach ($GLOBALS['js_events'] as $js_event) {
67 echo "$(window.parent).bind('" . $js_event['event'] . "', "
68 . $js_event['function'] . ");\n";
71 // ]]>
72 </script>
73 <?php
74 // Reloads the navigation frame via JavaScript if required
75 PMA_reloadNavigation();