3.4.3 release
[phpmyadmin/ammaryasirr.git] / libraries / header_scripts.inc.php
blobc25aa990ea92a8e314d0f27f64762929a67cb3b7
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);
43 /**
44 * Here we add a timestamp when loading the file, so that users who
45 * upgrade phpMyAdmin are not stuck with older .js files in their
46 * browser cache. This produces an HTTP 304 request for each file.
49 // avoid loading twice a js file
50 $GLOBALS['js_include'] = array_unique($GLOBALS['js_include']);
51 foreach ($GLOBALS['js_include'] as $js_script_file) {
52 echo PMA_includeJS($js_script_file);
55 <script type="text/javascript">
56 // <![CDATA[
57 // Updates the title of the frameset if possible (ns4 does not allow this)
58 if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown'
59 && typeof(parent.document.title) == 'string') {
60 parent.document.title = '<?php echo PMA_sanitize(PMA_escapeJsString(htmlspecialchars($title))); ?>';
63 <?php
64 foreach ($GLOBALS['js_events'] as $js_event) {
65 echo "$(window.parent).bind('" . $js_event['event'] . "', "
66 . $js_event['function'] . ");\n";
69 // ]]>
70 </script>
71 <?php
72 // Reloads the navigation frame via JavaScript if required
73 PMA_reloadNavigation();