Translation update done using Pootle.
[phpmyadmin/madhuracj.git] / libraries / header_scripts.inc.php
blobc8a68ac1cb0e2663449ebe6d813d26e3ef8a8e58
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 if ($GLOBALS['server'] > 0) {
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']))
31 } else {
32 $title = $page_title;
34 // here, the function does not exist with this configuration: $cfg['ServerDefault'] = 0;
35 $is_superuser = function_exists('PMA_isSuperuser') && PMA_isSuperuser();
37 $GLOBALS['js_include'][] = 'functions.js';
38 $GLOBALS['js_include'][] = 'jquery/jquery.qtip-1.0.0-rc3.js';
39 $params = array('lang' => $GLOBALS['lang']);
40 if (isset($GLOBALS['db'])) {
41 $params['db'] = $GLOBALS['db'];
43 $GLOBALS['js_include'][] = 'messages.php' . PMA_generate_common_url($params);
44 // Append the theme id to this url to invalidate the cache on a theme change
45 $GLOBALS['js_include'][] = 'get_image.js.php?theme=' . urlencode($_SESSION['PMA_Theme']->getId());
47 /**
48 * Here we add a timestamp when loading the file, so that users who
49 * upgrade phpMyAdmin are not stuck with older .js files in their
50 * browser cache. This produces an HTTP 304 request for each file.
53 // avoid loading twice a js file
54 $GLOBALS['js_include'] = array_unique($GLOBALS['js_include']);
55 foreach ($GLOBALS['js_include'] as $js_script_file) {
56 echo PMA_includeJS($js_script_file);
58 // Below javascript Updates the title of the frameset if possible
60 <script type="text/javascript">
61 // <![CDATA[
62 if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown'
63 && typeof(parent.document.title) == 'string') {
64 parent.document.title = '<?php echo (isset($title) ? PMA_sanitize(PMA_escapeJsString(htmlspecialchars($title))) : ''); ?>';
66 <?php
67 if (count($GLOBALS['js_script']) > 0) {
68 echo implode("\n", $GLOBALS['js_script'])."\n";
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();