header.inc.php 8.2 KB

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