Merge branch 'MAINT_3_4_0' into QA_3_4
[phpmyadmin-regexreplace.git] / libraries / header_scripts.inc.php
blob6bd87f6b3a3275760d9a326f2d73e3b45ccd4f82
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']) {
19 echo PMA_includeJS('cross_framing_protection.js');
21 // generate title
22 $title = PMA_expandUserString(
23 !empty($GLOBALS['table']) ? $GLOBALS['cfg']['TitleTable'] :
24 (!empty($GLOBALS['db']) ? $GLOBALS['cfg']['TitleDatabase'] :
25 (!empty($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['TitleServer'] :
26 $GLOBALS['cfg']['TitleDefault']))
28 // here, the function does not exist with this configuration: $cfg['ServerDefault'] = 0;
29 $is_superuser = function_exists('PMA_isSuperuser') && PMA_isSuperuser();
31 $GLOBALS['js_include'][] = 'functions.js';
32 $GLOBALS['js_include'][] = 'jquery/jquery.qtip-1.0.0.min.js';
33 $params = array('lang' => $GLOBALS['lang']);
34 if (isset($GLOBALS['db'])) {
35 $params['db'] = $GLOBALS['db'];
37 $GLOBALS['js_include'][] = 'messages.php' . PMA_generate_common_url($params);
39 /**
40 * Here we add a timestamp when loading the file, so that users who
41 * upgrade phpMyAdmin are not stuck with older .js files in their
42 * browser cache. This produces an HTTP 304 request for each file.
45 // avoid loading twice a js file
46 $GLOBALS['js_include'] = array_unique($GLOBALS['js_include']);
47 foreach ($GLOBALS['js_include'] as $js_script_file) {
48 echo PMA_includeJS($js_script_file);
51 <script type="text/javascript">
52 // <![CDATA[
53 // Updates the title of the frameset if possible (ns4 does not allow this)
54 if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown'
55 && typeof(parent.document.title) == 'string') {
56 parent.document.title = '<?php echo PMA_sanitize(PMA_escapeJsString(htmlspecialchars($title))); ?>';
59 <?php
60 foreach ($GLOBALS['js_events'] as $js_event) {
61 echo "$(window.parent).bind('" . $js_event['event'] . "', "
62 . $js_event['function'] . ");\n";
65 // ]]>
66 </script>
67 <?php
68 // Reloads the navigation frame via JavaScript if required
69 PMA_reloadNavigation();