Fix CodeGen export
[phpmyadmin.git] / libraries / header_scripts.inc.php
blob2e0a9ca1e465d48db798b3fe487ddb12e5e558e6
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 (unless we already have $page_title, from cookie auth)
22 if (! isset($page_title)) {
23 $title = PMA_expandUserString(
24 !empty($GLOBALS['table']) ? $GLOBALS['cfg']['TitleTable'] :
25 (!empty($GLOBALS['db']) ? $GLOBALS['cfg']['TitleDatabase'] :
26 (!empty($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['TitleServer'] :
27 $GLOBALS['cfg']['TitleDefault']))
29 } else {
30 $title = $page_title;
32 // here, the function does not exist with this configuration: $cfg['ServerDefault'] = 0;
33 $is_superuser = function_exists('PMA_isSuperuser') && PMA_isSuperuser();
35 $GLOBALS['js_include'][] = 'functions.js';
36 $GLOBALS['js_include'][] = 'jquery/jquery.qtip-1.0.0.min.js';
37 $params = array('lang' => $GLOBALS['lang']);
38 if (isset($GLOBALS['db'])) {
39 $params['db'] = $GLOBALS['db'];
41 $GLOBALS['js_include'][] = 'messages.php' . PMA_generate_common_url($params);
42 $GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
43 $GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
45 /**
46 * Here we add a timestamp when loading the file, so that users who
47 * upgrade phpMyAdmin are not stuck with older .js files in their
48 * browser cache. This produces an HTTP 304 request for each file.
51 // avoid loading twice a js file
52 $GLOBALS['js_include'] = array_unique($GLOBALS['js_include']);
53 foreach ($GLOBALS['js_include'] as $js_script_file) {
54 echo PMA_includeJS($js_script_file);
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();