PageRenderTime 62ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/sitemanager/phpmyadmin/libraries/header_scripts.inc.php

https://bitbucket.org/itoxable/chiron-gaming
PHP | 82 lines | 52 code | 8 blank | 22 comment | 14 complexity | a30c1712dff3cb498003ce75f4b2110e MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. *
  5. * @package PhpMyAdmin
  6. */
  7. if (! defined('PHPMYADMIN')) {
  8. exit;
  9. }
  10. /**
  11. *
  12. */
  13. require_once './libraries/common.inc.php';
  14. // Cross-framing protection
  15. if ( false === $GLOBALS['cfg']['AllowThirdPartyFraming']) {
  16. echo PMA_includeJS('cross_framing_protection.js');
  17. }
  18. // generate title (unless we already have $page_title, from cookie auth)
  19. if (! isset($page_title)) {
  20. if ($GLOBALS['server'] > 0) {
  21. $title = PMA_expandUserString(
  22. ! empty($GLOBALS['table']) ? $GLOBALS['cfg']['TitleTable'] :
  23. (! empty($GLOBALS['db']) ? $GLOBALS['cfg']['TitleDatabase'] :
  24. (! empty($GLOBALS['cfg']['Server']['host']) ? $GLOBALS['cfg']['TitleServer'] :
  25. $GLOBALS['cfg']['TitleDefault']))
  26. );
  27. }
  28. } else {
  29. $title = $page_title;
  30. }
  31. // here, the function does not exist with this configuration: $cfg['ServerDefault'] = 0;
  32. $is_superuser = function_exists('PMA_isSuperuser') && PMA_isSuperuser();
  33. $GLOBALS['js_include'][] = 'functions.js';
  34. $GLOBALS['js_include'][] = 'jquery/jquery.qtip-1.0.0-rc3.js';
  35. $params = array('lang' => $GLOBALS['lang']);
  36. if (isset($GLOBALS['db'])) {
  37. $params['db'] = $GLOBALS['db'];
  38. }
  39. $GLOBALS['js_include'][] = 'messages.php' . PMA_generate_common_url($params);
  40. // Append the theme id to this url to invalidate the cache on a theme change
  41. $GLOBALS['js_include'][] = 'get_image.js.php?theme=' . urlencode($_SESSION['PMA_Theme']->getId());
  42. /**
  43. * Here we add a timestamp when loading the file, so that users who
  44. * upgrade phpMyAdmin are not stuck with older .js files in their
  45. * browser cache. This produces an HTTP 304 request for each file.
  46. */
  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. echo PMA_includeJS($js_script_file);
  51. }
  52. // Below javascript Updates the title of the frameset if possible
  53. ?>
  54. <script type="text/javascript">
  55. // <![CDATA[
  56. if (typeof(parent.document) != 'undefined' && typeof(parent.document) != 'unknown'
  57. && typeof(parent.document.title) == 'string') {
  58. parent.document.title = '<?php echo (isset($title) ? PMA_sanitize(PMA_escapeJsString(htmlspecialchars($title))) : ''); ?>';
  59. }
  60. <?php
  61. if (count($GLOBALS['js_script']) > 0) {
  62. echo implode("\n", $GLOBALS['js_script'])."\n";
  63. }
  64. foreach ($GLOBALS['js_events'] as $js_event) {
  65. echo "$(window.parent).bind('" . $js_event['event'] . "', "
  66. . $js_event['function'] . ");\n";
  67. }
  68. ?>
  69. // ]]>
  70. </script>
  71. <?php
  72. // Reloads the navigation frame via JavaScript if required
  73. PMA_reloadNavigation();
  74. ?>