header.inc.php 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This script displays the Chamilo header.
  5. * @package chamilo.include
  6. */
  7. /* HEADERS SECTION */
  8. // Server mode indicator.
  9. if (api_is_platform_admin()) {
  10. if (api_get_setting('server_type') == 'test') {
  11. error_reporting(E_ALL);
  12. $mtime = microtime();
  13. $mtime = explode(" ",$mtime);
  14. $mtime = $mtime[1] + $mtime[0];
  15. $starttime = $mtime;
  16. $_SESSION['page_start_time_execution'] = $starttime;
  17. }
  18. }
  19. header('Content-Type: text/html; charset='.api_get_system_encoding());
  20. //show the X-Powered-By header so that parsers can find it
  21. global $_configuration;
  22. header('X-Powered-By: '.$_configuration['software_name'].' '.substr($_configuration['system_version'],0,1));
  23. $navigator_info = api_get_navigator();
  24. //ie6 fix
  25. if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
  26. $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/iepngfix/iepngfix_tilebg.js" type="text/javascript" language="javascript"></script>';
  27. }
  28. // Include here the script ASCIIMathML.js if you want to show mathematical formulas and graphics
  29. // not only in the "Documents" tool, but elsewhere in the system. This setting is related to the
  30. // online editor's plugins 'asciimath' and 'asciisvg'.
  31. if (api_get_setting('include_asciimathml_script') == 'true') {
  32. $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'asciimath/ASCIIMathML.js" type="text/javascript"></script>';
  33. }
  34. if (isset($httpHeadXtra) && $httpHeadXtra) {
  35. foreach ($httpHeadXtra as & $thisHttpHead) {
  36. header($thisHttpHead);
  37. }
  38. }
  39. // Get language iso-code for this page - ignore errors
  40. $document_language = api_get_language_isocode();
  41. $course_title = $_course['name'];
  42. $title_list[] = api_get_setting('Institution');
  43. $title_list[] = api_get_setting('siteName');
  44. if (!empty($course_title)) {
  45. $title_list[] = $course_title;
  46. }
  47. if ($nameTools != '') {
  48. $title_list[] = $nameTools;
  49. }
  50. $title_string = '';
  51. for($i=0; $i<count($title_list);$i++) {
  52. $title_string .=$title_list[$i];
  53. if (isset($title_list[$i+1])) {
  54. $item = trim($title_list[$i+1]);
  55. if (!empty($item))
  56. $title_string .=' - ';
  57. }
  58. }
  59. /*
  60. * HTML HEADER
  61. */
  62. ?>
  63. <!DOCTYPE html
  64. PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  65. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  66. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $document_language; ?>" lang="<?php echo $document_language; ?>">
  67. <head>
  68. <title>
  69. <?php
  70. echo Security::remove_XSS($title_string);
  71. ?>
  72. </title>
  73. <style type="text/css" media="screen, projection">
  74. /*<![CDATA[*/
  75. <?php
  76. $platform_theme = api_get_setting('stylesheets');
  77. $my_style = api_get_visual_theme();
  78. global $show_learn_path;
  79. if ($show_learn_path) {
  80. $htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_CSS_PATH).$my_style.'/learnpath.css"/>';
  81. $htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="dtree.css" />'; //will be moved
  82. $htmlHeadXtra[] = '<script src="dtree.js" type="text/javascript"></script>'; //will be moved
  83. }
  84. //Base CSS
  85. echo '@import "'.api_get_path(WEB_CSS_PATH).'base.css";';
  86. //Default CSS
  87. echo '@import "'.api_get_path(WEB_CSS_PATH).$my_style.'/default.css";';
  88. //Course CSS
  89. echo '@import "'.api_get_path(WEB_CSS_PATH).$my_style.'/course.css";';
  90. if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') {
  91. echo 'img, div { behavior: url('.api_get_path(WEB_LIBRARY_PATH).'javascript/iepngfix/iepngfix.htc) } ';
  92. }
  93. ?>
  94. /*]]>*/
  95. </style>
  96. <style type="text/css" media="print">
  97. /*<![CDATA[*/
  98. <?php
  99. echo '@import "'.api_get_path(WEB_CSS_PATH).$my_style.'/print.css";';
  100. ?>
  101. /*]]>*/
  102. </style>
  103. <script src="<?php echo api_get_path(WEB_LIBRARY_PATH);?>javascript/jquery.js" type="text/javascript" ></script>
  104. <script src="<?php echo api_get_path(WEB_LIBRARY_PATH);?>javascript/thickbox.js" type="text/javascript" ></script>
  105. <link rel="stylesheet" href="<?php echo api_get_path(WEB_LIBRARY_PATH);?>javascript/thickbox.css" type="text/css" media="projection, screen" />
  106. <link rel="top" href="<?php echo api_get_path(WEB_PATH); ?>index.php" title="" />
  107. <link rel="courses" href="<?php echo api_get_path(WEB_CODE_PATH); ?>auth/courses.php" title="<?php echo api_htmlentities(get_lang('OtherCourses'), ENT_QUOTES); ?>" />
  108. <link rel="profil" href="<?php echo api_get_path(WEB_CODE_PATH); ?>auth/profile.php" title="<?php echo api_htmlentities(get_lang('ModifyProfile'), ENT_QUOTES); ?>" />
  109. <link href="http://www.chamilo.org/documentation.php" rel="Help" />
  110. <link href="http://www.chamilo.org/team.php" rel="Author" />
  111. <link href="http://www.chamilo.org" rel="Copyright" />
  112. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo api_get_system_encoding(); ?>" />
  113. <meta name="Generator" content="<?php echo $_configuration['software_name'].' '.substr($_configuration['system_version'],0,1);?>">
  114. <script src= "<?php echo api_get_path(WEB_LIBRARY_PATH);?>javascript/jquery.menu.js" type="text/javascript"></script>
  115. <script type="text/javascript">
  116. //<![CDATA[
  117. // This is a patch for the "__flash__removeCallback" bug, see FS#4378.
  118. if ( ( navigator.userAgent.toLowerCase().indexOf('msie') != -1 ) && ( navigator.userAgent.toLowerCase().indexOf( 'opera' ) == -1 ) ) {
  119. window.attachEvent( 'onunload', function() {
  120. window['__flash__removeCallback'] = function ( instance, name ) {
  121. try {
  122. if ( instance ) {
  123. instance[name] = null ;
  124. }
  125. } catch ( flashEx ) {
  126. }
  127. } ;
  128. }
  129. ) ;
  130. }
  131. //]]>
  132. </script>
  133. <?php
  134. if (api_get_setting('accessibility_font_resize') == 'true') {
  135. echo '<script src= "'.api_get_path(WEB_LIBRARY_PATH).'javascript/fontresize.js" type="text/javascript"></script>';
  136. }
  137. if (isset($htmlHeadXtra) && $htmlHeadXtra) {
  138. foreach ($htmlHeadXtra as & $this_html_head) {
  139. echo $this_html_head;
  140. }
  141. }
  142. if (isset($htmlIncHeadXtra) && $htmlIncHeadXtra) {
  143. foreach ($htmlIncHeadXtra as & $this_html_head) {
  144. include($this_html_head);
  145. }
  146. }
  147. // The following include might be subject to a setting proper to the course or platform.
  148. include api_get_path(LIBRARY_PATH).'javascript/email_links.lib.js.php';
  149. $favico = '<link rel="shortcut icon" href="'.api_get_path(WEB_PATH).'favicon.ico" type="image/x-icon" />';
  150. if (isset($_configuration['multiple_access_urls']) && $_configuration['multiple_access_urls']) {
  151. $access_url_id = api_get_current_access_url_id();
  152. if ($access_url_id != -1) {
  153. $url_info = api_get_access_url($access_url_id);
  154. $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url']));
  155. $clean_url = replace_dangerous_char($url);
  156. $clean_url = str_replace('/', '-', $clean_url);
  157. $clean_url .= '/';
  158. $homep = api_get_path(REL_PATH).'home/'.$clean_url; //homep for Home Path
  159. //we create the new dir for the new sites
  160. if (is_file($homep.'favicon.ico')) {
  161. $favico = '<link rel="shortcut icon" href="'.$homep.'favicon.ico" type="image/x-icon" />';
  162. }
  163. }
  164. }
  165. echo $favico;
  166. ?>
  167. </head>
  168. <body dir="<?php echo api_get_text_direction(); ?>" <?php
  169. if (defined('CHAMILO_HOMEPAGE') && CHAMILO_HOMEPAGE)
  170. echo 'onload="javascript: if(document.formLogin) { document.formLogin.login.focus(); }"'; ?>>
  171. <div class="skip">
  172. <ul>
  173. <li><a href="#menu"><?php echo get_lang('WCAGGoMenu'); ?></a></li>
  174. <li><a href="#content" accesskey="2"><?php echo get_lang('WCAGGoContent'); ?></a></li>
  175. </ul>
  176. </div>
  177. <?php
  178. // Banner
  179. require_once api_get_path(INCLUDE_PATH).'banner.inc.php';